mirror of https://github.com/kholia/OSX-KVM.git
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.
This commit is contained in:
parent
6cf56dd2d1
commit
404454e4ed
|
@ -67,6 +67,8 @@ args=(
|
||||||
-device vmware-svga
|
-device vmware-svga
|
||||||
-display none
|
-display none
|
||||||
-vnc 0.0.0.0:1,password=on -k en-us
|
-vnc 0.0.0.0:1,password=on -k en-us
|
||||||
|
-netdev user,id=pxenet0,tftp=netboot/tftpboot,bootfile=pxelinux.0
|
||||||
|
-device e1000,netdev=pxenet0
|
||||||
)
|
)
|
||||||
|
|
||||||
qemu-system-x86_64 "${args[@]}"
|
qemu-system-x86_64 "${args[@]}"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Configuration for dnsmasq to support PXE boot
|
||||||
|
|
||||||
|
# Set the TFTP root directory
|
||||||
|
enable-tftp
|
||||||
|
tftp-root=/tftpboot
|
||||||
|
|
||||||
|
# Configure DHCP options for PXE boot
|
||||||
|
dhcp-range=192.168.1.100,192.168.1.200,12h
|
||||||
|
dhcp-boot=pxelinux.0
|
||||||
|
pxe-service=x86PC, "Install macOS", pxelinux
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to retrieve the internal IP address of the Codespace
|
||||||
|
|
||||||
|
hostname -I
|
|
@ -0,0 +1,4 @@
|
||||||
|
DEFAULT macOS
|
||||||
|
LABEL macOS
|
||||||
|
KERNEL vmlinuz
|
||||||
|
APPEND initrd=initrd.img
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/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
|
Loading…
Reference in New Issue