diff --git a/board/common/Config.in b/board/common/Config.in index 70891198..57e65a12 100644 --- a/board/common/Config.in +++ b/board/common/Config.in @@ -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 diff --git a/board/common/mkdisk.sh b/board/common/mkdisk.sh index 79516aaf..973dd37a 100755 --- a/board/common/mkdisk.sh +++ b/board/common/mkdisk.sh @@ -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" \ diff --git a/board/common/post-image.sh b/board/common/post-image.sh index ccd8e70e..dd342d45 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -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