commit bf8661a9b080896c4881699717ce8cbceac108d6
Author: Keshav P R <the.ridikulus.rat@gmail.com>
Date:   Thu Apr 5 10:33:20 2012 +0530

    [configs/releng] Search in all existing UEFI FS mountpoints for archiso efistub kernel file
    
    There is no guarantee that the efistub kernel will always be in fs0:
    (similar to the case inside linux OS where the sda, sdb confusion exists,
    hence the need for UUIDs), especially when USB (instead os CD/ISO) is
    used for booting.
    
    Hence loop through all possible fs mountpoints (in UEFI) in startup.nsh
    and try to launch the first mountpoint that contains the archiso files.
    
    Cd's into the fs%m:\EFI\archiso directory also may remove future issues
    with efistub's linux.conf where the efistub might have problems
    identifying the directory from which the kernel was launched.
    
    Also add an helpful echo message showing the user the UEFI PATH to the
    archiso kernel file being launched by startup.nsh .
    
    Hopefully this should work in both CD and USB. Tested in Tianocore
    UDK/EDK2 DuetPkg X64 UEFI 2.3.1 firmware with EdkShellBinPkg's Shell.

diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 37c5ae0..fb1ea6d 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -86,8 +86,19 @@ make_boot_efi() {
             wget -O ${work_dir}/efiboot/EFI/boot/bootx64.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
 
             # Add an EFI shell script for automatic boot if ESC-key is not pressed within 5 seconds timeout.
-            echo "fs0:" > ${work_dir}/efiboot/EFI/boot/startup.nsh
-            echo "\EFI\archiso\vmlinuz.efi archisolabel=${iso_label} initrd=\EFI\archiso\archiso.img" >> ${work_dir}/efiboot/EFI/boot/startup.nsh
+            cat << EOF > "${work_dir}/efiboot/EFI/boot/startup.nsh"
+echo -off
+
+for %m in 0 1 2 3 4 5 6 7 8 9
+    if exist fs%m:\EFI\archiso\vmlinuz.efi then
+        fs%m:
+        cd fs%m:\EFI\archiso
+        echo "Launching Arch Linux ISO Kernel fs%m:\EFI\archiso\vmlinuz.efi"
+        vmlinuz.efi archisolabel=${iso_label} initrd=\EFI\archiso\archiso.img
+    endif
+endfor
+
+EOF
 
             umount ${work_dir}/efiboot
         fi
