From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 14 10:42:24 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 13572DC5 for ; Fri, 14 Dec 2012 10:42:24 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 891E48FC18 for ; Fri, 14 Dec 2012 10:42:23 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id je9so1565104bkc.13 for ; Fri, 14 Dec 2012 02:42:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:subject:date:content-type :content-transfer-encoding:in-reply-to:references:x-mailer; bh=wF9MakPlq3f3LAMsjNkHe/VLW6JMZsYmER55VEkmmzM=; b=z1dwSDuZP1shGDFAQUFZdzW2EXHCcnjAcAr9w3ooAAVIayKcKs86VmgzR407LMBw2C ljOktVbiE9ZBjQZIf92mLyEJ9nh8hCDoQghlgWpgKiYzFLSJkziiPuZtJ/Hxa8FNJYeg Wiw2eyy8/i8WPoOSz254M4egpAC2w/WK8af1nbZPqe2TtrfCjySoQv8AlQ4nBkl3xiWZ zONS+vkecA7hlIdsgYAKCSfvVUKzzf1dPOSkVDprZjYeYjSAdxUrwgD2qJ8a5PKToU8G hvGf/xAbFFU7RRigDegIuLmjBLZDH2cWvIEzLNvQywmdIOlW5QWJpKd+mXwG4Mp+qTM9 CEvQ== Received: by 10.204.5.145 with SMTP id 17mr2491784bkv.98.1355481742174; Fri, 14 Dec 2012 02:42:22 -0800 (PST) Received: from DOMYPC ([82.193.208.225]) by mx.google.com with ESMTPS id q22sm3908488bkv.16.2012.12.14.02.42.18 (version=SSLv3 cipher=OTHER); Fri, 14 Dec 2012 02:42:20 -0800 (PST) Message-ID: <20121214.104219.547.1@DOMY-PC> From: rank1seeker@gmail.com To: "Dieter BSD" , hackers@freebsd.org Subject: Re: NetBSD's boot select MBR Date: Fri, 14 Dec 2012 11:42:19 +0100 Content-Type: text/plain; charset="Windows-1250" Content-Transfer-Encoding: quoted-printable In-Reply-To: <20121213221145.310760@gmx.com> References: <20121213221145.310760@gmx.com> X-Mailer: POP Peeper (3.8.1.0) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 10:42:24 -0000 > > > So I use NetBSD's MBR for disks I want=0D=0A> > > to boot = from.=0D=0A> >=0D=0A> > Can I have a CMD sequence?=0D=0A> >=0D=0A> > = First would be ...=0D=0A> > # fetch ...=0D=0A> =0D=0A> Read NetBSD's = fdisk(8) and mbr(8).=0D=0A> =0D=0A> The MBR is only 512 bytes, and must = contain the code and data.=0D=0A> This is very limiting, so there are = multiple versions depending=0D=0A> on which features you need. IIRC, = /usr/mdec/mbr_bootsel is the one I use.=0D=0A> You can specify a label = (up to 7 characters) for each bootable partition=0D=0A> ("slice" in = FreeBSD-speak). When the system executes the MBR code,=0D=0A> it presents = a menu with these labels. You can type '1' for the first=0D=0A> = partition/slice, '2' for the second, and so on. You can also type = a=0D=0A> function key to run the MBR of a different disk. The disk = numbering=0D=0A> can be rather insane, so it must be using the bios disk = numbering. If=0D=0A> you don't type anything it times out and boots the = active partition/slice.=0D=0A> =0D=0A> Sadly, the FreeBSD bootstrap = insists on booting the partition/slice=0D=0A> marked active in the MBR. = (The MBR code should look at the active=0D=0A> bit, the later bootstraps = should not.) So if you want to have=0D=0A> multiple FreeBSD versions, it = works best to put each on its own disk.=0D=0A> =0D=0A> The last time I = used fdisk, large disks triggered a bug where some=0D=0A> variable = overflowed, giving negative numbers. Hopefully this is fixed=0D=0A> by = now. FreeBSD's fdisk also had some bug, so I had great fun=0D=0A> = handcrafting a MBR.=0D=0A> =0D=0A> It's been a long time since I = installed NetBSD from scratch, (I usually=0D=0A> just unpack the tar = files, run installboot, and edit some config files.)=0D=0A> I assume you = can just boot a CD and get a shell, and experiment with=0D=0A> fdisk on a = scratch disk without actually installing NetBSD.=0D=0A> To avoid a = disaster, do something like=0D=0A> dd if=3D$DISK of=3D/boot/MBR_backup = bs=3D512 count=3D1 ; sync=0D=0A> beforehand, in case you accidently mess = up your boot drive.=0D=0A> =0D=0A> man pages:=0D=0A> = http://netbsd.gw.com/cgi-bin/man-cgi?++NetBSD-current=0D=0A> =0D=0A> = isos:=0D=0A> http://www.netbsd.org/mirrors/=0D=0A> for example:=0D=0A> = ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/amd64cd-5.2.iso=0D=0A> or=0D=0A> = ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/i386cd-5.2.iso=0D=0A=0D=0A=0D=0AMBR = supports max of 4 slices/partitions.=0D=0A=0D=0ALooing = at:=0D=0Ahttp://netbsd.gw.com/cgi-bin/man-cgi?mbr++NetBSD-6.0=0D=0A=0D=0AThe = '/usr/mdec/mbr_bootsel', which you've mentioned, is equivalent to = FreeBSD's '/boot/boot0', which is tuned via 'boot0cfg' util.=0D=0AIt will = also show menu, to choose from, a slice to boot or another drive OR =3D> = 'F6' to choose PXE boot.=0D=0AIf nothing has been selected, it will = simply boot an active slice.=0D=0ASo I see FreeBSD's, as superior = (additionally supports PXE) =3D> 8.0 onward ...=0D=0A=0D=0AI don't use = fdisk at all. Gpart is here ...=0D=0A;)=0D=0A=0D=0AAdditionally ..., when = I said '# fetch ...', I meant to get only 1 file, from ftp pub, which is = installed into MBR ('/usr/mdec/mbr_$SOMETHING')=0D=0AThen I would use = FreeBSD's:=0D=0A# gpart bootcode -b $path_to_netbsd_mbr_code = ...=0D=0A=0D=0ABut this won't happen, as I thought NetBSD's had a MBR = code, which could be told via a tool, from fully booted and running = FreeBSD:=0D=0A"Active slice is 2, but please, boot slice 4 at a next = boot".=0D=0AAfter that, I would '# reboot' and without any menu, slice 4 = would be booted, for that one time, instaed of an active slice = 2.=0D=0A=0D=0AAm I missing something?=0D=0AThanks in = advance.=0D=0A=0D=0A=0D=0ADomagoj Smol=E8i=E6=0D=0A=0D=0A