cgit: updated to 0.8.2
[namenlos-ports.git] / kernel / Pkgfile
blob7d9fea3d904b3875bd03fdc4e46fee0354a73d2f
1 # Maintainer: Richard Pöttler, richard dot poettler at gmail dot com
2 # Description: the linux kernel
3 # URL: http://www.kernel.org/
4 # Depends on: 
6 if [ -r /usr/src/kernel.release ]
7 then
8         . /usr/src/kernel.release
9 fi
11 name=kernel
12 version=${version:-2.6.27.6}
13 release=${release:-1}
14 source=(remove-lilo-calls.patch)
16 build () {
17         # get the sources
18         ketchup -d linux $version
19         cd linux
21         # configure the kernel
22         if [ -r /usr/src/kernel.config ]
23         then
24                 cp /usr/src/kernel.config .config
25                 make oldconfig
26         else
27                 make defconfig
28         fi
30         # apply patches
31         if [ -d /usr/src/kernel.patches/$version ]
32         then
33                 for patch in /usr/src/kernel.patches/$version/*
34                 do
35                         patch -p1 < $patch
36                 done
37         fi
39         # remove the lilo calls
40         patch -p0 < ../remove-lilo-calls.patch
42         # build everything
43         make all
45         # install the kernel image and the System.map
46         mkdir $PKG/boot
47         make INSTALL_PATH=$PKG/boot install
49         # tasks if modules are enabled
50         if grep '^[:space:]*CONFIG_MODULES=y' .config
51         then
52                 # install the modules
53                 make INSTALL_MOD_PATH=$PKG modules_install
55                 # correct the /lib/modules/$version/{build,source} links to
56                 # /usr/src/linux
57                 rm $PKG/lib/modules/$version/{build,source}
58                 ln -s /usr/src/linux $PKG/lib/modules/$version/build
59                 ln -s /usr/src/linux $PKG/lib/modules/$version/source
60         fi
62         # copy the configuration for later use
63         install .config $PKG/boot/kernel.config
65         # install the kernel sources
66         if [ ${INSTALL_KERNEL_SOURCE:-0} -eq 1 ]
67         then
68                 make clean
69                 cd ..
70                 mkdir -p $PKG/usr/src
71                 mv linux $PKG/usr/src
72         fi