As to how the galileo knows it has to start on the SD. do you mean how to boot linux?
When an empty SD card is inserted you can use the SD.h library to Read. Write. etc.
Yes, i would like to know if there is a peace of code on the SPI memory with check if there is a linux installation on the SD, and in this case the load on linux from SD is done, or if there is something else?
I think EJP may be after something else than chofrock describes in his post, let me try to answer that.
The SPI image ("firmware") contains grub, which is set to search for a config file on the SD card first, in /boot/grub/grub.conf. If it doesn't find it - it loads the one in SPI, which boots the kernel from SPI by default