board/common: allow device specific compat strings for .pkg files

This patch allows us to define the rauc manifest compatibility string with
menuconfig.  The INFIX_IMAGE_ID is a direct replacement for the previously
composed "infix-$ARCH" in mkrauc.sh.

For example, the compatibility string "infix-aarch64" is replaced for the
NanoPi R2S with "infix-r2s" to ensure users get a proper warning if they
try upgrading to an image that maybe boots, but is not likely to work.

The CLI upgrade command gets a 'force' flag to override the compat string.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-08-16 16:47:28 +02:00
committed by Tobias Waldekranz
parent df89b22062
commit 890d812b69
5 changed files with 22 additions and 4 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ set -e
GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags)
name=$1
arch=$2
compat=$2
sign=$3
crt=$(ls $sign/*.crt)
@@ -25,7 +25,7 @@ cp -f $BINARIES_DIR/rootfs.itbh $work/rootfs.itbh
cat >$work/manifest.raucm <<EOF
[update]
compatible=infix-${arch}
compatible=${compat}
version=${GIT_VERSION}
[bundle]
+10
View File
@@ -55,6 +55,16 @@ else
VERSION=$GIT_VERSION
fi
if [ -n "$INFIX_IMAGE_ID" ]; then
NAME="$INFIX_IMAGE_ID"
else
NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/')
fi
if [ -f "$TARGET_DIR/etc/rauc/system.conf" ]; then
sed -i "s/compatible=.*/compatible=$NAME/" "$TARGET_DIR/etc/rauc/system.conf"
fi
# This is a symlink to /usr/lib/os-release, so we remove this to keep
# original Buildroot information.
rm -f "$TARGET_DIR/etc/os-release"
+4 -1
View File
@@ -12,6 +12,9 @@ load_cfg BR2_ARCH
load_cfg BR2_DEFCONFIG
load_cfg BR2_EXTERNAL_INFIX_PATH
load_cfg BR2_TARGET_ROOTFS
# The default IMAGE_ID is infix-$BR2_ARCH but can be overridden
# for imaage names, and compat strings, like infix-r2s
if [ -n "$IMAGE_ID" ]; then
NAME="$IMAGE_ID"
else
@@ -36,7 +39,7 @@ if [ "$SIGN_ENABLED" = "y" ]; then
$common/sign.sh $BR2_ARCH $SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh "$NAME$(ver)" $BR2_ARCH $SIGN_KEY
$common/mkrauc.sh "$NAME$(ver)" $NAME $SIGN_KEY
fi
load_cfg DISK_IMAGE
+1
View File
@@ -169,6 +169,7 @@ BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
INFIX_VENDOR_HOME="https://github.com/kernelkit"
INFIX_IMAGE_ID="${INFIX_ID}-r2s"
INFIX_DESC="Infix is a Network Operating System based on Linux. It can be set up both as a switch, with offloading using switchdev, and a router with firewalling."
INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://github.com/kernelkit/infix/tree/main/doc"
+5 -1
View File
@@ -504,8 +504,12 @@
<COMMAND name="upgrade" help="Install a software update bundle from remote or local file">
<PARAM name="URI" ptype="/STRING" help="[(ftp|tftp|http|https|sftp)://(dns.name | ip.address)/path/to/]upgrade-bundle.pkg"/>
<SWITCH name="optional" min="0" max="1">
<COMMAND name="force" help="Force upgrade, ignoring compatibility check."/>
</SWITCH>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
rauc install $KLISH_PARAM_URI
force=${KLISH_PARAM_force:+--ignore-compatible}
rauc install $force $KLISH_PARAM_URI
</ACTION>
</COMMAND>