Subject: loading a root ramdisk at root mount time
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 04/28/2007 08:42:42
Hi

On amd64, some obscure bug won't allow me to use PXE boot for a kernel 
embedding a RAMdisk bigger than around 11 MB. The thing crashes somewhere
in between the secondary bootloader and the stage where the kernel is able 
to printf something. Debugging this is especially unattractive.

When I reported the problem, a nice workaround was proposed: we could boot
the kernel without an embedded RAMdisk, then download it from tftp, nfs, or
even from local disk, at root mount time, probably around 
src/sys/kern/kern_subr.c:setroot().

I tried playing a bit with the code, and it seems impossible to reuse
the libsa code (open("tftp:ramdisk.fs", 0) then read and close) at that
stage: it produces warnings about redefinitions. 

Is it possible by tweaking the code, or is libsa just not made for being
used after kernel startup? I suspect the later, so is there a smart way
to do the job without duplicating libsa code?

I found nothing outside of libsa to perform a TFTP download, and if I try 
to get ramdisk.fs from NFS, I have first to mount the NFS filesystem as
root, and it seems once root is mounted, it would be difficult to
unmount it in order to remount the root from the ramdisk.

Any hint?

-- 
Emmanuel Dreyfus
manu@netbsd.org