File:  [NetBSD Developer Wiki] / wikisrc / ports / xen / howto-grub.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Wed Dec 24 01:05:19 2014 UTC (5 years, 10 months ago) by gdt
Branches: MAIN
CVS tags: HEAD
park more grub text

Stray Grub notes
================

Now, the use of NetBSD's normal boot code is recommended.  This file
exists to save stray text about grub.  Note that it is far far easier
to use the native boot code, and that you probably should not be
reading this.

Install
-------

If you plan to use the `grub` boot loader, when partitioning the disk
you have to make the root partition smaller than 512Mb, and formatted
as FFSv1 with 8k block/1k fragments. If the partition is larger than
this, uses FFSv2 or has different block/fragment sizes, grub may fail
to load some files.

You'll also need `sysutils/grub` from pkgsrc.

Grub config
-----------


    #Grub config file for NetBSD/xen. Copy as /grub/menu.lst and run
    # grub-install /dev/rwd0d (assuming your boot device is wd0).
    #
    # The default entry to load will be the first one
    default=0

    # boot the default entry after 10s if the user didn't hit keyboard
    timeout=10

    # Configure serial port to use as console. Ignore if you'll use VGA only
    serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1

    # Let the user select which console to use (serial or VGA), default
    # to serial after 10s
    terminal --timeout=10 serial console

    # An entry for NetBSD/xen, using /netbsd as the domain0 kernel, and serial
    # console. Domain0 will have 64MB RAM allocated.
    # Assume NetBSD is installed in the first MBR partition.
    title Xen 3 / NetBSD (hda0, serial)
      root(hd0,0)
      kernel (hd0,a)/xen.gz dom0_mem=65536 com1=115200,8n1
      module (hd0,a)/netbsd bootdev=wd0a ro console=ttyS0

    # Same as above, but using VGA console
    # We can use console=tty0 (Linux syntax) or console=pc (NetBSD syntax)
    title Xen 3 / NetBSD (hda0, vga)
      root(hd0,0)
      kernel (hd0,a)/xen.gz dom0_mem=65536
      module (hd0,a)/netbsd bootdev=wd0a ro console=tty0

    # NetBSD/xen using a backup domain0 kernel (in case you installed a
    # nonworking kernel as /netbsd
    title Xen 3 / NetBSD (hda0, backup, serial)
      root(hd0,0)
      kernel (hd0,a)/xen.gz dom0_mem=65536 com1=115200,8n1
      module (hd0,a)/netbsd.backup bootdev=wd0a ro console=ttyS0
    title Xen 3 / NetBSD (hda0, backup, VGA)
      root(hd0,0)
      kernel (hd0,a)/xen.gz dom0_mem=65536
      module (hd0,a)/netbsd.backup bootdev=wd0a ro console=tty0

    #Load a regular NetBSD/i386 kernel. Can be useful if you end up with a
    #nonworking /xen.gz
    title NetBSD 5.1
      root (hd0,a)
      kernel --type=netbsd /netbsd-GENERIC

    #Load the NetBSD bootloader, letting it load the NetBSD/i386 kernel.
    #May be better than the above, as grub can't pass all required infos
    #to the NetBSD/i386 kernel (e.g. console, root device, ...)
    title NetBSD chain
      root        (hd0,0)
      chainloader +1

    ## end of grub config file.
          

Install grub with the following command:

    # grub --no-floppy

    grub> root (hd0,a)
     Filesystem type is ffs, partition type 0xa9

    grub> setup (hd0)
     Checking if "/boot/grub/stage1" exists... no
     Checking if "/grub/stage1" exists... yes
     Checking if "/grub/stage2" exists... yes
     Checking if "/grub/ffs_stage1_5" exists... yes
     Running "embed /grub/ffs_stage1_5 (hd0)"...  14 sectors are embedded.
    succeeded
     Running "install /grub/stage1 (hd0) (hd0)1+14 p (hd0,0,a)/grub/stage2 /grub/menu.lst"...
     succeeded
    Done.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb