Subject: Booting to a device other than /dev/wd0a
To: None <port-i386@netbsd.org>
From: CJ Kucera <pez@apocalyptech.com>
List: port-i386
Date: 01/13/2003 19:01:50
Hello, everyone...

I installed NetBSD 1.6 off of the ISO images found on ftp.netbsd.org.
I wasn't happy with the default disklabel scheme the installer came up
with, so I tweaked it to a slightly simpler version that looks like this:

  * wd0a - Swap
  * wd0b - FFS, mounted on /

Obviously that's not the traditional way to do things, but it's on a
system somewhat short of disk space and as it's my first time
installing NetBSD I didn't really have the info to come up with a more
intelligent partitioning scheme before seeing how large various
partitions get (/var, /usr, /tmp, etc).

I proceeded with the install, and everything appeared to be fine. My
problem is that the Stage 1 boot manager (the one that gets loaded by
BIOS right off the bat) insists on trying to boot "hd0a:netbsd," when
what I really want to boot is "hd0b:netbsd." If I type this in at the
boot prompt, everything is entirely peachy.

With some help from various people, it turns out that you're pretty
much required to patch "biosboot.sym" in order to get it to default to
a partition other than "a," and the following patch should work very
nicely in my case:

> diff -ruN sys/arch/i386/stand/biosboot/main.c sys-new/arch/i386/stand/biosboot/main.c 
> --- sys/arch/i386/stand/biosboot/main.c Wed Jul  4 19:58:45 2001
> +++ sys-new/arch/i386/stand/biosboot/main.c     Mon Jan 13 11:21:40 2003
> @@ -251,7 +251,7 @@
> 
>         /* try to set default device to what BIOS tells us */
>         bios2dev(boot_biosdev, &default_devname, &default_unit);
> -       default_partition = 0;
> +       default_partition = 1;
> 
>         /* if the user types "boot" without filename */
>         default_filename = DEFFILENAME;

This compiled up and I got a shiny new "biosboot.sym" all ready to
go. My problem is that the "installboot" program doesn't seem to
actually be inserting this updated bootloader. I've tested this out
by modifying the print_banner function in
sys/arch/i386/stand/biosboot/main.c, and my modifications are *not*
present upon bootup.

The command that I had been using to set up the boot loader is:

   /usr/mdec/installboot /usr/mdec/biosboot_new.sym /dev/rwd0b

The biosboot_new.sym was the new version I had compiled with my
modifications. Running this command produces no output, but it did
seem to process something for a few seconds before coming back.

One other oddity I noted was that there seem to be two different
versions of installboot on my system. The version in
/usr/mdec/installboot takes these options:

> usage: installboot [-b bno] [-n] [-v] [-f] <boot> <device>

Those options are the ones described in the installboot manpage.

The version in /usr/sbin/installboot looks like this:

> Usage: installboot [-nv] [-m machine] [-o options] [-t fstype]
>                    [-b s1start] [-B s2start] filesystem primary [secondary]
> Usage: installboot -c [-nv] [-m machine] [-o options] [-t fstype] filesystem
> installboot: Supported machines are:
>         alpha, i386, macppc, news68k, newsmips, pmax, shark, sparc, sparc64,
>         sun2, sun3, vax
> installboot: Supported file system types are:
>         ffs, raw

Have I been using the wrong one? Am I missing something major? Any
help would be appreciated, and thanks in advance...

-CJ

-- 
WOW: Kakistocracy        |  "The ships hung in the sky in much the same
apocalyptech.com/wow     |    way that bricks don't." - Douglas Adams,
pez@apocalyptech.com     |     _The Hitchhiker's Guide To The Galaxy_