Netboot-scratchpad

From Funtoo Linux
Revision as of 02:40, 8 February 2011 by 404 Error (Talk)

Jump to: navigation, search

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


Contents

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.

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...).
  • Must be built in in kernel !
  • Basic structure:
 ├── bin
├── dev
├── etc
├── lib
├── lib64 -> lib
├── mnt
│   ├── cdrom
│   ├── floppy
│   └── funtoo
├── proc
├── sbin
├── sys
├── tmp
├── usr
│   ├── bin
│   └── sbin
└── var
  • Creation (mkdir and cd into it first) :
# mkdir -p bin sbin lib usr/bin usr/sbin usr/lib etc var sys proc sys dev etc mnt/floppy mnt/cdrom mnt/funtoo
# chmod -R 755 *
# chmod 1777 tmp
# ln -s lib64 lib
  • Emerge busybox in this subtree and remove unwanted files (eg. /usr/share/doc, and such). Ok because we ask for a static build (this stuff can be built with ulibc also... see also buildroot)
# CFLAGS="-O2 -pipe -mcpu=v9" USE="static make-symlinks" emerge --nodeps --root=/path/to/ramdisk/tree busybox
  • 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
Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff