build: split serial / vga stages; closes #29

This commit is contained in:
Franco Fichtner 2016-05-05 16:50:04 +02:00
parent 3e584dc6cd
commit 32c2f5e21c
5 changed files with 76 additions and 40 deletions

View File

@ -1,6 +1,6 @@
STEPS= base chroot clean core distfiles kernel iso \
memstick nano plugins ports prefetch rebase \
regress release skim
STEPS= base chroot clean core distfiles kernel \
iso nano plugins ports prefetch rebase \
regress release serial skim vga
.PHONY: ${STEPS}
PAGER?= less
@ -49,8 +49,8 @@ ports distfiles: base
plugins: ports
core: plugins
packages: core
iso memstick nano: packages kernel
everything release: iso memstick nano
iso serial vga nano: packages kernel
everything release: iso serial vga nano
# Expand target arguments for the script append:

View File

@ -108,9 +108,13 @@ A cdrom live image is created using:
# make iso
A memstick image for VGA and serial is created using:
A serial memstic image for is created using:
# make memstick
# make serial
A vga memstic image for is created using:
# make vga
A direct disk image in NanoBSD style is created using:

View File

@ -1,6 +1,7 @@
#!/bin/sh
# Copyright (c) 2014-2016 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2010-2011 Scott Ullrich <sullrich@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -258,6 +259,23 @@ setup_copy()
cp -r ${2} ${1}${2}
}
setup_memstick()
{
cat > ${1}/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass#
/dev/ufs/${3} / ufs ro,noatime 1 1
tmpfs /tmp tmpfs rw,mode=01777 0 0
EOF
makefs -t ffs -B little -o label=${3} ${2} ${1}
DEV=$(mdconfig -a -t vnode -f "${2}")
gpart create -s BSD "${DEV}"
gpart bootcode -b "${1}"/boot/boot "${DEV}"
gpart add -t freebsd-ufs "${DEV}"
mdconfig -d -u "${DEV}"
}
setup_chroot()
{
echo ">>> Setting up chroot in ${1}"

View File

@ -31,7 +31,6 @@ set -e
. ./common.sh && $(${SCRUB_ARGS})
SERIALIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-serial-${ARCH}.img"
VGAIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-vga-${ARCH}.img"
# rewrite the disk label, because we're install media
LABEL="${LABEL}_Install"
@ -43,19 +42,8 @@ setup_base ${STAGEDIR}
setup_kernel ${STAGEDIR}
setup_packages ${STAGEDIR}
setup_mtree ${STAGEDIR}
echo ">>> Building memstick image(s)..."
cat > ${STAGEDIR}/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass#
/dev/ufs/${LABEL} / ufs ro,noatime 1 1
tmpfs /tmp tmpfs rw,mode=01777 0 0
EOF
setup_entropy ${STAGEDIR}
makefs -t ffs -B little -o label=${LABEL} ${VGAIMG} ${STAGEDIR}
echo "-S${SERIAL_SPEED} -D" > ${STAGEDIR}/boot.config
cat > ${STAGEDIR}/boot/loader.conf << EOF
@ -69,24 +57,4 @@ sed -i '' -e "s:</system>:${SERIAL_CONFIG}</system>:" ${STAGEDIR}${CONFIG_XML}
sed -i '' -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
setup_entropy ${STAGEDIR}
makefs -t ffs -B little -o label=${LABEL} ${SERIALIMG} ${STAGEDIR}
setup_bootcode()
{
local dev
dev=$(mdconfig -a -t vnode -f "${1}")
gpart create -s BSD "${dev}"
gpart bootcode -b "${STAGEDIR}"/boot/boot "${dev}"
gpart add -t freebsd-ufs "${dev}"
mdconfig -d -u "${dev}"
}
setup_bootcode ${VGAIMG}
setup_bootcode ${SERIALIMG}
echo "done:"
ls -lah ${IMAGESDIR}/*
setup_memstick ${STAGEDIR} ${SERIALIMG} ${LABEL}

46
build/vga.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# Copyright (c) 2014-2016 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. ./common.sh && $(${SCRUB_ARGS})
VGAIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-vga-${ARCH}.img"
# rewrite the disk label, because we're install media
LABEL="${LABEL}_Install"
sh ./clean.sh memstick
setup_stage ${STAGEDIR}
setup_base ${STAGEDIR}
setup_kernel ${STAGEDIR}
setup_packages ${STAGEDIR}
setup_mtree ${STAGEDIR}
setup_entropy ${STAGEDIR}
setup_memstick ${STAGEDIR} ${VGAIMG} ${LABEL}