[arch-releng] [RFC] [PATCH] [configs/releng] Add UEFI boot support via linux >= 3.3 EFI boot stub on x86_64

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Sun Apr 1 19:37:15 EDT 2012


This only works via EFI shell because we need to pass boot params to kernel.

An aditional EFI shell is provided with an startup script for automatic booting.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
---
 README                  |    3 +++
 configs/releng/build.sh |   24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/README b/README
index 57c87e3..711e51d 100644
--- a/README
+++ b/README
@@ -153,6 +153,9 @@ if nothing is specified on command line.
  + squashfs-tools          for mksquashfs
  + libisoburn              for xorriso
 
+** For configs/releng build.sh needs theses packages (build host):
+ + dosfstools              for mkfs.vfat
+
 ** For these hooks needs these packages (on target root-image)
 * archiso
  + (none)
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 2faf210..c041953 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -58,6 +58,29 @@ make_boot() {
     fi
 }
 
+# Prepare EFI "El Torito" boot image (using Linux >= 3.3 EFI boot stub)
+make_boot_efi() {
+    if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
+        if [[ ${arch} == "x86_64" ]]; then
+            mkdir -p ${work_dir}/iso/EFI/archiso
+            dd of=${work_dir}/iso/EFI/archiso/efiboot.img bs=1 seek=20M count=0
+            mkfs.vfat ${work_dir}/iso/EFI/archiso/efiboot.img
+            mkdir -p ${work_dir}/efiboot
+            mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot
+            mkdir -p ${work_dir}/efiboot/EFI/archiso
+            cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi
+            cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img
+            # Always provide an EFI shell for systems without it (most real hardware for home-end-users?).
+            mkdir -p ${work_dir}/efiboot/EFI/boot
+            wget -O ${work_dir}/efiboot/EFI/boot/bootx64.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi
+            # Added an EFI shell script for automatic boot if ESC-key is not pressed.
+            echo "\EFI\archiso\vmlinuz.efi initrd=\EFI\archiso\archiso.img archisolabel=${iso_label}" > ${work_dir}/efiboot/EFI/boot/startup.nsh
+            umount ${work_dir}/efiboot
+        fi
+        : > ${work_dir}/build.${FUNCNAME}
+    fi
+}
+
 # Prepare /${install_dir}/boot/syslinux
 make_syslinux() {
     if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
@@ -259,6 +282,7 @@ make_common_single() {
     make_packages
     make_setup_mkinitcpio
     make_boot
+    make_boot_efi
     make_syslinux
     make_isolinux
     make_customize_root_image
-- 
1.7.9.5



More information about the arch-releng mailing list