101 lines
2.6 KiB
Bash
Executable File
101 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Create UML root filesystem
|
|
#
|
|
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
|
|
# Zuercher Hochschule Winterthur
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by the
|
|
# Free Software Foundation; either version 2 of the License, or (at your
|
|
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
|
|
DIR=`dirname $0`
|
|
|
|
source $DIR/function.sh
|
|
|
|
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
|
|
|
|
source $DIR/../testing.conf
|
|
|
|
cecho-n " * Looking for root image at '$ROOTFS'.."
|
|
if [ -f "$ROOTFS" ]
|
|
then
|
|
cgecho "found it"
|
|
else
|
|
cecho "none"
|
|
exit
|
|
fi
|
|
|
|
[ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist"
|
|
|
|
ROOTFSDIR=$BUILDDIR/root-fs
|
|
|
|
if [ ! -d $ROOTFSDIR ]
|
|
then
|
|
cecho-n " * Root file system directory '$ROOTFSDIR' does not exist..creating.."
|
|
mkdir $ROOTFSDIR
|
|
cgecho "done"
|
|
fi
|
|
|
|
cd $ROOTFSDIR
|
|
|
|
if [ ! -d $LOOPDIR ]
|
|
then
|
|
mkdir $LOOPDIR
|
|
fi
|
|
|
|
######################################################
|
|
# mount root image
|
|
#
|
|
BASE=$BUILDDIR/base.img
|
|
cecho-n " * Mounting base image $BASE.."
|
|
cp $ROOTFS $BASE
|
|
mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1
|
|
mount -t proc none $LOOPDIR/proc >> $LOGFILE 2>&1
|
|
cgecho "done"
|
|
|
|
######################################################
|
|
# install software from source using 'recipes'
|
|
#
|
|
mkdir -p $ROOTFSCOMPILEDIR
|
|
cecho " * Mounting $ROOTFSCOMPILEDIR as /root/compile.."
|
|
mkdir -p $LOOPDIR/root/compile
|
|
mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile >> $LOGFILE 2>&1
|
|
|
|
cecho " * Installing software from source.."
|
|
RECPDIR=$UMLTESTDIR/testing/scripts/recipes
|
|
RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename`
|
|
cp -r $RECPDIR/patches $LOOPDIR/root/compile
|
|
for r in $RECIPES
|
|
do
|
|
cecho-n " - $r.."
|
|
cp $RECPDIR/$r ${LOOPDIR}/root/compile
|
|
chroot ${LOOPDIR} make SWANVERSION=$SWANVERSION -C /root/compile -f $r \
|
|
>> $LOGFILE 2>&1
|
|
if [ $? != 0 ]; then
|
|
cecho "failed"
|
|
else
|
|
cgecho "done"
|
|
fi
|
|
done
|
|
|
|
umount $LOOPDIR/root/compile
|
|
|
|
cecho " * Setting up shared build tree at /root/compile"
|
|
echo "" >> $LOOPDIR/etc/fstab
|
|
echo "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab
|
|
|
|
######################################################
|
|
# remove /etc/resolv.conf
|
|
#
|
|
cecho " * Removing /etc/resolv.conf"
|
|
rm -f $LOOPDIR/etc/resolv.conf
|
|
|
|
umount $LOOPDIR/proc
|
|
umount $LOOPDIR
|