From d79a2641c2de7933b1290f87391b7664fcb8a3cf Mon Sep 17 00:00:00 2001 From: davidplunkett Date: Fri, 21 Jun 2019 22:50:09 +0000 Subject: [PATCH] add build of ipxe.img and ipxe.iso files In addition to building ipxe.efi, also build ipxe.img which can be booted as a removable virtual disk and ipxe.iso which can be booted as a virtual cd. Signed-off-by: davidplunkett Change-Id: I0bd2adc80ac3bab53230eced89ded3d3235e67d3 --- create_ipxe.sh | 38 ++++++++++++++++++++++++++++++++++++-- setup_tools.sh | 2 +- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/create_ipxe.sh b/create_ipxe.sh index e05e10e..f2a9c58 100755 --- a/create_ipxe.sh +++ b/create_ipxe.sh @@ -132,6 +132,40 @@ fi ## COPY IPXE TO WEB ROOT cp -f $IPXE_ROOT/src/bin-x86_64-efi/ipxe.efi $WEB_ROOT/ipxe.efi - -echo "Created ipxe file [$WEB_ROOT/ipxe.efi] in web root [$WEB_ROOT]" +echo "Created ipxe efi file [$WEB_ROOT/ipxe.efi] in web root [$WEB_ROOT]" + +## CREATE IPXE BOOTABLE IMG +IPXE_IMG=$IPXE_ROOT/ipxe.img +IPXE_IMG_MNT=$IPXE_ROOT/image +dd if=/dev/zero of=$IPXE_IMG bs=1M count=8 +parted -s $IPXE_IMG mklabel msdos +parted -s $IPXE_IMG -a optimal mkpart primary fat32 1 100% +mkfs.vfat $IPXE_IMG +mkdir -p $IPXE_IMG_MNT +mount $IPXE_IMG $IPXE_IMG_MNT +mkdir -p $IPXE_IMG_MNT/EFI/BOOT +cp -f $IPXE_ROOT/src/bin-x86_64-efi/ipxe.efi $IPXE_IMG_MNT/EFI/BOOT/BOOTX64.EFI +umount $IPXE_IMG_MNT + +## COPY IPXE IMG TO WEB ROOT +cp -f $IPXE_IMG $WEB_ROOT/ipxe.img +echo "Created ipxe img file [$WEB_ROOT/ipxe.img] in web root [$WEB_ROOT]" + +## CREATE IPXE BOOTABLE ISO +IPXE_ISO_DIR=$IPXE_ROOT/ipxe_iso +IPXE_ISO=$IPXE_ROOT/ipxe.iso +rm -rf $IPXE_ISO_DIR +mkdir -p $IPXE_ISO_DIR/EFI/BOOT +cp -f $IPXE_ROOT/src/bin-x86_64-efi/ipxe.efi $IPXE_ISO_DIR/EFI/BOOT/BOOTX64.EFI +mkdir -p $IPXE_ISO_DIR/isolinux +cp /usr/lib/ISOLINUX/isolinux.bin $IPXE_ISO_DIR/isolinux/ +cp -f $IPXE_IMG $IPXE_ISO_DIR/isolinux/efiboot.img +xorriso -as mkisofs -r -V 'IPXE 64-bit' -o "$IPXE_ISO" -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -J -l -joliet-long -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e isolinux/efiboot.img -no-emul-boot -isohybrid-gpt-basdat "$IPXE_ISO_DIR" + +## COPY IPXE ISO TO WEB ROOT +cp -f $IPXE_ISO $WEB_ROOT/ipxe.iso +echo "Created ipxe iso file [$WEB_ROOT/ipxe.iso] in web root [$WEB_ROOT]" + +## LIST IPXE FILES CREATED +ls -lh $WEB_ROOT/ipxe.* diff --git a/setup_tools.sh b/setup_tools.sh index 4884c26..c5c4db8 100755 --- a/setup_tools.sh +++ b/setup_tools.sh @@ -70,7 +70,7 @@ mkdir -p $BUILD_ROOT ## CHECK THAT REQUIRED PACKAGES ARE INSTALLED echo "Checking for known required packages" -PACKAGES="python xorriso sshpass python-requests python-pip python-yaml python-jinja2 make gcc coreutils" +PACKAGES="python xorriso sshpass python-requests python-pip python-yaml python-jinja2 make gcc git isolinux coreutils" for PKG in $PACKAGES ; do if ! apt list $PKG 2>/dev/null | grep "$PKG.*installed.*" ; then echo "Attempting to install missing package $PKG" -- 2.16.6