build: add support for bootloader images

In light of future devices in need of special images for initial
flashing which are, in contrast to factory images, only flashable
from the bootloader, we add a new category for images which are only
suitable for flashing thru the vendor bootloader.

Devices in need for those images contain the AVM Fritz!Box 4040 and
various TP-Link Mediatek models.
This commit is contained in:
David Bauer 2018-06-07 16:06:49 +02:00
parent 638e6d8400
commit aff3e617d8
2 changed files with 28 additions and 1 deletions

View File

@ -38,6 +38,10 @@ sysupgrade() {
: :
} }
bootloader() {
:
}
no_opkg() { no_opkg() {
: :
} }

View File

@ -7,6 +7,8 @@ set -e
default_factory_ext='.bin' default_factory_ext='.bin'
default_factory_suffix='-squashfs-factory' default_factory_suffix='-squashfs-factory'
default_bootloader_ext=
default_bootloader_suffix=
default_sysupgrade_ext='.bin' default_sysupgrade_ext='.bin'
default_sysupgrade_suffix='-squashfs-sysupgrade' default_sysupgrade_suffix='-squashfs-sysupgrade'
@ -16,13 +18,15 @@ aliases=
factory_ext= factory_ext=
factory_suffix= factory_suffix=
bootloader_ext=
bootloader_suffix=
sysupgrade_ext= sysupgrade_ext=
sysupgrade_suffix= sysupgrade_suffix=
no_opkg= no_opkg=
mkdir -p "${GLUON_IMAGEDIR}/factory" "${GLUON_IMAGEDIR}/sysupgrade" mkdir -p "${GLUON_IMAGEDIR}/factory" "${GLUON_IMAGEDIR}/bootloader" "${GLUON_IMAGEDIR}/sysupgrade"
if [ "$(expr match "$OPENWRT_TARGET" '.*-.*')" -gt 0 ]; then if [ "$(expr match "$OPENWRT_TARGET" '.*-.*')" -gt 0 ]; then
OPENWRT_BINDIR="${OPENWRT_TARGET//-/\/}" OPENWRT_BINDIR="${OPENWRT_TARGET//-/\/}"
@ -49,6 +53,18 @@ copy() {
done done
fi fi
if [ "$bootloader_ext" ]; then
rm -f "${GLUON_IMAGEDIR}/bootloader/gluon-"*"-${output}-bootloader${bootloader_ext}"
cp "openwrt/bin/targets/${OPENWRT_BINDIR}/openwrt-${OPENWRT_TARGET}${profile}${bootloader_suffix}${bootloader_ext}" \
"${GLUON_IMAGEDIR}/bootloader/gluon-${SITE_CODE}-${GLUON_RELEASE}${output}-bootloader${bootloader_ext}"
for alias in $aliases; do
rm -f "${GLUON_IMAGEDIR}/factory/gluon-"*"-${alias}-bootloader${bootloader_ext}"
ln -s "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-bootloader${bootloader_ext}" \
"${GLUON_IMAGEDIR}/factory/gluon-${SITE_CODE}-${GLUON_RELEASE}-${alias}-bootloader${bootloader_ext}"
done
fi
if [ "$sysupgrade_ext" ]; then if [ "$sysupgrade_ext" ]; then
rm -f "${GLUON_IMAGEDIR}/sysupgrade/gluon-"*"-${output}-sysupgrade${sysupgrade_ext}" rm -f "${GLUON_IMAGEDIR}/sysupgrade/gluon-"*"-${output}-sysupgrade${sysupgrade_ext}"
cp "openwrt/bin/targets/${OPENWRT_BINDIR}/openwrt-${OPENWRT_TARGET}${profile}${sysupgrade_suffix}${sysupgrade_ext}" \ cp "openwrt/bin/targets/${OPENWRT_BINDIR}/openwrt-${OPENWRT_TARGET}${profile}${sysupgrade_suffix}${sysupgrade_ext}" \
@ -74,6 +90,8 @@ device() {
factory_ext="$default_factory_ext" factory_ext="$default_factory_ext"
factory_suffix="$default_factory_suffix" factory_suffix="$default_factory_suffix"
bootloader_ext="$default_bootloader_ext"
bootloader_suffix="$default_bootloader_suffix"
sysupgrade_ext="$default_sysupgrade_ext" sysupgrade_ext="$default_sysupgrade_ext"
sysupgrade_suffix="$default_sysupgrade_suffix" sysupgrade_suffix="$default_sysupgrade_suffix"
} }
@ -148,6 +166,11 @@ sysupgrade() {
fi fi
} }
bootloader() {
bootloader_suffix="$1"
bootloader_ext="$2"
}
no_opkg() { no_opkg() {
no_opkg=1 no_opkg=1
} }