December 5, 2016

Intel Galileo - Xinu on the Gen 2 - setting up network boot

If you intend to do any development work at all with Xinu, this is what you want to do. There are two aspects of this. One is setting up your boot server, the other is setting up an SD card to run the Xinu "xboot" program. for the Galileo.

Setting up the server

I use a Fedora 24 linux system as my boot server. My notes on setting this up follow.

Here is the /etc/dhcpd/dhcpd.conf file that I use. It works. You may not need all of the stuff in it.
authoritative;
allow unknown-clients;
allow booting;
allow bootp;
default-lease-time              14400;          # 4 hours
max-lease-time                  14400;          # 4 hours

# TJT - This is required as of ISC 3.0.3 to tell what
# IP to be used for TFTP (for PXE booting).
next-server 192.168.0.5;

option option-128 code 128 = string;
option option-129 code 129 = text;

shared-network "CASTELLON" {

        subnet 192.168.0.0 netmask 255.255.255.0 {

            option routers                  192.168.0.1;
            option subnet-mask              255.255.255.0;
            option domain-name-servers      208.67.222.222,
                                            208.67.220.220;
            host galileo {
                    hardware ethernet 98:4f:ee:05:xx:yy;
                    fixed-address 192.168.0.30;
                    option host-name "galileo";
                    server-name "trona";
                    filename "xinu";
            }
        }
}
The default setup for fedora is that TFTP serves files out of the directory /var/lib/tftpboot. I change permissions on this so I can freely copy into it as myself, then after I build xinu, I copy the file "xinu" (not xinu.elf) into this directory.

Set up the SD card

This is as easy as fetching the following tar archive and copying it onto a blank microSD card. Note that this tar archive is intended to be extracted into an empty directory (in general the root directory of your SD card). So if you extract it on your machine in order to examine it, do that in a fresh empty directory.

Get yourself a blank microSD card. They usually come from the factory with a FAT-32 filesystem on them, and will mount on linux as type "vfat" which is what you want. After deleting any files on the card, do something like this:

-- linux should just automount the sdcard for you when it is plugged in via a card reader
cd /mount/sdcard
tar xvf /path/sdcard-netboot.tgz
eject /mount/sdcard
Put this card into the Galileo, watch the serial console and it should just work. There are sometimes headaches with getting the DHCP and TFTP servers running and configured, not to mention opening firewall ports. Be sure and put a xinu binary in the directory your tftp server serves out of. If all else fails, run wireshark and see what packets are and are not moving.

Xboot sources

You should not need to rebuild xboot, but in case you do, here are some tips. The xboot program is simply xinu configured to be a network boot agent. If you are going to rebuild it, you should clone the latest sources from github: Something like this:
git clone https://github.com/real-xinu/xinu-galileo.git
cd xinu-galileo
git checkout xboot
cd compile
make clean
make depclean
make
This should yield an xboot executable that you can put onto your SD card.
Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]