Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pygrub with NetBSD domU



For future reference about booting a NetBSD domU using pygrub

Here is my xen config file for the domU:
--- cut here ---
#  -*- mode: python; -*
bootloader = '/usr/pkg/bin/pygrub'
memory = 256
name = "rack"
disk = [ 'file:/xen/vnd/rack.vnd,0x03,w' ]
vif = [ 'bridge=bridge0' ]
serial = 'pty'

on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'
--- cut here ---

In the filesystem image, we only need /grub/menu.lst (no need to really
install and/or setup grub)
--- cut here ---
default=0
timeout=1

title xbd0: NetBSD-6.1.3 XEN3PAE_DOMU
root (hd0,0)
kernel netbsd613-XEN3PAE_DOMU

title xbd0: NetBSD-6.1.3 INSTALL_XEN3PAE_DOMU
root (hd0,0)
kernel netbsd613-INSTALL_XEN3PAE_DOMU
--- cut here ---

And of course I have in filesystem root:
/netbsd614-INSTALL_XEN3PAE_DOMU
/netbsd614-XEN3PAE_DOMU

Issues:

1- FFSv1 is required. NetBSD 6.1.4 installer formats using FFSv2 by
default, hence FFSv1 must be explicitely chosen at install time.

2- pygrub works with a MBR or with NetBSD using the whole disk, but if
the later is chosen, NetBSD installer creates a sector 0 with a valid
MBR magic number but an empty partition table. 

This can be seen at offset 0x1f8, magic number 0xaa55
dd if=/xen/vnd/rack2.vnd bs=512 count=2|hexdump -C

pygrub will consider the sector 0 to contain a MBR but will fail since
there is no NetBSD partition. We could save our day by setting a NetBSD
partition at offset 0 using fdisk, but fdisk will refuse since sector 0
is the for the MBR. 

Workarounds:
- reinstall without using the whole disk so that there is a MBR and a
NetBSD partitionstarting at sector 63
- erase MBR so that there is no MBR magic number and pygrub considers a
partition using the whole disk:
vnconfig vnd4 xen/vnd/rack2.vnd
dd if=/dev/zero of=/dev/rvnd4d bs=512 count=1 
vnconfig -u vnd4

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index