Skip to content

Instantly share code, notes, and snippets.

@dragon788
Created February 9, 2020 21:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dragon788/b255a12f019ffc4274ff1f1c64861a81 to your computer and use it in GitHub Desktop.
Save dragon788/b255a12f019ffc4274ff1f1c64861a81 to your computer and use it in GitHub Desktop.
TFTP boot for openwrt / GLiNet / LEDE and Clear Linux
tee -a /etc/dnsmasq.conf << EOF
dhcp-match=set:ipxeclient,60,IPXEClient*
dhcp-match=set:bios,60,PXEClient:Arch:00000
dhcp-boot=tag:bios,netboot.xyz.kpxe,,192.168.8.1
dhcp-match=set:efi32,60,PXEClient:Arch:00002
dhcp-boot=tag:efi32,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi32-1,60,PXEClient:Arch:00006
dhcp-boot=tag:efi32-1,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi64,60,PXEClient:Arch:00007
dhcp-boot=tag:efi64,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi64-1,60,PXEClient:Arch:00008
dhcp-boot=tag:efi64-1,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi64-2,60,PXEClient:Arch:00009
dhcp-boot=tag:efi64-2,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:ipxeboot,175
dhcp-boot=tag:ipxeboot,http://192.168.8.1/ipxe/ipxe_boot_script.ipxe
dhcp-boot=tag:!ipxeboot,undionly.kpxe,192.168.8.1
EOF
uci set dhcp.@dnsmasq[0].dhcp_match=set:bios,60,PXEClient:Arch:00000
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:bios,ipxe/netboot.xyz.kpxe,,192.168.8.1
uci set dhcp.@dnsmasq[0].dhcp_match=set:efi32,60,PXEClient:Arch:00002
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:efi32,ipxe/netboot.xyz.efi,,192.168.8.1
uci set dhcp.@dnsmasq[0].dhcp_match=set:efi32-1,60,PXEClient:Arch:00006
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:efi32-1,ipxe/netboot.xyz.efi,,192.168.8.1
uci set dhcp.@dnsmasq[0].dhcp_match=set:efi64,60,PXEClient:Arch:00007
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:efi64,ipxe/netboot.xyz.efi,,192.168.8.1
uci set dhcp.@dnsmasq[0].dhcp_match=set:efi64-1,60,PXEClient:Arch:00008
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:efi64-1,ipxe/netboot.xyz.efi,,192.168.8.1
uci set dhcp.@dnsmasq[0].dhcp_match=set:efi64-2,60,PXEClient:Arch:00009
uci set dhcp.@dnsmasq[0].dhcp_boot=tag:efi64-2,ipxe/netboot.xyz.efi,,192.168.8.1
uci commit
/etc/init.d/dnsmasq restart
### Getting Clear Linux PXE bits
export IPXE_ROOT_DIR=/mnt/GLiShare/PXEboot
# Need to download to mounted drive where there is enough space
curl -o ${IPXE_ROOT_DIR}/clear-pxe.tar.xz \
https://cdn.download.clearlinux.org/current/clear-$(curl \
https://cdn.download.clearlinux.org/latest)-pxe.tar.xz
tar -xJf ${IPXE_ROOT_DIR}/clear-pxe.tar.xz -C ${IPXE_ROOT_DIR}
# Will this work on busybox? who knows
ln -sf $(ls ${IPXE_ROOT_DIR} | grep 'org.clearlinux.*') ${IPXE_ROOT_DIR}/linux ln -sf $(ls ${IPXE_ROOT_DIR} | grep 'org.clearlinux.*') ${IPXE_ROOT_DIR}/linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment