RTL = $(shell cd ../../../;pwd) include $(RTL)/.config CC := gcc LD := ld # Linker should relocate monitor to this address MONITOR_BASE := 0xE0100000 RTL_ARCH = $(shell cd ..;pwd) CFLAGS := -fno-builtin -O3 -Wall -I$(RTL_ARCH)/h AFLAGS := -fno-builtin -O3 -Wall -I$(RTL_ARCH)/h TARGET := sa-rtl OBJS = entry.o ../../../modules/*.o ifdef CONFIG_RTL_GUI OBJS += $(RTL)/modules/libPTK.a endif default: $(TARGET) $(TARGET): head.o $(OBJS) # Image will load at 0xC0000000. First bytes from head.o #$(LD) -N -Ttext 0xC0000000 head.o $(OBJS) -o $@.elf $(LD) -N -T sa-rtl.lds head.o $(OBJS) -o $@.elf -static $(shell cc -print-libgcc-file-name) -lm # Guest OS header -- first 8 bytes are identifier 'XenoGues'. echo -e -n 'XenoGues' >$@ # Guest OS header -- next 4 bytes are load address (0xC0000000). echo -e -n '\000\000\000\300' >>$@ # Create a raw bag of bytes from the ELF image. objcopy -O binary -R .note -R .comment $@.elf $@.raw # Guest OS header is immediately followed by raw OS image. cat $@.raw >>$@ gzip -f -9 -c $@ >$@.gz clean: find . -type f -name '*.o' | xargs rm -f rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz find . -type l | xargs rm -f %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -c $< -o $@ %.o: %.S $(HDRS) Makefile $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@