Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active March 21, 2024 23:00
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active February 25, 2024 07:46
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN (private network)
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;
@robinsmidsrod
robinsmidsrod / sysrcd.ipxe
Last active February 15, 2024 12:47
SystemRescueCD iPXE menu script and monkeypatch for preloading sysrcd.dat with iPXE instead of loading from local storage
#!ipxe
set sysrcd-version 4.7.1
echo Booting SystemRescueCD ${sysrcd-version} x86 for ${initiator-iqn}
# Kernel command-line options are documented here:
# http://www.system-rescue-cd.org/Sysresccd-manual-en_Booting_the_CD-ROM#Network_boot_using_PXE
set base-url sysrcd-${sysrcd-version}-x86/
kernel ${base-url}isolinux/altker${archs} setkmap=no net.ifnames=0 backstore=off
initrd ${base-url}isolinux/initram.igz
initrd ${base-url}sysrcd.dat /sysrcd.dat
# Load the ramdisk again as a file inside the ramdisk, so our custom init script
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active December 21, 2023 10:41
Simple chainloading config loading iPXE for ISC dhcpd which supports both legacy BIOS and UEFI
option client-arch code 93 = unsigned integer 16;
subnet 10.8.8.0 netmask 255.255.255.0 {
range 10.8.8.100 10.8.8.199;
option routers 10.8.8.1;
option domain-name-servers 10.8.8.1;
next-server 10.8.8.1;
if exists user-class and option user-class = "iPXE" {
filename "http://10.8.8.11/ipxeroot/bootstrap.ipxe";
} elsif option client-arch != 0 {
filename "ipxe.efi";
@robinsmidsrod
robinsmidsrod / configuration.yaml
Created September 13, 2023 16:42
garate gate cover
cover:
- platform: template
covers:
garage_gate:
device_class: garage
friendly_name: "Garage Gate"
value_template: |
{% if is_state('binary_sensor.garage_gate', 'off') %}
closed
{% else %}
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active August 26, 2023 12:24
Booting an Apple Mac into iPXE using simulated Apple Boot Server on ISC DHCPD
next-server 10.0.3.2;
if ( substring(option vendor-class-identifier, 0, 9) = "AAPLBSDPC"
and substring(option vendor-class-identifier, 10, 4) = "i386" ) {
# This needs to be there to tell the client we're an Apple boot server
option vendor-class-identifier "AAPLBSDPC";
# Normally the client asks for a list, we respond, they tell us what we want,
# then we send a select back with the information of that image.
# This skips all that and forces the select down to the client.
option vendor-encapsulated-options 01:01:02;
# Use ipxe.efi for native drivers, or snponly.efi for underlying UNDI
@robinsmidsrod
robinsmidsrod / ubuntu_1804.ipxe
Last active July 4, 2023 09:11
iPXE script entries for booting Ubuntu 18.04 in different ways
# boot-url points to an nfs URL
# sanboot-url points to an http URL
# ubuntu-version contains 18.04.3
# ubuntu-release contains bionic
:ubuntu
echo Booting Ubuntu from iSCSI for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.boot.ubuntu
sanboot ${root-path} || goto failed
goto start
@robinsmidsrod
robinsmidsrod / gist:d2bdb98110e56f1a0f55adcbd593c371
Created October 10, 2019 10:09
USB-over-IP for sharing webcam over local network
# server - make a device available remotely
apt install linux-tools-common linux-tools-generic hwdata
modprobe usbip-core
modprobe usbip-host
usbipd -D # (runs in background)
usbip list -l
usbip bind -b <busid>
# client - attach to remote device
apt install linux-tools-common linux-tools-generic-hwe-18.04 hwdata
@robinsmidsrod
robinsmidsrod / inventory.ipxe
Created July 16, 2015 22:48
iPXE hardware inventory script (from svenx)
# Run a PCI/SMBios/net inventory scan and upload the results. This gives us a
# way of tracking nodes to some extent, leaving us less blind than usual.
#
# We use the iPXE pciscan command to enumerate the PCI bus. For each device, we
# check the 'header type' register at offset 0x0e. If it's type 0 (endpoint),
# we can read the subsystem vendor and device registers too. Unfortunately, if
# the 7th bit of the header type field is set (0x80), it indicates a
# multi-function device. So to check the type, this bit should be masked out.
# Masking is not possible with iPXE commands, so we have to duplicate some of
# the iseq tests.
@robinsmidsrod
robinsmidsrod / ubuntu-autoinstall.ipxe
Last active February 23, 2023 15:22
Ubuntu 20.04 autoinstall (casper/subiquity/curtin) to iPXE - work-in-progress (not fully working for iSCSI)
:ubuntu-autoinstall
echo Starting Ubuntu ${ubuntu-version} ${archl} autoinstaller for ${initiator-iqn}
sanhook ${base-iscsi}:${hostname}.boot.ubuntu || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-cc-iscsi storage: { layout: { name: lvm }, config: [{type: disk, path: ${base-iscsi}:${hostname}.boot.ubuntu }] } || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-iscsi ISCSI_INITIATOR=${initiator-iqn} ISCSI_TARGET_NAME=${base-iqn}:${hostname}.boot.ubuntu ISCSI_TARGET_IP=${iscsi-server} ISCSI_TARGET_PORT=3260 || sleep 1
# https://medium.com/@tlhakhan/ubuntu-server-20-04-autoinstall-2e5f772b655a
# https://ubuntu.com/server/docs/install/autoinstall
# https://github.com/canonical/cloud-init/blob/master/doc/examples/kernel-cmdline.txt
# https://matt.olan.me/raspberry-pi-iscsi-root-on-ubuntu-20-04/
# https://askubuntu.com/questions/1235723/automated-20-04-server-installation-using-pxe-and-live-server-image