[arch-releng] [PATCH]{RFC]Change from UEFI Shell to gummiboot-efi-x86_64 for booting

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Thu Sep 20 23:32:54 EDT 2012


On 09/20/2012 11:28 PM, Gerardo Exequiel Pozzi wrote:
> On 09/15/2012 12:40 PM, Keshav P R wrote:
>> Hi,
>>       In some UEFI systems, startup.nsh does not start and the boot
>> stops at Shell prompt without giving any indication of any error
>> whatsoever. I think instead of relying on UEFI Shell, we should use a
>> proper, simple UEFI boot manager to load EFISTUB kernel in archiso.
>>           So here is a patch replacing UEFI Shell as the primary boot
>> pathway to gummiboot. I have renamed the UEFI Shell binaries and
>> archiso now includes both v1 and v2 shell binaries, accessible via
>> gummiboot menu. Some options present in shell v2 is not present in v1,
>> but v1 works in all firmwares while v2 works only in >=2.3 (spec.
>> version) firmwares.
>>           I have attached the patch. For this support,
>> gummiboot-efi-x86_64 https://aur.archlinux.org/packages.php?ID=62791
>> should be moved to [extra] or [core] repo. Please give your comments.
>>
>> Regards.
>>
>> Keshav
>
> reviewing a more in deep the patch... (next time please attach inline...)
>
>
> +            mkdir -p ${work_dir}/iso/loader/entries
>
> and etc...can not be in ${work_dir}/iso/EFI/loader ? I want to avoid 
> multiple directories on the root.

uggg, no is not possible, it looks at fixed location [#1]

[#1] http://cgit.freedesktop.org/gummiboot/tree/gummiboot.c#n1168

>
>
> +            cp ${work_dir}/iso/EFI/shellx64_v1.efi 
> ${work_dir}/efiboot/EFI/shellx64_v1.efi
> +
> +            # There are plans to support command line options via a 
> config file (not yet in linux-3.3)
>
> such line empty contains spaces, also here...
>
> +            #echo "archisobasedir=${install_dir} 
> archisolabel=${iso_label} initrd=\\EFI\\boot\\archiso.img" > 
> ${work_dir}/efiboot/EFI/boot/linux.conf
> +
>              umount ${work_dir}/efiboot
>
>
> +            # There are plans to support command line options via a 
> config file (not yet in linux-3.3)
>
> and related lines, they are "obsolete" in favor of gummiboot :)
>
>
> you can split this function make_boot_efi() in two, one for 
> efiboot.img and other for /EFI
>
> make_boot_efi() -> steps to build /EFI directory, for usbboot or EFI 
> firmwares that understands iso9660 filesystem.
> make_boot_efiboot() ->  steps to build efiboot.img for "El Torito".
>
>
done ;)

diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index df089d4..f7365a7 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -65,19 +65,17 @@ make_boot() {
      fi
  }

-# Prepare EFI "El Torito" boot image (using Linux >= 3.3 EFI boot stub)
-make_boot_efi() {
+make_efi() {
      if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
          if [[ ${arch} == "x86_64" ]]; then
-            ## Start - UEFI USB

              mkdir -p ${work_dir}/iso/EFI/boot
              cp 
${work_dir}/root-image/boot/efi/EFI/gummiboot/gummibootx64.efi 
${work_dir}/iso/EFI/boot/bootx64.efi

              mkdir -p ${work_dir}/iso/loader/entries
-            cp ${script_path}/efiboot/loader/loader.conf 
${work_dir}/iso/loader/loader.conf
-            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf 
${work_dir}/iso/loader/entries/uefi-shell-v2-x86_64.conf
-            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf 
${work_dir}/iso/loader/entries/uefi-shell-v1-x86_64.conf
+            cp ${script_path}/efiboot/loader/loader.conf 
${work_dir}/iso/loader/
+            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf 
${work_dir}/iso/loader/entries/
+            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf 
${work_dir}/iso/loader/entries/

              sed "s|%ARCHISO_LABEL%|${iso_label}|g;
                   s|%INSTALL_DIR%|${install_dir}|g" 
${script_path}/efiboot/loader/entries/archiso-x86_64-usb.conf > 
${work_dir}/iso/loader/entries/archiso-x86_64.conf
@@ -87,9 +85,14 @@ make_boot_efi() {
              # EFI Shell 1.0 for non UEFI 2.3+ ( 
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell )
              wget -O ${work_dir}/iso/EFI/shellx64_v1.efi 
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi

-            ## End - UEFI USB
+        fi
+        : > ${work_dir}/build.${FUNCNAME}
+    fi
+}

-            ## Start - UEFI CD
+make_efiboot() {
+    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
@@ -106,24 +109,18 @@ make_boot_efi() {
              cp 
${work_dir}/root-image/boot/efi/EFI/gummiboot/gummibootx64.efi 
${work_dir}/efiboot/EFI/boot/bootx64.efi

              mkdir -p ${work_dir}/efiboot/loader/entries
-            cp ${script_path}/efiboot/loader/loader.conf 
${work_dir}/efiboot/loader/loader.conf
-            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf 
${work_dir}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf
-            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf 
${work_dir}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf
+            cp ${script_path}/efiboot/loader/loader.conf 
${work_dir}/efiboot/loader/
+            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v2-x86_64.conf 
${work_dir}/efiboot/loader/entries/
+            cp 
${script_path}/efiboot/loader/entries/uefi-shell-v1-x86_64.conf 
${work_dir}/efiboot/loader/entries/

              sed "s|%ARCHISO_LABEL%|${iso_label}|g;
                   s|%INSTALL_DIR%|${install_dir}|g" 
${script_path}/efiboot/loader/entries/archiso-x86_64-cd.conf > 
${work_dir}/efiboot/loader/entries/archiso-x86_64.conf

-            cp ${work_dir}/iso/EFI/shellx64_v2.efi 
${work_dir}/efiboot/EFI/shellx64_v2.efi
-            cp ${work_dir}/iso/EFI/shellx64_v1.efi 
${work_dir}/efiboot/EFI/shellx64_v1.efi
-
-            # There are plans to support command line options via a 
config file (not yet in linux-3.3)
-            #cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz 
${work_dir}/efiboot/EFI/boot/bootx64.efi
-            #cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img 
${work_dir}/efiboot/EFI/boot/archiso.img
-            #echo "archisobasedir=${install_dir} 
archisolabel=${iso_label} initrd=\\EFI\\boot\\archiso.img" > 
${work_dir}/efiboot/EFI/boot/linux.conf
-
+            cp ${work_dir}/iso/EFI/shellx64_v2.efi ${work_dir}/efiboot/EFI/
+            cp ${work_dir}/iso/EFI/shellx64_v1.efi ${work_dir}/efiboot/EFI/
+
              umount ${work_dir}/efiboot

-            ## End - UEFI CD
          fi
          : > ${work_dir}/build.${FUNCNAME}
      fi
@@ -293,7 +290,8 @@ make_common_single() {
      make_packages
      make_setup_mkinitcpio
      make_boot
-    make_boot_efi
+    make_efi
+    make_efiboot
      make_syslinux
      make_isolinux
      make_customize_root_image
-- 
1.7.12.1


-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1



More information about the arch-releng mailing list