Booting from the Ether

One of our finalists shows you how to enable the NIC to boot from the network.
An Open-Source Solution

I wanted to have a completely open-source solution to this problem. Unfortunately, I couldn't make the GRUB software work, and I sure didn't want to write my own boot-loader software from scratch. The Etherboot package allows you to create your own boot ROM. If you have a network board that has a ROM socket on it, you can use the Etherboot package to create a ROM image that can then be burned into an EPROM for use on your network board. In our case, we already have a boot ROM, and it can't be replaced with a new one.

Fortunately, the Etherboot package allows you to make a ROM image that has a boot sector, so you can test the package from a floppy. This also means you can take this boot image and put it on a bootable CD-ROM. This doesn't use the boot ROM in the system so it would work on systems without boot ROMs.

You can download the source code to the Etherboot package and compile the code yourself, or you can use the ROM-o-matic web page setup by Marty Connor at http://rom-o-matic.net/. I tried both and the ROM-o-matic web page was by far the easiest. Select the SiS900 NIC and choose the Floppy Bootable ROM Image. In a few seconds, you'll have a 40K ROM image that you can use on your bootable CD-ROM.

When you make a bootable El Torito CD image, you need to provide a floppy boot image that is exactly 1.2, 1.44 or 2.88 megabytes. I used the following command to take the ROM image and append enough bytes to make it a 1.44MB file. Make sure your downloaded ROM image is in the file eb.img:

dd if=/dev/zero of=eb.img bs=512 seek=72 count=2808

This will increase the size of the file to 1.44MB. I used the following command to make the CD image:

mkisofs -b eb.img -o /tmp/cd.iso .
You can then burn to a CD-ROM the ISO9960 CD image in the file /tmp/cd.iso. Don't tell anyone, but I used Adaptec's Easy CD Creator software on Windows. If your CD writer happens to be in a Linux box, you can feel free to use one of the fine CD-writing programs for Linux.

There is a utility in the Etherboot package called mknbi. This file will take a Linux kernel and put it in the proper format needed to load via the Etherboot loader. Install this utility package, change to the /tftpboot/bpbatch directory, then run the following command:

/usr/local/bin/mknbi-linux bzImage --output bzImage.out --param="rw root=/dev/nfs
nfsroot=192.168.1.5:/nfsboot/nicroot ip=192.168.1.12:192.168.1.5:192.168.1.1 :255.255.255.0::eth0"

This will take the kernel we generated earlier, convert it to the proper format and add all the parameters required for it to find its root filesystem.

You need to change one line in the /etc/dhcpd.conf for this new method to work. The existing file contains the line

filename "/bpbatch/bpbatch";

Change this line to

filename "/bpbatch/bzImage.out";
Restart your DHCP server so it reads your changes. Put your bootable CD-ROM into your ThinkNIC and turn it on. If all goes well, it will start up as it did using the BpBatch software. This time though, you are using a completely open-source solution.

Conclusion

It does take a little time to get all the components set up properly, but booting your ThinkNIC computer from the network is the first step to making it do new and exciting things. You did enter your exciting idea in the Embedded Linux Journal ThinkNIC contest didn't you?

Resources

Glossary

Jay Sissom (jsissom@indiana.edu) is a systems analyst in the Computing Department at Indiana University in Bloomington, Indiana. His amateur radio callsign is KA9OKT, and he enjoys playing the piano. He wishes there were 36 hours in the day so he had more time to try out some of his crazy ideas.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

pxelinux/gpxelinux

Doug Scoular's picture

Hi Jay,
Good article... but I was surprised that you didn't cover
pxelinux/gpxelinux which offers an amazing amount of functionality
in a PXE bootloader... with many plugin (com32) modules. There's
a complete menuing system too.

With gpxelinux you can even load your kernel/initramfs via HTTP.
There's also the option to boot via iSCSI.

Anyway, I just thought I'd mention that pxelinux and friends are
great tools for diskless booting:

http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project

Cheers,

Doug

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix