aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/build-umlkernel
blob: 44e27c2b29aeac925e5dfe2da4b213cc8e37c76f (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# build an UML kernel based on a vanilla kernel and UML patch
#
# 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 kernel at '$KERNEL'.."
if [ -f "${KERNEL}" ]
then
    cecho "found it"
    KERNELVERSION=`basename $KERNEL .tar.bz2 | sed -e 's/linux-//'`
    cecho " * Kernel version is $KERNELVERSION"
else
    cecho "none"
    exit
fi

if [ ${UMLPATCH} ]
then
    cecho-n " * Looking for uml patch at '$UMLPATCH'.."
    if [ -f "${UMLPATCH}" ]
    then
	cecho "found it"
    else
	cecho "none"
	exit
    fi
fi

cecho-n " * Looking for kernel config at '$KERNELCONFIG'.."
if [ -f "${KERNEL}" ]
then
    cecho "found it"
else
    cecho "none"
    exit
fi

#######################################################
# unpack kernel and create symlink
#

if [ ! -d $BUILDDIR ]
then
    cecho " * Creating directory '$BUILDDIR'"
    mkdir $BUILDDIR
fi

cecho " * Changing to directory '$BUILDDIR'"
cd $BUILDDIR

cecho-n " * Unpacking kernel.."
tar xjf $KERNEL >> $LOGFILE 2>&1
cgecho "done"

KERNELDIR=${BUILDDIR}/linux-${KERNELVERSION}

if [ -d $KERNELDIR ]
then
    cecho " * Kernel directory is '$KERNELDIR'"
    cecho " * Creating symlink 'linux'"
    if [ -d linux ]
    then
	rm linux
    fi
    ln -s linux-${KERNELVERSION} linux
else
    cecho "!! Kernel directory '$KERNELDIR' can not be found"
    exit
fi

#######################################################
# patch kernel
#

cecho " * Changing to directory '$KERNELDIR'"
cd $KERNELDIR

if [ $UMLPATCH ]
then
    cecho-n " * Applying uml patch.."
    bzcat $UMLPATCH | patch -p1 >> $LOGFILE 2>&1
    cgecho  "done"
fi

#######################################################
# copy our default .config to linux and build kernel
#

cp $KERNELCONFIG .config

cecho "!!"
cecho "!! Making .config for kernel. You might be prompted for new parameters!"
cecho "!!"
make oldconfig ARCH=um 2>&1 | tee -a $LOGFILE

cecho-n " * Now compiling uml kernel.."
make -j5 linux ARCH=um >> $LOGFILE 2>&1
cgecho "done"

cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.."
mv linux ${BUILDDIR}/linux-uml-${KERNELVERSION}
cgecho "done"