summaryrefslogtreecommitdiff
path: root/testing/scripts/build-umlkernel
blob: 074d7847a2e7144e3fd5cc0e010ad31de7b2bc4e (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
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/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.
#
# RCSID $Id: build-umlkernel,v 1.2 2005/01/09 21:54:25 as Exp $

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

LOGFILE=${BUILDDIR}/testing.log

if [ ! -f $LOGFILE ]
then
    cecho-n " * Logfile '$LOGFILE' does not exist..creating.."
    touch $LOGFILE
    cecho "done"
fi

cecho-n " * Unpacking kernel.."
tar xjf $KERNEL >> $LOGFILE 2>&1
cecho "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
    cecho  "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 >> $LOGFILE 2>&1

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

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