conf/144548: Automatic dual kernel cd boot amd64/i386
Alexei Volkov
Alexei.Volkov at softlynx.ru
Mon Mar 8 11:00:19 UTC 2010
>Number: 144548
>Category: conf
>Synopsis: Automatic dual kernel cd boot amd64/i386
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Mar 08 11:00:11 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Alexei Volkov
>Release: 8.0-RELEASE-p28.0-RELEASE-p2
>Organization:
SoftLynx
>Environment:
FreeBSD host.softlynx.ru 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #1: Tue Jan 26 06:30:15 UTC 2010 root at builder8-amd64.softlynx.ru:/usr/obj/usr/src/sys/SOFTLYNX amd64
>Description:
I wood like to to get bootable cd with auto selectable amd64/i386 boot kernel, but did not find any solution in current boot facilities.
For instance, if i have a bootable cd with two kernels located /boot/kernel.amd64
and /boot/kernel.i386 accordingly it looks pretty logical to have loader.conf line like /kernel=kernel.${hw.machine} and it let boots up amd64 kernel if long mode supported.
>How-To-Repeat:
append loader.conf with line
kernel=kernel.${hw.machine}
andd see nothing will happend event you have kernels in a assumed path.
>Fix:
I found that the boot facilities has everything to setup the hw.machine kernel environment variable, but does't do that.
Is it right to setup hw.machine kernel variable with a patch attached?
Patch attached with submission follows:
--- /usr/src/sys/boot/i386/loader/main.c 2010-02-10 12:36:20.468937250 +0300
+++ /usr/src/sys/boot/i386/loader/main.c 2010-02-10 12:36:49.796728917 +0300
@@ -185,6 +185,11 @@
setenv("LINES", "24", 1); /* optional */
bios_getsmap();
+
+ if (bi_checkcpu())
+ setenv("hw.machine","amd64",1);
+ else
+ setenv("hw.machine","i386",1);
interact(); /* doesn't return */
--- /usr/src/sys/boot/i386/libi386/bootinfo64.c 2010-02-10 12:36:32.213285664 +0300
+++ /usr/src/sys/boot/i386/libi386/bootinfo64.c 2010-02-10 12:19:17.000000000 +0300
@@ -129,7 +129,7 @@
/*
* Check to see if this CPU supports long mode.
*/
-static int
+int
bi_checkcpu(void)
{
char *cpu_vendor;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list