Date: Fri, 15 Sep 2023 07:58:35 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 273814] sysutils/grub2-bhyve: fails to boot OpenBSD Current kernel Message-ID: <bug-273814-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273814 Bug ID: 273814 Summary: sysutils/grub2-bhyve: fails to boot OpenBSD Current kernel Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: ports-bugs@FreeBSD.org Reporter: naito.yuichiro@gmail.com Created attachment 244872 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D244872&action= =3Dedit grub2-bhyve.patch By the following commit, OpenBSD Current kernel has dropped supporting old console device structure. It causes grub-bhyve not to boot the OpenBSD Curr= ent kernel. The new release 7.4 is coming soon will also unbootable from the current grub2-bhyve. https://github.com/Openbsd/src/commit/745c2f60e98fd1f418c104960a567e120624d= 705 I wrote a patch for this problem that changes to use the new console device structure by default. And my patch switches to use the old console device structure if the loading kernel is older than '7.3' release. The version number is written in the value of 'osrelease' symbol in the Ope= nBSD kernel. My patch reads it to see if the kernel is older than '7.3' or not. All the previous releases contain symbol tables, so no problem. If users st= rip the OpenBSD kernel, reading the version number will fail. I added 'kopenbsd= -l' option to force to use the old console device structure. If users boot the OpenBSD Current or newer kernel, just 'kopenbsd' command works fine although the kernel is stripped. Because the new console device structure is chosen = by default. Implementation Note: (record for maintainers) Reading symbol tables is already implemented in 'grub_openbsd_find_ramdisk' function. I added reading the value of 'osrelease' symbol in this function = to share the symbol lookup code. And building console device structure is implemented in 'grub_cmd_openbsd' function, but it is called earlier than 'grub_openbsd_find_ramdisk' function. So 'grub_cmd_openbsd' function never knows the version number. I changed to build both the new and old console device structures in 'grub_cmd_openbsd'. They are added to 'tag' list and 'grub_openbsd_boot' function reads the 'tag' list and build stack frame tha= t is passed to OpenBSD kernel. I changed the building stack frame code to ignore unnecessary console device structure checked by the 'osrelease' value. I also added 'openbsd_force_legacy_console' global variable. It's a flag to force to use the old console device structure. This flag is set by '-l' opt= ion. Testing:=20 My poudriere build successfully finished with my patch. And I confirmed my patch booted OpenBSD kernel from 6.9 to 7.3 and Current successfully. And also the installers of OpenBSD 6.9 - 7.3 was booted successfully. Please apply the attached 'grub2-bhyve.patch' to Ports tree. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-273814-7788>