Skip to content
Snippets Groups Projects
Commit 0e58005e authored by Ronny Nilsson's avatar Ronny Nilsson
Browse files

sysupgrade: generate a .y3 image specifically for Iopsys 4 to 5 migration.

The migration image .y3 can ONLY be used for migration.
Once Iopsys 5 is running it can't be used any more.
parent 60d677bb
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ endif ...@@ -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_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) 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) 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}')) 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) GIT_SHORT = $(shell cd $(TOPDIR) && git rev-parse --short HEAD)
...@@ -226,7 +227,7 @@ endef ...@@ -226,7 +227,7 @@ endef
define Image/Build/HeaderY3 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" # Any unused arguments should be passed as "void"
echo "In Image/Build/Header $(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8)" echo "In Image/Build/Header $(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8)"
...@@ -269,14 +270,15 @@ define Image/Build/HeaderY3 ...@@ -269,14 +270,15 @@ define Image/Build/HeaderY3
pkg_ofs=$$$$(( ubi_ofs + ubi_sz )) && \ pkg_ofs=$$$$(( ubi_ofs + ubi_sz )) && \
pkg_sz=$$$$(find $(KDIR)/$(strip $(6)) -printf "%s") && \ pkg_sz=$$$$(find $(KDIR)/$(strip $(6)) -printf "%s") && \
scr_ofs=$$$$(( pkg_ofs + pkg_sz )) && \ 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_ofs=$$$$(( scr_ofs + scr_sz )) && \
sig_sz=$(if $(CONFIG_SMIMEOPT),256,0) && \ sig_sz=$(if $(CONFIG_SMIMEOPT),256,0) && \
md5_ofs=$$$$(( sig_ofs + sig_sz )) && \ md5_ofs=$$$$(( sig_ofs + sig_sz )) && \
md5_sz=32 && \ md5_sz=32 && \
filesize=$$$$(( md5_ofs + md5_sz )) && \ filesize=$$$$(( md5_ofs + md5_sz )) && \
echo "IntenoIopY" >$(KDIR)/hdr && \ 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 "integrity MD5SUM" >> $(KDIR)/hdr && \
echo "git $(GIT_SHORT)" >>$(KDIR)/hdr && \ echo "git $(GIT_SHORT)" >>$(KDIR)/hdr && \
echo "chip $(CONFIG_BCM_CHIP_ID)" >>$(KDIR)/hdr && \ echo "chip $(CONFIG_BCM_CHIP_ID)" >>$(KDIR)/hdr && \
...@@ -328,7 +330,7 @@ define Image/Build/HeaderY3 ...@@ -328,7 +330,7 @@ define Image/Build/HeaderY3
endef endef
define Image/Build/ubifs define Image/Build/ubifs
# Generate ubi image # Generate Broadcom pureUBI kernel volume.
mkdir -p $(KDIR)/bootfs mkdir -p $(KDIR)/bootfs
cp -vf $(KDIR)/cferam.000 $(wildcard $(KDIR)/*.dtb) $(KDIR)/vmlinux.lz $(KDIR)/bootfs cp -vf $(KDIR)/cferam.000 $(wildcard $(KDIR)/*.dtb) $(KDIR)/vmlinux.lz $(KDIR)/bootfs
$(BRCM_TOP)/targets/buildUBI -u "/dev/null" \ $(BRCM_TOP)/targets/buildUBI -u "/dev/null" \
...@@ -391,16 +393,16 @@ define Image/Build/imgY3 ...@@ -391,16 +393,16 @@ define Image/Build/imgY3
endif endif
ifeq ($(CONFIG_TARGET_IMAGE_Y3),y) 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, \ $(call Image/Build/HeaderY3,header.y3,cfe$(CONFIG_BCM_CHIP_ID)_nand.v, \
vmlinux.jffs2,void,root.ubi,pkginfo, \ void,void,root.ubi,pkginfo, \
$(KDIR)/bundled-upgrade-script.tar.gz,rescue.ubi) bundled-upgrade-script.tar.gz,rescue.ubi)
# Concat header, cfe, vmlinux and ubi together # Concat header, cfe, vmlinux and ubi together
cat $(KDIR)/header.y3 \ cat $(KDIR)/header.y3 \
$(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \
$(KDIR)/rescue.ubi \ $(KDIR)/rescue.ubi \
$(KDIR)/vmlinux.jffs2 \
$(KDIR)/root.ubi \ $(KDIR)/root.ubi \
$(KDIR)/pkginfo \ $(KDIR)/pkginfo \
$(KDIR)/bundled-upgrade-script.tar.gz >$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 $(KDIR)/bundled-upgrade-script.tar.gz >$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3
...@@ -408,7 +410,6 @@ define Image/Build/imgY3 ...@@ -408,7 +410,6 @@ define Image/Build/imgY3
# If build is signed also sign the cfe,kernel,fs part of the image. # If build is signed also sign the cfe,kernel,fs part of the image.
ifeq ($(CONFIG_SMIMEOPT),y) ifeq ($(CONFIG_SMIMEOPT),y)
cat $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \ cat $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v \
$(KDIR)/vmlinux.jffs2 \
$(KDIR)/root.ubi | \ $(KDIR)/root.ubi | \
openssl dgst -sha256 -sign $(CONFIG_OPKGSMIME_KEY) \ openssl dgst -sha256 -sign $(CONFIG_OPKGSMIME_KEY) \
-passin file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)) \ -passin file:$(call qstrip,$(CONFIG_OPKGSMIME_PASSFILE)) \
...@@ -419,6 +420,35 @@ define Image/Build/imgY3 ...@@ -419,6 +420,35 @@ define Image/Build/imgY3
md5sum -b $(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 |awk '{printf "%s",$$$$1}' \ md5sum -b $(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 |awk '{printf "%s",$$$$1}' \
>>$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 >>$(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3
ln -sf $(BIN_DIR)/$(IHGSP_BUILD_VERSION).y3 $(BIN_DIR)/last.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 endif
endef endef
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment