I have successfully installed Ubuntu 18.04 onto an SD card. I did this by creating an msdos partition table (pi doesn't support guid), then putting U-Boot onto the SD Card on partition 1 (fat32, pi doesn't support anything else). Then I pasted the pi-bootloader onto partition 1 /. And then I copied the files from the net installer (mini-iso) onto that partition as well. The whole process is laid out here.
Everything works perfectly well from the SD Card. UBoot starts, then it loads the grub2 that came with the net installer mini iso. that in turn i have changed the config so it loads the linux kernel from partition 3 (p2 is swap, in my case).
So I pulled an image of that, put it on an usb drive (usb to m2 sata adapter), which should just behave like any other flash drive. So, I turn it on. U boot starts, I don't see anything different from normal. Then it loads grub. But instead of displaying a nice menu with the option to boot ubuntu or install it (because the net installer stuff is still on there), it dumps me straight into the grub console.
typing ls I get (memdisk), and nothing else. It doesn't seem to find the usb drive it actually loaded from itself. on that memdisk is a single file at (memdisk)/boot/grub/grub.cfg, but I have no way of knowing what's actually in there. Edit: (memdisk) is there on the sd card also, same content, it just lists the partitions on the sd card also, while it does not on the flash drive.
There are no grub modules, no nothing. I think it ever so briefly flashes an error at me, but then the grub console opens and I have no time to read those messages.
I'm at a loss as to what to do. Perhaps if I made my own grub image with usb modules like it is described here (using grub-mkimage to create a grub image with modules in the memdisk)? Although I have no idea which modules I need, or if that's even the right approach.
Any help would be greatly appreciated.
Edit: I have found this:
Basically you need grub modules (which I don't have) for grub to recognize the usb drive.
the short answer is:
insmod usbms insmod ehci insmod uhci insmod ohci
Only one of the *hci line is needed (usually ehci), but older machines may need either uhci or ohci Inserting all 3 works fine.
Those lines should be added to either grub.cfg or custom.cfg (I recommend the latter) in the /boot/grub/ folder on the non-USB drive.
I got my modules from here, however usbms is not among them and neither is [e,u,o]hci. I have found this about writing grub modules, but it confuses me. And I can't find the source code. Using something odd like the armhf 64bit processor doesn't make things easy to find compatible software.
Edit2: I have downloaded the grub source code from http://git.savannah.gnu.org/git/grub.git/ and compiled it on my raspberry pi. However the usbms.c and ehci.c source code files are there, it did not compile them into grub modules.
I have found this information on how to build grub modules here but it just doesn't work for me. I tried changing Makefile.core.am and removed the if statement around usbms.module, then running autogen and configure. No dice. I tried manually building in grub-core with make usbms.module, but it says gcc: fatal error: no input files.
I don't need grub. I just want to boot my Ubuntu arm64. If I can somehow skip from u boot directly to there it's fine.
My current ideas:
- Compile usbms.mod, ehci.mod, uhci.mod and ohci.mod, make a new grub image with those modules linked in, and it should just work with the current grub config.
- Make a new grub image with the modules, the config and the linux kernel and initramfs built in as a memdisk. boot the kernel from there with the command line indicating that the rootfs is on partition 3
- Somehow tell uboot to boot my linux kernel from partition3 with the command line that partition 3 is root.
- use the black magic boot loader that comes with the raspberry pi firmware thing. I have not the slightest idea how that stuff works, but if someone can make it boot my ubuntu x64 then I'd be all too happy to ignore the fact that I don't know how it works.
I have no idea how to do any of them.