📄 makefile
字号:
## Stage 1 boot loader#loader.bin : loader.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader.elf: loader.o $(OBJS-y) 2ndboot.o $(LD) --gc-section -e start -Ttext $(LOADERBASE) -o $@ loader.o $(OBJS-y) 2ndboot.o $(OBJDUMP) -d -S -x $@ > loader.maploader.o: loader.S config.h $(RTCONFIG) Makefile $(CC) $(CFLAGS) -c -o $@ $<loader2.o: loader.S config.h $(RTCONFIG) Makefile $(CC) $(CFLAGS) -DSECONDARY_LOADER -c -o $@ $<## Stage 2 boot loader (if needed)#2ndboot2.o: 2ndboot.c $(CC) $(CFLAGS) -c -DSECONDARY_LOADER -o $@ $<loader2.elf: loader2.o $(OBJS-y) 2ndboot2.o $(LD) --gc-section -e start -Ttext $(LOADERBASE) -o $@ loader2.o $(OBJS-y) 2ndboot2.o $(OBJDUMP) -d -S -x $@ > loader2.maploader2.bin: loader2.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash-stage2.bin: loader2.bin genchecksum cat $< /dev/zero | dd of=$@ bs=1 count=$(STAGE2_IMAGE_SIZE) ./genchecksum $@ genchecksum: genchecksum.c gcc -O2 -o $@ $<## loader-sflash.bin#ifeq ($(DRAMADJUSTMENT), n)loader-sflash.bin : loader-sflash0.bin loader.bin cat $< /dev/zero | dd of=$@ count=1028 bs=1 cat loader.bin >> $@loader-sflash0.bin : loader-sflash.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash.elf : loader-sflash.o $(LD) --gc-section -e stage0_start -Ttext 0x40000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-sflash.maploader-sflash.o : loader-sflash.s $(CC) $(CFLAGS) -c -o $@ $<loader-sflash.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_SFLASH $< > $@endif## loader-flash.bin#ifeq ($(DRAMADJUSTMENT), n)loader-flash.bin : loader-flash0.bin loader.bin cat $< /dev/zero | dd of=$@ count=1024 bs=1 cat loader.bin >> $@loader-flash0.bin : loader-flash.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash.elf : loader-flash.o $(LD) --gc-section -e stage0_start -Ttext 0x46000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-flash.maploader-flash.o : loader-flash.s $(CC) $(CFLAGS) -c -o $@ $<loader-flash.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_FLASH $< > $@endif## loader-sflash-min.bin#loader-sflash-min.bin : loader-sflash-min.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash-min.elf : loader-sflash-min.o $(LD) --gc-section -e stage0_start -Ttext 0x40000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-sflash-min.maploader-sflash-min.o : loader-sflash-min.s $(CC) $(CFLAGS) -c -o $@ $<loader-sflash-min.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_SFLASH -DCONFIG_BOOTINITONLY $< > $@## loader-sflash-test.bin#TEST_STAGE0_OBJS = test-stage0.o em8600_mem_test.o board/test-stage0.o uart.o em86xxapi.o util.o vsprintf.o loader-sflash-test.bin : loader-sflash-test0.bin loader-sflash-test-stage0.bin loader.bin cat loader-sflash-test0.bin /dev/zero | dd count=1028 bs=1 > $@ cat loader-sflash-test-stage0.bin /dev/zero | dd count=$(STAGE0_TEST_IMAGE_SIZE) bs=1 >> $@ cat loader.bin >> $@loader-sflash-test-stage0.bin : loader-sflash-test-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash-test-stage0.elf : $(TEST_STAGE0_OBJS)ifeq ($(TESTLOADERONRAM), y) $(LD) --gc-section -e test_stage0 -Ttext 0x91700404 -o $@ $(TEST_STAGE0_OBJS)else $(LD) --gc-section -e test_stage0 -Ttext 0xC0000400 -o $@ $(TEST_STAGE0_OBJS)endif $(OBJDUMP) -d -S -x $@ > loader-sflash-test-stage0.maploader-sflash-test0.bin : loader-sflash-test.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash-test.elf : loader-sflash-test.o $(LD) --gc-section -e stage0_start -Ttext 0x40000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-sflash-test.maploader-sflash-test.o : loader-sflash-test.s $(CC) $(CFLAGS) -c -o $@ $<loader-sflash-test.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_SFLASH -DCONFIG_PRODUCTIONTEST -DSTAGE0_TEST_IMAGE_SIZE=$(STAGE0_TEST_IMAGE_SIZE) $< > $@## extra sflash#ifeq ($(DEBUG_DRAMADJUSTMENT), y)XTRA_STAGE0_OBJS = em86xx_dram.o uart.o util.o vsprintf.o em86xxapi.oelseXTRA_STAGE0_OBJS = em86xx_dram.oendififeq ($(DRAMADJUSTMENT), y)loader-sflash.bin : loader-sflash-xtra0.bin loader-sflash-xtra-stage0.bin loader.bin cat loader-sflash-xtra0.bin /dev/zero | dd count=1028 bs=1 > $@ cat loader-sflash-xtra-stage0.bin /dev/zero | dd count=$(STAGE0_XTRA_IMAGE_SIZE) bs=1 >> $@ cat loader.bin >> $@loader-sflash-xtra-stage0.bin : loader-sflash-xtra-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash-xtra-stage0.elf : $(XTRA_STAGE0_OBJS)ifeq ($(TESTLOADERONRAM), y) $(LD) --gc-section -e xtra_stage0 -Ttext 0x91700404 -o $@ $(XTRA_STAGE0_OBJS)else $(LD) --gc-section -e xtra_stage0 -Ttext 0xC0000400 -o $@ $(XTRA_STAGE0_OBJS)endif $(OBJDUMP) -d -S -x $@ > loader-sflash-xtra-stage0.maploader-sflash-xtra0.bin : loader-sflash-xtra0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-sflash-xtra0.elf : loader-sflash-xtra0.o $(LD) --gc-section -e stage0_start -Ttext 0x40000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-sflash-xtra0.maploader-sflash-xtra0.o : loader-sflash-xtra0.s $(CC) $(CFLAGS) -c -o $@ $<loader-sflash-xtra0.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_SFLASH -DCONFIG_DRAMADJUSTMENT -DSTAGE0_XTRA_IMAGE_SIZE=$(STAGE0_XTRA_IMAGE_SIZE) $< > $@endif## loader-flash-secure-boot1.bin#loader-flash-secure-boot1.bin: loader-flash-stage2.bin cd $(CRYPTODIR)/scripts/ && ./gen_complete_pflash.sh $(ID) $(CURDIR)/loader-flash-stage2.bin > $(CURDIR)/$@## loader-flash-secure-boot0.bin#loader-flash-secure-boot0.bin: loader-flash-crypto.bin $(CRYPTODIR)/stage0/ucode_pflash.bin cd $(CRYPTODIR)/scripts/ && ./gen_complete_stage0.sh $(ID) p $(CURDIR)/loader-flash-crypto.bin ../stage0/ucode_pflash.bin > $(CURDIR)/$@## loader-sflash-secure-boot0.bin#loader-sflash-secure-boot0.bin: loader-sflash-crypto.bin $(CRYPTODIR)/stage0/ucode_sflash.bin cd $(CRYPTODIR)/scripts/ && ./gen_complete_stage0.sh $(ID) s $(CURDIR)/loader-sflash-crypto.bin ../stage0/ucode_sflash.bin > $(CURDIR)/$@## loader-flash-secure-kernel.bin#loader-flash-secure-kernel.bin: loader-flash0.bin cd $(CRYPTODIR)/scripts/ && ./gen_uncomplete_stage0.sh $(ID) p $(CURDIR)/loader-flash0.bin > $(CURDIR)/$@## loader-sflash-secure-kernel.bin#loader-sflash-secure-kernel.bin: loader-sflash0.bin cd $(CRYPTODIR)/scripts/ && ./gen_uncomplete_stage0.sh $(ID) s $(CURDIR)/loader-sflash0.bin > $(CURDIR)/$@## loader-flash-crypto.bin#CRYPTO_STAGE0_FLASH_OBJS = $(CRYPTODIR_STAGE0)/cryptolib_pflash.o uart.o util.o vsprintf.o em86xxapi.o board/board-init.oifeq ($(DRAMADJUSTMENT), y)loader-flash-crypto.bin : loader-flash-crypto-stage0.bin loader-flash.bin cat loader-flash.bin /dev/urandom | dd count=`printf $$[1024+$(STAGE0_XTRA_IMAGE_SIZE)]` bs=1 > $@ cat loader-flash-crypto-stage0.bin /dev/urandom | dd count=$(STAGE0_CRYPTO_IMAGE_SIZE) bs=1 >> $@elseloader-flash-crypto.bin : loader-flash-crypto-stage0.bin loader-flash.bin cat loader-flash.bin /dev/urandom | dd count=1024 bs=1 > $@ cat loader-flash-crypto-stage0.bin /dev/urandom | dd count=$(STAGE0_CRYPTO_IMAGE_SIZE) bs=1 >> $@endifloader-flash-crypto-stage0.bin : loader-flash-crypto-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@ifeq ($(DRAMADJUSTMENT), y)loader-flash-crypto-stage0.elf : $(CRYPTO_STAGE0_FLASH_OBJS) $(LD) --gc-section -e crypto_stage0_start -Ttext `printf "0x%x" $$[0x46000400+$(STAGE0_XTRA_IMAGE_SIZE)]` -o $@ $(CRYPTO_STAGE0_FLASH_OBJS) $(OBJDUMP) -d -S -x $@ > loader-flash-crypto-stage0.mapelseloader-flash-crypto-stage0.elf : $(CRYPTO_STAGE0_FLASH_OBJS) $(LD) --gc-section -e crypto_stage0_start -Ttext 0x46000400 -o $@ $(CRYPTO_STAGE0_FLASH_OBJS) $(OBJDUMP) -d -S -x $@ > loader-flash-crypto-stage0.mapendif## loader-sflash-crypto.bin#CRYPTO_STAGE0_SFLASH_OBJS = $(CRYPTODIR_STAGE0)/cryptolib_sflash.o uart.o util.o vsprintf.o em86xxapi.o board/board-init.oifeq ($(DRAMADJUSTMENT), y)loader-sflash-crypto.bin : loader-sflash-crypto-stage0.bin loader-sflash.bin cat loader-sflash.bin /dev/urandom | dd count=`printf $$[1028+$(STAGE0_XTRA_IMAGE_SIZE)]` bs=1 > $@ cat loader-sflash-crypto-stage0.bin /dev/urandom | dd count=$(STAGE0_CRYPTO_IMAGE_SIZE) bs=1 >> $@elseloader-sflash-crypto.bin : loader-sflash-crypto-stage0.bin loader-sflash.bin cat loader-sflash.bin /dev/urandom | dd count=1028 bs=1 > $@ cat loader-sflash-crypto-stage0.bin /dev/urandom | dd count=$(STAGE0_CRYPTO_IMAGE_SIZE) bs=1 >> $@endifloader-sflash-crypto-stage0.bin : loader-sflash-crypto-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@ifeq ($(DRAMADJUSTMENT), y)loader-sflash-crypto-stage0.elf : $(CRYPTO_STAGE0_SFLASH_OBJS) $(LD) --gc-section -e crypto_stage0_start -Ttext `printf "0x%x" $$[0x40000400+$(STAGE0_XTRA_IMAGE_SIZE)]` -o $@ $(CRYPTO_STAGE0_SFLASH_OBJS) $(OBJDUMP) -d -S -x $@ > loader-sflash-crypto-stage0.mapelseloader-sflash-crypto-stage0.elf : $(CRYPTO_STAGE0_SFLASH_OBJS) $(LD) --gc-section -e crypto_stage0_start -Ttext 0x40000400 -o $@ $(CRYPTO_STAGE0_SFLASH_OBJS) $(OBJDUMP) -d -S -x $@ > loader-sflash-crypto-stage0.mapendif## loader-flash-test.bin#loader-flash-test.bin : loader-flash-test0.bin loader-flash-test-stage0.bin loader.bin cat loader-flash-test0.bin /dev/zero | dd count=1024 bs=1 > $@ cat loader-flash-test-stage0.bin /dev/zero | dd count=$(STAGE0_TEST_IMAGE_SIZE) bs=1 >> $@ cat loader.bin >> $@loader-flash-test-stage0.bin : loader-flash-test-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash-test-stage0.elf : $(TEST_STAGE0_OBJS) $(LD) --gc-section -e test_stage0 -Ttext 0x46000400 -o $@ $(TEST_STAGE0_OBJS) $(OBJDUMP) -d -S -x $@ > loader-flash-test-stage0.maploader-flash-test0.bin : loader-flash-test.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash-test.elf : loader-flash-test.o $(LD) --gc-section -e stage0_start -Ttext 0x46000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-flash-test.maploader-flash-test.o : loader-flash-test.s $(CC) $(CFLAGS) -c -o $@ $<loader-flash-test.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_FLASH -DCONFIG_PRODUCTIONTEST -DSTAGE0_TEST_IMAGE_SIZE=$(STAGE0_TEST_IMAGE_SIZE) $< > $@## extra flash#ifeq ($(DRAMADJUSTMENT), y)loader-flash.bin : loader-flash-xtra0.bin loader-flash-xtra-stage0.bin loader.bin cat loader-flash-xtra0.bin /dev/zero | dd count=1024 bs=1 > $@ cat loader-flash-xtra-stage0.bin /dev/zero | dd count=$(STAGE0_XTRA_IMAGE_SIZE) bs=1 >> $@ cat loader.bin >> $@loader-flash-xtra-stage0.bin : loader-flash-xtra-stage0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash-xtra-stage0.elf : $(XTRA_STAGE0_OBJS) $(LD) --gc-section -e xtra_stage0 -Ttext 0x46000400 -o $@ $(XTRA_STAGE0_OBJS) $(OBJDUMP) -d -S -x $@ > loader-flash-xtra-stage0.maploader-flash-xtra0.bin : loader-flash-xtra0.elf $(OBJCOPY) -Obinary $< $@ chmod a-x $@loader-flash-xtra0.elf : loader-flash-xtra0.o $(LD) --gc-section -e stage0_start -Ttext 0x46000000 -o $@ $< $(OBJDUMP) -d -S -x $@ > loader-flash-xtra0.maploader-flash-xtra0.o : loader-flash-xtra0.s $(CC) $(CFLAGS) -c -o $@ $<loader-flash-xtra0.s : loader-stage0.S config.h $(RTCONFIG) Makefile $(CPP) $(CPPFLAGS) -DCONFIG_BOOTFROM_FLASH -DCONFIG_DRAMADJUSTMENT -DSTAGE0_XTRA_IMAGE_SIZE=$(STAGE0_XTRA_IMAGE_SIZE) $< > $@endif## Miscellaneous#$(CRYPTODIR_STAGE1)/cryptolib.o: make -C $(CRYPTODIR_STAGE1)$(CRYPTODIR_STAGE0)/cryptolib_sflash.o: make -C $(CRYPTODIR_STAGE0) BOOTFROM=sflash$(CRYPTODIR_STAGE0)/cryptolib_pflash.o: make -C $(CRYPTODIR_STAGE0) BOOTFROM=pflashifeq ($(ENABLE_DVI), y)export CROSS=arm-elf-export RMCFLAGS += -DLLAD_DIRECT=1$(RUA_DIR)/emhwlib_hal/i2c/src/i2c_hal.o: make -C $(@D)endifcheckbin: @echo @echo "Binary information : " @echo " Code starts at address `$(NM) loader.elf | grep vectors | awk '/ / { print $$1 }'`" @echo " BSS ends at address `$(NM) loader.elf | grep __bss_end__ | awk '/ / { print $$1 }'`" @echo " Size of loader.bin : `ls -l loader.bin | awk '/ / { print $$5 }'`"ifeq ($(PRODUCTIONTEST), y) @echo " Size of stage0 test binary : `ls -l loader-sflash-test-stage0.bin | awk '/ / { print $$5 }'` (Maximum = $(STAGE0_TEST_IMAGE_SIZE))" @echo " Size of loader-sflash-test.bin : `ls -l loader-sflash-test.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-flash-test.bin : `ls -l loader-flash-test.bin | awk '/ / { print $$5 }'`"elseifeq ($(DRAMADJUSTMENT), y) @echo " Size of stage0 xtra binary : `ls -l loader-sflash-xtra-stage0.bin | awk '/ / { print $$5 }'` (Maximum = $(STAGE0_XTRA_IMAGE_SIZE))" @echo " Size of loader-sflash.bin : `ls -l loader-sflash.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-flash.bin : `ls -l loader-flash.bin | awk '/ / { print $$5 }'`"else @echo " Size of loader-sflash.bin : `ls -l loader-sflash.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-flash.bin : `ls -l loader-flash.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-sflash-min.bin : `ls -l loader-sflash-min.bin | awk '/ / { print $$5 }'`"endifendififneq ($(PRODUCTIONTEST), y)ifeq ($(ENABLE_2NDBOOT), y)ifeq ($(ENABLE_FLASH), y) @echo " Size of loader-flash-stage2.bin : `ls -l loader-flash-stage2.bin | awk '/ / { print $$5 }'`"endifendifendififeq ($(ENABLE_CRYPTO), y)ifneq ($(ENABLE_CRYPTO_FULL), y) @echo " Size of loader-sflash-secure-kernel.bin : `ls -l loader-sflash-secure-kernel.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-flash-secure-kernel.bin : `ls -l loader-flash-secure-kernel.bin | awk '/ / { print $$5 }'`"endifendififeq ($(ENABLE_CRYPTO_FULL), y)ifeq ($(findstring loader-sflash-secure-boot0.bin, $(TARGET)), loader-sflash-secure-boot0.bin) @echo " Size of loader-sflash-crypto.bin : `ls -l loader-sflash-crypto.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-sflash-secure-boot0.bin : `ls -l loader-sflash-secure-boot0.bin | awk '/ / { print $$5 }'`"endififeq ($(findstring loader-flash-secure-boot0.bin, $(TARGET)), loader-flash-secure-boot0.bin) @echo " Size of loader-flash-crypto.bin : `ls -l loader-flash-crypto.bin | awk '/ / { print $$5 }'`" @echo " Size of loader-flash-secure-boot0.bin : `ls -l loader-flash-secure-boot0.bin | awk '/ / { print $$5 }'`"endif @echo " Size of loader-flash-secure-boot1.bin : `ls -l loader-flash-secure-boot1.bin | awk '/ / { print $$5 }'`"endif$(OBJS-y) : config.h $(RTCONFIG) Makefile$(XTRA_STAGE0_OBJS) : config.h $(RTCONFIG) Makefiletest-stage1.o : test-stage1.c $(CC) $(CFLAGS) -c -DCONFIG_PRODUCTIONTEST -o $@ $<.PHONY : cleanclean: rm -f *~ *.o board*/*.o *.s *.bin *.bin.* *.elf *.map version.h board genchecksumifeq ($(ENABLE_CRYPTO),y) make -C $(CRYPTODIR_STAGE1) cleanendififeq ($(ENABLE_CRYPTO_FULL),y) make -C $(CRYPTODIR_STAGE0) BOOTFROM=sflash clean make -C $(CRYPTODIR_STAGE0) BOOTFROM=pflash cleanendififeq ($(ENABLE_DVI), y) make -C $(RUA_DIR)/emhwlib_hal/i2c/src/ cleanendifcleanall: clean rm -f .configifeq ($(ENABLE_CRYPTO),y) make -C $(CRYPTODIR_STAGE1) cleanallendififeq ($(ENABLE_CRYPTO_FULL),y) make -C $(CRYPTODIR_STAGE0) BOOTFROM=sflash cleanall make -C $(CRYPTODIR_STAGE0) BOOTFROM=pflash cleanallendififeq ($(ENABLE_DVI), y) make -C $(RUA_DIR)/emhwlib_hal/i2c/src/ cleanallendif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -