aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Dembicki <paweldembicki@gmail.com>2020-08-24 14:29:32 +0200
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-10-26 00:40:12 +0100
commita254279a6c3048feb83909649c41ee4a7d37ec93 (patch)
treebc6d544a7d45fbf6f7362f28289c1d94dd894e38
parentc51f8030b623e03567a73fbcedc4ee69a8896688 (diff)
downloadupstream-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>
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt6
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt6
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt6
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt6
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt6
-rw-r--r--package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt4
-rw-r--r--target/linux/layerscape/Makefile4
-rw-r--r--target/linux/layerscape/README9
-rw-r--r--target/linux/layerscape/armv7/config-5.43
-rw-r--r--target/linux/layerscape/armv8_64b/config-5.43
-rw-r--r--target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version6
-rw-r--r--target/linux/layerscape/base-files/lib/preinit/79_move_config26
-rw-r--r--target/linux/layerscape/base-files/lib/upgrade/platform.sh103
-rw-r--r--target/linux/layerscape/image/Makefile28
-rw-r--r--target/linux/layerscape/image/armv7.mk42
-rw-r--r--target/linux/layerscape/image/armv8_64b.mk84
-rwxr-xr-xtarget/linux/layerscape/image/gen_sdcard_head_img.sh14
17 files changed, 166 insertions, 190 deletions
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt
index 31178df690..1fcd769dc9 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1012a-frwy-sdboot-uEnv.txt
@@ -1,8 +1,8 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
-fdt_high=0xffffffffffffffff
+fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff
-sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;pfe stop;run sd_boot
bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt
index 7772daa100..ed8661bc6e 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1021a-iot-sdboot-uEnv.txt
@@ -1,8 +1,8 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
-fdt_high=0xffffffff
+fdt_high=0x8fffffff
initrd_high=0xffffffff
-sd_boot=mmc read ${fdtaddr} 7800 800;mmc read ${loadaddr} 8000 8000;bootm ${loadaddr} - ${fdtaddr}
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt
index da286a24ae..ed8661bc6e 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1021a-twr-sdboot-uEnv.txt
@@ -1,8 +1,8 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
-fdt_high=0xffffffff
+fdt_high=0x8fffffff
initrd_high=0xffffffff
-sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 cma=64M@0x0-0xb0000000
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt
index c1596b506a..6034033876 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1043a-rdb-sdboot-uEnv.txt
@@ -1,9 +1,9 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
-fdt_high=0xffffffffffffffff
+fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto
-sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt
index c1596b506a..6034033876 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1046a-rdb-sdboot-uEnv.txt
@@ -1,9 +1,9 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
-fdt_high=0xffffffffffffffff
+fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto
-sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt
index 2d27f7eb05..b25e9c8ee7 100644
--- a/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt
+++ b/package/boot/uboot-layerscape/files/fsl_ls1088a-rdb-sdboot-uEnv.txt
@@ -4,7 +4,7 @@ fdt_high=0xa0000000
initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto
mc_init=mmc read 80000000 5000 1800;mmc read 80300000 7000 800;fsl_mc start mc 80000000 80300000;mmc read 80400000 6800 800;fsl_mc apply dpl 80400000
-sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr
-bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
+sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
+bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run mc_init;run sd_boot
bootdelay=3
diff --git a/target/linux/layerscape/Makefile b/target/linux/layerscape/Makefile
index c5b27ad0c7..9030747823 100644
--- a/target/linux/layerscape/Makefile
+++ b/target/linux/layerscape/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
BOARD:=layerscape
BOARDNAME:=NXP Layerscape
KERNEL_PATCHVER:=5.4
-FEATURES:=squashfs nand usb pcie gpio fpu ubifs ext4
+FEATURES:=squashfs nand usb pcie gpio fpu ubifs ext4 rootfs-part boot-part
SUBTARGETS:=armv8_64b armv7
define Target/Description
@@ -19,6 +19,6 @@ endef
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += kmod-usb3 kmod-usb-dwc3 kmod-usb-storage \
- partx-utils
+ mkf2fs e2fsprogs partx-utils
$(eval $(call BuildTarget))
diff --git a/target/linux/layerscape/README b/target/linux/layerscape/README
index 8cbf05bd15..4bade4a9c0 100644
--- a/target/linux/layerscape/README
+++ b/target/linux/layerscape/README
@@ -39,13 +39,14 @@ $ ./scripts/feeds install -a
* Final firmware/image
Path: bin/targets/layerscape/<subtarget>/
Firmware for flash: openwrt-layerscape-<subtarget>-<device>-<rootfs>-firmware.bin
- Image for SD card: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sdcard.img
+ Image for SD card: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sdcard.img.gz
+ Sysupgrade images: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sysupgrade.bin
3. Program NOR/QSPI flash or SD card
------------------------------------
-The firmware.bin or sdcard.img is an all-in-one image including all things for
-OpenWrt staring up. (except LS1012AFRWY. Refer to 3.3.)
+The firmware.bin or sdcard.img (after extract from gz) is an all-in-one image including all
+things for OpenWrt staring up. (except LS1012AFRWY. Refer to 3.3.)
If you want to install all things into flash, please use firmware.bin.
If you want to install all things into SD card, please use sdcard.img.
@@ -53,7 +54,7 @@ If you want to install all things into SD card, please use sdcard.img.
---------------------------------
sdcard.img could be programmed to SD card in either u-boot environment
or linux environment. After programming, configure the board to boot
-from SD card.
+from SD card. (sdcard.img images are gz-iped to save space. Please extract them first.)
* u-boot environment
diff --git a/target/linux/layerscape/armv7/config-5.4 b/target/linux/layerscape/armv7/config-5.4
index 56a6dfd913..1b969afd85 100644
--- a/target/linux/layerscape/armv7/config-5.4
+++ b/target/linux/layerscape/armv7/config-5.4
@@ -242,6 +242,9 @@ CONFIG_EVENT_TRACING=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
+CONFIG_F2FS_FS=y
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
CONFIG_FAILOVER=y
CONFIG_FAT_FS=y
# CONFIG_FEC is not set
diff --git a/target/linux/layerscape/armv8_64b/config-5.4 b/target/linux/layerscape/armv8_64b/config-5.4
index 311f2eee84..6da7ff01a5 100644
--- a/target/linux/layerscape/armv8_64b/config-5.4
+++ b/target/linux/layerscape/armv8_64b/config-5.4
@@ -266,6 +266,9 @@ CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXTCON=y
CONFIG_EXTCON_USB_GPIO=y
+CONFIG_F2FS_FS=y
+CONFIG_F2FS_FS_XATTR=y
+CONFIG_F2FS_STAT_FS=y
CONFIG_FAILOVER=y
CONFIG_FANOTIFY=y
CONFIG_FAT_FS=y
diff --git a/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version
index 923f4ac273..6cd137af9a 100644
--- a/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version
@@ -5,11 +5,17 @@
. /lib/functions.sh
case "$(board_name)" in
+ fsl,ls1012a-frwy-sdboot | \
fsl,ls1012a-rdb | \
+ fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr | \
+ fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb | \
+ fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb | \
+ fsl,ls1046a-rdb-sdboot | \
fsl,ls1088a-rdb | \
+ fsl,ls1088a-rdb-sdboot | \
fsl,ls2088a-rdb)
uci set system.@system[0].compat_version="2.0"
uci commit system
diff --git a/target/linux/layerscape/base-files/lib/preinit/79_move_config b/target/linux/layerscape/base-files/lib/preinit/79_move_config
new file mode 100644
index 0000000000..d691fa99f1
--- /dev/null
+++ b/target/linux/layerscape/base-files/lib/preinit/79_move_config
@@ -0,0 +1,26 @@
+. /lib/functions.sh
+. /lib/upgrade/common.sh
+
+BOOTPART=/dev/mmcblk0p1
+
+move_config() {
+ local board=$(board_name)
+
+ case "$board" in
+ fsl,ls1012a-frwy-sdboot | \
+ fsl,ls1021a-iot-sdboot | \
+ fsl,ls1021a-twr-sdboot | \
+ fsl,ls1043a-rdb-sdboot | \
+ fsl,ls1046a-rdb-sdboot | \
+ fsl,ls1088a-rdb-sdboot)
+ if [ -b $BOOTPART ]; then
+ mkdir -p /boot
+ mount -t ext4 -o rw,noatime $BOOTPART /boot 2>&1
+ [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
+ umount /boot
+ fi
+ ;;
+ esac
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
index de01ac46de..a8d83de7ea 100644
--- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh
+++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
@@ -8,88 +8,28 @@ RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock"
REQUIRE_IMAGE_METADATA=1
-platform_check_image_sdboot() {
- local diskdev partdev diff
-
- export_bootdevice && export_partdevice diskdev 0 || {
- echo "Unable to determine upgrade device"
- return 1
- }
-
- # get partitions table from boot device
- get_partitions "/dev/$diskdev" bootdisk
-
- # get partitions table from sysupgrade.bin
- dd if="$1" of=/tmp/image.bs bs=512b count=1 > /dev/null 2>&1
- sync
- get_partitions /tmp/image.bs image
-
- # compare tables
- diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
-
- rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
-
- if [ -n "$diff" ]; then
- echo "Partition layout has changed. Full image will be written."
- ask_bool 0 "Abort" && exit 1
- return 0
- fi
-}
platform_do_upgrade_sdboot() {
- local diskdev partdev diff
+ local diskdev partdev parttype=ext4
+ local tar_file="$1"
+ local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
- if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
- # get partitions table from boot device
- get_partitions "/dev/$diskdev" bootdisk
-
- # get partitions table from sysupgrade.bin
- dd if="$1" of=/tmp/image.bs bs=512b count=1 > /dev/null 2>&1
- sync
- get_partitions /tmp/image.bs image
-
- # compare tables
- diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
- else
- diff=1
- fi
-
- if [ -n "$diff" ]; then
- dd if="$1" of="/dev/$diskdev" bs=1024 count=4 > /dev/null 2>&1
- echo "Writing image to /dev/$diskdev..."
- dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 > /dev/null 2>&1
- sync
-
- # Separate removal and addtion is necessary; otherwise, partition 1
- # will be missing if it overlaps with the old partition 2
- partx -d - "/dev/$diskdev"
- partx -a - "/dev/$diskdev"
-
- return 0
+ if export_partdevice partdev 1; then
+ mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
+ echo "Writing kernel..."
+ tar xf $tar_file ${board_dir}/kernel -O > /mnt/fitImage
+ umount /mnt
fi
- # write dtb
- echo "Writing dtb to /dev/$diskdev..."
- dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 count=1024 > /dev/null 2>&1
- # write kernel image
- echo "Writing kernel to /dev/$diskdev..."
- dd if="$1" of="/dev/$diskdev" bs=1024 skip=16384 seek=16384 count=16384 > /dev/null 2>&1
- sync
-
- # iterate over each partition from the image and write it to the boot disk
- while read part start size; do
- if export_partdevice partdev $part; then
- echo "Writing image to /dev/$partdev..."
- dd if="$1" of="/dev/$partdev" bs=512 skip="$start" count="$size" > /dev/null 2>&1
- sync
- else
- echo "Unable to find partition $part device, skipped."
- fi
- done < /tmp/partmap.image
+ echo "Erasing rootfs..."
+ dd if=/dev/zero of=/dev/mmcblk0p2 bs=1M > /dev/null 2>&1
+ echo "Writing rootfs..."
+ tar xf $tar_file ${board_dir}/root -O | dd of=/dev/mmcblk0p2 bs=512k > /dev/null 2>&1
}
platform_do_upgrade_traverse_nandubi() {
@@ -119,6 +59,7 @@ platform_copy_config_sdboot() {
if export_partdevice partdev 1; then
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
+ echo "Saving config backup..."
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt
fi
@@ -128,6 +69,7 @@ platform_copy_config() {
case "$board" in
fsl,ls1012a-frwy-sdboot | \
+ fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb-sdboot | \
@@ -146,22 +88,20 @@ platform_check_image() {
return $?
;;
fsl,ls1012a-frdm | \
+ fsl,ls1012a-frwy-sdboot | \
fsl,ls1012a-rdb | \
+ fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr | \
+ fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb | \
+ fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb | \
+ fsl,ls1046a-rdb-sdboot | \
fsl,ls1088a-rdb | \
+ fsl,ls1088a-rdb-sdboot | \
fsl,ls2088a-rdb)
return 0
;;
- fsl,ls1012a-frwy-sdboot | \
- fsl,ls1021a-twr-sdboot | \
- fsl,ls1043a-rdb-sdboot | \
- fsl,ls1046a-rdb-sdboot | \
- fsl,ls1088a-rdb-sdboot)
- platform_check_image_sdboot "$1"
- return 0
- ;;
*)
echo "Sysupgrade is not currently supported on $board"
;;
@@ -192,6 +132,7 @@ platform_do_upgrade() {
default_do_upgrade "$1"
;;
fsl,ls1012a-frwy-sdboot | \
+ fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb-sdboot | \
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})