Skip to contentSkip to conversation

grub-shell: Support riscv64-efi

PATCH In review Vladimir Serbinenko 2 participants 12 messages Sep 11, 2024 – Sep 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 grub-shell: Support riscv64-efi

---
 tests/util/grub-shell.in | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +42 -1
index ae5f711fe..04405a789 100644
@@ -33,6 +33,7 @@ export PATH
 
 trim=0
 trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c
+trim_tail=a3f2a1b5-74fb-4c76-959b-4cf5ef5578b3
 
 # Usage: usage
 # Print the usage.
@@ -303,6 +304,41 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
 	serial_port=efi0
 	;;
+     riscv64-efi)
+	qemu=qemu-system-riscv64
+	boot=hd
+	console=console
+	trim=1
+	pflash_code=${srcdir}/RISCV_VIRT_CODE.fd
+	pflash_vars=${srcdir}/RISCV_VIRT_VARS.fd
+	if [ -f "$pflash_code" ]; then
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    if [ -f "$pflash_vars" ]; then
+		qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
+	    fi
+	elif [ -f /usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd ]; then
+	    pflash_code=/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd
+	    pflash_vars=/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
+	elif [ -f /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd ]; then
+	    # Fedora ships images that are under 32M and we need to fill them to 32M
+	    cp /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd "$work_directory"
+	    cp /usr/share/edk2/riscv/RISCV_VIRT_VARS.fd "$work_directory"
+	    pflash_code="$work_directory"/RISCV_VIRT_CODE.fd
+	    pflash_vars="$work_directory"/RISCV_VIRT_VARS.fd
+	    truncate -s 32M $pflash_code
+	    truncate -s 32M $pflash_vars	    
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"	    
+	else
+	    echo "Firmware not found, please install either the appropriate Debian/Fedora package or an appropriately named copy in the source directory." >&2
+	    exit 1
+	fi
+	qemuopts="-machine virt $qemuopts"
+	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
+	serial_port=efi0
+	;;
     loongarch64-efi)
 	qemu=qemu-system-loongarch64
 	boot=hd
@@ -498,6 +534,9 @@ source "\$prefix/testcase.cfg"
 # Stop serial output to suppress "ACPI shutdown failed" error.
 EOF
 # Attempt to switch to console on i386-ieee1275 causes "screen not found" message
+if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ]; then
+    echo "echo $trim_tail" >>${cfgfile}
+fi
 if [ x$console != x ] && [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != xi386-ieee1275 ]; then
     echo "terminal_output $console" >>${cfgfile}
 fi
@@ -547,6 +586,8 @@ if [ x$boot = xhd ]; then
 	device="device virtio-blk-device,drive=hd0 -drive if=none,id=hd0,file="
     elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = loongarch64-efi ]; then
 	device="device virtio-blk-pci,drive=grubdisk -drive if=none,id=grubdisk,file="
+    elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = riscv64-efi ]; then
+	device="device virtio-blk-device,drive=hd0,bootindex=1 -drive if=none,id=hd0,file="
     elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then
 	device="hdb "
     else
@@ -612,7 +653,7 @@ fi
 do_trim ()
 {
     if [ $trim = 1 ] || [ $trim = 2 ]; then
-	awk '{ if (have_head == 1) print $0; } /^'"$trim_head"'/ { have_head=1; }'
+	awk ' /^'"$trim_tail"'/ { have_head=0; } { if (have_head == 1) print $0; } /^'"$trim_head"'/ { have_head=1; }'
     else
 	cat
     fi
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH 2/9 grub-shell: Support Fedora path for ovmf32

---
 tests/util/grub-shell.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +6 -1
index 04405a789..e79296ccd 100644
@@ -192,6 +192,11 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	    if [ -f "$pflash_vars" ]; then
 		qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
 	    fi
+        elif [ -f /usr/share/edk2/ovmf-ia32/OVMF_CODE.fd ]; then
+	    pflash_code=/usr/share/edk2/ovmf-ia32/OVMF_CODE.secboot.fd
+	    pflash_vars=/usr/share/edk2/ovmf-ia32/OVMF_VARS.fd
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
 	else
 	    pflash=/usr/share/qemu/OVMF32.fd
 	    pflash_code=/usr/share/OVMF/OVMF32_CODE_4M.secboot.fd
@@ -202,7 +207,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 		qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
 		qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
 	    else
-		echo "Firmware not found, please install either the appropriate Debian package or an appropriately named copy in the source directory." >&2
+		echo "Firmware not found, please install either the appropriate Debian or Fedora package or an appropriately named copy in the source directory." >&2
 		exit 1
 	    fi
 	fi
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

PATCH 3/9 grub-shell: Update qemu name of the machine

In reply to Vladimir Serbinenko
---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-shell.in +1 -1
index e79296ccd..84fb6682f 100644
@@ -144,7 +144,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mipsel-loongson)
 	boot=mipsel_fulong2e
 	qemu=qemu-system-mips64el
