config: support UEFI in serial images, off by default for now; closes #138

While here switch images to UFS2.
This commit is contained in:
Franco Fichtner 2021-01-07 16:56:27 +01:00
parent 8dd525035a
commit 84aefa59b0
9 changed files with 43 additions and 32 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2014-2020 Franco Fichtner <franco@opnsense.org>
Copyright (c) 2014-2021 Franco Fichtner <franco@opnsense.org>
Copyright (c) 2015-2017 The FreeBSD Foundation
Copyright (c) 2004-2011 Scott Ullrich <sullrich@gmail.com>
All rights reserved.

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015-2020 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-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
@ -72,7 +72,7 @@ KERNEL?= SMP
ADDITIONS?= os-dyndns${SUFFIX}
DEVICE?= A10
SPEED?= 115200
UEFI?= yes
UEFI?= dvd vga vm # serial
GITBASE?= https://github.com/opnsense
MIRRORS?= https://opnsense.c0urier.net \
http://mirrors.nycbug.org/pub/opnsense \

View File

@ -64,7 +64,7 @@ Available build options are:
* SPEED: serial speed, e.g. "115200" (default)
* TYPE: the base name of the top package to be installed
* SUFFIX: the suffix of top package name (empty, "-devel")
* UEFI: "yes" for amd64 hybrid images with optional UEFI boot
* UEFI: Use amd64 hybrid images for said images, e.g. "vga vm"
* VERSION: a version tag (if applicable)
How to specify build options via configuration file

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2020 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2021 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
@ -160,9 +160,7 @@ while getopts ${OPTS} OPT; do
esac
;;
u)
if [ "${OPTARG}" = "yes" ]; then
export PRODUCT_UEFI=${OPTARG}
fi
export PRODUCT_UEFI=${OPTARG}
;;
v)
export PRODUCT_VERSION=${OPTARG}

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2019 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-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
@ -47,7 +47,8 @@ setup_mtree ${STAGEDIR}/work
setup_entropy ${STAGEDIR}/work
UEFIBOOT=
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" ]; then
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" -a \
-z "${PRODUCT_UEFI%%*dvd*}" ]; then
dd if=/dev/zero of=${STAGEDIR}/efiboot.img bs=4k count=200
DEV=$(mdconfig -a -t vnode -f ${STAGEDIR}/efiboot.img)
newfs_msdos -F 12 -m 0xf8 /dev/${DEV}

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2015-2018 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2021 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2004-2009 Scott Ullrich <sullrich@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
@ -58,7 +58,7 @@ cat > ${STAGEDIR}/etc/fstab << EOF
/dev/ufs/${NANOLABEL} / ufs rw,noatime 1 1 # notrim
EOF
makefs -t ffs -s ${NANOSIZE} -B little -f 400000 \
makefs -s ${NANOSIZE} -B little -f 400000 -o version=2 \
-o label=${NANOLABEL} ${NANOIMG} ${STAGEDIR}
DEV=$(mdconfig -a -t vnode -f ${NANOIMG})

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2017 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-2021 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
@ -39,24 +39,33 @@ SERIALLABEL="${PRODUCT_NAME}_Install"
sh ./clean.sh ${SELF}
setup_stage ${STAGEDIR}
setup_base ${STAGEDIR}
setup_kernel ${STAGEDIR}
setup_packages ${STAGEDIR}
setup_extras ${STAGEDIR} ${SELF}
setup_mtree ${STAGEDIR}
setup_entropy ${STAGEDIR}
setup_stage ${STAGEDIR} work
setup_base ${STAGEDIR}/work
setup_kernel ${STAGEDIR}/work
setup_packages ${STAGEDIR}/work
setup_extras ${STAGEDIR}/work ${SELF}
setup_mtree ${STAGEDIR}/work
setup_entropy ${STAGEDIR}/work
cat > ${STAGEDIR}/etc/fstab << EOF
cat > ${STAGEDIR}/work/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass#
/dev/ufs/${SERIALLABEL} / ufs ro,noatime 1 1
tmpfs /tmp tmpfs rw,mode=01777 0 0
EOF
makefs -t ffs -B little -o label=${SERIALLABEL} ${SERIALIMG} ${STAGEDIR}
makefs -B little -o label=${SERIALLABEL} -o version=2 \
${STAGEDIR}/root.part ${STAGEDIR}/work
DEV=$(mdconfig -a -t vnode -f ${SERIALIMG})
gpart create -s BSD ${DEV}
gpart bootcode -b ${STAGEDIR}/boot/boot ${DEV}
gpart add -t freebsd-ufs ${DEV}
mdconfig -d -u ${DEV}
UEFIBOOT=
GPTDUMMY=
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" -a \
-z "${PRODUCT_UEFI%%*serial*}" ]; then
UEFIBOOT="-p efi:=${STAGEDIR}/work/boot/boot1.efifat"
GPTDUMMY="-p freebsd-swap::512k"
read YN
fi
mkimg -s gpt -o ${SERIALIMG} -b ${STAGEDIR}/work/boot/pmbr ${UEFIBOOT} \
-p freebsd-boot:=${STAGEDIR}/work/boot/gptboot ${GPTDUMMY} \
-p freebsd-ufs:=${STAGEDIR}/root.part

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2014-2017 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2014-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
@ -52,12 +52,14 @@ cat > ${STAGEDIR}/work/etc/fstab << EOF
tmpfs /tmp tmpfs rw,mode=01777 0 0
EOF
makefs -B little -o label=${VGALABEL} ${STAGEDIR}/root.part ${STAGEDIR}/work
makefs -B little -o label=${VGALABEL} -o version=2 \
${STAGEDIR}/root.part ${STAGEDIR}/work
UEFIBOOT=
GPTDUMMY=
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" ]; then
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" -a \
-z "${PRODUCT_UEFI%%*vga*}" ]; then
UEFIBOOT="-p efi:=${STAGEDIR}/work/boot/boot1.efifat"
GPTDUMMY="-p freebsd-swap::512k"
fi

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2016-2017 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
@ -84,7 +84,8 @@ GPTDUMMY="-p freebsd-swap::512k"
SWAPARGS=
UEFIBOOT=
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" ]; then
if [ ${PRODUCT_ARCH} = "amd64" -a -n "${PRODUCT_UEFI}" -a \
-z "${PRODUCT_UEFI%%*vm*}" ]; then
UEFIBOOT="-p efi:=${STAGEDIR}/boot/boot1.efifat"
fi