Repacking and Check Out
Now we'll need to put everything back together. First we need to compress the RAM disk file :
gzip -9 ramdisk
You should end up with a ramdisk.gz file. Next, we need to build the final Flash image using the pack parameter to splitnslu:
./splitnslu pack newflash.bin
This will give a few lines of status and then complete, creating a new Flash called newflash.bin. For assurance sake, compare the size of your new image with the size of the original image :
ls -l *.bin
You should see that both the original image and the new image are the same size.
We are ready to burn our new image to the NSLU2. This is the most critical part of the process. Up to now we haven't modified anything on the box itself. If you take this step, you take the risk of killing the box if the edits were made incorrectly.
We'll use the standard Linksys menus to install the Flash. First, using a browser, go the Administration web page of the NSLU2. Under Administration select Advanced, then Upgrade. Select the "Choose File" button and find your new Flash: newflash.bin. Then on the bottom of the page, select "Start Upgrade".
When a menu appears, take a deep breath and select "OK". At this point you should see the LEDs flickering on the box as the burn occurs. Eventually you'll get a pop-up indicating that the system is going to reboot. Select "OK". After a nervous minute or so, you should hear a single "beep" indicating that the box has booted normally. Whew! We've done it.
Now, enable telnet by executing the standard Management/telnet.cgi script discussed in my previous articles. Telnet in and take a look at the /etc/rc.d directory. You should see your new rc.hook script. Let's try it out. It's set up to execute our script /share/hdd/conf/rc.d/rc.custom which doesn't yet exist, so we'll create it. For starters, just put a test in it to verify that it works. I put the following in mine :
#!/bin/sh /usr/bin/Set_Led beep1
Mark it executable, and then execute it through the rc.hook script to make sure it works:
chmod +x /share/hdd/conf/rc.d/rc.custom /etc/rc.d/rc.hook
You should hear a "beep". Now reboot :
After a minute or so you should hear the standard first beep followed a few seconds later by our second beep. It works! We have a permanent hook on disk to start up our own processes.