From 499a8f718c431bf45ebab9fa8558d99a05162883 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Fri, 30 Dec 2022 16:10:43 +0100 Subject: [PATCH] common: Create (e)MMC image with redundant root filesystems This image contains: - A partition to hold bootloader config ("aux"). - Two redundant copies of the FIT framed rootfs (which will be upgradable by RAUC from within Infix). - A partition to store critical configuration data ("cfg") - A partition to store data created dynamically by Infix ("var") --- board/common/genimage.cfg | 64 ++++++++++++++++++++++++++++++++++++++ board/common/mkmmc.sh | 22 +++++++++++++ board/common/post-image.sh | 1 + 3 files changed, 87 insertions(+) create mode 100644 board/common/genimage.cfg create mode 100755 board/common/mkmmc.sh diff --git a/board/common/genimage.cfg b/board/common/genimage.cfg new file mode 100644 index 00000000..285bde4a --- /dev/null +++ b/board/common/genimage.cfg @@ -0,0 +1,64 @@ + +image aux.ext4 { + mountpoint = "/aux" + temporary = true + size = 2M + + ext4 { + label = "aux" + } +} + +image cfg.ext4 { + empty = true + temporary = true + size = 16M + + ext4 { + label = "cfg" + } +} + +image var.ext4 { + empty = true + temporary = true + # 44M - 24k (GPT backup) + size = 45032k + + ext4 { + label = "var" + } +} + +image mmc.img { + size = 512M + hdimage { + partition-table-type = "gpt" + } + + partition aux { + offset = 2M + image = "aux.ext4" + } + + partition primary { + image = "rootfs.itb" + size = 224M + } + + partition secondary { + image = "rootfs.itb" + size = 224M + } + + partition cfg { + image = "cfg.ext4" + } + + partition var { + image = "var.ext4" + } +} + +# Silence genimage warnings +config {} diff --git a/board/common/mkmmc.sh b/board/common/mkmmc.sh new file mode 100755 index 00000000..b8349d19 --- /dev/null +++ b/board/common/mkmmc.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +common=$(dirname $(readlink -f "$0")) +root=$BUILD_DIR/genimage.root +tmp=$BUILD_DIR/genimage.tmp + + +mkdir -p $root/aux +cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh +cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh +cp -f $BINARIES_DIR/uboot-env.bin $root/aux/uboot.env + +rm -rf $tmp + +genimage \ + --rootpath $root \ + --tmppath $tmp \ + --inputpath $BINARIES_DIR \ + --outputpath $BINARIES_DIR \ + --config $common/genimage.cfg diff --git a/board/common/post-image.sh b/board/common/post-image.sh index b2893beb..2d12aca3 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -10,6 +10,7 @@ signkey=$3 $common/sign.sh $arch $signkey $common/mkfit.sh +$common/mkmmc.sh if [ "$BR2_ARCH" = "x86_64" ]; then "$common/mkgns3a.sh"