Installing on Asus T100TA - how to get systemd-boot to work with IA32?

I’ve got this old Windows tablet lying around that has 64-bit CPU, but 32-bit UEFI.

A thread on Manjaro forums claimed that Ventoy would work out of the box with IA 32-bit EFI, but for me it didn’t boot.

So I turned to an old Ubuntu forums thread.

Modifying the old steps a bit, I got a booting live USB:

umount /dev/sdx # Some (most?) distros mount it automagically, but we need format it later on
fdisk /dev/sdx
o # Erase everything in the USB
n # Create new partition table
p # Primary partition
1 # Partition number
# Don’t type that literally!
# The partition get’s all disk space
t # Change the partition type
0b # FAT32 partition type
a # Make partition bootable
w # Write everything and exit

Remove and reinsert the USB, then…

mkdosfs -F32 /dev/sdx1 # Don’t forget the “1”!
mlabel -i /dev/sdx1 ::THE_LABEL # This needs to match archisolabel in the loader/entries/archiso-x86_64-linux.conf file found inside the ISO
mkdir /mnt/usb # Or use any other mountpoint you like
mount /dev/sdx1 /mnt/usb
7z x -o/mnt/usb /path/to/MyDistro.iso # No space should go between “-o” and the path, BTW.

mkdir -p /mnt/usb/EFI/boot
cp /path/to/bootia32.efi /mnt/usb/EFI/boot

bootia32.efi can be acquired from https://github.com/hirotakaster/baytail-bootia32.efi/blob/master/bootia32.efi

To examine the contents of loader/entries/archiso-x86_64-linux.conf I mounted the ISO with:
sudo mount /path/to/Endeavouros_Cassini_Nova-03-2023_R3.iso isomount -o loop

Booting from the live USB was a bit of a pain as I needed to always manually define the linux and initrd in the GRUB shell. Fortunately tab completion works for paths.

set root=(hd0,msdos1)
linux /arch/boot/x86_64/vmlinuz-linux archisobasedir=arch archisolabel=ARCH_LABEL cow_spacesize=10G copytoram=n module_blacklist=pcspkr i915.modeset=1 # archisolabel same as in loader/entries/archiso-x86_64-linux.conf
initrd /arch/boot/intel-ucode.img
initrd /arch/boot/x86_64/initramfs-linux.img
boot

I could install EndeavourOS just fine (picking systemd-boot), but there was a catch: no boot entry was created. Even though EFI mixed mode support was added to systemd-boot in 2022, it seems Arch Linux only started including IA32 in builds a couple of weeks ago. So I booted again from the live USB, was able to swap in an ethernet dongle to the only USB-A port and got network.

I grabbed the bootia32.efi from GitHub and put it where systemd-boot would look for it:

sudo mount /dev/mmcblk2p2 /mnt
sudo mount /dev/mmcblk2p1 /mnt/boot

wget https://raw.githubusercontent.com/hirotakaster/baytail-bootia32.efi/master/bootia32.efi /mnt/home/user

sudo arch-chroot /mnt
cp /home/user/bootia32.efi /usr/lib/systemd/boot/efi/systemd-bootia32.efi

I had to add to /boot/loader/loader.conf the line random-seed-mode always before it agreed to install with bootctl install.

I could see the available boot entry with bootctl list. Sadly, when booting I was greeted with a GRUB shell. With ls I could see where everything was located and I tried to manually set linux and initrd, but booting failed.

Any ideas? Should I just wait until EndeavourOS ISO gets a new rebuild with (hopefully) systemd-boot with IA32 UEFI binaries?