aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/build-umlrootfs
blob: 271e532d42477da4270eddd9f1662d4c0e03054f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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.

echo "Building root image"

. $PWD/scripts/function.sh

[ `id -u` -eq 0 ] || die "You must be root to run $0"

[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"

mkdir -p $ROOTFSDIR
mkdir -p $LOOPDIR
mkdir -p $ROOTFSCOMPILEDIR
cd $ROOTFSDIR

BASE=$BUILDDIR/base.img
log_action "Creating $BASE"
execute "cp $ROOTFS $BASE"

log_action "Mounting base image $BASE"
execute "mount -o loop $BASE $LOOPDIR"
log_action "Mounting proc filesystem to $LOOPDIR/proc"
execute "mount -t proc none $LOOPDIR/proc"

mkdir -p $LOOPDIR/root/compile
log_action "Mounting $ROOTFSCOMPILEDIR as /root/compile"
execute "mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile"

do_on_exit umount $LOOPDIR/root/compile
do_on_exit umount $LOOPDIR/proc
do_on_exit umount $LOOPDIR

echo "Installing software from source"
RECPDIR=$UMLTESTDIR/testing/scripts/recipes
RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename`
execute "cp -r $RECPDIR/patches $LOOPDIR/root/compile" 0
for r in $RECIPES
do
	cp $RECPDIR/$r ${LOOPDIR}/root/compile
	log_action "Installing from recipe $r"
	execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r"
done

log_action "Removing /etc/resolv.conf"
execute "rm -f $LOOPDIR/etc/resolv.conf"