Skip to content

Instantly share code, notes, and snippets.

@robinsmidsrod
Created August 3, 2016 14:49
Show Gist options
  • Save robinsmidsrod/aaf5b98a14f68adff0db6f66ff721567 to your computer and use it in GitHub Desktop.
Save robinsmidsrod/aaf5b98a14f68adff0db6f66ff721567 to your computer and use it in GitHub Desktop.
Bash functions for building iPXE in different ways
#!/bin/bash
make_ipxe() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=chain bin/undionly.kpxe bin/ipxe.lkrn bin/ipxe.pxe bin/ipxe.usb &&
sudo install -v -m 0644 -g root -o root bin/undionly.kpxe /srv/salt/tftpd/files/undionly.kpxe &&
sudo install -v -m 0644 -g root -o root bin/ipxe.lkrn /srv/salt/tftpd/files/ipxe.lkrn &&
sudo install -v -m 0644 -g root -o root bin/ipxe.pxe /srv/salt/tftpd/files/ipxe.pxe &&
sudo salt-call -l quiet state.single file.recurse name=/srv/tftp source=salt://tftpd/files dir_mode=755 file_mode=644 &&
popd >/dev/null
}
make_usb() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=usb bin/intel--ecm.lkrn DEBUG=usb,ecm &&
popd >/dev/null
}
make_efi() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=efi EMBED=../efi.ipxe bin-x86_64-efi/ipxe.efi bin-x86_64-efi/snponly.efi bin-i386-efi/ipxe.efi bin-i386-efi/snponly.efi &&
sudo install -v -m 0644 -g root -o root bin-i386-efi/ipxe.efi /srv/salt/tftpd/files/ipxe-x86.efi &&
sudo install -v -m 0644 -g root -o root bin-i386-efi/snponly.efi /srv/salt/tftpd/files/snponly-x86.efi &&
sudo install -v -m 0644 -g root -o root bin-x86_64-efi/ipxe.efi /srv/salt/tftpd/files/ipxe-x64.efi &&
sudo install -v -m 0644 -g root -o root bin-x86_64-efi/snponly.efi /srv/salt/tftpd/files/snponly-x64.efi &&
sudo salt-call -l quiet state.single file.recurse name=/srv/tftp source=salt://tftpd/files dir_mode=755 file_mode=644 &&
popd >/dev/null
}
make_vbox() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=vbox bin/intel--virtio-net--pcnet32.isarom &&
echo "Max size of VirtualBox ROM is 56KB, 57344 bytes" &&
ls -l bin/intel--virtio-net--pcnet32.isarom &&
prefix=$(date +%Y%m%d-%H%M%S) &&
mkdir -p /ipxe/$prefix &&
cp -v bin/intel--virtio-net--pcnet32.isarom /ipxe/$prefix/ &&
echo -e "@echo off\r\nvboxmanage setextradata global VBoxInternal/Devices/pcbios/0/Config/LanBootRom C:\\Programs\\iPXE\\$prefix\\intel--virtio-net--pcnet32.isarom\r\nvboxmanage getextradata global enumerate\r\n" >/ipxe/setvboxrom.bat &&
popd >/dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment