Today's lecture revolved around the information and processes located at http://www.nslu2-linux.org/wiki/SlugOS/InstallandTurnupABasicSlugOSSystem
This process is very straightforward and is outlined clearly on the web site. In general, today we focused on doing a pivot to a new root filesystem stored on an external drive(so that we have more room than the 8MB or so on the NSLU2).
A couple of notes regarding general points, and the we will move on to notes that should be read while following the online instructions:
When the kernel boots up, the initramfs is compressed. You can make it very small, but this will take much longer to boot in order to decompress it. So there are tradeoffs on compression.
In general, there is a "lot of trickery that goes about trying to fit everything into this small amount of space." One of these tricks is BusyBox.
All of these embedded Linux systems use something that is slightly different from larger machines running linux. On larger machines, commands are all individual programs. To save space on an embedded machine, everything is put into on single program called BusyBox(cp, mv, ls). These commands will then all be symbolic links to the BusyBox program.
In some cases, they simply reduced the number of options for each command, which assisted in making the binary smaller.
Notes following along with the web site:
Using DHCP is probably not a good idea, as you have no monitor to view the DHCP-supplied address to be able to SSH in. But, the instructions are there if you are interested.... however, the setup we have in the lab will allow us to use a static IP so we don't need to struggle to find a way to find the dynamic address.
command df : Will show you what things are mounted, general sort of info on the mounted drives.
On the NSLU2, this command will show root twice. This is a byproduct of the boot process, Dr. Herman says we don't need to worry about it.
Preparing the External Storage:
dmesg | tail -10
Tail takes the tail end of all those messages(hence the 10). Opposite of tail is head. tail -f will continually print the messages as they come(for instance, if you plug in a USB drive).
Usually if you buy a USB drive it will be FAT or VFAT or FAT32(Windows stuff). You want to reformat it into a native Linux format(ext3 is good). This is outlined on the web page.
(Slug OS might detect it as SCSI, don't be alarmed)
use the df command: will show /dev/sda1 if you plugged it in.
Writing the New File System:
Get rid of FAT!!! Get skinny with ext3. They show how to manually unmount it with the umount command, df to verify that it isn't there. Then type in(unique to this embedded system):
Then you have a nice formatted USB stick.
Note: on Slackware Linux, the command would be mke2fs -j /dev/sda1 (maybe if you install the e2fsprogs package on the slug, this command would be available on the NSLU2)
Copying and Switching to the External Storage:
turnup memstick -i /dev/sda1
This will mount /dev/sda1, and will copy the file system over to the flash drive. We're just moving it to a bigger drive, then we are ultimately going to do a pivot. This pivot will be automatically taken care of by the OS from here on out; it is all built into the turnup command.
Checking for Successful Turnup:
Then log back in. This will do the pivot automatically, and the root filesystem will now be the USB drive. The down side is that the NSLU2 will be effectively bricked unless you have the USB stick.
Now that we have a much bigger root filesystem, we have plenty of room to do whatever we want.
Read the section on swap space.
Updating the Feeds and remaining sections
Let's get some new software: Packages!
opkg(newer) or ipkg(older)
-more information is available on the web page
Dr. Herman then continued on to manually download a number of additional packages to his laptop, which he will then copy over to the NSLU2, since he does not have internet access on the NSLU2.
Take an additional look at http://www.nslu2-linux.org/wiki/Applications/HomePage
This page contains a number of real-world applications for this particular embedded system.