diff options
Diffstat (limited to 'images/freebsd/genimg')
| -rwxr-xr-x | images/freebsd/genimg | 63 | +5 −58 |
1 files changed, 5 insertions, 58 deletions
diff --git a/images/freebsd/genimg b/images/freebsd/genimg index 08a258c..521bb50 100755 --- a/images/freebsd/genimg +++ b/images/freebsd/genimg @@ -1,6 +1,6 @@ #!/bin/sh -eux # SPDX-FileCopyrightText: 2017-2026 Drew DeVault -# SPDX-FileCopyrightText: 2026 Nikolay Govorov +# SPDX-FileCopyrightText: 2026 Nikolay Govorov # SPDX-License-Identifier: AGPL-3.0-only self=$(dirname "$(readlink -f "$0")") @@ -141,9 +141,10 @@ esac # resolver; the guest resolv.conf written below is purely for runtime. pkg -C /dev/null -R "$reposdir" -r "$rootfs" update pkg -C /dev/null -R "$reposdir" -r "$rootfs" install -y \ - pkg git-lite mercurial sudo curl qemu-guest-agent + pkg git-lite mercurial sudo curl pkg -C /dev/null -R "$reposdir" -r "$rootfs" clean -ay + if [ "$with_ports" = true ]; then git clone https://github.com/freebsd/freebsd-ports "$rootfs"/usr/ports \ --depth=1 --single-branch @@ -157,7 +158,6 @@ cat >>"$rootfs"/etc/rc.conf <<EOF ntpd_enable=YES sshd_enable=YES growfs_enable=YES -qemu_guest_agent_enable=YES hostname="build" ifconfig_DEFAULT="inet 10.0.2.15 netmask 255.255.255.0" defaultrouter="10.0.2.2" @@ -185,66 +185,13 @@ echo "%sudo ALL=(ALL) NOPASSWD: ALL" >>"$rootfs"/usr/local/etc/sudoers # bootable GPT qcow2 -- no md(4), mount or raw->qcow2 conversion needed. makefs -s 8g -B little -o label=rootfs -o version=2 -o softupdates=1 disk.img "$rootfs" mkdir -p "$out" -# .hmi (Hule Machine Image): mkimg emits a plain qcow2; keep it snapshot-free so -# it materializes losslessly to raw. Base image = chain root, no backing. -size_gib=16 mkimg -s gpt \ -b "$rootfs"/boot/pmbr \ - -C "${size_gib}G" \ + -C 16G \ -p freebsd-boot:="$rootfs"/boot/gptboot \ -p freebsd-ufs/rootfs:=disk.img \ -f qcow2 \ - -o "$out"/root.hmi + -o "$out"/root.img.qcow2 cleanup trap : EXIT - -# --- Hule machine configuration (`config.json`) ------------------------------ -# GPT + freebsd-boot (gptboot/pmbr), booted by the VMM's BIOS firmware. No -# boot.cmdline (the FreeBSD loader owns boot; firmware-disk takes none from the -# VMM). FreeBSD host tools: sha256(1) and stat -f, not GNU coreutils. -disk_sha=$(sha256 -q "$out/root.hmi") -disk_bytes=$(stat -f%z "$out/root.hmi") -virtual_bytes=$((size_gib * 1024 * 1024 * 1024)) -mem_min=$((256 * 1024 * 1024)) -mem_def=$((1024 * 1024 * 1024)) - -cat >"$out/config.json" <<CONFIG -{ - "schemaVersion": 1, - "kind": "MachineImage", - - "system": { - "os": "freebsd", - "version": "$version", - "architecture": "$arch" - }, - - "machine": { - "cpu": { "minimum": 1, "default": 2 }, - "ram": { "minimum": $mem_min, "default": $mem_def }, - "boot": [ - { - "protocol": "firmware-disk/bios", - "disk": "root" - } - ], - "access": [ - { "type": "ssh", "port": 22, "user": "build", "auth": "empty-password" }, - { "type": "qga" } - ], - "network": { "mode": "static", "address": "10.0.2.15/24", "gateway": "10.0.2.2" } - }, - - "disks": [ - { - "id": "root", - "format": "qcow2", - "path": "root.hmi", - "digest": "sha256:$disk_sha", - "virtSize": $virtual_bytes, - "diskSize": $disk_bytes - } - ] -} -CONFIG |
