I have an Acer Aspire R15 laptop, and I need to have a Linux run from the internal SD card slot. There is no SD card option available in the Boot Options menu.
I have Windows 10 installed on the main SSD, with ~100MB EFI partition (49MB free space). I have installed Arch Linux on SD card, chrooted into it, mounted EFI partition as /efi (leaving /boot on the SD card), added an UEFI record with grub-install --target=x86_64-efi --efi-directory /efi --boot-directory /boot --bootloader-id=ARCH-SD
, but the problem is the SD card slot is not reachable on the early boot stage, so GRUB cannot reach /boot to load kernel and initram. I understand I need to have the kernel with "mmc_core mmc_block sdhci sdhci-pci" modules installed (via editing /etc/mkinitcpio.conf to MODULES="mmc_core mmc_block sdhci sdhci-pci"
and running mkinitcpio -p linux
), and I could have mounted EFI partition to /boot to have it reachable on the early stage, would the EFI partition free space be not that sparse.
So, the question is: is there a way to set up an .efi binary on the EFI partition to have it embedded a minimal kernel with SD card modules installed (disk space usage is the key), with its only purpose to make the SD card reachable, and chainload the full-featured kernel, initram etc on the SD card? Or is there any better other way? Doing so by the means of GRUB/efibootmgr/other_bootloader is preferred (rather than doing lower-level stuff that is error-prone and needs manual support on system updates). Repartitioning the main SSD, or using an USB SD adapter, or whatever similar, is not an option.
Update:
Solution: As per @alex-stragies advice, I got it working by setting the boot folder on the Windows partition. The whole sequence is as follows:
- Mount the EFI partition to the /efi folder;
- Install ntfs-3g package for ntfs support, mount Windows partition to /mnt/Windows/:
mount /dev/sdxY /mnt/Windows
and make boot directory on it:mkdir /mnt/Windows/boot
; - bind the created folder to boot:
mount --bind /mnt/Windows/boot /boot
; - (optional, yet recommended; needed for system / kernel updates only) add the above to /etc/fstab for persistence, there should be at least 4 mount records: /, /efi, /mnt/Windows, /boot (the latter bound to the boot folder on the previously mounted /mnt/Windows, add bind to its mount options);
- edit /etc/mkinitcpio.conf, section "HOOKS", to have block hook to be right after udev and before filesystems (the kernel modules mentioned above turned out unnecessary, SD/MMC card support is added by the block hook), then make an initrd update:
mkinitcpio -p linux
; - make a GRUB record to UEFI:
grub-install --target=x86_64-efi --efi-directory /efi --boot-directory /boot --bootloader-id=LINUX-SD
; - update GRUB config:
grub-mkconfig -o /boot/grub/grub.cfg
; - reboot and choose the added LINUX-SD boot option (usually F8 or F12, or via BIOS/UEFI; might need an explicit boot record confirmation there).
That should be it. The boot chain is as follows: the UEFI shell executes grubx64.efi binary on the EFI partition, it follows the link to the Windows partition with the boot folder, GRUB loads the initrd environment with the kernel (SD card support becomes enabled at this point), the / (root) partition on the SD card is mounted, and the usual boot process continues thereafter.