extend build.sh to be able to build any architecture supported by openwrt
This commit is contained in:
parent
6a8fae808e
commit
8faf47e902
53
build.sh
53
build.sh
@ -15,21 +15,41 @@ absolutize ()
|
|||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET_PLATFORM=$1
|
TARGET_ARCHITECTURE=$1
|
||||||
|
TARGET_VARIANT=$2
|
||||||
if [ -z ${TARGET_PLATFORM} ]; then
|
TARGET_DEVICE=$3
|
||||||
echo "Usage: $0 target-platform (e.g. 'TLWDR4300')"
|
|
||||||
kill -INT $$
|
|
||||||
fi
|
|
||||||
|
|
||||||
BUILD=`dirname "$0"`"/build/"
|
BUILD=`dirname "$0"`"/build/"
|
||||||
BUILD=`absolutize $BUILD`
|
BUILD=`absolutize $BUILD`
|
||||||
|
|
||||||
|
###
|
||||||
|
### chose a release
|
||||||
|
###
|
||||||
|
RELEASE_NAME="chaos_calmer"
|
||||||
RELEASE="15.05"
|
RELEASE="15.05"
|
||||||
|
|
||||||
|
#RELEASE_NAME="snapshots"
|
||||||
|
#RELEASE="trunk"
|
||||||
|
|
||||||
|
if [ $RELEASE = "trunk" ]; then
|
||||||
|
IMGBUILDER_NAME="OpenWrt-ImageBuilder-${TARGET_ARCHITECTURE}-${TARGET_VARIANT}.Linux-x86_64"
|
||||||
|
else
|
||||||
|
IMGBUILDER_NAME="OpenWrt-ImageBuilder-${RELEASE}-${TARGET_ARCHITECTURE}-${TARGET_VARIANT}.Linux-x86_64"
|
||||||
|
fi
|
||||||
|
IMGBUILDER_DIR="${BUILD}/${IMGBUILDER_NAME}"
|
||||||
|
IMGBUILDER_ARCHIVE="${IMGBUILDER_NAME}.tar.bz2"
|
||||||
|
|
||||||
IMGTEMPDIR="${BUILD}/openwrt-build-image-extras"
|
IMGTEMPDIR="${BUILD}/openwrt-build-image-extras"
|
||||||
IMGBUILDERDIR="${BUILD}/OpenWrt-ImageBuilder-${RELEASE}-ar71xx-generic.Linux-x86_64"
|
IMGBUILDERURL="https://downloads.openwrt.org/${RELEASE_NAME}/${RELEASE}/${TARGET_ARCHITECTURE}/${TARGET_VARIANT}/${IMGBUILDER_ARCHIVE}"
|
||||||
IMGBUILDERARCHIVE="OpenWrt-ImageBuilder-${RELEASE}-ar71xx-generic.Linux-x86_64.tar.bz2"
|
|
||||||
IMGBUILDERURL="https://downloads.openwrt.org/chaos_calmer/${RELEASE}/ar71xx/generic/${IMGBUILDERARCHIVE}"
|
if [ -z ${TARGET_DEVICE} ]; then
|
||||||
|
echo "Usage: $0 architecture variant device-profile"
|
||||||
|
echo " e.g.: $0 ar71xx generic TLWDR4300"
|
||||||
|
echo " $0 ramips mt7621 ZBT-WG3526"
|
||||||
|
echo " to get a list of supported devices issue a 'make info' in the OpenWRT image builder directory:"
|
||||||
|
echo " '${IMGBUILDER_DIR}'"
|
||||||
|
kill -INT $$
|
||||||
|
fi
|
||||||
|
|
||||||
# the absolute minimum for extroot to work at all (i.e. when the disk is already set up, for example by hand).
|
# the absolute minimum for extroot to work at all (i.e. when the disk is already set up, for example by hand).
|
||||||
# this list may be smaller and/or different for your router, but it works with my ar71xx.
|
# this list may be smaller and/or different for your router, but it works with my ar71xx.
|
||||||
@ -51,23 +71,24 @@ mkdir --parents ${BUILD}
|
|||||||
|
|
||||||
rm -rf $IMGTEMPDIR
|
rm -rf $IMGTEMPDIR
|
||||||
cp -r image-extras/common/ $IMGTEMPDIR
|
cp -r image-extras/common/ $IMGTEMPDIR
|
||||||
PER_PLATFORM_IMAGE_EXTRAS=image-extras/${TARGET_PLATFORM}/
|
PER_PLATFORM_IMAGE_EXTRAS=image-extras/${TARGET_DEVICE}/
|
||||||
if [ -e $PER_PLATFORM_IMAGE_EXTRAS ]; then
|
if [ -e $PER_PLATFORM_IMAGE_EXTRAS ]; then
|
||||||
rsync -pr $PER_PLATFORM_IMAGE_EXTRAS $IMGTEMPDIR/
|
rsync -pr $PER_PLATFORM_IMAGE_EXTRAS $IMGTEMPDIR/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e ${IMGBUILDERDIR} ]; then
|
if [ ! -e ${IMGBUILDER_DIR} ]; then
|
||||||
pushd ${BUILD}
|
pushd ${BUILD}
|
||||||
wget --continue ${IMGBUILDERURL}
|
# --no-check-certificate if needed
|
||||||
tar jvxf ${IMGBUILDERARCHIVE}
|
wget --continue ${IMGBUILDERURL}
|
||||||
|
tar jvxf ${IMGBUILDER_ARCHIVE}
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd ${IMGBUILDERDIR}
|
pushd ${IMGBUILDER_DIR}
|
||||||
|
|
||||||
make image PROFILE=${TARGET_PLATFORM} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR}
|
make image PROFILE=${TARGET_DEVICE} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR}
|
||||||
|
|
||||||
pushd bin/ar71xx/
|
pushd bin/${TARGET_ARCHITECTURE}/
|
||||||
ln -s ../../packages .
|
ln -s ../../packages .
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user