OSX-KVM/netboot/serve_pxe.sh
CHUCK 404454e4ed Add PXE boot configuration and scripts
* **PXE boot configuration**: Add `dnsmasq.conf` to configure PXE boot, set TFTP root directory, and configure DHCP options.
* **PXE bootloader configuration**: Add `pxelinux.cfg/default` to configure the PXE bootloader and set the bootloader to point to the macOS KVM kernel/initrd.
* **Serve PXE boot files**: Add `serve_pxe.sh` script to serve `pxelinux.0`, `vmlinuz`, and `initrd` via TFTP using `dnsmasq`.
* **Retrieve internal IP**: Add `get_internal_ip.sh` script to retrieve the internal IP address of the Codespace.
* **Update boot script**: Modify `boot-macOS-headless.sh` to use the PXE boot files from the `netboot` directory and add a network boot option to the QEMU command.
2025-04-23 05:02:51 -04:00

25 lines
576 B
Bash

#!/bin/bash
# Serve pxelinux.0, vmlinuz, and initrd via TFTP using dnsmasq
# Ensure dnsmasq is installed
if ! command -v dnsmasq &> /dev/null
then
echo "dnsmasq could not be found, please install it."
exit
fi
# Create tftpboot directory if it doesn't exist
TFTPBOOT_DIR="tftpboot"
if [ ! -d "$TFTPBOOT_DIR" ]; then
mkdir -p "$TFTPBOOT_DIR"
fi
# Copy necessary files to tftpboot directory
cp pxelinux.0 "$TFTPBOOT_DIR/"
cp vmlinuz "$TFTPBOOT_DIR/"
cp initrd.img "$TFTPBOOT_DIR/"
# Start dnsmasq to serve PXE boot files
dnsmasq --conf-file=netboot/dnsmasq.conf