Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 78 lines (64 sloc) 2.16 KB
#!/bin/sh
. config/options
if [ ! -r build/config/options ]; then
echo "Cannot find a valid config (build/config/options is missing!)"
echo "Maybe you forgot to run 'make menuconfig' ?"
exit 1
fi
$SCRIPTS/checkdeps build || exit 1
export INSTALL=$ROOTFS
mkdir -p $INSTALL
# bootstrap the build environment
$SCRIPTS/build opkg-utils
$SCRIPTS/build opkg-host
$SCRIPTS/install base-files
$SCRIPTS/installdev opkg-utils
$SCRIPTS/installdev opkg-host
# remove stale packages
for f in $INSTALL/var/lib/opkg/info/*.control ; do
package=`basename $f .control`
drop_package=yes
for rootfs_package in $ROOTFS_PACKAGES; do
[ "$package" != "$rootfs_package" ] && continue
# the package is in $ROOTFS_PACKAGES, keep it
drop_package=no
# echo "$package : drop : $drop_package"
break
done
if [ "$drop_package" = yes ] || [ $PACKAGES/*/$package/meta -nt $f ] || [ $PACKAGES/*/$package/patches -nt $f ] || \
[ $PACKAGES/*/$package/unpack -nt $f ] || [ $PACKAGES/*/$package/build -nt $f ] || [ $PACKAGES/*/$package/install -nt $f ]; then
# echo "$package : drop : $drop_package"
$SCRIPTS/uninstall $package
fi
done
for rootfs_package in $ROOTFS_PACKAGES; do
[ "$rootfs_package" = linux ] && DEPMOD=yes
install_package=yes
for f in $INSTALL/var/lib/opkg/info/*.control ; do
package=`basename $f .control`
[ "$rootfs_package" != "$package" ] && continue
# the package is already installed, skip it
install_package=no
break
done
[ "$install_package" = yes ] && $SCRIPTS/install $rootfs_package
done
for package in $OPK_PACKAGES; do
$SCRIPTS/package $package
done
# set package status to "installed"
sed -e "s/ unpacked$/ installed/" -i $INSTALL/var/lib/opkg/status
# create kernel modules dependancies
if [ "$DEPMOD" = yes ]; then
$SCRIPTS/installdev kmod-host
VER=$(kernel_version)
for i in `ls $INSTALL/lib/modules/$VER/modules.* | \
grep -v modules.order | grep -v modules.builtin`; do
rm -f $i
done
$ROOT/$TOOLCHAIN/bin/depmod -b $INSTALL -C $INSTALL/etc/depmod.d -v $VER > /dev/null
fi
# save build config
DOT_CONFIG="`ls -d $ROOT/$BUILD_NOARCH/kconfig-frontends-*`/.config"
cp -P $DOT_CONFIG $INSTALL/config
exit 0