updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kernel26-901-git / PKGBUILD
blobba309fe2fcf79b7b645165dec4cd31411351b320
1 # Maintainer marius <marius@habarnam.ro>
2 # Based on http://aur.archlinux.org/packages.php?ID=13900
3 # Many thanks to ilikenwf/Matt Parnell <parwok@gmail.com> and Patrick Bartels <p4ddy.b@gmail.com>
5 pkgname="kernel26-901-git"
6 pkgver=20100808
7 pkgrel=1
8 pkgdesc="Development kernel for EeePc 901 and compatibles. Static kernel."
9 url="http://www.reddit.com/r/linux/comments/9ozu9/does_anyone_still_build_from_source/c0dtc8o"
10 arch=("i686" "x86_64")
11 license=("GPL2")
12 depends=("coreutils")
13 makedepends=("git")
15 _gitname="kernel-901-git"
16 _gitroot="http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git"
18 source=(
19 #       "http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=blob_plain;f=rt2860.bin;hb=HEAD"
20         "rt2860.bin"
23 md5sums=('7f55011396eff4983f26bb7dd7339fb3')
25 # Pulls the source tree via GIT
26 _checkout() {
28         if [ ! -d $startdir/src/$_gitname ]; then
29                 warning "Do not delete src/ as it takes VERY long to clone the kernel sources via GIT"
31                 msg2 "Cloning the project..."
32                 git clone $_gitroot $_gitname
33         else
34                 msg "\033[1;33mDo you want to pull the sources first and then build [y/N] ?\033[1;0m"
35                 read choice;
37                 # changing directory to the source tree
38                 cd $startdir/src/$_gitname
39                 if [ "$choice" = "y" ]; then
40                         msg "Updating the source tree..."
41                         git pull origin || return 1 
42                 fi
45                 if [ "$_object" != "master" ]; then
46                         msg "Switching to a new commit: $_object..."
47                         git checkout -b $_object $_object > /dev/null || return 1 
48                 fi
50                 if [ "$choice" = "y" ]; then
51             _cleanup
52         fi
53         fi
56 _cleanup () {
57         # cleaning up
58         msg "Cleaning up after us"
59         if [ "$_object" != "master" ]; then
60                 git checkout master && \
61                 git branch -d $_object || \
62                 warning "You need to remove the branch you used for the current build in order to use it again"
63         fi
64         # Optimize the local repo
65         git gc
68 # Build function called by makepkg
69 build() {
70         _karch="x86"
72         msg "Including package configuration..."
73         . $startdir/CONFIG 
75         # Determine user's build option, continue to build without pulling, or pull then build
76         _checkout || return 1 
78         cd $startdir/src/$_gitname
80         msg "Loading configuration..."
81         if [ -e $startdir/config.local ]; then
82                 msg2 "Using custom kernel config (config.local)..."
83                 cat $startdir/config.local > .config
84         elif [ -e $startdir/config.saved.$CARCH ]; then
85                 msg2 "Using saved kernel config (config.saved.$CARCH)..."
86                 cat $startdir/config.saved.$CARCH > .config
87         elif [ "$CARCH" = "i686" ]; then
88                 cat ../config.i686 > .config
89         else
90                 error "Unsupported architecture: $CARCH"
91                 return 1
92         fi
94         if [ "$_auto_old_config" = "1" ]; then
95                 yes "" | make oldconfig ARCH=$_karch
96         else
97                 msg "Updating configuration..."
98                 make oldconfig ARCH=$_karch
99         fi
101         case "$_menu_method" in
102                 menuconfig|xconfig|gconfig)
103                         msg2 "Running make $_menu_method..."
104                         make $_menu_method ARCH=$_karch
105                 ;;
106         esac
108         if [ "$_save_config" = "1" ]; then
109                 msg "Saving configuration..."
110                 msg2 "Saving src/$_gitname/.config as config.saved.$CARCH"
111                 cp .config $startdir/config.saved.$CARCH
113                 if [ "$_date_localversion" = "1" ]; then
114                         msg2 "Restoring CONFIG_LOCALVERSION..."
115                         sed -i "s/^CONFIG_LOCALVERSION=.*$/CONFIG_LOCALVERSION=\"$_localversion\"/" \
116                                 $startdir/config.saved.$CARCH
117                 fi
118         fi
120         msg "Building kernel ..."
121 #       if ! make ARCH=$_karch V="$_verbose" bzImage modules; then
122         if ! make ARCH=$_karch V="$_verbose" bzImage; then
123                 error "Failed... Your source tree might be broken. Run 'make mrproper' in src/$_gitname to clean it up"
124                 return 1
125         fi
127         _kernver="$(make kernelrelease ARCH=$_karch)"
128         _basekernel="${_kernver/-*/}"
130         if [ "$_kernel_pkgver" = "1" ]; then
131                 msg "Updating pkgver..."
132                 [ 1 ] && pkgver="${_kernver//-/.}"
133         fi
135         msg "Updating provides array..."
136         [ 1 ] && provides=("${provides[@]}" "kernel26=${_kernver//-/.}" "kernel26-901=${_kernver//-/.}")
138         msg "Installing kernel image..."
139         install -D -m644 System.map $startdir/pkg/boot/System.map26-901-git
140         install -D -m644 arch/$_karch/boot/bzImage $startdir/pkg/boot/vmlinuz26-901-git
141         install -D -m644 .config    $startdir/pkg/boot/kconfig26-901-git
143         install -D -m644 Makefile        $startdir/pkg/usr/src/linux-$_kernver/Makefile
144         install -D -m644 kernel/Makefile $startdir/pkg/usr/src/linux-$_kernver/kernel/Makefile
145         install -D -m644 .config         $startdir/pkg/usr/src/linux-$_kernver/.config
146         install -D -m644 .config         $startdir/pkg/lib/modules/$_kernver/.config
147     
148     # installing the rt2860.bin file to /lib/firmware
149 #    if [ ! -h $srcdir/rt2860.bin ]; then
150 #        #cp "$srcdir/linux-firmware.git;a=blob_plain;f=rt2860.bin;hb=HEAD" $srcdir/rt2860.bin || return 1
151 #    fi
152     mkdir -p -m755  $startdir/pkg/lib/firmware &&
153     cp $srcdir/rt2860.bin $startdir/pkg/lib/firmware/ || return 1
157 #vim: set ts=2 sw=2 noet: