build/arm: finish cross-building image, assorted cleanups

This commit is contained in:
Franco Fichtner 2017-09-03 12:25:51 +02:00
parent 66f5ef1d6e
commit c56ebd53c9
6 changed files with 51 additions and 15 deletions

View File

@ -70,11 +70,20 @@ setup_base ${STAGEDIR}/mnt
setup_kernel ${STAGEDIR}/mnt
# xtools poison the installation, but...
setup_xtools ${STAGEDIR}/mnt
# XXX PHP needs to be defanged temporarily
extract_packages ${STAGEDIR}/mnt
install_packages ${STAGEDIR}/mnt php70
mv ${STAGEDIR}/mnt/usr/local/bin/php ${STAGEDIR}/php
cp ${STAGEDIR}/mnt/usr/bin/true ${STAGEDIR}/mnt/usr/local/bin/php
lock_packages ${STAGEDIR}/mnt
setup_packages ${STAGEDIR}/mnt
unlock_packages ${STAGEDIR}/mnt
mv ${STAGEDIR}/php ${STAGEDIR}/mnt/usr/local/bin/php
setup_extras ${STAGEDIR} ${SELF}/mnt
setup_entropy ${STAGEDIR}/mnt
# ... rewriting the base will fix that
setup_base ${STAGEDIR}/mnt
setup_kernel ${STAGEDIR}/mnt
cat > ${STAGEDIR}/mnt/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass#

View File

@ -374,6 +374,9 @@ setup_xtools()
if [ -n "${XTOOLS_SET}" ]; then
tar -C ${1} -xpf ${XTOOLS_SET}
fi
# prevent the start of configd in build environments
echo 'configd_enable="NO"' >> ${1}/etc/rc.conf.local
}
setup_chroot()
@ -411,6 +414,9 @@ setup_base()
{
echo ">>> Setting up world in ${1}"
# if we had a base in here before, allow for rewrite
chflags -R noschg ${1}
# manually undo xtools additions
rm -f ${1}/usr/bin/qemu-*-static ${1}/etc/rc.conf.local
@ -598,6 +604,22 @@ lock_packages()
done
}
unlock_packages()
{
BASEDIR=${1}
shift
PKGLIST=${@}
if [ -z "${PKGLIST}" ]; then
PKGLIST="-a"
fi
echo ">>> Unlocking packages in ${BASEDIR}: ${PKGLIST}"
for PKG in ${PKGLIST}; do
pkg -c ${BASEDIR} unlock -qy ${PKG}
done
}
install_packages()
{
BASEDIR=${1}
@ -831,4 +853,9 @@ setup_stage()
for DIR in ${@}; do
mkdir -p ${STAGE}/${DIR}
done
# try to clean up dangling md nodes
for NODE in $(mdconfig -l); do
mdconfig -d -u ${NODE} || true
done
}

View File

@ -61,8 +61,8 @@ EOF
makefs -t ffs -s ${NANOSIZE} -B little \
-o label=${NANOLABEL} ${NANOIMG} ${STAGEDIR}
DEV=$(mdconfig -a -t vnode -f "${NANOIMG}" -x 63 -y 255)
gpart create -s BSD "${DEV}"
gpart bootcode -b "${STAGEDIR}"/boot/boot "${DEV}"
gpart add -t freebsd-ufs "${DEV}"
mdconfig -d -u "${DEV}"
DEV=$(mdconfig -a -t vnode -f ${NANOIMG} -x 63 -y 255)
gpart create -s BSD ${DEV}
gpart bootcode -b ${STAGEDIR}/boot/boot ${DEV}
gpart add -t freebsd-ufs ${DEV}
mdconfig -d -u ${DEV}

View File

@ -36,7 +36,7 @@ for ARG in ${@}; do
arm)
echo ">>> Renaming arm image: ${VERSION}"
mv ${IMAGESDIR}/*-${PRODUCT_FLAVOUR}-arm-${PRODUCT_ARCH}.img \
${IMAGESDIR}/${PRODUCT_NAME}-${VERSION}-${PRODUCT_FLAVOUR}-arm-${PRODUCT_ARCH}.iso
${IMAGESDIR}/${PRODUCT_NAME}-${VERSION}-${PRODUCT_FLAVOUR}-arm-${PRODUCT_ARCH}.img
;;
base)
setup_stage ${STAGEDIR}

View File

@ -55,8 +55,8 @@ EOF
makefs -t ffs -B little -o label=${SERIALLABEL} ${SERIALIMG} ${STAGEDIR}
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}"
DEV=$(mdconfig -a -t vnode -f ${SERIALIMG} -x 63 -y 255)
gpart create -s BSD ${DEV}
gpart bootcode -b ${STAGEDIR}/boot/boot ${DEV}
gpart add -t freebsd-ufs ${DEV}
mdconfig -d -u ${DEV}

View File

@ -61,9 +61,9 @@ sh ./clean.sh ${SELF}
setup_stage ${STAGEDIR} mnt
truncate -s ${VMSIZE} ${VMBASE}
MD=$(mdconfig -f ${VMBASE})
newfs /dev/${MD}
mount /dev/${MD} ${STAGEDIR}/mnt
DEV=$(mdconfig -f ${VMBASE})
newfs /dev/${DEV}
mount /dev/${DEV} ${STAGEDIR}/mnt
setup_base ${STAGEDIR}/mnt
@ -102,7 +102,7 @@ elif [ -n "${VMSWAP}" -a -n "${UEFIBOOT}" ]; then
fi
umount ${STAGEDIR}/mnt
mdconfig -d -u ${MD}
mdconfig -d -u ${DEV}
echo -n ">>> Building vm image... "