board/common: introduce image test-mode

To support testing, the test-config.cfg file has been introduced in Infix.
Additionally, a "test mode" for the running image is required for this
configuration to be applied.

Basically the test-config will only be loaded when the device is in test mode,
which is determined by the presence of the /mnt/aux/test-mode file.
However, placing this file via the Qeneth system proved to be
inconvenient in the test environment. Therefore, it the entire image is
built in test mode, with the 'test-mode' file preloaded onto the disk
image (specifically in the auxiliary partition).
To support this, a new variable, (bool) DISK_IMAGE_TEST_MODE, has been
introduced:

 enabled: the image will be built in the test mode;
 disabled: the image will be built in the standard mode.

Part of issue #568
This commit is contained in:
Ahmed Karic
2024-08-26 13:59:49 +02:00
committed by Mattias Walström
parent 21274aa379
commit 241f3f224f
3 changed files with 28 additions and 2 deletions
+12
View File
@@ -107,6 +107,18 @@ config DISK_IMAGE_BOOT_OFFSET
to make sure that the GPT still fits at the start of the
image.
config DISK_IMAGE_TEST_MODE
bool "Enable Test Mode"
depends on DISK_IMAGE
default y
help
Enable the test mode option by default. This setting creates a test-mode flag
in the auxiliary partition of the disk image, initiating the system with the test-config
instead of regular startup-config. The primary purpose of running an image in this mode
is to ensure proper execution of all Infix tests. Additionally, it enables extra RPCs
related to system restart and configuration overrides, allowing tests to be run even on
systems where the factory configuration may potentially create L2 loops.
config DISK_IMAGE_RELEASE_URL
string "Infix URL"
depends on DISK_IMAGE
+10 -1
View File
@@ -128,7 +128,7 @@ diskimg=disk.img
bootimg=
bootpart=
while getopts "a:b:B:n:s:" opt; do
while getopts "a:b:B:n:s:t" opt; do
case ${opt} in
a)
arch=$OPTARG
@@ -145,6 +145,9 @@ while getopts "a:b:B:n:s:" opt; do
s)
total=$(size2int $OPTARG)
;;
t)
testmode=true
;;
esac
done
shift $((OPTIND - 1))
@@ -190,6 +193,12 @@ cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh
cp -f $BINARIES_DIR/rauc.status $root/aux/rauc.status
if [ "$testmode" = true ]; then
touch "$root/aux/test-mode"
else
rm -f "$root/aux/test-mode"
fi
case "$arch" in
aarch64)
mkenvimage -s 0x4000 -o "$root/aux/uboot.env" \
+6 -1
View File
@@ -59,8 +59,13 @@ if [ "$DISK_IMAGE" = "y" ]; then
tar -xa --strip-components=1 -C "$BINARIES_DIR" -f "$archive"
fi
testmode_flag=""
if [ "$DISK_IMAGE_TEST_MODE" = "y" ]; then
testmode_flag="-t"
fi
$common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status"
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg -s $DISK_IMAGE_SIZE $bootcfg
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg $testmode_flag -s $DISK_IMAGE_SIZE $bootcfg
fi
load_cfg SDCARD_AUX