next up previous contents
Next: Building a Kernel Up: Getting Linux into Small Previous: Other Essential Binaries   Contents

Populating the Root File System

The binaries and libraries are already installed in the rootfs directory. Now we will complete the root file system. First create the remaining directories in rootfs.

cd /home/lennartb/myboot/rootfs
mkdir dev tmp etc proc mnt etc/init.d

Add the device nodes. We will only add the necessary device nodes: two floppy disks, two hard disks with 8 partitions each and four terminals. Further we need some memory related devices and a ram disk. Become root and cd to the dev subdirectory in the myboot/rootfs file system.

mknod fd0 b 2 0
mknod fd1 b 2 1
mknod hda b 3 0
mknod hda1 b 3 1
mknod hda2 b 3 2
mknod hda3 b 3 3
mknod hda4 b 3 4
mknod hda5 b 3 5
mknod hda6 b 3 6
mknod hda7 b 3 7
mknod hda8 b 3 8
mknod hdb b 3 64
mknod hdb1 b 3 65
mknod hdb2 b 3 66
mknod hdb3 b 3 67
mknod hdb4 b 3 68
mknod hdb5 b 3 69
mknod hdb6 b 3 70
mknod hdb7 b 3 71
mknod hdb8 b 3 72
mknod tty c 5 0
mknod console c 5 1
mknod tty1 c 4 1
mknod tty2 c 4 2
mknod tty3 c 4 3
mknod tty4 c 4 4
mknod ram b 1 1
mknod mem c 1 1
mknod kmem c 1 2
mknod null c 1 3
mknod zero c 1 5

Add files in the /etc subdirectory. The init program from busybox works without a login procedure, so the passwd and group files are not really needed. You could of course create single line versions for the root user and group. Even the inittab file is not essential and busybox provides a reasonable default. You are free to copy the scripts/busybox file from the source directory and customize it. The only file I added in /etc was init.d/rcS, which must have execute permissions.

#!/bin/sh
mount -t proc none /proc

Make all files in the root file system owned by root:

chown -R 0:0 /home/lennartb/myboot/rootfs

Now we have a complete root file system in a directory. We still need a kernel and a way to boot. Further we need to transfer the file system to a floppy disk.


next up previous contents
Next: Building a Kernel Up: Getting Linux into Small Previous: Other Essential Binaries   Contents
Lennart Benschop 2003-05-29