build/boot: uncompress if needed, update README

This commit is contained in:
Franco Fichtner 2021-07-05 10:26:52 +02:00
parent 8ba6951dd4
commit 31d406fc5c
2 changed files with 16 additions and 7 deletions

View File

@ -386,8 +386,7 @@ There's also the posh way to boot a final image using bhyve(8):
# make boot-<image>
Please note that the system does not have working networking after
bootup and login is only possible via the Nano and Serial images.
Please note that login is only possible via the Nano and Serial images.
Generating a make.conf for use in running OPNsense
--------------------------------------------------

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2016-2020 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2016-2021 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -37,7 +37,7 @@ if [ -z "${1}" ]; then
exit 1
fi
IMAGE=$(find ${IMAGESDIR} -name "*-${1}-${PRODUCT_ARCH}.*")
IMAGE=$(find ${IMAGESDIR} -name "*-${1}-${PRODUCT_ARCH}.*" \! -name "*.sig")
if [ ! -f "${IMAGE}" ]; then
echo ">> No image found."
@ -48,9 +48,19 @@ AHCI=ahci-hd; if [ "${1}" = "dvd" ]; then AHCI=ahci-cd;fi
setup_stage ${STAGEDIR}
TARGET=${STAGEDIR}/image.img
if [ -z "${IMAGE%%*.bz2}" ]; then
echo -n ">>> Uncompressing image ${IMAGE}... "
bunzip2 -c ${IMAGE} > ${TARGET}
echo "done"
else
ln -s ${IMAGE} ${TARGET}
fi
truncate -s 4G ${STAGEDIR}/disk.img
echo ">>> Booting image ${IMAGE}..."
echo ">>> Booting image ${IMAGE}:"
BRGDEV=bridge0
TAPLAN=tap0
@ -65,12 +75,12 @@ ifconfig ${BRGDEV} addm ${TAPWAN} addm ${PHYDEV} up || true
ifconfig ${TAPWAN} up
kldstat -qm vmm || kldload vmm
bhyveload -m ${MEM} -d ${IMAGE} vm0
bhyveload -m ${MEM} -d ${TARGET} vm0
bhyve -c 1 -m ${MEM} -AHP \
-s 0,hostbridge \
-s 1:0,virtio-net,${TAPLAN} \
-s 1:1,virtio-net,${TAPWAN} \
-s 2:0,${AHCI},${IMAGE} \
-s 2:0,${AHCI},${TARGET} \
-s 3:0,ahci-hd,${STAGEDIR}/disk.img \
-s 31,lpc -l com1,stdio \
vm0 || true