[RFC,v2,configs/releng] Add 32-bit EFI support
diff mbox

Message ID 20170307155020.2204-1-vmlinuz386@gmail.com
State New
Headers show

Commit Message

Ian Li via arch-releng March 7, 2017, 3:50 p.m. UTC
Support booting 64-bit Linux, from 32-bit EFI firmware.

Only tested on qemu with ovmf, does not work at all.
cdrom mode: qemu stop with bad instruction address
hybrid mode: qemu just freeze at tianocore logo with a upper pixed dot.

---
 configs/releng/build.sh                         | 24 ++++++++++++++++++++++++
 configs/releng/efiboot/syslinux/archiso-cd.cfg  |  7 +++++++
 configs/releng/efiboot/syslinux/archiso-usb.cfg |  7 +++++++
 configs/releng/efiboot/syslinux/syslinux.cfg    |  6 ++++++
 4 files changed, 44 insertions(+)
 create mode 100644 configs/releng/efiboot/syslinux/archiso-cd.cfg
 create mode 100644 configs/releng/efiboot/syslinux/archiso-usb.cfg
 create mode 100644 configs/releng/efiboot/syslinux/syslinux.cfg

Comments

Thomas Bächler March 10, 2017, 6:59 p.m. UTC | #1
Am 07.03.2017 um 16:50 schrieb Gerardo Exequiel Pozzi via arch-releng:
> Support booting 64-bit Linux, from 32-bit EFI firmware.
> 
> Only tested on qemu with ovmf, does not work at all.
> cdrom mode: qemu stop with bad instruction address
> hybrid mode: qemu just freeze at tianocore logo with a upper pixed dot.

Are you sure you want to use syslinux for this? I tried this once with
efilinux and had some success, but some problems as well. I am just
asking because my experience with syslinux and EFI was very bad.

Is this even a use case? What kind of machines come with 32 bit EFI?
beest March 10, 2017, 7:14 p.m. UTC | #2
On Fri, Mar 10, 2017 at 07:59:54PM +0100, Thomas Bächler wrote:
> Am 07.03.2017 um 16:50 schrieb Gerardo Exequiel Pozzi via arch-releng:
> > Support booting 64-bit Linux, from 32-bit EFI firmware.
> > 
> > Only tested on qemu with ovmf, does not work at all.
> > cdrom mode: qemu stop with bad instruction address
> > hybrid mode: qemu just freeze at tianocore logo with a upper pixed dot.
> 
> Are you sure you want to use syslinux for this? I tried this once with
> efilinux and had some success, but some problems as well. I am just
> asking because my experience with syslinux and EFI was very bad.
> 
> Is this even a use case? What kind of machines come with 32 bit EFI?
> 
> 
Atoms, some old Acer and Asus machines, early Intel Macs. I have a C2D
iMac where the only distro installer that will work from EFI (without
extra work) is Debian's. Also note that booting 64-bit Linux kernels
from a 32-bit EFI is only something that's happened in the past couple
of years, if I recall.
Ian Li via arch-releng March 11, 2017, 1:06 p.m. UTC | #3
On 03/10/17 15:59, Thomas Bächler wrote:
> Am 07.03.2017 um 16:50 schrieb Gerardo Exequiel Pozzi via arch-releng:
>> Support booting 64-bit Linux, from 32-bit EFI firmware.
>>
>> Only tested on qemu with ovmf, does not work at all.
>> cdrom mode: qemu stop with bad instruction address
>> hybrid mode: qemu just freeze at tianocore logo with a upper pixed dot.
> 
> Are you sure you want to use syslinux for this? I tried this once with
> efilinux and had some success, but some problems as well. I am just
> asking because my experience with syslinux and EFI was very bad.
> 
> Is this even a use case? What kind of machines come with 32 bit EFI?
> 
> 

Hi Thomas,

I do not like it, indeed I denied some past requests in our bugtracker,
because was a extreme corner case. But seems to be more common these
days, so lets bring a opportunity.

