wok-next view linux-source/stuff/get-linux-source @ rev 15185
linux-source: add mirror src fallback
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Aug 23 18:59:48 2013 +0000 (2013-08-23) |
parents | f15c857e3e67 |
children | df406884857b |
line source
1 #!/bin/sh
4 source /etc/slitaz/slitaz.conf
5 SOURCES_REPOSITORY=$SLITAZ_DIR/$SLITAZ_VERSION/src
6 VERSION=XXX
8 url=$(cat /usr/src/kernel-patches/slitaz/url | sed "s/-${VERSION:0:3}.tar/-$VERSION.tar/")
9 for i in http://linux-kernel.uio.no/pub http://www.gtlib.gatech.edu/pub/kernel.org http://www.kernel.org/pub ; do
10 busybox wget -s $url && break
11 url=$(echo $url | sed "s|.*/linux/kernel|$i/linux/kernel|")
12 done
14 mirror_src=http://mirror.slitaz.org/sources/packages-$(cat /etc/slitaz-release)
15 busybox wget -s $url || url=$mirror_src/l/$(basename $url)
17 if [ ! -d $SOURCES_REPOSITORY ]; then
18 mkdir -p $SOURCES_REPOSITORY
19 fi
21 cd /usr/src/
22 if [ -f $SOURCE_REPOSITORY/$(basename ${url//bz2/lzma}) ]; then
23 unlzma -c $SOURCES_REPOSITORY/$(basename ${url//bz2/lzma}) | tar xf - -C $PWD
24 elif [ -f $SOURCES_REPOSITORY/$(basename $url) ]; then
25 tar xf $SOURCES_REPOSITORY/$(basename $url)
26 else
27 wget -O $SOURCES_REPOSITORY/$(basename $url) -c $url
28 tar xf $SOURCES_REPOSITORY/$(basename $url)
29 fi
31 cp -a /usr/src/kernel-patches/slitaz /usr/src/linux-$VERSION
32 if [ -d /usr/src/linux-$VERSION/slitaz/aufs2 ]; then
33 cp -pa /usr/src/linux-$VERSION/slitaz/aufs2/* /usr/src/linux-$VERSION
34 fi
36 # Add tazpkg support
37 if [ -d "/usr/src/linux-$VERSION/scripts/package" ]; then
38 cp -pa /usr/src/linux-$VERSION/slitaz/buildtaz /usr/src/linux-$VERSION/scripts/package
39 cd /usr/src/linux-$VERSION
40 patch -p1 -i slitaz/make-tazpkg.u
41 fi
43 cd /usr/src/linux-$VERSION
44 while read patch_file; do
45 echo "Apply $patch_file"
46 patch -p1 < slitaz/$patch_file
47 done < slitaz/patches
48 [ ! -f System.map ] && cp slitaz/config .config &&
49 make oldconfig && make modules_prepare
50 ln -s /usr/src/linux-$VERSION /lib/modules/$VERSION-slitaz/build
51 ln -s linux-$VERSION /usr/src/linux
53 cat <<EOT
54 ----
55 To modify the kernel configuration:
56 $ cd /usr/src/linux-$VERSION
57 $ make menuconfig
59 To build the kernel and the modules:
60 $ cd /usr/src/linux-$VERSION
61 $ make bzImage && make modules
63 To install the new kernel and the modules:
64 $ make modules_install
65 $ cp -a arch/x86/boot/bzImage /boot/vmlinuz-$VERSION-slitaz
67 To make a Slitaz package with the new kernel and the modules:
68 $ make tazpkg
70 See /usr/src/linux-$VERSION/README
71 ----
72 EOT