From 0fe580b5ea37f72ecc7e3806e753bf9cffc19d27 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 20 Mar 2025 12:36:00 +0100 Subject: qemu-x86_64: various fixes - fix dual-boot for EFI setups - normal BIOS does not work in dual-boot - VGA and EFI does not work --- package/grub/Makefile | 19 ++++++---- package/grub/files/grub-dual.cfg | 54 --------------------------- package/grub/files/grub-efi-dual-serial.cfg | 58 +++++++++++++++++++++++++++++ package/grub/files/grub-efi-serial.cfg | 14 +++++++ package/grub/files/grub-pc-serial.cfg | 14 +++++++ package/grub/files/grub-pc-vga.cfg | 2 +- package/grub/files/grub.cfg | 14 ------- 7 files changed, 99 insertions(+), 76 deletions(-) delete mode 100644 package/grub/files/grub-dual.cfg create mode 100644 package/grub/files/grub-efi-dual-serial.cfg create mode 100644 package/grub/files/grub-efi-serial.cfg create mode 100644 package/grub/files/grub-pc-serial.cfg delete mode 100644 package/grub/files/grub.cfg (limited to 'package') diff --git a/package/grub/Makefile b/package/grub/Makefile index d37472b8c..3d7f8d868 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -66,6 +66,11 @@ GRUB_PREFIX= (hd0,msdos1)/boot/grub GRUB_TARGET= i386 GRUB_PLATFORM= pc GRUB_MODULES= boot linux ext2 fat part_msdos part_gpt normal biosdisk +ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y) +GRUB_CFG= grub-pc-vga.cfg +else +GRUB_CFG= grub-pc-serial.cfg +endif endif ifeq ($(ADK_PACKAGE_GRUB_EFI_X86),y) @@ -77,6 +82,11 @@ GRUB_PREFIX= /EFI/BOOT GRUB_TARGET= i386 GRUB_PLATFORM= efi GRUB_MODULES= boot linux ext2 fat part_msdos part_gpt normal efi_gop +ifeq ($(ADK_TARGET_DUAL_BOOT),y) +GRUB_CFG= grub-efi-serial-dual.cfg +else +GRUB_CFG= grub-efi-serial.cfg +endif endif ifeq ($(ADK_PACKAGE_GRUB_EFI_X86_64),y) @@ -88,15 +98,10 @@ GRUB_PREFIX= /EFI/BOOT GRUB_TARGET= x86_64 GRUB_PLATFORM= efi GRUB_MODULES= boot linux ext2 fat part_msdos part_gpt normal efi_gop -endif - ifeq ($(ADK_TARGET_DUAL_BOOT),y) -GRUB_CFG= grub-dual.cfg -else -ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y) -GRUB_CFG= grub-pc-vga.cfg +GRUB_CFG= grub-efi-dual-serial.cfg else -GRUB_CFG= grub.cfg +GRUB_CFG= grub-efi-serial.cfg endif endif diff --git a/package/grub/files/grub-dual.cfg b/package/grub/files/grub-dual.cfg deleted file mode 100644 index 46b5451ad..000000000 --- a/package/grub/files/grub-dual.cfg +++ /dev/null @@ -1,54 +0,0 @@ -if [ "x\${timeout}" != "x-1" ]; then - if keystatus; then - if keystatus --shift; then - set timeout=-1 - else - set timeout=0 - fi - else - if sleep --interruptible 2; then - set timeout=0 - fi - fi -fi - -if [ -s $prefix/grubenv ]; then - set have_grubenv=true - load_env -fi -if [ "${next_entry}" ] ; then - set default="${next_entry}" - set next_entry= - save_env next_entry - set boot_once=true -else - set default="${saved_entry}" -fi -if [ "${prev_saved_entry}" ]; then - set saved_entry="${prev_saved_entry}" - save_env saved_entry - set prev_saved_entry= - save_env prev_saved_entry - set boot_once=true -fi - -function savedefault { - if [ -z "${boot_once}" ]; then - saved_entry="${chosen}" - save_env saved_entry - fi -} - -menuentry "OpenADK1" { - insmod part_gpt - insmod ext2 - set root=(hd0,gpt2) - linux (hd0,2)/boot/kernel root=/dev/@@ROOTDEV@@2 rootfstype=ext4 rootwait panic=5 -} -menuentry "OpenADK2" { - insmod part_gpt - insmod ext2 - set root=(hd0,gpt3) - linux (hd0,3)/boot/kernel root=/dev/@@ROOTDEV@@3 rootfstype=ext4 rootwait panic=5 -} - diff --git a/package/grub/files/grub-efi-dual-serial.cfg b/package/grub/files/grub-efi-dual-serial.cfg new file mode 100644 index 000000000..fde844e09 --- /dev/null +++ b/package/grub/files/grub-efi-dual-serial.cfg @@ -0,0 +1,58 @@ +serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial + +if [ "x\${timeout}" != "x-1" ]; then + if keystatus; then + if keystatus --shift; then + set timeout=-1 + else + set timeout=2 + fi + else + if sleep --interruptible 2; then + set timeout=2 + fi + fi +fi + +if [ -s $prefix/grubenv ]; then + set have_grubenv=true + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +menuentry "OpenADK1" { + insmod part_gpt + insmod ext2 + set root=(hd0,gpt2) + linux (hd0,2)/boot/kernel root=/dev/@@ROOTDEV@@2 rootfstype=ext4 rootwait panic=5 +} +menuentry "OpenADK2" { + insmod part_gpt + insmod ext2 + set root=(hd0,gpt3) + linux (hd0,3)/boot/kernel root=/dev/@@ROOTDEV@@3 rootfstype=ext4 rootwait panic=5 +} + diff --git a/package/grub/files/grub-efi-serial.cfg b/package/grub/files/grub-efi-serial.cfg new file mode 100644 index 000000000..3fdc48eda --- /dev/null +++ b/package/grub/files/grub-efi-serial.cfg @@ -0,0 +1,14 @@ +serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial + +set default=0 +set timeout=3 + +menuentry "OpenADK" { + insmod part_gpt + insmod ext2 + set root='hd0,gpt2' + echo "Loading OpenADK" + linux /boot/kernel root=/dev/sda2 rootfstype=ext4 rootwait panic=10 +} diff --git a/package/grub/files/grub-pc-serial.cfg b/package/grub/files/grub-pc-serial.cfg new file mode 100644 index 000000000..4b6a0616c --- /dev/null +++ b/package/grub/files/grub-pc-serial.cfg @@ -0,0 +1,14 @@ +serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial + +set default=0 +set timeout=3 + +menuentry "OpenADK" { + insmod msdospart + insmod ext2 + set root='hd0,1' + echo "Loading OpenADK" + linux /boot/kernel root=/dev/sda1 rootfstype=ext4 rootwait panic=10 +} diff --git a/package/grub/files/grub-pc-vga.cfg b/package/grub/files/grub-pc-vga.cfg index b0259ddb3..72af5abce 100644 --- a/package/grub/files/grub-pc-vga.cfg +++ b/package/grub/files/grub-pc-vga.cfg @@ -6,5 +6,5 @@ menuentry "OpenADK" { insmod ext2 set root='hd0,1' echo "Loading OpenADK" - linux /boot/kernel root=/dev/sda1 rootfstype=ext4 rootwait panic=10 + linux /boot/kernel console=tty0 root=/dev/sda1 rootfstype=ext4 rootwait panic=10 } diff --git a/package/grub/files/grub.cfg b/package/grub/files/grub.cfg deleted file mode 100644 index 3fdc48eda..000000000 --- a/package/grub/files/grub.cfg +++ /dev/null @@ -1,14 +0,0 @@ -serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 -terminal_input serial -terminal_output serial - -set default=0 -set timeout=3 - -menuentry "OpenADK" { - insmod part_gpt - insmod ext2 - set root='hd0,gpt2' - echo "Loading OpenADK" - linux /boot/kernel root=/dev/sda2 rootfstype=ext4 rootwait panic=10 -} -- cgit v1.2.3