From 5e15d85ff9313b5dd18ef223a0b3a3a5b3f2bb4f Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 28 Apr 2023 18:18:16 +0200 Subject: [PATCH] board/common: artifact naming overhaul With the introduction of the -classic defconfigs we need to also make sure to name the resulting artifacts accordingly: - infix-$ARCH.{gns3a,img,pkg} - infix-$ARCH-classic.{gns3a,img,pkg} For release builds the version (-23.02-$REV) will be appended before the file suffix, e.g., infix-x86-64-classic-23.02-3.img Signed-off-by: Joachim Wiberg --- board/common/mkgns3a.sh | 2 +- board/common/mkrauc.sh | 9 +++++---- board/common/post-image.sh | 25 +++++++++++++++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/board/common/mkgns3a.sh b/board/common/mkgns3a.sh index 361c87b8..51a6145b 100755 --- a/board/common/mkgns3a.sh +++ b/board/common/mkgns3a.sh @@ -1,6 +1,6 @@ #!/bin/sh -NM="infix-${1:-custom}" +NM="${1:-custom}" RAM=${2:-512} IFNUM=${3:-1} diff --git a/board/common/mkrauc.sh b/board/common/mkrauc.sh index b253910c..7c71dbbb 100755 --- a/board/common/mkrauc.sh +++ b/board/common/mkrauc.sh @@ -4,8 +4,9 @@ set -e GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags) -arch=$1 -sign=$2 +name=$1 +arch=$2 +sign=$3 crt=$(ls $sign/*.crt) key=$(ls $sign/*.key) @@ -38,7 +39,7 @@ filename=rootfs.img hooks=post-install EOF -rm -f $BINARIES_DIR/infix-$arch.pkg +rm -f $BINARIES_DIR/$name.pkg rauc --cert=$crt --key=$key \ - bundle $work $BINARIES_DIR/infix-$arch.pkg + bundle $work $BINARIES_DIR/$name.pkg diff --git a/board/common/post-image.sh b/board/common/post-image.sh index 45c655f7..fe824c46 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -1,9 +1,24 @@ #!/bin/sh - common=$(dirname "$(readlink -f "$0")") . $common/lib.sh +load_cfg BR2_DEFCONFIG load_cfg BR2_EXTERNAL_INFIX_PATH +NAME=infix-$(basename "$BR2_DEFCONFIG" _defconfig | tr _ -) + +ver() +{ + [ -n "$RELEASE" ] || return + GITVER=$(git describe --tags --dirty) + if echo "$GITVER" |grep -q 'latest-'; then + latest=$(echo "$GITVER" | sed 's/latest-[0-9]*-\(g.*\)/\1/') + cd "$BR2_EXTERNAL_INFIX_PATH/buildroot" || exit 1 + br2ver=$(git describe --tags --dirty | sed 's/..\([^-]*\).*/\1/g') + cd - || exit 1 + GITVER=$br2ver-$latest + fi + printf "-%s" "$GITVER" +} load_cfg BR2_ARCH load_cfg SIGN_KEY @@ -12,7 +27,7 @@ ixmsg "Signing SquashFS Image" $common/sign.sh $BR2_ARCH $SIGN_KEY ixmsg "Creating RAUC Update Bundle" -$common/mkrauc.sh $BR2_ARCH $SIGN_KEY +$common/mkrauc.sh $NAME $BR2_ARCH $SIGN_KEY load_cfg DISK_IMAGE load_cfg DISK_IMAGE_SIZE @@ -25,9 +40,8 @@ load_cfg GNS3_APPLIANCE if [ "$GNS3_APPLIANCE" = "y" ]; then load_cfg GNS3_APPLIANCE_RAM load_cfg GNS3_APPLIANCE_IFNUM - load_cfg BR2_DEFCONFIG ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports" - $common/mkgns3a.sh $(basename $BR2_DEFCONFIG _defconfig | tr _ -) $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM + $common/mkgns3a.sh $NAME $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM fi load_cfg FIT_IMAGE @@ -35,3 +49,6 @@ if [ "$FIT_IMAGE" = "y" ]; then ixmsg "Creating Traditional FIT Image" $common/mkfit.sh fi + +# For use outside of the build system, e.g., Qeneth +ln -sf rootfs.squashfs "$BINARIES_DIR/$NAME$(ver).img"