Browse code

Support dual ISO boot (EFI/BIOS)

Change-Id: Iaff1c02c392cc5f92fd4f2d14a7e3365c7e3234b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2102
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Alexey Makhalov authored on 2017/03/04 20:38:50
Showing 5 changed files
1 1
new file mode 100644
2 2
Binary files /dev/null and b/installer/BUILD_DVD/boot/grub2/efiboot.img differ
3 3
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+set default=0
1
+set timeout=3
2
+loadfont ascii
3
+set gfxmode="1024x768"
4
+gfxpayload=keep
5
+set theme=/boot/grub2/themes/photon/theme.txt
6
+terminal_output gfxterm
7
+
8
+menuentry "Install" {
9
+    linux /isolinux/vmlinuz root=/dev/ram0 loglevel=3
10
+    initrd /isolinux/initrd.img
11
+}
0 12
new file mode 100644
1 13
Binary files /dev/null and b/installer/EFI/BOOT/bootx64.efi differ
2 14
new file mode 100755
... ...
@@ -0,0 +1,16 @@
0
+#! /bin/bash
1
+
2
+# efiboot is a fat16 image that has only one file EFI/BOOT/bootx64.efi
3
+#
4
+# let's assume given /home/user/EFI/BOOT/bootx64.efi,
5
+# then EFI_DIR=/home/user/EFI
6
+
7
+EFI_DIR=./EFI
8
+IMAGE=./BUILD_DVD/boot/grub2/efiboot.img
9
+dd if=/dev/zero of=$IMAGE bs=1K count=1024
10
+mkdosfs $IMAGE
11
+mcopy -s -i $IMAGE $EFI_DIR '::/'
12
+
13
+# bootx64.efi is generated on Photon OS by:
14
+#
15
+# # grub2-efi-mkimage -o bootx64.efi -p /boot/grub2 -O x86_64-efi  fat iso9660 part_gpt part_msdos  normal boot linux configfile loopback chain  efifwsetup efi_gop efi_uga  ls search search_label search_fs_uuid search_fs_file  gfxterm gfxterm_background gfxterm_menu test all_video loadenv  exfat ext2 udf halt gfxmenu png tga
... ...
@@ -39,6 +39,13 @@ WORKINGDIR=${BUILDROOT}
39 39
 BUILDROOT=${BUILDROOT}/photon-chroot
40 40
 
41 41
 run_command "cp isolinux to working directory: ${WORKINGDIR}" "cp -r BUILD_DVD/isolinux ${WORKINGDIR}/" "${LOGFILE}"
42
+run_command "cp boot/grub2 to working directory: ${WORKINGDIR}" "cp -r BUILD_DVD/boot ${WORKINGDIR}/" "${LOGFILE}"
43
+run_command "# 1" "mkdir ${WORKINGDIR}/boot/grub2/fonts/" "${LOGFILE}"
44
+run_command "# 2" "cp boot/ascii.pf2 ${WORKINGDIR}/boot/grub2/fonts/" "${LOGFILE}"
45
+run_command "# 3" "mkdir -p ${WORKINGDIR}/boot/grub2/themes/photon/" "${LOGFILE}"
46
+run_command "# 4" "cp boot/splash.png ${WORKINGDIR}/boot/grub2/themes/photon/photon.png" "${LOGFILE}"
47
+run_command "# 5" "cp boot/terminal_*.tga ${WORKINGDIR}/boot/grub2/themes/photon/" "${LOGFILE}"
48
+run_command "# 6" "cp boot/theme.txt ${WORKINGDIR}/boot/grub2/themes/photon/" "${LOGFILE}"
42 49
 run_command "echo : ${WORKINGDIR}" "echo ${WORKINGDIR}" "${LOGFILE}"
43 50
 cp BUILD_DVD/isolinux/splash.png ${BUILDROOT}/installer/boot/.
44 51
 
... ...
@@ -276,7 +283,9 @@ rm -rf $BUILDROOT
276 276
 #Step 9 Generate the ISO!!!!
277 277
 pushd $WORKINGDIR
278 278
 mkisofs -R -l -L -D -b isolinux/isolinux.bin -c isolinux/boot.cat \
279
-		-no-emul-boot -boot-load-size 4 -boot-info-table -V "PHOTON_$(date +%Y%m%d)" \
279
+		-no-emul-boot -boot-load-size 4 -boot-info-table \
280
+		-eltorito-alt-boot -e boot/grub2/efiboot.img -no-emul-boot \
281
+		-V "PHOTON_$(date +%Y%m%d)" \
280 282
 		$WORKINGDIR >$ISO_OUTPUT_NAME
281 283
 
282 284
 popd