diff --git a/iopsys-brcm63xx-arm/image/Makefile b/iopsys-brcm63xx-arm/image/Makefile index e0944a917168dfbb7762588d90aa47ee65ba84e8..ef886d3bc4790e19b444e1f46d8ed04d0cdb5518 100644 --- a/iopsys-brcm63xx-arm/image/Makefile +++ b/iopsys-brcm63xx-arm/image/Makefile @@ -27,6 +27,7 @@ endif IHGSP_VERSION:=$(CONFIG_TARGET_FAMILY)-$(DSL_MODE)-$(CONFIG_TARGET_CUSTOMER)-$(CONFIG_TARGET_VERSION)-$(shell date '+%y%m%d_%H%M') IHGSP_BUILD_VERSION:=$(shell echo $(IHGSP_VERSION) | sed s/\"//g) +imageNameMigrator := $(CONFIG_TARGET_FAMILY)-$(DSL_MODE)-$(CONFIG_TARGET_CUSTOMER)-$(CONFIG_TARGET_VERSION)-Migrator4-$(shell date '+%y%m%d_%H%M') BUILD_DIR_ROOT:=$(BUILD_DIR)/root-$(shell echo $(CONFIG_TARGET_BOARD) | sed s/\"//g) KERNEL_ENTRY = $(if $(wildcard $(KDIR)/vmlinux.bcm.elf), $(shell readelf -h $(KDIR)/vmlinux.bcm.elf | grep Entry | awk '{print $$4}')) GIT_SHORT = $(shell cd $(TOPDIR) && git rev-parse --short HEAD) @@ -226,7 +227,7 @@ endef define Image/Build/HeaderY3 - # Args: $1=header $2=cfe $3=kernel $4=ubifs $5=ubi $6=pkginfo $7=upgrade script $8=cferam backup + # Args: $1=header $2=cfe $3=kernel (jffs2) $4=ubifs $5=ubi $6=pkginfo $7=upgrade script $8=cferam backup # Any unused arguments should be passed as "void" echo "In Image/Build/Header $(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8)" @@ -269,14 +270,15 @@ define Image/Build/HeaderY3 pkg_ofs=$$$$(( ubi_ofs + ubi_sz )) && \ pkg_sz=$$$$(find $(KDIR)/$(strip $(6)) -printf "%s") && \ scr_ofs=$$$$(( pkg_ofs + pkg_sz )) && \ - scr_sz=$$$$(find $(strip $(7)) -printf "%s") && \ + scr_sz=$$$$(find $(KDIR)/$(strip $(7)) -printf "%s") && \ sig_ofs=$$$$(( scr_ofs + scr_sz )) && \ sig_sz=$(if $(CONFIG_SMIMEOPT),256,0) && \ md5_ofs=$$$$(( sig_ofs + sig_sz )) && \ md5_sz=32 && \ filesize=$$$$(( md5_ofs + md5_sz )) && \ echo "IntenoIopY" >$(KDIR)/hdr && \ - echo "version 7" >>$(KDIR)/hdr && \ + ( [ -s "$(KDIR)/$(strip $(3))" ] && \ + echo "version 5" || echo "version 8") >>$(KDIR)/hdr && \ echo "integrity MD5SUM" >> $(KDIR)/hdr && \ echo "git $(GIT_SHORT)" >>$(KDIR)/hdr && \ echo "chip $(CONFIG_BCM_CHIP_ID)" >>$(KDIR)/hdr && \ @@ -328,7 +330,7 @@ define Image/Build/HeaderY3 endef define Image/Build/ubifs - # Generate ubi image + # Generate Broadcom pureUBI kernel volume. mkdir -p $(KDIR)/bootfs cp -vf $(KDIR)/cferam.000 $(wildcard $(KDIR)/*.dtb) $(KDIR)/vmlinux.lz $(KDIR)/bootfs $(BRCM_TOP)/targets/buildUBI -u "/dev/null" \ @@ -391,16 +393,16 @@ define Image/Build/imgY3 endif ifeq ($(CONFIG_TARGET_IMAGE_Y3),y) - # Make header (.y3) + # Generate regular Iopsys .y3 + # header $(call Image/Build/HeaderY3,header.y3,cfe$(CONFIG_BCM_CHIP_ID)_nand.v, \ - vmlinux.jffs2,void,root.ubi,pkginfo, \ - $(KDIR)/bundled-upgrade-script.tar.gz,rescue.ubi) + void,void,root.ubi,pkginfo, \ + bundled-upgrade-script.tar.gz,rescue.ubi) # Concat header, cfe, vmlinux and ubi together cat $(KDIR)/header.y3 \ $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ $(KDIR)/rescue.ubi \ - $(KDIR)/vmlinux.jffs2 \ $(KDIR)/root.ubi \ $(KDIR)/pkginfo \ $(KDIR)/bundled-upgrade-script.tar.gz >$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 @@ -408,7 +410,6 @@ define Image/Build/imgY3 # If build is signed also sign the cfe,kernel,fs part of the image. ifeq ($(CONFIG_SMIMEOPT),y) cat $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ - $(KDIR)/vmlinux.jffs2 \ $(KDIR)/root.ubi | \ openssl dgst -sha256 -sign $(CONFIG_OPKGSMIME_KEY) \ -passin file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)) \ @@ -419,6 +420,35 @@ define Image/Build/imgY3 md5sum -b $(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 |awk '{printf "%s",$$$$1}' \ >>$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 ln -sf $(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 $(BIN_DIR)/last.y3 + + + #----- + # Generate Iopsys 4 to 5 migrator .y3 + # header + $(call Image/Build/HeaderY3,header.y3,cfe$(CONFIG_BCM_CHIP_ID)_nand.v, \ + vmlinux.jffs2,void,root.ubi,pkginfo, void,void) + + # Concat header, cfe, vmlinux and ubi together + cat $(KDIR)/header.y3 \ + $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ + $(KDIR)/vmlinux.jffs2 \ + $(KDIR)/root.ubi \ + $(KDIR)/pkginfo >$(BIN_DIR)/$(imageNameMigrator).y3 + + # If build is signed also sign the cfe,kernel,fs part of the image. + ifeq ($(CONFIG_SMIMEOPT),y) + cat $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ + $(KDIR)/vmlinux.jffs2 \ + $(KDIR)/root.ubi | \ + openssl dgst -sha256 -sign $(CONFIG_OPKGSMIME_KEY) \ + -passin file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)) \ + >>$(BIN_DIR)/$(imageNameMigrator).y3 + endif + + # Attach checksum to combined image + md5sum -b $(BIN_DIR)/$(imageNameMigrator).y3 | awk '{printf "%s",$$$$1}' \ + >>$(BIN_DIR)/$(imageNameMigrator).y3 + ln -sf $(BIN_DIR)/$(imageNameMigrator).y3 $(BIN_DIR)/migrator.y3 endif endef