My test hw, on which I want to boot, is MinnowBoard Max Turbot which is an x86 machine with UEFI and so far, I have successfully built GRUB2 from source and it successfully boots kernel from USB.
Now, I want to boot the linux kernel and rootfs from network. Since, Minnowboard's UEFI firmware doesn't support PXE (network drivers unavailable), I chose to get it through GRUB2, which can be built with network drivers.
I can setup dhcp server and tftp server, however, I am not able to find any Wiki/tutorial on how to specify grub2 the IP address of the tftp and dhcp servers. How do I tell GRUB2 to boot from network?
The best I could find was this : https://tr.opensuse.org/SDB:Booting_from_the_Network_with_GRUB
However, it uses grub-legacy. The GRUB2 documentation is also not clear.
Can someone please tell me the steps and commands to tell grub2 to boot kernel from network? Also what modules do I need to build GRUB2 with (full command to build GRUB2 would be appreciated)
EDIT
I have built GRUB2 with the following command :
./grub-mkimage -d ./grub-core -o bootx64.efi -O x86_64-efi -p "" fat iso9660 part_gpt part_msdos normal boot linux configfile loopback chain efifwsetup efi_gop efi_uga ls search search_label search_fs_uuid search_fs_file gfxterm gfxterm_background gfxterm_menu test all_video loadenv exfat ext2 ntfs btrfs hfsplus udf tftp efinet
I have a tftp server running on IP a.b.c.d.
Now when I set linux as below in GRUB2 console :
linux (tftp,a.b.c.d)/tftpboot/bzImage
I get the error destination unreachable. Also when I do net_ls_cards, I don't get any cards listed. But I have confirmed that internet over ethernet works on this board by booting Ubuntu on it.
EDIT2
Thanks to @telcoM , to point out that 64-bit version has needed network UEFI support. This gave me confidence to spend another day trying and I finally had success.
I setup tftp, dhcp and nfs servers (out of scope of this title).
The in GRUB2, I hit net_bootp and this is the juice. Though name is misleading it worked as the first step to request IP from DHCP server. This puts the HW on the network with legal network settings. Now I could set kernel path
grub> linux (tftp,a.b.c.d)/tftpboot/bzImage
Now the kernel boots. But I am still one step behind - the rootfs !!! Kernel fails while loading rootfs, which is expected.
I am not able to figure out how to tell grub2 to set rootfs location as NFS server. Is there some function like (tftp) ? I am checking through docs. If someone already know, please point out.