diff options
author | Pawel Dembicki <paweldembicki@gmail.com> | 2020-08-24 14:29:32 +0200 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-10-26 00:40:12 +0100 |
commit | a254279a6c3048feb83909649c41ee4a7d37ec93 (patch) | |
tree | bc6d544a7d45fbf6f7362f28289c1d94dd894e38 /target/linux/layerscape/image | |
parent | c51f8030b623e03567a73fbcedc4ee69a8896688 (diff) | |
download | upstream-a254279a6c3048feb83909649c41ee4a7d37ec93.tar.gz upstream-a254279a6c3048feb83909649c41ee4a7d37ec93.tar.bz2 upstream-a254279a6c3048feb83909649c41ee4a7d37ec93.zip |
layerscape: Change to combined rootfs on sd images
At this moment layerscape images are ext4 only. It causes problem with
save changes durring sysupgrade and make "firstboot" and failsafe mode
useless.
This patch changes sd-card images to squashfs + f2fs combined images.
To make place, for saving config, kernel space ar now ext4 partition
with fit kernel.
This method of image generation is similar to rest of OpenWrt sd-card
targets.
Reviewed-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[reword README, reword DEVICE_COMPAT_MESSAGE, keep original indent]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/layerscape/image')
-rw-r--r-- | target/linux/layerscape/image/Makefile | 28 | ||||
-rw-r--r-- | target/linux/layerscape/image/armv7.mk | 42 | ||||
-rw-r--r-- | target/linux/layerscape/image/armv8_64b.mk | 84 | ||||
-rwxr-xr-x | target/linux/layerscape/image/gen_sdcard_head_img.sh | 14 |
4 files changed, 82 insertions, 86 deletions
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index 08864b1316..bfc4af4ca4 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -7,13 +7,22 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +LS_SD_KERNELPART_SIZE = 40 +LS_SD_KERNELPART_OFFSET = 16 LS_SD_ROOTFSPART_OFFSET = 64 LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \ - $(CONFIG_TARGET_ROOTFS_PARTSIZE)) * 1024 * 1024))) + $(CONFIG_TARGET_ROOTFS_PARTSIZE))))) # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs LS_SYSUPGRADE_IMAGE_SIZE = 49m +define Image/Prepare + # Build .dtb for all boards we may run on + $(foreach dts,$(DEVICE_DTS_LIST), + $(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb) + ) +endef + define Build/ls-clean rm -f $@ endef @@ -23,12 +32,21 @@ define Build/ls-append endef define Build/ls-append-dtb - $(call Image/BuildDTB,$(DTS_DIR)/$(1).dts,$(DTS_DIR)/$(1).dtb) dd if=$(DTS_DIR)/$(1).dtb >> $@ endef +define Build/ls-append-kernel + mkdir -p $@.tmp && \ + cp $(IMAGE_KERNEL) $@.tmp/fitImage && \ + make_ext4fs -J -L kernel -l "$(LS_SD_KERNELPART_SIZE)M" "$@.kernel.part" "$@.tmp" && \ + dd if=$@.kernel.part >> $@ && \ + rm -rf $@.tmp && \ + rm -f $@.kernel.part +endef + define Build/ls-append-sdhead ./gen_sdcard_head_img.sh $(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img \ + $(LS_SD_KERNELPART_OFFSET) $(LS_SD_KERNELPART_SIZE) \ $(LS_SD_ROOTFSPART_OFFSET) $(CONFIG_TARGET_ROOTFS_PARTSIZE) dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@ endef @@ -53,6 +71,12 @@ define Device/fix-sysupgrade After that, You can use "sysupgrade -F". endef +define Device/rework-sdcard-images + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := SD-card images were changed to squashfs + ext4 overlay combined images. \ + It is required to flash the entire sd-card again and manually copy config. +endef + include $(SUBTARGET).mk $(eval $(call BuildImage)) diff --git a/target/linux/layerscape/image/armv7.mk b/target/linux/layerscape/image/armv7.mk index 23bd3e8d82..46e5cf9395 100644 --- a/target/linux/layerscape/image/armv7.mk +++ b/target/linux/layerscape/image/armv7.mk @@ -40,50 +40,40 @@ endef TARGET_DEVICES += fsl_ls1021a-twr define Device/fsl_ls1021a-twr-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := TWR-LS1021A DEVICE_VARIANT := SD Card Boot DEVICE_DTS := ls1021a-twr - FILESYSTEMS := ext4 - IMAGES := sdcard.img sysupgrade.bin - IMAGE/sdcard.img := \ + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := sdcard.img.gz sysupgrade.bin + IMAGE/sdcard.img.gz := \ ls-clean | \ ls-append-sdhead $(1) | pad-to 4K | \ ls-append $(1)-uboot.bin | pad-to 3M | \ - ls-append $(1)-uboot-env.bin | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append $(1)-uboot-env.bin | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1021a-twr-sdboot define Device/fsl_ls1021a-iot-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := LS1021A-IoT DEVICE_VARIANT := SD Card Boot DEVICE_DTS := ls1021a-iot - FILESYSTEMS := ext4 SUPPORTED_DEVICES := - IMAGES := sdcard.img sysupgrade.bin - IMAGE/sdcard.img := \ + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := sdcard.img.gz sysupgrade.bin + IMAGE/sdcard.img.gz := \ ls-clean | \ ls-append-sdhead $(1) | pad-to 4K | \ ls-append $(1)-uboot.bin | pad-to 1M | \ - ls-append $(1)-uboot-env.bin | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append $(1)-uboot-env.bin | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1021a-iot-sdboot diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index 35bab47124..ff480c287b 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -67,6 +67,7 @@ endef TARGET_DEVICES += fsl_ls1012a-rdb define Device/fsl_ls1012a-frwy-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := FRWY-LS1012A DEVICE_PACKAGES += \ @@ -74,8 +75,8 @@ define Device/fsl_ls1012a-frwy-sdboot tfa-ls1012a-frwy-sdboot \ kmod-ppfe DEVICE_DTS := freescale/fsl-ls1012a-frwy - FILESYSTEMS := ext4 - IMAGES := firmware.bin sdcard.img sysupgrade.bin + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := firmware.bin sdcard.img.gz sysupgrade.bin IMAGE/firmware.bin := \ ls-clean | \ ls-append $(1)-bl2.pbl | pad-to 128K | \ @@ -83,18 +84,12 @@ define Device/fsl_ls1012a-frwy-sdboot ls-append $(1)-fip.bin | pad-to 1856K | \ ls-append $(1)-uboot-env.bin | pad-to 2048K | \ check-size 2097153 - IMAGE/sdcard.img := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ + IMAGE/sdcard.img.gz := \ ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append-sdhead $(1) | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1012a-frwy-sdboot @@ -124,6 +119,7 @@ endef TARGET_DEVICES += fsl_ls1043a-rdb define Device/fsl_ls1043a-rdb-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := LS1043A-RDB DEVICE_VARIANT := SD Card Boot @@ -135,24 +131,18 @@ define Device/fsl_ls1043a-rdb-sdboot kmod-hwmon-ina2xx \ kmod-hwmon-lm90 DEVICE_DTS := freescale/fsl-ls1043a-rdb-sdk - FILESYSTEMS := ext4 - IMAGES := sdcard.img sysupgrade.bin - IMAGE/sdcard.img := \ + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := sdcard.img.gz sysupgrade.bin + IMAGE/sdcard.img.gz := \ ls-clean | \ ls-append-sdhead $(1) | pad-to 4K | \ ls-append $(1)-bl2.pbl | pad-to 1M | \ ls-append $(1)-fip.bin | pad-to 5M | \ ls-append $(1)-uboot-env.bin | pad-to 9M | \ - ls-append fsl_ls1043a-rdb-fman.bin | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append fsl_ls1043a-rdb-fman.bin | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1043a-rdb-sdboot @@ -182,6 +172,7 @@ endef TARGET_DEVICES += fsl_ls1046a-rdb define Device/fsl_ls1046a-rdb-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := LS1046A-RDB DEVICE_VARIANT := SD Card Boot @@ -193,24 +184,18 @@ define Device/fsl_ls1046a-rdb-sdboot kmod-hwmon-ina2xx \ kmod-hwmon-lm90 DEVICE_DTS := freescale/fsl-ls1046a-rdb-sdk - FILESYSTEMS := ext4 - IMAGES := sdcard.img sysupgrade.bin - IMAGE/sdcard.img := \ + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := sdcard.img.gz sysupgrade.bin + IMAGE/sdcard.img.gz := \ ls-clean | \ ls-append-sdhead $(1) | pad-to 4K | \ ls-append $(1)-bl2.pbl | pad-to 1M | \ ls-append $(1)-fip.bin | pad-to 5M | \ ls-append $(1)-uboot-env.bin | pad-to 9M | \ - ls-append fsl_ls1046a-rdb-fman.bin | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append fsl_ls1046a-rdb-fman.bin | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1046a-rdb-sdboot @@ -242,6 +227,7 @@ endef TARGET_DEVICES += fsl_ls1088a-rdb define Device/fsl_ls1088a-rdb-sdboot + $(Device/rework-sdcard-images) DEVICE_VENDOR := NXP DEVICE_MODEL := LS1088A-RDB DEVICE_VARIANT := SD Card Boot @@ -254,9 +240,9 @@ define Device/fsl_ls1088a-rdb-sdboot kmod-hwmon-ina2xx \ kmod-hwmon-lm90 DEVICE_DTS := freescale/fsl-ls1088a-rdb - FILESYSTEMS := ext4 - IMAGES := sdcard.img sysupgrade.bin - IMAGE/sdcard.img := \ + KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + IMAGES := sdcard.img.gz sysupgrade.bin + IMAGE/sdcard.img.gz := \ ls-clean | \ ls-append-sdhead $(1) | pad-to 4K | \ ls-append $(1)-bl2.pbl | pad-to 1M | \ @@ -264,16 +250,10 @@ define Device/fsl_ls1088a-rdb-sdboot ls-append $(1)-uboot-env.bin | pad-to 10M | \ ls-append fsl_ls1088a-rdb-mc.itb | pad-to 13M | \ ls-append fsl_ls1088a-rdb-dpl.dtb | pad-to 14M | \ - ls-append fsl_ls1088a-rdb-dpc.dtb | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) - IMAGE/sysupgrade.bin := \ - ls-clean | \ - ls-append-sdhead $(1) | pad-to 15M | \ - ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ - append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ - append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata + ls-append fsl_ls1088a-rdb-dpc.dtb | pad-to 16M | \ + ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ + append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += fsl_ls1088a-rdb-sdboot diff --git a/target/linux/layerscape/image/gen_sdcard_head_img.sh b/target/linux/layerscape/image/gen_sdcard_head_img.sh index 08ab4497d5..d3a8fd2d12 100755 --- a/target/linux/layerscape/image/gen_sdcard_head_img.sh +++ b/target/linux/layerscape/image/gen_sdcard_head_img.sh @@ -7,16 +7,18 @@ # set -x -[ $# -eq 3 ] || { - echo "SYNTAX: $0 <file> <rootfs part offset> <rootfs size>" +[ $# -eq 5 ] || { + echo "SYNTAX: $0 <file> <kernel part offset> <kernel size> <rootfs part offset> <rootfs size>" exit 1 } OUTPUT="$1" -ROOTFSOFFSET="$(($2 * 1024))" -ROOTFSSIZE="$3" +KERNELOFFSET="$(($2 * 1024))" +KERNELSIZE="$3" +ROOTFSOFFSET="$(($4 * 1024))" +ROOTFSSIZE="$5" head=4 -sect=16 +sect=63 -set $(ptgen -o $OUTPUT -h $head -s $sect -l $ROOTFSOFFSET -t 83 -p ${ROOTFSSIZE}M) +set $(ptgen -o $OUTPUT -h $head -s $sect -t 83 -p ${KERNELSIZE}M@${KERNELOFFSET} -p ${ROOTFSSIZE}M@${ROOTFSOFFSET}) |