build/arm: sensible changes, some consolidation in other images

This commit is contained in:
Franco Fichtner 2017-09-05 06:09:32 +02:00
parent de69db6994
commit 3f85f895e3
7 changed files with 48 additions and 41 deletions

View File

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

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (c) 2017 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015 The FreeBSD Foundation
# Copyright (c) 2015-2017 The FreeBSD Foundation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -50,62 +50,58 @@ ARMLABEL="${PRODUCT_NAME}"
sh ./clean.sh ${SELF}
setup_stage ${STAGEDIR} mnt
setup_stage ${STAGEDIR}
truncate -s ${ARMSIZE} ${ARMIMG}
DEV=$(mdconfig -a -t vnode -f ${ARMIMG} -x 63 -y 255)
gpart create -s MBR ${DEV}
gpart add -t '!12' -a 63 -s 50m ${DEV}
gpart add -t '!12' -a 512k -s 50m ${DEV}
gpart set -a active -i 1 ${DEV}
newfs_msdos -L msdosboot -F 16 /dev/${DEV}s1
gpart add -t freebsd ${DEV}
gpart create -s bsd ${DEV}s2
gpart add -t freebsd-ufs -a 64k /dev/${DEV}s2
newfs -U -L ${ARMLABEL} /dev/${DEV}s2a
mount /dev/${DEV}s2a ${STAGEDIR}/mnt
mount /dev/${DEV}s2a ${STAGEDIR}
setup_base ${STAGEDIR}/mnt
setup_kernel ${STAGEDIR}/mnt
setup_xtools ${STAGEDIR}/mnt
setup_base ${STAGEDIR}
setup_kernel ${STAGEDIR}
setup_xtools ${STAGEDIR}
# 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
setup_xbase ${STAGEDIR}/mnt
extract_packages ${STAGEDIR}
install_packages ${STAGEDIR} php70
cp -p ${STAGEDIR}/usr/local/bin/php ${STAGEDIR}/php
cp -p ${STAGEDIR}/usr/bin/true ${STAGEDIR}/usr/local/bin/php
lock_packages ${STAGEDIR}
setup_packages ${STAGEDIR}
unlock_packages ${STAGEDIR}
cp -p ${STAGEDIR}/php ${STAGEDIR}/usr/local/bin/php
rm ${STAGEDIR}/php
setup_extras ${STAGEDIR} ${SELF}
setup_entropy ${STAGEDIR}
setup_xbase ${STAGEDIR}
cat > ${STAGEDIR}/mnt/etc/fstab << EOF
echo -n ">>> Building arm image... "
cat > ${STAGEDIR}/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass#
/dev/ufs/${ARMLABEL} / ufs rw 1 1
/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0
EOF
mkdir -p ${STAGEDIR}/mnt/boot/msdos
cp -rp ${STAGEDIR}/mnt/boot ${STAGEDIR}/boot
mkdir -p ${STAGEDIR}/boot/msdos
mount_msdosfs /dev/${DEV}s1 ${STAGEDIR}/boot/msdos
umount ${STAGEDIR}/mnt
mount_msdosfs /dev/${DEV}s1 ${STAGEDIR}/mnt
cp -p ${STAGEDIR}/boot/ubldr ${STAGEDIR}/boot/msdos/ubldr
cp -p ${STAGEDIR}/boot/ubldr.bin ${STAGEDIR}/boot/msdos/ubldr.bin
cp -p ${STAGEDIR}/boot/dtb/rpi2.dtb ${STAGEDIR}/boot/msdos/rpi2.dtb
cp -p /usr/local/share/u-boot/u-boot-rpi2/* ${STAGEDIR}/boot/msdos
UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2"
UBOOT_FILES="bootcode.bin config.txt fixup.dat fixup_cd.dat \
fixup_x.dat start.elf start_cd.elf start_x.elf u-boot.bin"
for _UF in ${UBOOT_FILES}; do
cp -p ${UBOOT_DIR}/${_UF} ${STAGEDIR}/mnt
done
cp -p ${STAGEDIR}/boot/ubldr ${STAGEDIR}/mnt/ubldr
cp -p ${STAGEDIR}/boot/ubldr.bin ${STAGEDIR}/mnt/ubldr.bin
cp -p ${STAGEDIR}/boot/dtb/rpi2.dtb ${STAGEDIR}/mnt/rpi2.dtb
umount ${STAGEDIR}/mnt
umount ${STAGEDIR}/boot/msdos
umount ${STAGEDIR}
mdconfig -d -u ${DEV}
echo "done"

View File

@ -840,7 +840,16 @@ setup_stage()
{
echo ">>> Setting up stage in ${1}"
MOUNTDIRS="/dev /mnt ${SRCDIR} ${PORTSDIR} ${COREDIR} ${PLUGINSDIR}"
MOUNTDIRS="
/boot/msdos
/dev
/mnt
${SRCDIR}
${PORTSDIR}
${COREDIR}
${PLUGINSDIR}
/
"
STAGE=${1}
local PID DIR

View File

@ -64,5 +64,5 @@ makefs -t ffs -s ${NANOSIZE} -B little \
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}
gpart add -t -a 4k freebsd-ufs ${DEV}
mdconfig -d -u ${DEV}

View File

@ -58,5 +58,5 @@ makefs -t ffs -B little -o label=${SERIALLABEL} ${SERIALIMG} ${STAGEDIR}
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}
gpart add -t -a 4k freebsd-ufs ${DEV}
mdconfig -d -u ${DEV}

View File

@ -61,7 +61,7 @@ sh ./clean.sh ${SELF}
setup_stage ${STAGEDIR} mnt
truncate -s ${VMSIZE} ${VMBASE}
DEV=$(mdconfig -f ${VMBASE})
DEV=$(mdconfig -t vnode -f ${VMBASE})
newfs /dev/${DEV}
mount /dev/${DEV} ${STAGEDIR}/mnt

View File

@ -13,6 +13,8 @@ EOF
arm_hook()
{
loader_conf_fixup ${1}
touch ${1}/.probe.for.growfs.nano
}
dvd_hook()