lorax: preliminary EFI support

This commit is contained in:
Marek Marczykowski-Górecki 2015-03-24 00:31:22 +01:00
parent 5796c78979
commit ff30f25718
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
4 changed files with 46 additions and 32 deletions

View File

@ -13,19 +13,18 @@ set gfxpayload=keep
insmod gzio insmod gzio
insmod part_gpt insmod part_gpt
insmod ext2 insmod ext2
insmod chain
set timeout=5 set timeout=5
### END /etc/grub.d/00_header ### ### END /etc/grub.d/00_header ###
search --no-floppy --set=root -l '@ISOLABEL@' search --no-floppy --set=root -l '@ISOLABEL@'
### BEGIN /etc/grub.d/10_linux ### menuentry 'Test media and install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os {
menuentry '@PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { chainloader @EFIDIR@/xen-check.efi
linuxefi @KERNELPATH@ @ROOT@ }
initrdefi @INITRDPATH@
} menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os {
menuentry 'Test this media & start @PRODUCT@' --class fedora --class gnu-linux --class gnu --class os { chainloader @EFIDIR@/xen.efi
linuxefi @KERNELPATH@ @ROOT@ quiet rd.live.check
initrdefi @INITRDPATH@
} }

View File

@ -0,0 +1,7 @@
[global]
default=qubes
[qubes]
options=loglvl=all
kernel=vmlinuz @ROOT@ rd.live.check
ramdisk=initrd.img

View File

@ -1,5 +1,6 @@
<%page args="configdir, KERNELDIR, efiarch, isolabel"/> <%page args="configdir, KERNELDIR, efiarch, isolabel"/>
<% <%
from string import lower
EFIBOOTDIR="EFI/BOOT" EFIBOOTDIR="EFI/BOOT"
APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns"
APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol"
@ -8,12 +9,14 @@ APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol"
mkdir ${EFIBOOTDIR} mkdir ${EFIBOOTDIR}
mkdir ${EFIBOOTDIR}/fonts/ mkdir ${EFIBOOTDIR}/fonts/
install boot/efi/EFI/*/shim.efi ${EFIBOOTDIR}/BOOT${efiarch}.efi install boot/efi/EFI/*/shim.efi ${EFIBOOTDIR}/BOOT${efiarch}.efi
install boot/efi/EFI/*/xen*.efi ${EFIBOOTDIR}/xen-check.efi
install boot/efi/EFI/*/xen*.efi ${EFIBOOTDIR}/xen.efi
install boot/efi/EFI/*/MokManager.efi ${EFIBOOTDIR}/ install boot/efi/EFI/*/MokManager.efi ${EFIBOOTDIR}/
install boot/efi/EFI/*/gcdx64.efi ${EFIBOOTDIR}/grubx64.efi install boot/efi/EFI/*/gcd${efiarch|lower}.efi ${EFIBOOTDIR}/grub${efiarch|lower}.efi
install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/ install boot/efi/EFI/*/fonts/unicode.pf2 ${EFIBOOTDIR}/fonts/
## actually make the EFI images ## actually make the EFI images
${make_efiboot("images/efiboot.img")} ${make_efiboot("images/efiboot.img", include_kernel=True)}
%if domacboot: %if domacboot:
${make_efiboot("images/macboot.img", imgtype="apple")} ${make_efiboot("images/macboot.img", imgtype="apple")}
%endif %endif
@ -23,7 +26,9 @@ ${make_efiboot("images/efiboot.img")}
<% <%
kdir = EFIBOOTDIR if include_kernel else KERNELDIR kdir = EFIBOOTDIR if include_kernel else KERNELDIR
eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) eficonf = "%s/grub.cfg" % (EFIBOOTDIR, )
args = "--label=ANACONDA" xenconf = "%s/xen-check.cfg" % (EFIBOOTDIR, )
xenconf_no_check = "%s/xen.cfg" % (EFIBOOTDIR, )
args = "--label=ANACONDA --debug"
if disk: args += " --disk" if disk: args += " --disk"
if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version) if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version)
%> %>
@ -32,23 +37,26 @@ ${make_efiboot("images/efiboot.img")}
copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR}
%endif %endif
install ${configdir}/grub2-efi.cfg ${eficonf} install ${configdir}/grub2-efi.cfg ${eficonf}
install ${configdir}/xen-efi.cfg ${xenconf}
replace @PRODUCT@ '${product.name}' ${eficonf} replace @PRODUCT@ '${product.name}' ${eficonf}
replace @VERSION@ ${product.version} ${eficonf} replace @VERSION@ ${product.version} ${eficonf}
replace @KERNELNAME@ vmlinuz ${eficonf} replace @KERNELNAME@ vmlinuz ${eficonf}
replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf}
replace @KERNELPATH@ /${kdir}/vmlinuz ${xenconf}
replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf}
replace @EFIDIR@ /${EFIBOOTDIR} ${eficonf}
replace @ISOLABEL@ '${isolabel}' ${eficonf} replace @ISOLABEL@ '${isolabel}' ${eficonf}
%if disk: %if disk:
replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf} replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf}
replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${xenconf}
%else: %else:
replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf} replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf}
replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${xenconf}
%endif %endif
copy ${xenconf} ${xenconf_no_check}
replace rd.live.check '' ${xenconf_no_check}
%if efiarch == 'IA32': %if efiarch == 'IA32':
copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf
%endif %endif
runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img}
%if include_kernel:
remove ${EFIBOOTDIR}/vmlinuz
remove ${EFIBOOTDIR}/initrd.img
%endif
</%def> </%def>

View File

@ -90,23 +90,23 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
%endif %endif
%endif %endif
## ## WHeeeeeeee, EFI. ## WHeeeeeeee, EFI.
## ## We could remove the basearch restriction someday.. ## We could remove the basearch restriction someday..
## <% efiargs=""; efigraft=""; efihybrid="" %> <% efiargs=""; efigraft=""; efihybrid="" %>
## %if exists("boot/efi/EFI/fedora/gcdx64.efi") and basearch != 'i386': %if exists("boot/efi/EFI/*/gcdx64.efi") and basearch != 'i386':
## <% <%
## efiarch = 'X64' if basearch=='x86_64' else 'IA32' efiarch = 'X64' if basearch=='x86_64' else 'IA32'
## efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
## images = ["images/efiboot.img"] images = ["images/efiboot.img"]
## if domacboot: if domacboot:
## images.append("images/macboot.img") images.append("images/macboot.img")
## for img in images: for img in images:
## efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
## efigraft += " {0}={1}/{0}".format(img,outroot) efigraft += " {0}={1}/{0}".format(img,outroot)
## efihybrid = "--uefi --mac" if domacboot else "--uefi" efihybrid = "--uefi --mac" if domacboot else "--uefi"
## %> %>
## <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/> <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch=efiarch, isolabel=isolabel"/>
## %endif %endif
## ## make boot.iso ## ## make boot.iso
## runcmd mkisofs -o ${outroot}/images/boot.iso \ ## runcmd mkisofs -o ${outroot}/images/boot.iso \