Subject: [PATCH] Make NetBSD/Xen Dom0 boot with root on nfs
To: None <port-xen@netbsd.org>
From: Christoph Egger <Christoph_Egger@gmx.de>
List: port-xen
Date: 06/22/2007 16:20:19
--========GMX10271182522019578503
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi!

I have attached a patch, which lets me NetBSD/Xen Dom0 boot with root on nfs.
Just pass bootdev=<dev> ip=... and nfsroot=...  to the dom0 kernel in GRUB
in the same format as in a config file for a DomU.

I don't know, where this "boot device: <unknown>" comes from, even with bootdev specified, but at least it works.
If this bootdev is fixed, then booting from nfs is almost identical with Linux. Linux additionally supports ip=dhcp.

I also had to increase the max length of parseable commandline in order
to not truncate the string. The ip=... field is already a long string
and when you have a long nfsroot=... field, then you don't mount what you want.


Below is a snippet from my boot messages.

Please review and apply the patch.

Tnx,

Christoph



[...]
Kernelized RAIDframe activated
xenbus0: using event channel 16
atapibus0 at atabus4: 2 targets
cd0 at atapibus0 drive 1: <LITE-ON DVD SHD-16P1S, , GS05> cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
wd0 at atabus4 drive 0: <WDC WD400BB-22JHC0>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 38166 MB, 77545 cyl, 16 head, 63 sec, 512 bytes/sect x 78165360 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(viaide1:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
cd0(viaide1:0:1): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA)
Searching for RAID components...
boot device: <unknown>
root device: help
use one of: ex0 cd0[a-p] wd0[a-p] ddb halt reboot
root device: ex0
dump device: none
file system (default generic): nfs
root on ex0
nfs_boot: trying static
nfs_boot: client_addr=192.168.85.12
nfs_boot: gateway=192.168.85.254
nfs_boot: netmask=192.168.85.0
nfs_boot: server=192.168.85.14
nfs_boot: root=192.168.85.14:/vol/osrc_data/nfsroot/netbsd-i386-fricka-cegger
root on 192.168.85.14:/vol/osrc_data/nfsroot/netbsd-i386-fricka-cegger
root time: 0x467bbb98
warning: no /dev/console
init path (default /sbin/init): 
init: copying out path `/sbin/init' 11
Created mfs /dev (433 blocks, 1266 inodes)
ex0: transmit underrun (9000) @20
Thu Jun 21 12:11:43 UTC 2007
Checking for botched superblock upgrades: done.
Starting file system checks:
mount: /: unknown special file or file system.
Setting tty flags.
Setting sysctl variables:
Starting network.
Hostname: fricka
IPv6 mode: host
Configuring network interfaces:.
add net default: gateway 192.168.85.254
Adding interface aliases:
Building databases: dev, utmp, utmpx done
Starting syslogd.
Checking for core dump...
savecore: can't find device 1039/26852
Jun 21 12:11:46 fricka savecore: can't find device 1039/26852
Mounting all filesystems...
mount: realpath /kern: No such file or directory
Clearing temporary files.
Creating a.out runtime link editor directory cache.
Checking quotas: done.
[...]
Starting inetd.
Starting cron.
ex0: transmit underrun (9000) @20
Thu Jun 21 12:11:48 UTC 2007

NetBSD/i386 (fricka) (console)

login:


--========GMX10271182522019578503
Content-Type: application/octet-stream; name="dom0_root_on_nfs.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dom0_root_on_nfs.diff"

PyBhcmNoL3hlbi9kb20wX3Jvb3Rfb25fbmZzLmRpZmYKSW5kZXg6IGFyY2gveGVuL2kzODYvYXV0
b2NvbmYuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3Zzcm9vdC9zcmMvc3lzL2FyY2gveGVuL2kz
ODYvYXV0b2NvbmYuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4yMwpkaWZmIC11IC1wIC1yMS4y
MyBhdXRvY29uZi5jCi0tLSBhcmNoL3hlbi9pMzg2L2F1dG9jb25mLmMJMTcgTWF5IDIwMDcgMTQ6
NTE6MzUgLTA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