All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] grub-shell: Support riscv64-efi
@ 2024-09-11  9:37 Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 2/9] grub-shell: Support Fedora path for ovmf32 Vladimir Serbinenko
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/util/grub-shell.in | 43 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index ae5f711fe..04405a789 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/9] grub-shell: Support Fedora path for ovmf32
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 3/9] grub-shell: Update qemu name of the machine Vladimir Serbinenko
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/util/grub-shell.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 04405a789..e79296ccd 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/9] grub-shell: Update qemu name of the machine
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 2/9] grub-shell: Support Fedora path for ovmf32 Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 4/9] grub-shell: Temporarily use reboot on fuloong2e Vladimir Serbinenko
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index e79296ccd..84fb6682f 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
 	;;
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/9] grub-shell: Temporarily use reboot on fuloong2e
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 2/9] grub-shell: Support Fedora path for ovmf32 Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 3/9] grub-shell: Update qemu name of the machine Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 5/9] grub-shell: Support Fedora arm-efi Vladimir Serbinenko
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

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

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/util/grub-shell.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 84fb6682f..35ecc28dc 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/9] grub-shell: Support Fedora arm-efi
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (2 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 4/9] grub-shell: Temporarily use reboot on fuloong2e Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown Vladimir Serbinenko
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

This needs 2 adjustments:

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

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/util/grub-shell.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 35ecc28dc..b7a7dff01 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (3 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 5/9] grub-shell: Support Fedora arm-efi Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-19 21:58   ` Glenn Washburn
  2024-09-11  9:37 ` [PATCH 7/9] partmap_test: Accept hd1 on arm-efi Vladimir Serbinenko
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

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

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/grub_cmd_set_date.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
index 17673cd8a..153609399 100644
--- a/tests/grub_cmd_set_date.in
+++ b/tests/grub_cmd_set_date.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/9] partmap_test: Accept hd1 on arm-efi
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (4 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 8/9] grub-shell: Ignore trailing garbage on loongarch64-efi Vladimir Serbinenko
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

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

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/partmap_test.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 4138e88fe..d67ad100f 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/9] grub-shell: Ignore trailing garbage on loongarch64-efi
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (5 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 7/9] partmap_test: Accept hd1 on arm-efi Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-11  9:37 ` [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275 Vladimir Serbinenko
  2024-09-19 21:50 ` [PATCH 1/9] grub-shell: Support riscv64-efi Glenn Washburn
  8 siblings, 0 replies; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index b7a7dff01..4b0900a32 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (6 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 8/9] grub-shell: Ignore trailing garbage on loongarch64-efi Vladimir Serbinenko
@ 2024-09-11  9:37 ` Vladimir Serbinenko
  2024-09-19 22:16   ` Glenn Washburn
  2024-09-19 21:50 ` [PATCH 1/9] grub-shell: Support riscv64-efi Glenn Washburn
  8 siblings, 1 reply; 12+ messages in thread
From: Vladimir Serbinenko @ 2024-09-11  9:37 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 tests/util/grub-shell.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 4b0900a32..de1eba83e 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -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
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/9] grub-shell: Support riscv64-efi
  2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
                   ` (7 preceding siblings ...)
  2024-09-11  9:37 ` [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275 Vladimir Serbinenko
@ 2024-09-19 21:50 ` Glenn Washburn
  8 siblings, 0 replies; 12+ messages in thread
From: Glenn Washburn @ 2024-09-19 21:50 UTC (permalink / raw)
  To: Vladimir Serbinenko; +Cc: The development of GNU GRUB

On Wed, 11 Sep 2024 12:37:27 +0300
Vladimir Serbinenko <phcoder@gmail.com> wrote:

> Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
> ---
>  tests/util/grub-shell.in | 43 +++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
> index ae5f711fe..04405a789 100644
> --- a/tests/util/grub-shell.in
> +++ b/tests/util/grub-shell.in
> @@ -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.

>  
>  # 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

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.

> +	    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

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

> +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

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown
  2024-09-11  9:37 ` [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown Vladimir Serbinenko
@ 2024-09-19 21:58   ` Glenn Washburn
  0 siblings, 0 replies; 12+ messages in thread
From: Glenn Washburn @ 2024-09-19 21:58 UTC (permalink / raw)
  To: Vladimir Serbinenko; +Cc: The development of GNU GRUB

On Wed, 11 Sep 2024 12:37:32 +0300
Vladimir Serbinenko <phcoder@gmail.com> wrote:

> 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

> 
> Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
> ---
>  tests/grub_cmd_set_date.in | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
> index 17673cd8a..153609399 100644
> --- a/tests/grub_cmd_set_date.in
> +++ b/tests/grub_cmd_set_date.in
> @@ -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

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275
  2024-09-11  9:37 ` [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275 Vladimir Serbinenko
@ 2024-09-19 22:16   ` Glenn Washburn
  0 siblings, 0 replies; 12+ messages in thread
From: Glenn Washburn @ 2024-09-19 22:16 UTC (permalink / raw)
  To: Vladimir Serbinenko; +Cc: The development of GNU GRUB

On Wed, 11 Sep 2024 12:37:35 +0300
Vladimir Serbinenko <phcoder@gmail.com> wrote:

> Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
> ---
>  tests/util/grub-shell.in | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
> index 4b0900a32..de1eba83e 100644
> --- a/tests/util/grub-shell.in
> +++ b/tests/util/grub-shell.in
> @@ -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

>  	;;
>      i386-qemu)
>  	boot=qemu

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-09-19 22:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11  9:37 [PATCH 1/9] grub-shell: Support riscv64-efi Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 2/9] grub-shell: Support Fedora path for ovmf32 Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 3/9] grub-shell: Update qemu name of the machine Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 4/9] grub-shell: Temporarily use reboot on fuloong2e Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 5/9] grub-shell: Support Fedora arm-efi Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown Vladimir Serbinenko
2024-09-19 21:58   ` Glenn Washburn
2024-09-11  9:37 ` [PATCH 7/9] partmap_test: Accept hd1 on arm-efi Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 8/9] grub-shell: Ignore trailing garbage on loongarch64-efi Vladimir Serbinenko
2024-09-11  9:37 ` [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275 Vladimir Serbinenko
2024-09-19 22:16   ` Glenn Washburn
2024-09-19 21:50 ` [PATCH 1/9] grub-shell: Support riscv64-efi Glenn Washburn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.