wok-next view linux-source/stuff/get-linux-source @ rev 15772
linux-source: install initrd.cpio
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 07 23:03:08 2014 +0000 (2014-01-07) |
parents | 7c9b40764925 |
children | db5b03f42dd9 |
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 cp /usr/share/boot/initrd initrd.cpio
45 while read patch_file; do
46 echo "Apply $patch_file"
47 patch -p1 < slitaz/$patch_file
48 done < slitaz/patches
49 [ ! -f System.map ] && cp slitaz/config .config &&
50 make oldconfig && make modules_prepare
51 ln -s /usr/src/linux-$VERSION /lib/modules/$VERSION-slitaz/build
52 ln -s linux-$VERSION /usr/src/linux
54 cat <<EOT
55 ----
56 To modify the kernel configuration:
57 $ cd /usr/src/linux-$VERSION
58 $ make menuconfig
60 To build the kernel and the modules:
61 $ cd /usr/src/linux-$VERSION
62 $ make bzImage && make modules
64 To install the new kernel and the modules:
65 $ make modules_install
66 $ cp -a arch/x86/boot/bzImage /boot/vmlinuz-$VERSION-slitaz
68 To make a Slitaz package with the new kernel and the modules:
69 $ make tazpkg
71 See /usr/src/linux-$VERSION/README
72 ----
73 EOT