Difference between revisions of "Netboot-scratchpad"
From Funtoo Linux
(Created page with "{{Template:Fancynote|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 ...") |
|||
| Line 14: | Line 14: | ||
* Magic command (/in /usr/src/linux) : make tftpboot.img | * Magic command (/in /usr/src/linux) : make tftpboot.img | ||
** Scans System.map to get ELF entries (espcially _star and _end) | ** 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 | + | * 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 | * 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: | ||
| + | <pre> | ||
| + | ├── bin | ||
| + | ├── dev | ||
| + | ├── etc | ||
| + | ├── lib | ||
| + | ├── lib64 -> lib | ||
| + | ├── mnt | ||
| + | │ ├── cdrom | ||
| + | │ ├── floppy | ||
| + | │ └── funtoo | ||
| + | ├── proc | ||
| + | ├── sbin | ||
| + | ├── sys | ||
| + | ├── tmp | ||
| + | ├── usr | ||
| + | │ ├── bin | ||
| + | │ └── sbin | ||
| + | └── var | ||
| + | </pre> | ||
| + | |||
| + | * Creation (mkdir and cd into it first) : | ||
| + | |||
| + | <pre> | ||
| + | # 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 | ||
| + | </pre> | ||
| + | |||
| + | * 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) | ||
| + | <pre> | ||
| + | # CFLAGS="-O2 -pipe -mcpu=v9" USE="static make-symlinks" emerge --nodeps --root=/path/to/ramdisk/tree busybox | ||
| + | </pre> | ||
| + | |||
| + | * Recompile a Linux kernel and put the modules in the cramfs directory sttructure (make modules_install INSTALL_MOD_PATH= | ||
| + | |||
| + | * put something useful in /bin/init: | ||
[[Category:Labs]] | [[Category:Labs]] | ||
Revision as of 02:35, 8 February 2011
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 sttructure (make modules_install INSTALL_MOD_PATH=
- put something useful in /bin/init: