From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 8 11:00:19 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 654BB106566B for ; Mon, 8 Mar 2010 11:00:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 276228FC18 for ; Mon, 8 Mar 2010 11:00:19 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o28B0BcY064898 for ; Mon, 8 Mar 2010 11:00:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o28B0B93064897; Mon, 8 Mar 2010 11:00:11 GMT (envelope-from gnats) Resent-Date: Mon, 8 Mar 2010 11:00:11 GMT Resent-Message-Id: <201003081100.o28B0B93064897@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexei Volkov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49372106566C for ; Mon, 8 Mar 2010 10:54:17 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 37AB88FC16 for ; Mon, 8 Mar 2010 10:54:17 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o28AsHam006106 for ; Mon, 8 Mar 2010 10:54:17 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o28AsGLX006093; Mon, 8 Mar 2010 10:54:16 GMT (envelope-from nobody) Message-Id: <201003081054.o28AsGLX006093@www.freebsd.org> Date: Mon, 8 Mar 2010 10:54:16 GMT From: Alexei Volkov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/144548: Automatic dual kernel cd boot amd64/i386 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2010 11:00:19 -0000 >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@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: