[OpenWrt-Devel] [PATCH v4 3/4] sunxi: create KDIR_TMP, build boot.img in it

Matthias Schiffer mschiffer at universe-factory.net
Thu Aug 13 13:46:06 EDT 2015


It's nice to have a distinction between files which are built during the
normal OpenWrt build process and ones that are created by the ImageBuilder
(like it already exists on some other targets).

This also gives boot.img a profile-specific prefix as it contains profile-
specific data.

Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/sunxi/image/Makefile | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile
index 19ab935..45e8dea 100644
--- a/target/linux/sunxi/image/Makefile
+++ b/target/linux/sunxi/image/Makefile
@@ -8,10 +8,14 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 include $(INCLUDE_DIR)/host.mk
 
+KDIR_TMP:=$(KDIR)/tmp
+
 FAT32_BLOCK_SIZE=1024
 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
 
 define Image/BuildKernel
+	-mkdir -p $(KDIR_TMP)
+
 	mkimage -A arm -O linux -T kernel -C none \
 		-a 0x40008000 -e 0x40008000 \
 		-n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \
@@ -29,16 +33,16 @@ define Image/BuildKernel
 endef
 
 define Image/Build/SDCard
-	rm -f $(KDIR)/boot.img
-	mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
+	rm -f $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img
+	mkdosfs $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img -C $(FAT32_BLOCKS)
 
-	mcopy -i $(KDIR)/boot.img $(KDIR)/uboot-sunxi-$(PROFILE)-boot.scr ::boot.scr
-	mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(2).dtb ::dtb
-	mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
+	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(KDIR)/uboot-sunxi-$(PROFILE)-boot.scr ::boot.scr
+	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTS_DIR)/$(2).dtb ::dtb
+	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
 
 	./gen_sunxi_sdcard_img.sh \
 		$(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
-		$(KDIR)/boot.img \
+		$(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img \
 		$(KDIR)/root.$(1) \
 		$(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
 		$(CONFIG_TARGET_ROOTFS_PARTSIZE) \
-- 
2.5.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list