1# 2# MAKEFILE FOR THE MIPS LINUX BOOTLOADER AND ROM DEBUGGER 3# 4# i-data Networks 5# 6# Author: Thomas Horsten <thh@i-data.com> 7# 8 9ifndef Version 10 Version = "$(USER)-test" 11endif 12 13MKLASATIMG = mklasatimg 14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 15ifdef CONFIG_LASAT_SERVICE 16MKLASATIMG_FLAG = -s 17else 18MKLASATIMG_FLAG = -k 19endif 20 21KERNEL_IMAGE = $(TOPDIR)/vmlinux 22KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep _ftext | cut -f1 -d\ ) 23KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ ) 24 25LDSCRIPT= -Tromscript.normal 26 27HEAD_DEFINES = -D_kernel_start=0x$(KERNEL_START) \ 28 -D_kernel_entry=0x$(KERNEL_ENTRY) \ 29 -D VERSION="\"$(Version)\"" \ 30 -D TIMESTAMP=$(shell date +%s) 31 32head.o: head.S $(KERNEL_IMAGE) 33 $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $< 34 35OBJECTS= head.o kImage.o 36 37rom.sw: rom.bin 38 $(MKLASATIMG) -o rom.sw $(MKLASATIMG_FLAG) rom.bin -m $(MKLASATIMG_ARCH) 39 40rom.bin: rom 41 $(OBJCOPY) -O binary -S rom rom.bin 42 43# Rule to make the bootloader 44rom: $(OBJECTS) 45 $(LD) $(LDFLAGS) $(LDSCRIPT) -o rom $(OBJECTS) 46 47%.o: %.gz 48 $(LD) $(LDFLAGS) -r -o $@ -b binary $< 49 50%.gz: %.bin 51 gzip -cf -9 $< > $@ 52 53kImage.bin: $(KERNEL_IMAGE) 54 $(OBJCOPY) -O binary -S $(TOPDIR)/vmlinux kImage.bin 55 56clean: 57 rm -f rom rom.bin rom.sw kImage.bin 58 59USE_STANDARD_AS_RULE = 1 60include $(TOPDIR)/Rules.make 61