I want to first try syslinux since is the "natural" choice for ArchISO,
but actually does not work, and I opened a ticket in syslinux bugtracker
[#1] "[Bug 75] [EFI-32] booting "mixed" (x86_64) Linux 4.9/4.10
hang/reset (4.4 is OK)"

efilinux is not updated since long time, who knows if build with current
gnu-efi.

The last last last... option will be grub if a found a simple way to use it.

[#1] https://bugzilla.syslinux.org/show_bug.cgi?id=75

Patch
diff mbox

diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 72b1e3f..17b929a 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -164,6 +164,18 @@  make_efi() {
     curl -o ${work_dir}/iso/EFI/shellx64_v2.efi https://raw.githubusercontent.com/tianocore/edk2/master/ShellBinPkg/UefiShell/X64/Shell.efi
     # EFI Shell 1.0 for non UEFI 2.3+
     curl -o ${work_dir}/iso/EFI/shellx64_v1.efi https://raw.githubusercontent.com/tianocore/edk2/master/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
+
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/syslinux.efi ${work_dir}/iso/EFI/boot/bootia32.efi
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/ldlinux.e32 ${work_dir}/iso/EFI/boot/
+    cp ${script_path}/efiboot/syslinux/syslinux.cfg ${work_dir}/iso/EFI/boot/
+
+    mkdir ${work_dir}/iso/EFI/syslinux
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/libutil.c32 ${work_dir}/iso/EFI/syslinux/
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/menu.c32 ${work_dir}/iso/EFI/syslinux/
+
+    sed "s|%ARCHISO_LABEL%|${iso_label}|g;
+         s|%INSTALL_DIR%|${install_dir}|g" \
+        ${script_path}/efiboot/syslinux/archiso-usb.cfg > ${work_dir}/iso/EFI/syslinux/archiso.cfg
 }
 
 # Prepare efiboot.img::/EFI for "El Torito" EFI boot mode
@@ -199,6 +211,18 @@  make_efiboot() {
     cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/
     cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/
 
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/syslinux.efi ${work_dir}/efiboot/EFI/boot/bootia32.efi
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/ldlinux.e32 ${work_dir}/efiboot/EFI/boot/
+    cp ${script_path}/efiboot/syslinux/syslinux.cfg ${work_dir}/efiboot/EFI/boot/
+
+    mkdir ${work_dir}/efiboot/EFI/syslinux
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/libutil.c32 ${work_dir}/efiboot/EFI/syslinux/
+    cp ${work_dir}/x86_64/airootfs/usr/lib/syslinux/efi32/menu.c32 ${work_dir}/efiboot/EFI/syslinux/
+
+    sed "s|%ARCHISO_LABEL%|${iso_label}|g;
+         s|%INSTALL_DIR%|${install_dir}|g" \
+        ${script_path}/efiboot/syslinux/archiso-cd.cfg > ${work_dir}/efiboot/EFI/syslinux/archiso.cfg
+
     umount -d ${work_dir}/efiboot
 }
 
diff --git a/configs/releng/efiboot/syslinux/archiso-cd.cfg b/configs/releng/efiboot/syslinux/archiso-cd.cfg
new file mode 100644
index 0000000..aebe289
--- /dev/null
+++ b/configs/releng/efiboot/syslinux/archiso-cd.cfg
@@ -0,0 +1,7 @@ 
+UI menu.c32
+
+LABEL arch64
+MENU LABEL Boot Arch Linux (x86_64)
+LINUX /EFI/archiso/vmlinuz
+INITRD /EFI/archiso/intel_ucode.img,/EFI/archiso/archiso.img
+APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL%
diff --git a/configs/releng/efiboot/syslinux/archiso-usb.cfg b/configs/releng/efiboot/syslinux/archiso-usb.cfg
new file mode 100644
index 0000000..03df5ca
--- /dev/null
+++ b/configs/releng/efiboot/syslinux/archiso-usb.cfg
@@ -0,0 +1,7 @@ 
+UI menu.c32
+
+LABEL arch64
+MENU LABEL Boot Arch Linux (x86_64)
+LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz
+INITRD /%INSTALL_DIR%/boot/intel_ucode.img,/%INSTALL_DIR%/boot/x86_64/archiso.img
+APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL%
diff --git a/configs/releng/efiboot/syslinux/syslinux.cfg b/configs/releng/efiboot/syslinux/syslinux.cfg
new file mode 100644
index 0000000..77b6407
--- /dev/null
+++ b/configs/releng/efiboot/syslinux/syslinux.cfg
@@ -0,0 +1,6 @@ 
+PATH /EFI/syslinux/
+DEFAULT loadconfig
+
+LABEL loadconfig
+  CONFIG /EFI/syslinux/archiso.cfg
+  APPEND /EFI/