-	qemuopts="-M fulong2e $qemuopts"
+	qemuopts="-M fuloong2e $qemuopts"
 	console=
 	trim=1
 	;;
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

PATCH 4/9 grub-shell: Temporarily use reboot on fuloong2e

In reply to Vladimir Serbinenko

Until we figure out why normal shutdown doesn't work, use reboot instead

---
 tests/util/grub-shell.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +2 -1
index 84fb6682f..35ecc28dc 100644
@@ -144,9 +144,10 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mipsel-loongson)
 	boot=mipsel_fulong2e
 	qemu=qemu-system-mips64el
-	qemuopts="-M fuloong2e $qemuopts"
+	qemuopts="-M fuloong2e $qemuopts -no-reboot"
 	console=
 	trim=1
+	halt_cmd=reboot
 	;;
     i386-coreboot)
 	boot=coreboot
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw

PATCH 5/9 grub-shell: Support Fedora arm-efi

In reply to Vladimir Serbinenko

This needs 2 adjustments:

* No separate vars file
* Shutdown command is too chatty so we need to trim it.

---
 tests/util/grub-shell.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/util/grub-shell.in +6 -2
index 35ecc28dc..b7a7dff01 100644
@@ -295,7 +295,11 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	else
 	    pflash=/usr/share/AAVMF/AAVMF32.fd
 	    pflash_code=/usr/share/AAVMF/AAVMF32_CODE.fd
-	    pflash_vars=/usr/share/AAVMF/AAVMF32_VARS.fd
+	    if [ -f /usr/share/AAVMF/AAVMF32_VARS.fd ]; then
+		pflash_vars=/usr/share/AAVMF/AAVMF32_VARS.fd
+	    else
+		pflash_vars=/usr/share/AAVMF/AAVMF_VARS.fd
+	    fi
 	    if [ -f "$pflash" ]; then
 		qemuopts="-drive if=pflash,format=raw,unit=0,snapshot=on,file=$pflash $qemuopts"
 	    elif [ -f "$pflash_code" ]; then
@@ -540,7 +544,7 @@ source "\$prefix/testcase.cfg"
 # Stop serial output to suppress "ACPI shutdown failed" error.
 EOF
 # Attempt to switch to console on i386-ieee1275 causes "screen not found" message
-if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ]; then
+if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ] || [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xarm-efi ]; then
     echo "echo $trim_tail" >>${cfgfile}
 fi
 if [ x$console != x ] && [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != xi386-ieee1275 ]; then
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw

PATCH 6/9 cmd_set_date: Ignore garbage line at shutdown

In reply to Vladimir Serbinenko

Fedora arm-efi and riscv64-efi are verbose and add a garbage line when shutting down. Ignore it

---
 tests/grub_cmd_set_date.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/grub_cmd_set_date.in +2 -2
index 17673cd8a..153609399 100644
@@ -21,7 +21,7 @@ out=$(cat <<EOF | @builddir@/grub-shell
 insmod datehook
 date
 if [ \$YEAR = 2004 -a \$MONTH = 4 -a \$DAY = 4 -a \$HOUR = 20 -a \$MINUTE = 47 ]; then
-  hello
+  echo Back to 2004
   halt
 fi
 date 2004-04-04 20:47:00
@@ -29,7 +29,7 @@ reboot
 EOF
 )
 
-if [ "$(echo "$out" | tail -n 1)" != "Hello World" ]; then
+if [ "$(echo "$out" | tail -n 3|grep "Back to 2004")" != "Back to 2004" ]; then
   echo "Test failed: $out"
   exit 1
 fi
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#6 lore raw

