[arch-releng] [DRAFT][RFC][PATCH][archiso] Add UEFI boot support via Linux >= 3.3 EFI boot stub.
Keshav P R
the.ridikulus.rat at gmail.com
Tue Mar 20 12:13:11 EDT 2012
On Tue, Mar 20, 2012 at 21:29, Gerardo Exequiel Pozzi
<vmlinuz386 at yahoo.com.ar> wrote:
> Support is only added to x86_64. This only works via (U)EFI shell. Boot with:
>
> fs0:\EFI\linux\vmlinuz.efi archisolabel=ARCH_201203 initrd=\EFI\linux\archiso.img
>
> There are plans to support command line options via a config file (not yet in linux-3.3),
> in such case vmlinuz.efi can be renamed to bootia64.efi and placed to \EFI\boot to automatic boot.
>
> ---
> archiso/mkarchiso | 11 ++++++++++-
> configs/releng/build.sh | 25 +++++++++++++++++++++++++
> 2 files changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/archiso/mkarchiso b/archiso/mkarchiso
> index ad88b0b..208f7b6 100755
> --- a/archiso/mkarchiso
> +++ b/archiso/mkarchiso
> @@ -380,6 +380,8 @@ command_checksum () {
>
> # Create an ISO9660 filesystem from "iso" directory.
> command_iso () {
> + local _iso_efi_boot_args
> +
> if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then
> _msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1
> fi
> @@ -387,6 +389,12 @@ command_iso () {
> _msg_error "The file '${work_dir}/iso/isolinux/isohdpfx.bin' does not exist." 1
> fi
>
> + if [[ -d "${work_dir}/iso/EFI" ]]; then
> + _iso_efi_boot_args="-eltorito-alt-boot --efi-boot EFI/archiso/archiso.fat -no-emul-boot"
> + else
> + _iso_efi_boot_args=""
> + fi
> +
> _show_config iso
>
> if _is_directory_changed "${work_dir}/iso" "${out_dir}/${img_name}"; then
> @@ -398,9 +406,10 @@ command_iso () {
> fi
> xorriso -as mkisofs ${_qflag} -r -l \
> -b isolinux/isolinux.bin -c isolinux/boot.cat \
> - -iso-level 3 \
> -no-emul-boot -boot-load-size 4 -boot-info-table \
> + ${_iso_efi_boot_args} \
> -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \
> + -iso-level 3 \
> -p "prepared by mkarchiso" \
> -publisher "${iso_publisher}" \
> -A "${iso_application}" \
> diff --git a/configs/releng/build.sh b/configs/releng/build.sh
> index 2faf210..f4ca11e 100755
> --- a/configs/releng/build.sh
> +++ b/configs/releng/build.sh
> @@ -58,6 +58,29 @@ make_boot() {
> fi
> }
>
> +# Prepare /EFI (using linux EFI boot stub)
> +make_boot_efi() {
> + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
> + if [[ ${arch} == "x86_64" ]]; then
> + mkdir -p ${work_dir}/iso/EFI/linux
> + cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/iso/EFI/linux/vmlinuz.efi
> + cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/iso/EFI/linux/archiso.img
Why duplicate the files? /EFI/linux/archiso.img in this case. You can always use
fs0:\EFI\linux\vmlinuz.efi archisolabel=ARCH_201203
initrd=\boot\x86_64\archiso.img
> + # There are plans to support command line options via a config file (not yet in linux-3.3)
> + # echo "archisolabel=${iso_label} initrd=\EFI\linux\archiso.img" | iconv -f ascii -t ucs2 > ${work_dir}/iso/EFI/linux/vmlinuz.conf
> + mkdir -p ${work_dir}/iso/EFI/archiso
> + mkdir -p ${work_dir}/fat
> + dd of=${work_dir}/iso/EFI/archiso/archiso.fat bs=1 seek=32M count=0
> + mkfs.vfat ${work_dir}/iso/EFI/archiso/archiso.fat
> + mount ${work_dir}/iso/EFI/archiso/archiso.fat ${work_dir}/fat/
> + mkdir -p ${work_dir}/fat/EFI/linux
> + cp ${work_dir}/iso/EFI/linux/vmlinuz.efi ${work_dir}/fat/EFI/linux
> + cp ${work_dir}/iso/EFI/linux/archiso.img ${work_dir}/fat/EFI/linux
> + # cp ${work_dir}/iso/EFI/linux/vmlinuz.conf ${work_dir}/fat/EFI/linux
> + umount ${work_dir}/fat/
> + fi
> + fi
> +}
> +
This is going to increase the iso size like hell. Having the kernel
and initrd files within a FAT image inside the iso is not a good idea.
A 32 MB fat image, come on. I know this is required for CD booting,
but this is not a good idea with efistub efilinux or elilo etc. For
USB booting you can just have the files in the iso itself, wherein the
user simply extract the iso in a FAT32 USB and boots from it. I say
drop support for iso booting via this fat fs image and support uefi
boot only in case of USBs.
Regards.
Keshav
More information about the arch-releng
mailing list