1#!/bin/bash
2
3# Build Linux kernel
4
5# Copyright (C) 2003-2006 IBM
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20# 02111-1307, USA.
21
22
23CPUS=`grep processor /proc/cpuinfo | wc -l`
24ARCH=`uname -m`
25VERSION=2.6.39
26# WARNING: If you update the kernel version that we use, be sure to
27# update $POUNDER_SRCDIR/memtest.patch, $POUNDER_HOME/test_scripts/memtest,
28# $POUNDER_HOME/test_scripts/build_kernel, and
29# $POUNDER_HOME/build_scripts/build_kernel.
30
31#LOG_ALL_MAKE=1
32
33# Decompress tarball if necessary
34cd "$POUNDER_TMPDIR"
35tar -xvf "$POUNDER_OPTDIR/linux-$VERSION.tar.bz2"
36
37# Clean up the tree.
38cd linux-$VERSION
39
40make mrproper
41
42# Create a config file
43make allmodconfig
44
45# Build system
46if [ $LOG_ALL_MAKE ]; then
47	#Let all ouput flow to the external logging
48	make -j$CPUS oldconfig
49       	time make -j$CPUS
50else
51	#Just log std err
52	make -j$CPUS oldconfig > /dev/null
53	time make -j$CPUS > /dev/null
54fi
55
56# Did we get a kernel image?
57RETCODE=1
58if [ -f vmlinux ]; then
59	RETCODE=0
60fi
61
62exit $RETCODE
63