Would really like to learn more about embedded linux. Found an incredible website \ about Bootdisks and the boot process at http://www.tldp.org/HOWTO/Bootdisk-HOWTO \ which will be a good \ start. Later I will tackle Linux from Stratch at http://www.linuxfromscratch.org/lfs/view/stable/chapter01/how.html
Also found some nice articles on a Tiny Busybox system written by the creator of BusyBox himself! Part 1 http://www.linuxjournal.com/article/4335 Part 2 http://www.linuxjournal.com/article/4395
We describe how to build a compressed filesystem, so called because it is compressed on disk and, when booted, \ is uncompressed onto a ramdisk. With a compressed filesystem you can fit many files \ (approximately six megabytes) onto a standard 1440K diskette. Because the filesystem is much larger than a \ diskette, it cannot be built on the diskette. We have to build it elsewhere, compress it, then copy it to the diskette.
We need a temp space where we can build the linux system, before we compress it. So we use a normal linux laptop, and \ create a loopback device, which will be 4mb in size, just enough to hold our bootdisk stuff.
# dd if=/dev/zero of=/mnt/bootdisk_file bs=1k count=4094
Note: This /mnt/bootdisk_file is not a dir, it's a file
The Linux kernel recognizes two file system types for root disks to be automatically copied to ramdisk. These are minix and ext2, of which ext2 is preferred. ALso, we could use any type of block device for our temp location, **here I am going to use a loop back device (a file \ mounted like a block device). You could easily use a spare partition, or ram disk /dev/ram0 or anything, as long as it's big enough \ to hold our uncompressed temporary work.
# mke2fs -m 0 -N 2000 /mnt/bootdisk_file
# mkdir /mnt/bootdisk # mount -t ext2 -o loop /mnt/bootdisk_file /mnt/bootdisk
Now we have what looks like a normal block device, like a hard drive, but it's actually the contents of that bootdisk_file
NOTE, from now on we will be working in the /mnt/bootdisk folder, so think relatively
# mkdir dev # mkdir proc # mkdir etc # mkdir sbin # mkdir bin # mkdir lib # mkdir mnt # mkdir usr
Device files are special, and must be created with 'mknod' command, or you can simply copy them from your existing linux system \ but you must copy them with the -R flag, just like this. Note for the /dev/fd[01] to work, you must have your floppy in the \ drive and recognized (reboot if it doesn't find it).
For some reason, my laptop does not recognize my floppy in linux, so I will use a spare partition
Note you MUST include console, kmem, mem, null, ram0, tty1
cp -dpR /dev/fd[01]* /mnt/bootdisk/dev cp -dpR /dev/tty[0-6] /mnt/bootdisk/dev cp -dpR /dev/console /mnt/bootdisk/dev cp -dpR /dev/kmem /mnt/bootdisk/dev cp -dpR /dev/mem /mnt/bootdisk/dev cp -dpR /dev/null /mnt/bootdisk/dev cp -dpR /dev/ram0 /mnt/bootdisk/dev
On my qlap01 I did
cp -dpR /dev/tty[0-6] /mnt/bootdisk/dev cp -dpR /dev/sd* /mnt/bootdisk/dev cp -dpR /dev/console /mnt/bootdisk/dev cp -dpR /dev/kmem /mnt/bootdisk/dev cp -dpR /dev/mem /mnt/bootdisk/dev cp -dpR /dev/null /mnt/bootdisk/dev cp -dpR /dev/ram* /mnt/bootdisk/dev
Which device files you copy/make is up to you, if it's not on the floppys dev folder, it won't be accessible. So if you want \ to use this disk to restore from a tape device, then ftape must be mknod'ed. Get it.
Note that one inode is required for each device special file, and inodes can at times be a scarce resource, especially on diskette filesystems. You'll need to be selective about the device files you include. For example, if you do not have SCSI disks you can safely ignore /dev/sd*; if you don't intend to use serial ports you can ignore /dev/ttyS*.