#!/bin/sh # License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. # cd-com0.sh -- a copy of an install CD whose loader talks on com0. # # usage: cd-com0.sh IN.iso OUT.iso # # The media choose their console themselves (console=auto). On # UEFI the loader takes a serial port only if a key arrives on it within seven # seconds (sys/arch/i386/stand/efiboot/eficons.c, CONSDEV_AUTO); in the test VM # no key sent through qemu's serial pipe or its keyboard made it do that # (measured 2026-11-08: the installer came up on the VGA screen). The test # therefore boots a copy whose /boot.cfg carries one more line, `consdev=com0' # (boot.cfg(5) of the loader: "consdev"). Everything else in the image, the # boot images included, is the medium as built; nothing in the build changes. # # Needs xorriso. The copy goes next to the other test images, never into the # release directory. set -e [ $# -eq 2 ] || { echo "usage: ${0##*/} IN.iso OUT.iso" >&2; exit 1; } in=$1 out=$2 [ -r "$in" ] || { echo "${0##*/}: cannot read $in" >&2; exit 1; } command -v xorriso > /dev/null || { echo "${0##*/}: xorriso not found" >&2; exit 1; } tmp=$(mktemp -d) || exit 1 trap 'rm -rf "$tmp"' EXIT HUP INT TERM xorriso -osirrox on -indev "$in" -extract /boot.cfg "$tmp/boot.cfg" > /dev/null 2>&1 \ || { echo "${0##*/}: no /boot.cfg in $in" >&2; exit 1; } grep -v '^consdev=' "$tmp/boot.cfg" > "$tmp/boot.cfg.new" echo 'consdev=com0' >> "$tmp/boot.cfg.new" rm -f "$out" xorriso -indev "$in" -outdev "$out" -boot_image any replay \ -map "$tmp/boot.cfg.new" /boot.cfg -commit > /dev/null 2>&1 \ || { echo "${0##*/}: xorriso failed" >&2; exit 1; } echo "${0##*/}: $out (consdev=com0)"