aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-5.10
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-02-15 14:37:17 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-02-24 01:35:20 +0000
commite6aac8d98f5663be99163f9e61dad23ad657b7ed (patch)
treee380522a134bab0afe6d9058d5cd8613fb2d4cf7 /target/linux/generic/pending-5.10
parentfb83efb626491e4e0de79429041ea7792db337d4 (diff)
downloadupstream-e6aac8d98f5663be99163f9e61dad23ad657b7ed.tar.gz
upstream-e6aac8d98f5663be99163f9e61dad23ad657b7ed.tar.bz2
upstream-e6aac8d98f5663be99163f9e61dad23ad657b7ed.zip
image: add support for building FIT image with filesystem
Allow for single (external-data) FIT image to hold kernel, dtb and squashfs. In that way, the bootloader verifies the system integrity including the rootfs, because what's the point of checking that the hash of the kernel is correct if it won't boot in case of squashfs being corrupted? Better allow bootloader to check everything needed to make it at least up to failsafe mode. As a positive side effect this change also makes the sysupgrade process on nand potentially much easier as it is now. In short: mkimage has a parameter '-E' which allows generating FIT images with 'external' data rather than embedding the data into the device-tree blob itself. In this way, the FIT structure itself remains small and can be parsed easily (rather than having to page around megabytes of image content). This patch makes use of that and adds support for adding sub-images of type 'filesystem' which are used to store the squashfs. Now U-Boot can verify the whole OS and the new partition parsers added in the Linux kernel can detect the filesystem sub-images, create partitions for them, and select the active rootfs volume based on the configuration in FIT (passing configuration via device tree could be implemented easily at a later stage). This new FIT partition parser works for NOR flash (on top of mtdblock), NAND flash (on top of ubiblock) as well as classic block devices (ie. eMMC, SDcard, SATA, NVME, ...). It could even be used to mount such FIT images via `losetup -P` on a user PC if this patch gets included in Linux upstream one day ;) Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic/pending-5.10')
-rw-r--r--target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch5
1 files changed, 4 insertions, 1 deletions
diff --git a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch
index e5ee2c8656..a2b48fd4fc 100644
--- a/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch
+++ b/target/linux/generic/pending-5.10/491-ubi-auto-create-ubiblock-device-for-rootfs.patch
@@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
-@@ -652,6 +652,44 @@ static void __init ubiblock_create_from_
+@@ -652,6 +652,47 @@ static void __init ubiblock_create_from_
}
}
@@ -33,6 +33,9 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY);
+ if (IS_ERR(desc))
++ desc = ubi_open_volume_nm(ubi_num, "fit", UBI_READONLY);;
++
++ if (IS_ERR(desc))
+ continue;
+
+ ubi_get_volume_info(desc, &vi);