November 28, 2016

Intel Galileo - Xinu on the Gen 2 - Building Xinu

You have a choice. You can build from the "book sources" or you can go to the "real-xinu" repository on Github and build the latest galileo sources from there. I chose the latter.
git clone https://github.com/real-xinu/xinu-galileo.git
cd xinu-galileo/compile
make clean
make depclean
make
This builds, with a couple of warnings.
y.tab.c: In function ‘yyparse’:
y.tab.c:1301:16: warning: implicit declaration of function ‘yylex’ [-Wimplicit-function-declaration]
       yychar = yylex ();
                       ^~~~~
../device/lfs/lfscheck.c: In function ‘lfscheck’:
../device/lfs/lfscheck.c:28:13: warning: result of ‘1483304565 << 8’ requires 40 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
     ((LFS_ID<< 8) & 0x00ff0000) |
             ^~
../device/lfs/lfscheck.c:29:13: warning: result of ‘1483304565 << 24’ requires 56 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
     ((LFS_ID<<24) & 0xff000000) ;
In file included from ../include/xinu.h:33:0,
                 from ../net/dhcp.c:3:
../net/dhcp.c: In function ‘dhcp_bld_bootp_msg’:
../include/prototypes.h:619:11: warning: result of ‘1669485411 << 8’ requires 40 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
      (((x)<<8) & 0x00ff0000) | (((x)<<24) & 0xff000000))
           ^
../net/dhcp.c:67:20: note: in expansion of macro ‘htonl’
  dmsg->dc_cookie = htonl(0x63825363); /* Magic cookie for DHCP */
                    ^~~~~
../include/prototypes.h:619:37: warning: result of ‘1669485411 << 24’ requires 56 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
      (((x)<<8) & 0x00ff0000) | (((x)<<24) & 0xff000000))
                                     ^
../net/dhcp.c:67:20: note: in expansion of macro ‘htonl’
  dmsg->dc_cookie = htonl(0x63825363); /* Magic cookie for DHCP */
                    ^~~~~
We then end up with a pair of xinu executables:
-rw-rw-r-- 1 tom tom 119296 Nov 28 12:54 xinu
-rwxrwxr-x 1 tom tom 142016 Nov 28 12:54 xinu.elf
Copy "xinu.elf" to the SD card to boot from the card. If you are set up to do network booting (and you should be if you are going down this road), copy "xinu" (not xinu.elf) to your tftpboot directory and let the Galileo pick it up via TFTP when you apply power (or hit reset).
Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]