File:  [NetBSD Developer Wiki] / wikisrc / ports / xen / howto-grub.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Fri Feb 26 18:39:20 2021 UTC (7 months ago) by gdt
Branches: MAIN
CVS tags: HEAD
xen: Demote info about migration from grub

At this point anything about grub is ancient history and there's no
reason to believe there are any maintained netbsd/xen systems with
grub.  We already have a place to store the old info, so simply demote
the conversion information to tidy the main HOWTO.

    1: Stray Grub notes
    2: ================
    3: 
    4: Now, the use of NetBSD's normal boot code is recommended.  This file
    5: exists to save stray text about grub.  Note that it is far far easier
    6: to use the native boot code, and that you probably should not be
    7: reading this.
    8: 
    9: Converting from grub to /boot
   10: -----------------------------
   11: 
   12: These instructions are provided only to help people using grub, which
   13: used to be the normal approach.
   14: 
   15: These instructions were used to convert a system from
   16: grub to /boot.  The system was originally installed in February of
   17: 2006 with a RAID1 setup and grub to boot Xen 2, and has been updated
   18: over time.  Before these commands, it was running NetBSD 6 i386, Xen
   19: 4.1 and grub, much like the message linked earlier in the grub
   20: section.
   21: 
   22: [[!template id=programlisting text="""
   23: # Install MBR bootblocks on both disks.
   24: fdisk -i /dev/rwd0d
   25: fdisk -i /dev/rwd1d
   26: # Install NetBSD primary boot loader (/ is FFSv1) into RAID1 components.
   27: installboot -v /dev/rwd0d /usr/mdec/bootxx_ffsv1
   28: installboot -v /dev/rwd1d /usr/mdec/bootxx_ffsv1
   29: # Install secondary boot loader
   30: cp -p /usr/mdec/boot /
   31: # Create boot.cfg following earlier guidance:
   32: menu=Xen:load /netbsd-XEN3PAE_DOM0.gz console=pc;multiboot /xen.gz dom0_mem=512M
   33: menu=Xen.ok:load /netbsd-XEN3PAE_DOM0.ok.gz console=pc;multiboot /xen.ok.gz dom0_mem=512M
   34: menu=GENERIC:boot
   35: menu=GENERIC single-user:boot -s
   36: menu=GENERIC.ok:boot netbsd.ok
   37: menu=GENERIC.ok single-user:boot netbsd.ok -s
   38: menu=Drop to boot prompt:prompt
   39: default=1
   40: timeout=30
   41: """]]
   42: 
   43: Install
   44: -------
   45: 
   46: If you plan to use the `grub` boot loader, when partitioning the disk
   47: you have to make the root partition smaller than 512Mb, and formatted
   48: as FFSv1 with 8k block/1k fragments. If the partition is larger than
   49: this, uses FFSv2 or has different block/fragment sizes, grub may fail
   50: to load some files.
   51: 
   52: You'll also need `sysutils/grub` from pkgsrc.
   53: 
   54: Grub config
   55: -----------
   56: 
   57:     #Grub config file for NetBSD/xen. Copy as /grub/menu.lst and run
   58:     # grub-install /dev/rwd0d (assuming your boot device is wd0).
   59:     #
   60:     # The default entry to load will be the first one
   61:     default=0
   62: 
   63:     # boot the default entry after 10s if the user didn't hit keyboard
   64:     timeout=10
   65: 
   66:     # Configure serial port to use as console. Ignore if you'll use VGA only
   67:     serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
   68: 
   69:     # Let the user select which console to use (serial or VGA), default
   70:     # to serial after 10s
   71:     terminal --timeout=10 serial console
   72: 
   73:     # An entry for NetBSD/xen, using /netbsd as the domain0 kernel, and serial
   74:     # console. Domain0 will have 64MB RAM allocated.
   75:     # Assume NetBSD is installed in the first MBR partition.
   76:     title Xen 3 / NetBSD (hda0, serial)
   77:       root(hd0,0)
   78:       kernel (hd0,a)/xen.gz dom0_mem=65536 com1=115200,8n1
   79:       module (hd0,a)/netbsd bootdev=wd0a ro console=ttyS0
   80: 
   81:     # Same as above, but using VGA console
   82:     # We can use console=tty0 (Linux syntax) or console=pc (NetBSD syntax)
   83:     title Xen 3 / NetBSD (hda0, vga)
   84:       root(hd0,0)
   85:       kernel (hd0,a)/xen.gz dom0_mem=65536
   86:       module (hd0,a)/netbsd bootdev=wd0a ro console=tty0
   87: 
   88:     # NetBSD/xen using a backup domain0 kernel (in case you installed a
   89:     # nonworking kernel as /netbsd
   90:     title Xen 3 / NetBSD (hda0, backup, serial)
   91:       root(hd0,0)
   92:       kernel (hd0,a)/xen.gz dom0_mem=65536 com1=115200,8n1
   93:       module (hd0,a)/netbsd.backup bootdev=wd0a ro console=ttyS0
   94:     title Xen 3 / NetBSD (hda0, backup, VGA)
   95:       root(hd0,0)
   96:       kernel (hd0,a)/xen.gz dom0_mem=65536
   97:       module (hd0,a)/netbsd.backup bootdev=wd0a ro console=tty0
   98: 
   99:     #Load a regular NetBSD/i386 kernel. Can be useful if you end up with a
  100:     #nonworking /xen.gz
  101:     title NetBSD 5.1
  102:       root (hd0,a)
  103:       kernel --type=netbsd /netbsd-GENERIC
  104: 
  105:     #Load the NetBSD bootloader, letting it load the NetBSD/i386 kernel.
  106:     #May be better than the above, as grub can't pass all required infos
  107:     #to the NetBSD/i386 kernel (e.g. console, root device, ...)
  108:     title NetBSD chain
  109:       root        (hd0,0)
  110:       chainloader +1
  111: 
  112:     ## end of grub config file.
  113: 
  114: Install grub with the following command:
  115: 
  116:     # grub --no-floppy
  117: 
  118:     grub> root (hd0,a)
  119:      Filesystem type is ffs, partition type 0xa9
  120: 
  121:     grub> setup (hd0)
  122:      Checking if "/boot/grub/stage1" exists... no
  123:      Checking if "/grub/stage1" exists... yes
  124:      Checking if "/grub/stage2" exists... yes
  125:      Checking if "/grub/ffs_stage1_5" exists... yes
  126:      Running "embed /grub/ffs_stage1_5 (hd0)"...  14 sectors are embedded.
  127:     succeeded
  128:      Running "install /grub/stage1 (hd0) (hd0)1+14 p (hd0,0,a)/grub/stage2 /grub/menu.lst"...
  129:      succeeded
  130:     Done.

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