gen-grub-cfg: Support different kernel file names

Different architectures and/or configurations can use a different name
for the Linux kernel image file.  The `gen-grub-cfg.sh` shell script
needs to be able to identify the correct file name in the GRUB
configuration fragment it embeds in the root filesystem image.
Dustin 2025-08-22 09:01:04 -05:00
parent 9562b7f9fd
commit 7f3c9ffe5b
2 changed files with 15 additions and 2 deletions

View File

@ -3,10 +3,11 @@
vers=${BR2_EXTERNAL_AIMEEOS_VERSION} vers=${BR2_EXTERNAL_AIMEEOS_VERSION}
br2_vers=${BR2_VERSION_FULL} br2_vers=${BR2_VERSION_FULL}
kernel_filename=$1
cat > "${TARGET_DIR}"/boot/grub.cfg <<EOF cat > "${TARGET_DIR}"/boot/grub.cfg <<EOF
menuentry "Aimee OS ${vers} (Buildroot ${br2_vers}) on \$dev" --class gnu-linux --id "id-\$partuuid" "\$dev" "\$partuuid" { menuentry "Aimee OS ${vers} (Buildroot ${br2_vers}) on \$dev" --class gnu-linux --id "id-\$partuuid" "\$dev" "\$partuuid" {
set root="\$2" set root="\$2"
linux "/boot/zImage" root=PARTUUID=\$3 ro linux "/boot/${kernel_filename}" root=PARTUUID=\$3 ro
} }
EOF EOF

View File

@ -6,8 +6,20 @@ $(foreach tuple, $(GRUB2_TUPLES-y), \
endef endef
GRUB2_INSTALL_IMAGES_CMDS += $(AIMEEOS_GRUB2_INSTALL_IMAGES_CMDS) GRUB2_INSTALL_IMAGES_CMDS += $(AIMEEOS_GRUB2_INSTALL_IMAGES_CMDS)
ifneq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),)
AIMEEOS_KERNEL_FILENAME = $(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM)
else ifeq ($(BR2_LINUX_KERNEL_IMAGE),y)
AIMEEOS_KERNEL_FILENAME = Image
else ifeq ($(BR2_LINUX_KERNEL_IMAGEZ),y)
AIMEEOS_KERNEL_FILENAME = zImage
else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
AIMEEOS_KERNEL_FILENAME = vmlinux
else
$(error "Must define a Linux kernel target")
endif
# Generate the grub.cfg stub for the kernel embedded in rootfs.squashfs # Generate the grub.cfg stub for the kernel embedded in rootfs.squashfs
define AIMEEOS_GEN_GRUB_CFG define AIMEEOS_GEN_GRUB_CFG
$(BR2_EXTERNAL_AIMEEOS_PATH)/boot/grub2/gen-grub-cfg.sh $(BR2_EXTERNAL_AIMEEOS_PATH)/boot/grub2/gen-grub-cfg.sh $(AIMEEOS_KERNEL_FILENAME)
endef endef
LINUX_TARGET_FINALIZE_HOOKS += AIMEEOS_GEN_GRUB_CFG LINUX_TARGET_FINALIZE_HOOKS += AIMEEOS_GEN_GRUB_CFG