From 8a2d305b041cb234d1ec5f2a4f41e6631d44887e Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Tue, 26 Aug 2025 21:35:32 -0500 Subject: [PATCH] grub2: Support setting rootflags in config The `AIMEEOS_DEFAULT_ROOTFLAGS` kconfig option can be used to set the default value for the `rootflags` GRUB2 environment variable. The value of this variable will be passed along as command-line arguments to whatever kernel is chosen at boot. Since post-image scripts do not have access to kconfig option values, we need to build the GRUB2 environment file in the `GRUB2_INSTALL_IMAGES_CMDS` script fragment instead. --- Config.in | 5 +++++ board/qemu/post-image.sh | 4 ---- boot/grub2/gen-grub-cfg.sh | 2 +- external.mk | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Config.in b/Config.in index ca7924f..8632387 100644 --- a/Config.in +++ b/Config.in @@ -30,3 +30,8 @@ config AIMEEOS_RPI select BR2_TARGET_GRUB2_ARM_EFI help Support running Aimee OS on Rasperry Pi devices + +config AIMEEOS_DEFAULT_ROOTFLAGS + string "Default kernel command line argumens" + help + Additional command line arguments to pass to the kernel by default. diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh index e546986..2252507 100755 --- a/board/qemu/post-image.sh +++ b/board/qemu/post-image.sh @@ -3,16 +3,12 @@ set -e BOARD_DIR=$(dirname "$0") -GRUBENV="${BINARIES_DIR}"/efi-part/EFI/BOOT/grubenv genimage_tmp=$(mktemp -d) trap 'rm -rf "${genimage_tmp}"' EXIT mkdir -p "${genimage_tmp}"/rootfs "${genimage_tmp}"/tmp -grub-editenv "${GRUBENV}" set default=0 -grub-editenv "${GRUBENV}" set timeout=3 - cd "${BINARIES_DIR}" genimage \ --rootpath "${genimage_tmp}/rootfs" \ diff --git a/boot/grub2/gen-grub-cfg.sh b/boot/grub2/gen-grub-cfg.sh index 84e379a..37adca2 100755 --- a/boot/grub2/gen-grub-cfg.sh +++ b/boot/grub2/gen-grub-cfg.sh @@ -8,6 +8,6 @@ kernel_filename=$1 cat > "${TARGET_DIR}"/boot/grub.cfg <