board/common: Move RAUC bundle creation to separate make target

This commit is contained in:
Tobias Waldekranz
2025-12-03 16:46:02 +01:00
parent bf1a431692
commit dd98c57bc7
7 changed files with 73 additions and 76 deletions
+1 -24
View File
@@ -1,38 +1,15 @@
menu "Images"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rootfs/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rauc/Config.in"
endmenu
menuconfig SIGN_ENABLED
bool "Image Signing"
default y
choice
prompt "Signing key source"
depends on SIGN_ENABLED
default SIGN_SRC_DIR
config SIGN_SRC_DIR
bool "Directory"
config SIGN_SRC_PKCS11
bool "PKCS#11 URL"
endchoice
config SIGN_KEY
string "Signing key"
depends on SIGN_ENABLED
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development" if SIGN_SRC_DIR
menuconfig TRUSTED_KEYS
bool "Trusted keys for image"
depends on SIGN_ENABLED
help
Keys that will be accepted for this image
config TRUSTED_KEYS_DEVELOPMENT
bool "Development key"
depends on TRUSTED_KEYS
@@ -0,0 +1,27 @@
menuconfig IMAGE_ITB_RAUC
bool "RAUC upgrade bundle (ITB)"
select IMAGE_ITB_ROOTFS
select BR2_PACKAGE_HOST_RAUC
help
Create RAUC upgrade bundle, for targets using ITB images,
that can be used to upgrade a running system to this version
of Infix.
config IMAGE_ITB_RAUC_KEY
string "signing key"
depends on IMAGE_ITB_RAUC
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development/infix.key"
help
Path to the private key, in PKCS#8 format, used to sign
the RAUC bundle; or a PKCS#11 URI.
config IMAGE_ITB_RAUC_CERT
string "signing certificate"
depends on IMAGE_ITB_RAUC
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development/infix.crt"
help
Path to the X509 certificate which will be associated with
the bundle signature.
NOTE: This cert MUST be included in the trust store of the
system on which this bundle is to be installed.
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
set -e
squash="${BINARIES_DIR}"/rootfs.squashfs
itbh="${BINARIES_DIR}"/rootfs.itbh
pkg="${BINARIES_DIR}"/"${ARTIFACT}.pkg"
cp -f "${PKGDIR}"/hooks.sh "${WORKDIR}"/hooks.sh
# RAUC internally uses the file extension to find a suitable install
# handler, hence the name must be .img
cp -f "${squash}" "${WORKDIR}"/rootfs.img
cp -f "${itbh}" "${WORKDIR}"/rootfs.itbh
cat >"${WORKDIR}"/manifest.raucm <<EOF
[update]
compatible=${COMPATIBLE}
version=${VERSION}
[bundle]
format=verity
[hooks]
filename=hooks.sh
[image.rootfs]
filename=rootfs.img
hooks=post-install
EOF
rauc --cert="${CERT}" --key="${KEY}" \
bundle "${WORKDIR}" "${pkg}.next"
mv "${pkg}.next" "${pkg}"
@@ -0,0 +1,10 @@
################################################################################
#
# image-itb-rauc
#
################################################################################
IMAGE_ITB_RAUC_DEPENDENCIES := host-rauc image-itb-rootfs
IMAGE_ITB_RAUC_CONFIG_VARS := KEY CERT
$(eval $(ix-image))
-43
View File
@@ -1,43 +0,0 @@
#!/bin/sh
set -e
name=$1
compat=$2
sign=$3
crt=$(ls $sign/*.crt)
key=$(ls $sign/*.key)
common=$(dirname "$(readlink -f "$0")")
work=$BUILD_DIR/mkrauc
mkdir -p "$work"
cp -f "$common/rauc-hooks.sh" "$work/hooks.sh"
# RAUC internally uses the file extension to find a suitable install
# handler, hence the name must be .img
cp -f "$BINARIES_DIR/rootfs.squashfs" "$work/rootfs.img"
cp -f "$BINARIES_DIR/rootfs.itbh" "$work/rootfs.itbh"
cat >"$work/manifest.raucm" <<EOF
[update]
compatible=${compat}
version=${INFIX_VERSION}
[bundle]
format=verity
[hooks]
filename=hooks.sh
[image.rootfs]
filename=rootfs.img
hooks=post-install
EOF
rm -f "$BINARIES_DIR/$name.pkg"
rauc --cert="$crt" --key="$key" \
bundle "$work" "$BINARIES_DIR/$name.pkg"
-9
View File
@@ -33,15 +33,6 @@ ver()
fi
}
load_cfg SIGN_ENABLED
if [ "$SIGN_ENABLED" = "y" ]; then
load_cfg BR2_ARCH
load_cfg SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh "$NAME$(ver)" $INFIX_COMPATIBLE $SIGN_KEY
fi
load_cfg DISK_IMAGE
if [ "$DISK_IMAGE" = "y" ]; then
ixmsg "Creating Disk Image"