feat(archiso): add PXE/netboot.xyz boot support
Enable the netboot buildmode in profiledef.sh so mkarchiso produces a netboot tarball (kernel + initrd + squashfs) alongside the ISO. Add --netboot-url flag to build.sh which generates a ready-to-chainload m-archy-netboot.ipxe script. Document the full netboot.xyz deployment workflow in docs/md/archiso.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main
parent
fbfe238e99
commit
86808b4573
|
|
@ -216,3 +216,75 @@ sudo dd if=~/m-archy-out/m-archy-*.iso of=/dev/sdX bs=4M status=progress oflag=s
|
|||
```
|
||||
|
||||
Or use `ventoy` / `balenaEtcher` as alternatives.
|
||||
|
||||
---
|
||||
|
||||
## PXE Boot / netboot.xyz
|
||||
|
||||
Every build also produces a `*-netboot-*.tar.gz` artifact alongside the ISO. This tarball contains the kernel, initrd, and squashfs image laid out for HTTP-based PXE booting. The live initramfs already includes the `archiso_pxe_http` hook, so no extra packages or custom kernel parameters beyond the ones below are required.
|
||||
|
||||
### 1. Build with a netboot URL
|
||||
|
||||
```bash
|
||||
bash setup/archiso/build.sh --netboot-url http://your-server/m-archy
|
||||
# or combined with an answerfile:
|
||||
bash setup/archiso/build.sh --preconf --netboot-url http://your-server/m-archy
|
||||
```
|
||||
|
||||
This generates `~/m-archy-out/m-archy-netboot.ipxe` alongside the netboot tarball.
|
||||
|
||||
### 2. Serve the artifacts
|
||||
|
||||
Extract the netboot tarball so that its contents are reachable at the base URL you provided:
|
||||
|
||||
```bash
|
||||
# On your web server
|
||||
mkdir -p /srv/http/m-archy
|
||||
tar -xzf ~/m-archy-out/*-netboot-*.tar.gz -C /srv/http/m-archy
|
||||
cp ~/m-archy-out/m-archy-netboot.ipxe /srv/http/m-archy/
|
||||
```
|
||||
|
||||
The server must expose at minimum:
|
||||
|
||||
```
|
||||
http://your-server/m-archy/arch/boot/x86_64/vmlinuz-linux
|
||||
http://your-server/m-archy/arch/boot/x86_64/initramfs-linux.img
|
||||
http://your-server/m-archy/arch/x86_64/airootfs.sfs
|
||||
http://your-server/m-archy/m-archy-netboot.ipxe
|
||||
```
|
||||
|
||||
### 3. Add to netboot.xyz
|
||||
|
||||
In your netboot.xyz configuration (or the **Custom iPXE** option in the netboot.xyz menu), chainload the generated script:
|
||||
|
||||
```
|
||||
chain http://your-server/m-archy/m-archy-netboot.ipxe
|
||||
```
|
||||
|
||||
Or add a named menu item:
|
||||
|
||||
```
|
||||
item m-archy M-Archy Arch Linux Installer
|
||||
...
|
||||
:m-archy
|
||||
chain http://your-server/m-archy/m-archy-netboot.ipxe
|
||||
```
|
||||
|
||||
### Manual iPXE parameters
|
||||
|
||||
If you prefer to write the boot stanza by hand (e.g. for a self-hosted netboot.xyz with YAML menus):
|
||||
|
||||
```
|
||||
kernel http://your-server/m-archy/arch/boot/x86_64/vmlinuz-linux \
|
||||
archiso_http_srv=http://your-server/m-archy/ \
|
||||
archisobasedir=arch \
|
||||
ip=dhcp
|
||||
initrd http://your-server/m-archy/arch/boot/x86_64/initramfs-linux.img
|
||||
boot
|
||||
```
|
||||
|
||||
| Kernel parameter | Purpose |
|
||||
|-----------------|---------|
|
||||
| `archiso_http_srv=<url>/` | Base URL the initramfs fetches the squashfs from (trailing slash required) |
|
||||
| `archisobasedir=arch` | Subdirectory prefix — matches `install_dir` in `profiledef.sh` |
|
||||
| `ip=dhcp` | Acquire an IP before the HTTP fetch |
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
# build.sh — build the M-Archy Arch Linux ISO
|
||||
# build.sh — build the M-Archy Arch Linux ISO + netboot artifacts
|
||||
#
|
||||
# Usage:
|
||||
# bash build.sh [--preconf [FILE]] [OUT_DIR]
|
||||
# bash build.sh [--preconf [FILE]] [--netboot-url URL] [OUT_DIR]
|
||||
#
|
||||
# --preconf Embed ~/answerfile.json into the ISO at /answerfile.json
|
||||
# --preconf FILE Embed the specified answerfile instead
|
||||
# OUT_DIR Output directory (default: ~/m-archy-out, or $OUT_DIR env)
|
||||
# --preconf Embed ~/answerfile.json into the ISO at /answerfile.json
|
||||
# --preconf FILE Embed the specified answerfile instead
|
||||
# --netboot-url URL Base URL where netboot artifacts will be served
|
||||
# (generates m-archy-netboot.ipxe in OUT_DIR)
|
||||
# OUT_DIR Output directory (default: ~/m-archy-out, or $OUT_DIR env)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
|
@ -15,6 +17,7 @@ DOTFILES_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|||
|
||||
# ── Argument parsing ───────────────────────────────────────────────────────────
|
||||
PRECONF_FILE=""
|
||||
NETBOOT_URL=""
|
||||
OUT_ARG=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
|
@ -32,6 +35,14 @@ while [[ $# -gt 0 ]]; do
|
|||
PRECONF_FILE="${1#--preconf=}"
|
||||
shift
|
||||
;;
|
||||
--netboot-url)
|
||||
[[ $# -gt 1 ]] || { echo "ERROR: --netboot-url requires a URL argument" >&2; exit 1; }
|
||||
NETBOOT_URL="$2"; shift 2
|
||||
;;
|
||||
--netboot-url=*)
|
||||
NETBOOT_URL="${1#--netboot-url=}"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown flag: $1" >&2; exit 1
|
||||
;;
|
||||
|
|
@ -113,3 +124,48 @@ if [[ -n "$PRECONF_FILE" ]]; then
|
|||
else
|
||||
echo "No answerfile — guided (manual) installer will start automatically on boot."
|
||||
fi
|
||||
|
||||
# ── Netboot artifacts ──────────────────────────────────────────────────────────
|
||||
NETBOOT_TARBALL="$(ls "$OUT_DIR/"*-netboot-*.tar.gz 2>/dev/null | head -n1 || true)"
|
||||
if [[ -n "$NETBOOT_TARBALL" ]]; then
|
||||
echo
|
||||
echo "Netboot artifact: $NETBOOT_TARBALL"
|
||||
echo " Extract and serve its contents from an HTTP server, then boot via PXE."
|
||||
echo " Internal layout (relative to tarball root):"
|
||||
tar -tzf "$NETBOOT_TARBALL" | sed 's/^/ /'
|
||||
|
||||
if [[ -n "$NETBOOT_URL" ]]; then
|
||||
# Strip trailing slash for consistency
|
||||
BASE_URL="${NETBOOT_URL%/}"
|
||||
IPXE_FILE="$OUT_DIR/m-archy-netboot.ipxe"
|
||||
cat > "$IPXE_FILE" <<IPXE
|
||||
#!ipxe
|
||||
# M-Archy Arch Linux Installer — PXE Boot
|
||||
# Generated by build.sh on $(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
#
|
||||
# Deploy:
|
||||
# 1. Extract the netboot tarball to the web root at: ${BASE_URL}/
|
||||
# 2. Add this script as a custom entry in netboot.xyz, or chainload it directly.
|
||||
#
|
||||
# netboot.xyz custom menu entry (paste into your netboot.xyz config):
|
||||
# item m-archy M-Archy Arch Linux Installer
|
||||
# goto m-archy
|
||||
# :m-archy
|
||||
# chain ${BASE_URL}/m-archy-netboot.ipxe
|
||||
|
||||
set base-url ${BASE_URL}
|
||||
kernel \${base-url}/arch/boot/x86_64/vmlinuz-linux \\
|
||||
archiso_http_srv=\${base-url}/ \\
|
||||
archisobasedir=arch \\
|
||||
ip=dhcp
|
||||
initrd \${base-url}/arch/boot/x86_64/initramfs-linux.img
|
||||
boot
|
||||
IPXE
|
||||
echo
|
||||
echo "iPXE script written to: $IPXE_FILE"
|
||||
echo " Serve it alongside the netboot tarball contents at: ${BASE_URL}/"
|
||||
else
|
||||
echo
|
||||
echo "Tip: rerun with --netboot-url <http://your-server/path> to generate an iPXE script."
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ iso_publisher="The_miro <https://git.abdelbaki.eu/The_miro/Dotfiles>"
|
|||
iso_application="M-Archy Arch Linux Installer"
|
||||
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
|
||||
install_dir="arch"
|
||||
buildmodes=('iso')
|
||||
buildmodes=('iso' 'netboot')
|
||||
bootmodes=('bios.syslinux' 'uefi.systemd-boot')
|
||||
arch="x86_64"
|
||||
pacman_conf="pacman.conf"
|
||||
|
|
|
|||
Loading…
Reference in New Issue