Subject: TFTP'ing RAMdisk at root mount time
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 05/04/2007 16:25:16
Hello

Due to stupid limitations in the bootloader, there are issues with loading
a kernel with a really big RAMdisk (more than around 10 MB). Because fixing
the bootloader is not very appealing, I worked on another approach: the
kernel boots with no RAMdisk embedded, and at root mount time, it 
downloads the RAMdisk through TFTP.

Here is an early preview of the thing:
http://ftp.espci.fr/shadow/manu/tftproot.diff

In order to use it, you need a kernel with
no options      MEMORY_DISK_ROOT_SIZE
options         MEMORY_DISK_DYNAMIC
options         TFTPROOT
options         TFTPROOT_DEBUG
options         MEMORY_RBFLAGS=0

TODO
1) discovering the file name by DHCP does not work. For now the code just
downloads the hardcoded "ramdisk.fs". That's the next thing I'll fix.

2) Some cleanup should be done to remove the dependency on NFS. The code
used to bootstrap using DHCP or BootP should be removed from src/sys/nfs
and become a stand-alone option. Where should it go? Would 
src/sys/netinet/dhcp_client.c 	for the DHCP part 
src/sys/netinet/dhcp_client.c 	for the TFTP part
src/sys/netinet/udp_client.c 	for common functions
be an appropriate layout?

3) support gzip'ed RAMdisk

4) Support TFTP with a blocksize > 512

5) In an ideal world, it would be possible to download the RAMdisk from
a NFS server, but that involve switching from one root (NFS) to another
(RAMdisk). Is it possible to do such a thing right now?

-- 
Emmanuel Dreyfus
manu@netbsd.org