Re: [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown

Quoted 2 lines · On Wed, 11 Sep 2024 12:37:32 +0300 Vladimir Serbinenko <[email protected]>…

Fedora arm-efi and riscv64-efi are verbose and add a garbage line when shutting down. Ignore it

Shouldn't the trim_tail modifications in patch 1 and 5 obviate the need for this? And why is the text being tested changed? I presume because of time discrepencies, but if so can't we just check a less precise date?

Glenn

Quoted 20 lines
---
 tests/grub_cmd_set_date.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/grub_cmd_set_date.in +1 -1
index 17673cd8a..153609399 100644
@@ -21,7 +21,7 @@ out=$(cat <<EOF | @builddir@/grub-shell
 insmod datehook
 date
 if [ \$YEAR = 2004 -a \$MONTH = 4 -a \$DAY = 4 -a \$HOUR = 20 -a \$MINUTE = 47 ]; then
-  hello
+  echo Back to 2004
   halt
 fi
 date 2004-04-04 20:47:00

tests/grub_cmd_set_date.in reboot · line 35

Quoted 8 lines
tests/grub_cmd_set_date.in +1 -1
@@ -29,7 +29,7 @@ reboot
 EOF
 )
 
-if [ "$(echo "$out" | tail -n 1)" != "Hello World" ]; then
+if [ "$(echo "$out" | tail -n 3|grep "Back to 2004")" != "Back to 2004" ]; then
   echo "Test failed: $out"
   exit 1
 fi

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#7 lore raw

PATCH 7/9 partmap_test: Accept hd1 on arm-efi

In reply to Vladimir Serbinenko

Whether it's hd1 or hd2 depends on firmware. Just accept both variants.

---
 tests/partmap_test.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/partmap_test.in +1 -1
index 4138e88fe..d67ad100f 100644
@@ -91,7 +91,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	disk=arc/scsi0/disk0/rdisk0
 	;;
     arm*-efi)
-	disk=hd2
+	disk=hd[12]
 	;;
     *)
 	disk=hd0
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#8 lore raw

PATCH 8/9 grub-shell: Ignore trailing garbage on loongarch64-efi

In reply to Vladimir Serbinenko
---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-shell.in +1 -1
index b7a7dff01..4b0900a32 100644
@@ -544,7 +544,7 @@ source "\$prefix/testcase.cfg"
 # Stop serial output to suppress "ACPI shutdown failed" error.
 EOF
 # Attempt to switch to console on i386-ieee1275 causes "screen not found" message
-if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ] || [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xarm-efi ]; then
+if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ] || [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xarm-efi ] || [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xloongarch64-efi ]; then
     echo "echo $trim_tail" >>${cfgfile}
 fi
 if [ x$console != x ] && [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != xi386-ieee1275 ]; then
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#9 lore raw

PATCH 9/9 grub-shell: Explicitly specify firmware for i386-ieee1275

In reply to Vladimir Serbinenko
---
 tests/util/grub-shell.in | 6 ++++++
 1 file changed, 6 insertions(+)
tests/util/grub-shell.in +6 -0
index 4b0900a32..de1eba83e 100644
@@ -165,6 +165,12 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	console=console
 	trim=1
 	disk="hdb "
+	if ! [ -f ${srcdir}/ofwx86.bin ]; then
+	    echo "Firmware not found, please install an appropriately named copy in the source directory." >&2
+	    exit 1
+	fi
+	cp ${srcdir}/ofwx86.bin "${work_directory}/ofwx86.bin"
+	qemuopts="-bios ${work_directory}/ofwx86.bin -vga cirrus $qemuopts"
 	;;
     i386-qemu)
 	boot=qemu
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#10 lore raw

Re: [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275

Quoted 10 lines · On Wed, 11 Sep 2024 12:37:35 +0300 Vladimir Serbinenko <[email protected]>…
---
 tests/util/grub-shell.in | 6 ++++++
 1 file changed, 6 insertions(+)
tests/util/grub-shell.in +0 -0
index 4b0900a32..de1eba83e 100644

tests/util/grub-shell.in case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in · line 173

Quoted 9 lines
tests/util/grub-shell.in +6 -0
@@ -165,6 +165,12 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	console=console
 	trim=1
 	disk="hdb "
+	if ! [ -f ${srcdir}/ofwx86.bin ]; then
+	    echo "Firmware not found, please install an appropriately named copy in the source directory." >&2
+	    exit 1
+	fi
+	cp ${srcdir}/ofwx86.bin "${work_directory}/ofwx86.bin"
+	qemuopts="-bios ${work_directory}/ofwx86.bin -vga cirrus $qemuopts"

Where can this firmware image be found? It doesn't appear to be in any official Debian packages. If it needs to be built, should we include a working version in the GRUB git repo if its not too big? At least instructions on how to build it should be included or a build script.

Why is this copied to the work directory and not just used in place like is done with other targets?

Glenn

tests/util/grub-shell.in case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in · line 176

Quoted 3 lines
tests/util/grub-shell.in +0 -0
 	;;
     i386-qemu)
 	boot=qemu

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#11 lore raw
In reply to Vladimir Serbinenko
Quoted 10 lines · On Wed, 11 Sep 2024 12:37:27 +0300 Vladimir Serbinenko <[email protected]>…
---
 tests/util/grub-shell.in | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +0 -0
index ae5f711fe..04405a789 100644

tests/util/grub-shell.in export PATH · line 36

Quoted 4 lines
tests/util/grub-shell.in +1 -0
@@ -33,6 +33,7 @@ export PATH
 
 trim=0
 trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c
