Netboot-scratchpad

Note

Draft for an experiment in progress. Accuracy here is random!

Warning

Information here may vary from day to day and hour to hour. It is a "pad" to help us to take various notes on a future and more complete tutorial on how produce netboot images for SPARC machines. Free feel to annotate if you wish.

Building a tftpboot image

Tools

Tilo (seems a bit buggy especially with large image => segfaults)

Linux kernel in itself

The Linux kernel way

Magic command (/in /usr/src/linux) : make tftpboot.img

Scans System.map to get ELF entries (espcially _star and _end)

Requires a root.img file in /usr/src. This file is a ramdisk image (!= initrd ?). The smaller the better, so cramfs can be used therem of course busybox is required.

cramfs must be included built-in

Some Sun machines does not initialize their MMU so everything must fit in 4 Mb in their case (1 page)

Cramfs

Designed for having a small footprint, ideal (to check with rw mount points ? The Fs is readonly and limited around 272Mb in size, no possibility to remount it rw...).

Recompile a Linux kernel and put the modules in the cramfs directory structure (make modules_install INSTALL_MOD_PATH=/path/to/ramdisk/tree)

Don't forget to put a default argument init=... (if is is suitable to keet the init deployed by busybox as is)

Put something useful in the cutomized init (can be a script) like

#!/bin/ash
echo "Hello world"

Build the cramfs, name it root.img and put it in /usr/src

Build the tftpboot image => cd /usr/src/linux && make tftpboot.img

Put the image on a tftpserver

The boot process ends with : Error -3 while decompressing! with some blocks (ramdisk is 4096 in size... too small ? overwriting problem ?) :-(

ext2

Same philosophy but a volume image must be created them mounted through a loopback device then formatted....

Tried with a ramdisk of 32 Mb, okay it boots :-)

Notes on busybox

Several defects or gotchas noted :

When something taken care of by BB is replaced by a "real" counterpart (e.g. copying a "real" fdisk binary instead of having the fdisk symlink pointing to BB) is run from the BB shell (ash), BB assumes it must run the internal command except when the command is run with its absolute path. ->

Busybox is emerged with "simplified" modutils activated by default with brings many issues with modules dependencies (e.g. symbols not found when dealing with the ext3 module).

BB mksf.ext2 overwrites the first 1024 bytes of a partition with zeros, thus killing the Sun disklabel on it the case of the first partition starting at sector 0 (required to be bootable from OpenBoot). Core utils mkfs.ext2 leave those 1024 first bytes untouched.