FS#53182 - Support for booting the 64-bit official installation image on 32-bit UEFI (i386-efi) only systems.
Attached to Project:
Release Engineering
Opened by Mortan (Mortan1961) - Monday, 06 March 2017, 17:40 GMT
Last edited by Gerardo Exequiel Pozzi (djgera) - Saturday, 23 June 2018, 22:52 GMT
Opened by Mortan (Mortan1961) - Monday, 06 March 2017, 17:40 GMT
Last edited by Gerardo Exequiel Pozzi (djgera) - Saturday, 23 June 2018, 22:52 GMT
|
Details
To preface: This report has nothing to do with the now
deprecated i686 architecture.
Some background: A core concept of the UEFI Specification is that the OS and firmware architecture need to match. For most non-Intel processors, this isn’t a big deal since they only have one architecture. The x86 compatible processor is a bit different, and can switch into various 16/32/64 bit modes for application compatibility. Because most Intel platforms support both 32-bit & 64-bit architecture, along with old school Intel 8086/80286 16-bit instructions, the UEFI firmware on these platforms can be compiled in IA32 or x64 mode. As tablets and cheaper laptops came into the market, more manufacturers started to ship Microsoft Windows 32-bit version. A 64-bit OS does theoretically perform better than a 32-bit OS, but those performance gains are tied to larger amounts of memory (over 4GB). The 64-bit version of Windows takes up more disk space, thanks to larger binaries and any underlying 64/32-bit translation layers. This means your Black Friday special purchase with 2GB of RAM and 16-32GB of internal flash storage doesn't see any 64-bit architecture benefits. For Intel, it was easy to support, just recompile the UEFI C-code in IA32 mode instead of x64. That means that 32-bit UEFI systems can't execute 64-bit code in firmware, even if the CPU is capable of it. A 64-bit OS can only boot on 32-bit UEFI if it has very ugly compatibility hacks, including having to rewrite structures and register state every time it makes a UEFI call. The Linux kernel since version 3.15 has support for this mixed EFI mode, however it is necessary for operating systems to ship boot loaders for x86_64-efi and i386-efi targets in addition to i386-pc for BIOS systems. The current state of affairs: Arch ships Linux with CONFIG_EFI_MIXED=y by default and it is therefore possible to enable i386-efi booting from an existing installation, but the official installation image only can boot from x86_64-efi and i386-pc. The official installation image will not even show up on the boot list on these i386-efi systems and because they do not support i386-pc it is impossible boot the installation image on these systems even though they are perfectly capable of running Arch. What needs to be done: An i386-efi bootloader that supports the EFI handover protocol (no EFI boot stub) must be installed to '/EFI/boot/bootia32.efi' on the official installation image. I am unsure on how the official installation image is built and what boot loaders it currently uses, but on an existing installation I was able to boot from one of these i386-efi only computers with: pacman -S --needed dosfstools efibootmgr grub intel-ucode grub-install --target=i386-efi --efi-directory=/boot --removable grub-mkconfig -o /boot/grub/grub.cfg So a starting point for booting from everything with official installation image's file system layout might be: pacman -S --needed dosfstools efibootmgr grub intel-ucode grub-install --target=x86_64-efi --efi-directory=/ --removable grub-install --target=i386-efi --efi-directory=/ --removable grub-install --target=i386-pc /dev/sda grub-mkconfig -o /grub/grub.cfg It would also help to update the Installation Guide to inform people on how to support booting installations from everything. Many other operating systems, like Debian, have supported booting from these i386-efi only systems for a while now in their standard stable official installation images. I really hope that this simple fix can be applied to address this critical issue so a that large class of devices can support installing Arch. If necessary, I can test installation images on real i386-efi only hardware to ensure that they work. Thanks for your consideration and work. |
This task depends upon
Closed by Gerardo Exequiel Pozzi (djgera)
Saturday, 23 June 2018, 22:52 GMT
Reason for closing: Won't implement
Saturday, 23 June 2018, 22:52 GMT
Reason for closing: Won't implement
* syslinux works. I do not like at all grub, too much complex.
* adding more boot methods does not break systems that currently works.
At the end we have, syslinux (bios), systemd-boot (efi-64), syslinux (efi-32)...
PS: x86-32 is ugly beyond 1GiB of physical memory, not 4GiB. Virtual address space should be >>> than physical address space.
Only tested on qemu with ovmf with bad results:
in cd-rom, qemu just crash, in "hybrid", freeze.
sudo pacman -S archiso
cp -r /usr/share/archiso/configs configs
curl -JLO https://bugs.archlinux.org/task/53182?getfile=15068
git apply 0001-configs-releng-Add-32-bit-EFI-support.patch
sudo ./configs/releng/build.sh -v
On real hardware it did show up in the UEFI boot menu and did boot a syslinux boot menu, however upon selecting the only option "Boot Arch Linux (x86_64)" it failed with "Loading /EFI/archiso/vmlinuz... failed: No such file or directory"
Also, sorry for incorrectly marking it as critical. The wiki at https://wiki.archlinux.org/index.php/Reporting_bug_guidelines#Severity says "Critical - ...severe boot failure that is likely to affect more than just you..." so I thought it applied.
Ok, I made a mistake, vmlinuz in efiboot.img for "el torito" (cdrom) is called vmlinuz.efi. So if you edit the cmdline (e key), will work.
I you can also test usb (hybrid) mode will be great.
New patch attached.
cp -r /usr/share/archiso/configs .
curl -JLO https://bugs.archlinux.org/task/53182?getfile=15071
git apply 0001-configs-releng-Add-32-bit-EFI-support.patch
sudo ./configs/releng/build.sh -v
Booting it prints:
Loading /EFI/archiso/vmlinuz.efi... ok
Loading /EFI/archiso/intel_ucode.img...ok
Loading /EFI/archiso/archiso.img...ok
Then it does nothing.
To clarify, I have only tried booting these images from a USB flash drive.
PS: I will try to test using syslinux build from git.
mount /dev/sdXY /mnt
grub-install --target i386-efi --efi-directory /mnt --boot-directory /mnt --removable
You can even run grub-install again appropriately with other targets to make the drive bootable on 64-bit UEFI and BIOS.
Then put the arch iso image file under /mnt and write a grub.cfg to /mnt/grub manually. See the attached one for reference.
This way you can even use the remaining space of the drive.
The hook/method is documented here: https://git.archlinux.org/archiso.git/tree/docs