+trim_tail=a3f2a1b5-74fb-4c76-959b-4cf5ef5578b3

I think it makes sense to put this and the last changeset into a separate preceding patch because logically its not quite related, perhaps noting that its to prepare for a subsequent patch. If not, at least something should be noted in the commit message.

Quoted 16 lines
tests/util/grub-shell.in +9 -0
 # Usage: usage
 # Print the usage.
@@ -303,6 +304,41 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
 	serial_port=efi0
 	;;
+     riscv64-efi)
+	qemu=qemu-system-riscv64
+	boot=hd
+	console=console
+	trim=1
+	pflash_code=${srcdir}/RISCV_VIRT_CODE.fd
+	pflash_vars=${srcdir}/RISCV_VIRT_VARS.fd
+	if [ -f "$pflash_code" ]; then
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"

tests/util/grub-shell.in case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in · line 325

Quoted 10 lines
tests/util/grub-shell.in +10 -0
+	    if [ -f "$pflash_vars" ]; then
+		qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
+	    fi
+	elif [ -f /usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd ]; then
+	    pflash_code=/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd
+	    pflash_vars=/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"
+	elif [ -f /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd ]; then
+	    # Fedora ships images that are under 32M and we need to fill them to 32M

Tests are only supported under Debian. I don't mind supporting other distros, but currently its not for other targets with respect to finding the firmware. And if we are going to do it, it should be done in a more target generic manner. This knowledge about how to run the tests on Fedora codified here seems valuable though, so I'm not opposed to this change and we can do what I suggest at a future date. But its not ideal.

Quoted 20 lines
tests/util/grub-shell.in +16 -0
+	    cp /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd "$work_directory"
+	    cp /usr/share/edk2/riscv/RISCV_VIRT_VARS.fd "$work_directory"
+	    pflash_code="$work_directory"/RISCV_VIRT_CODE.fd
+	    pflash_vars="$work_directory"/RISCV_VIRT_VARS.fd
+	    truncate -s 32M $pflash_code
+	    truncate -s 32M $pflash_vars	    
+	    qemuopts="-drive if=pflash,format=raw,unit=0,readonly=on,file=$pflash_code $qemuopts"
+	    qemuopts="-drive if=pflash,format=raw,unit=1,snapshot=on,file=$pflash_vars $qemuopts"	    
+	else
+	    echo "Firmware not found, please install either the appropriate Debian/Fedora package or an appropriately named copy in the source directory." >&2
+	    exit 1
+	fi
+	qemuopts="-machine virt $qemuopts"
+	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
+	serial_port=efi0
+	;;
     loongarch64-efi)
 	qemu=qemu-system-loongarch64
 	boot=hd

tests/util/grub-shell.in source "\$prefix/testcase.cfg" · line 536

Quoted 3 lines
tests/util/grub-shell.in +0 -0
@@ -498,6 +534,9 @@ source "\$prefix/testcase.cfg"
 # Stop serial output to suppress "ACPI shutdown failed" error.
 EOF
 # Attempt to switch to console on i386-ieee1275 causes "screen not found" message

This comment now does not go with the originally intended code and I doubt it should remain as is for the added change below. Also a comment should be added describing why the added code to trim to the end of the output is needed.

Glenn

Quoted 16 lines
tests/util/grub-shell.in +5 -0
+if [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = xriscv64-efi ]; then
+    echo "echo $trim_tail" >>${cfgfile}
+fi
 if [ x$console != x ] && [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != xi386-ieee1275 ]; then
     echo "terminal_output $console" >>${cfgfile}
 fi
@@ -547,6 +586,8 @@ if [ x$boot = xhd ]; then
 	device="device virtio-blk-device,drive=hd0 -drive if=none,id=hd0,file="
     elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = loongarch64-efi ]; then
 	device="device virtio-blk-pci,drive=grubdisk -drive if=none,id=grubdisk,file="
+    elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = riscv64-efi ]; then
+	device="device virtio-blk-device,drive=hd0,bootindex=1 -drive if=none,id=hd0,file="
     elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then
 	device="hdb "
     else

tests/util/grub-shell.in fi · line 659

Quoted 8 lines
tests/util/grub-shell.in +1 -1
@@ -612,7 +653,7 @@ fi
 do_trim ()
 {
     if [ $trim = 1 ] || [ $trim = 2 ]; then
-	awk '{ if (have_head == 1) print $0; } /^'"$trim_head"'/ { have_head=1; }'
+	awk ' /^'"$trim_tail"'/ { have_head=0; } { if (have_head == 1) print $0; } /^'"$trim_head"'/ { have_head=1; }'
     else
 	cat
     fi

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel