Skip to content

Instantly share code, notes, and snippets.

Robin Smidsrød robinsmidsrod

Block or report user

Report or block robinsmidsrod

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active Nov 6, 2019
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)
View _INSTALL.md

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 Oct 15, 2019
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
View dhcpd.conf
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 / gist:d2bdb98110e56f1a0f55adcbd593c371
Created Oct 10, 2019
USB-over-IP for sharing webcam over local network
View gist:d2bdb98110e56f1a0f55adcbd593c371
# 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
View gist:55963a62214da9a24bc9a646e4fba0a2
src/config/local/efi/console.h:/* Everything but DEBUG and LOG output to EFI console */
src/config/local/efi/console.h:#undef CONSOLE_EFI
src/config/local/efi/console.h://#define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG & ~CONSOLE_USAGE_LOG )
src/config/local/efi/console.h:#define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
src/config/local/efi/console.h:/* Everything but TUI output to syslog console */
src/config/local/efi/console.h:#undef CONSOLE_SYSLOG
src/config/local/efi/console.h:#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
src/config/local/efi/console.h:#undef LOG_LEVEL
src/config/local/efi/console.h:#define LOG_LEVEL LOG_ALL /* Full syslog logging */
src/config/local/efi/general.h:#undef BANNER_TIMEOUT
@robinsmidsrod
robinsmidsrod / ubuntu_1804.ipxe
Last active Oct 5, 2019
iPXE script entries for booting Ubuntu 18.04 in different ways
View ubuntu_1804.ipxe
# 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 / _README.md
Last active Sep 29, 2019
Embedded iPXE menu to choose which network adapter to boot from (autodetects up to 10 adapters)
View _README.md

Go into your git checkout folder of ipxe.

Save the below file as nic-menu.ipxe.

Build iPXE like this:

cd src && make EMBED=../nic-menu.ipxe && cd ..

Requirements: current iPXE as of 2013-08-01 (for proper behavior of autoboot with a network device specified, netX feature, PCI vendor/device ID display and inc command)

@robinsmidsrod
robinsmidsrod / ubuntu-amd64-installer.ipxe
Created Mar 27, 2012
Boot Ubuntu x64 installer directly from the network. Only iPXE needed
View ubuntu-amd64-installer.ipxe
#!ipxe
dhcp
echo Starting Ubuntu x64 installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
#imgargs linux auto=true url=http://yourserver/some/path/preseed.cfg
boot ||
# If everything failed, give the user some options
echo Boot from ${base-url} failed
@robinsmidsrod
robinsmidsrod / gist:18a559af2680f85a72134a6d3093f62f
Last active Aug 22, 2019
BitDefender Rescue CD iPXE boot script (non-working because missing /bin/mount.nfs in initramfs)
View gist:18a559af2680f85a72134a6d3093f62f
:bitdefender
echo Booting BitDefender Rescue ${bitdefender-version} x86 for ${initiator-iqn}
set base-url bitdefender-rescue-${bitdefender-version}/
kernel ${base-url}boot/kernel.i386-pc root=/dev/nfs nfsroot=${nfs-server}:${nfs-root}${base-url} ip=dhcp real_root=/dev/nfs loop=/rescue/livecd.squashfs looptype=squashfs livecd.nfsif=${netX/mac} initrd udev cdroot
initrd ${base-url}boot/initfs.i386-pc
boot || goto failed
goto start
@robinsmidsrod
robinsmidsrod / git-branch-sizes
Last active Aug 8, 2019
Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output
View git-branch-sizes
#!/bin/bash
#
# Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output
#
git for-each-ref --shell --format="ref=%(refname)" --no-merged | \
while read entry
do
eval "$entry"
size=$(git diff -U0 "master...$ref" | grep -vP '^(diff|index|@@|\-\-\-|\+\+\+)' | wc -l)
@robinsmidsrod
robinsmidsrod / sysrcd.ipxe
Last active Jun 9, 2019
SystemRescueCD iPXE menu script and monkeypatch for preloading sysrcd.dat with iPXE instead of loading from local storage
View sysrcd.ipxe
#!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
You can’t perform that action at this time.