1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 06:40:31 +00:00

Merge pull request #1263 from deitch/efi-live-boot-support

Add EFI live boot support
This commit is contained in:
Darren Shepherd
2016-10-10 10:23:50 -07:00
committed by GitHub
5 changed files with 91 additions and 1 deletions

14
scripts/grub.cfg Normal file
View File

@@ -0,0 +1,14 @@
set default="0"
set timeout=10
set gfxmode=auto
insmod efi_gop
insmod efi_uga
menuentry "Rancher" {
set gfxpayload=keep
linux /boot/vmlinuz quiet rancher.autologin=tty1 rancher.autologin=ttyS0
initrd /boot/initrd
}

View File

@@ -9,7 +9,7 @@ CD=${BUILD}/cd
ISO=${ARTIFACTS}/$(echo ${DISTRIB_ID} | tr '[:upper:]' '[:lower:]').iso
CHECKSUM=iso-checksums.txt
mkdir -p ${CD}/boot/isolinux
## TRADITIONAL MBR BOOT
mkdir -p ${CD}/boot/isolinux
if [ ! -f ${ARTIFACTS}/vmlinuz ] || [ ! -f ${ARTIFACTS}/initrd ]; then
@@ -21,12 +21,42 @@ cp ${ARTIFACTS}/vmlinuz ${CD}/boot
cp scripts/isolinux.cfg ${CD}/boot/isolinux
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux
## EFI BOOT
mkdir -p ${CD}/EFI/BOOT
mkdir -p ${CD}/boot/grub
cp scripts/grub.cfg ${CD}/boot/grub
cp -r /usr/lib/grub/x86_64-efi/ ${CD}/boot/grub
(cd ${CD} && grub-mkimage -O x86_64-efi -o EFI/BOOT/BOOTX64.EFI --config=boot/grub/grub.cfg --compression=auto --prefix='()/boot/grub' disk part_msdos fat iso9660 )
# make the EFI FAT filesystem to boot
EFIIMG=boot/efiboot.img
CDEFI=${CD}/${EFIIMG}
rm -f ${CDEFI}
dd if=/dev/zero of=${CDEFI} bs=4k count=1000
mkfs.vfat ${CDEFI}
mkdir -p tmp/
mount -o loop ${CDEFI} tmp/
cp -r ${CD}/EFI tmp/
umount tmp/
rmdir tmp/
rm -rf ${CD}/EFI
## BUILD THE ISO IMAGE
cd ${CD} && xorriso \
-as mkisofs \
-l -J -R -V "${DISTRIB_ID}" \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-eltorito-alt-boot \
-e ${EFIIMG} -no-emul-boot \
-isohybrid-gpt-basdat \
-o $ISO ${CD}
cd $(dirname $ISO)

View File

@@ -41,6 +41,21 @@ while [ "$#" -gt 0 ]; do
--kvm)
KVM=1
;;
--efi)
# set where our EFI firmware binary is
EFIFIRMWARE="./build/OVMF.fd"
# create the command-line to pass to qemu
EFI="--bios $EFIFIRMWARE"
# if the firmware does not yet exist, download it
if [[ ! -e "$EFIFIRMWARE" ]]; then
echo "Downloading OVMF EFI firmware"
# because unzip does not support streaming from stdin...
curl --location http://downloads.sourceforge.net/project/edk2/OVMF/OVMF-X64-r15214.zip > ./build/ovmf.zip
unzip ./build/ovmf.zip -d ./build OVMF.fd
rm -f ./build/ovmf.zip
echo "Download OVMF EFI firmware complete"
fi
;;
--no-format)
FORMAT=0
;;
@@ -138,6 +153,7 @@ if [ "$QEMU" == "1" ]; then
${CPU} \
${machine["$ARCH"]} \
-m 2048 \
${EFI} \
${network["$ARCH"]} \
$(eval "${hd["$ARCH"]} ${HD}") \
${SECOND_DRIVE_ENABLE} \
@@ -160,6 +176,7 @@ if [ "$QEMU" == "1" ]; then
-kernel ${KERNEL} \
-initrd ${INITRD} \
-m 2048 \
${EFI} \
${network["$ARCH"]} \
$(eval "${hd["$ARCH"]} ${HD}") \
${SECOND_DRIVE_ENABLE} \