rev |
line source |
pankso@3
|
1 # SliTaz package receipt.
|
pankso@3
|
2
|
pankso@3
|
3 PACKAGE="linux"
|
pascal@18296
|
4 VERSION="3.2.71"
|
pankso@3
|
5 CATEGORY="base-system"
|
pankso@3
|
6 SHORT_DESC="The Linux kernel and modules."
|
pankso@3864
|
7 MAINTAINER="devel@slitaz.org"
|
pascal@14657
|
8 LICENSE="GPL2"
|
pankso@15855
|
9 TARBALL="$PACKAGE-$VERSION.tar.xz"
|
pankso@3
|
10 WEB_SITE="http://www.kernel.org/"
|
pascal@18297
|
11 WGET_URL="http://www.kernel.org/pub/linux/kernel/v3.0/$TARBALL"
|
pankso@12803
|
12 HOST_ARCH="i486 arm x86_64"
|
pankso@12803
|
13
|
pankso@15855
|
14 DEPENDS="kmod"
|
pankso@15855
|
15 BUILD_DEPENDS="slitaz-toolchain perl git xz lzma patch kmod \
|
pascal@17029
|
16 uclibc-cross-compiler-x86_64"
|
pankso@12824
|
17
|
pankso@15855
|
18 #
|
pankso@15855
|
19 # The Linux receipt handle cross compilation. For x86_64 we actually use
|
pankso@15855
|
20 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
|
pankso@15855
|
21 # Please discuss any change and keep it simple, dont play with VERSION
|
pankso@15855
|
22 # string or Kernel SUBLEVEL because depmod and Pankso dont like that!
|
pankso@15855
|
23 #
|
pankso@15855
|
24 # The receipt also handle some cook options for faster build:
|
pankso@15855
|
25 # --nox64 : Skip the x86_64 cross compilation
|
pankso@15855
|
26 # --nonomods : Skip bzImage without modules build
|
pankso@15855
|
27 #
|
pankso@12812
|
28
|
pankso@12803
|
29 # Aufs enable chroot
|
pascal@14223
|
30 AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
|
pankso@3
|
31
|
pankso@12824
|
32 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
|
pankso@12803
|
33 case "$ARCH" in
|
pankso@15855
|
34 arm) BUILD_DEPENDS="xz" ;;
|
pankso@12824
|
35 x86_64) BUILD_DEPENDS="xz" ;;
|
pankso@12824
|
36 esac
|
pankso@12824
|
37
|
pankso@15855
|
38 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
|
pankso@15855
|
39 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
|
pankso@15921
|
40 if [ -f $root/etc/slitaz/slitaz.conf ]; then
|
pankso@15921
|
41 . $root/etc/slitaz/slitaz.conf
|
pankso@15921
|
42 case "$SLITAZ_ARCH" in
|
pankso@15921
|
43 arm) DEPENDS="" ;;
|
pankso@15921
|
44 esac
|
pankso@15921
|
45 fi
|
pankso@12824
|
46
|
pascal@17366
|
47 install_module_headers()
|
pascal@17366
|
48 {
|
pascal@17366
|
49 local path
|
pascal@17366
|
50 path=usr/src/linux-$KVERSION
|
pascal@17366
|
51 mkdir -p $1/lib/modules/$KVERSION
|
pascal@17366
|
52 ln -sf /$path $1/lib/modules/$KVERSION/build
|
pascal@17366
|
53 install -D -m644 $src/Makefile \
|
pascal@17366
|
54 $1/$path/Makefile
|
pascal@17366
|
55 install -D -m644 $src/kernel/Makefile \
|
pascal@17366
|
56 $1/$path/kernel/Makefile
|
pascal@17366
|
57 install -D -m644 $src/.config \
|
pascal@17366
|
58 $1/$path/.config
|
pascal@17366
|
59 mkdir -p $1/$path/include
|
pascal@17366
|
60
|
pascal@17366
|
61 for i in acpi asm-generic config crypto drm generated linux math-emu \
|
pascal@17366
|
62 media net pcmcia scsi sound trace video xen; do
|
pascal@17366
|
63 cp -a $src/include/$i $1/$path/include/
|
pascal@17366
|
64 done
|
pascal@17366
|
65
|
pascal@17366
|
66 # copy arch includes for external modules
|
pascal@17366
|
67 mkdir -p $1/$path/arch/x86
|
pascal@17366
|
68 cp -a $src/arch/x86/include $1/$path/arch/x86/
|
pascal@17366
|
69
|
pascal@17366
|
70 # copy files necessary for later builds, like nvidia and vmware
|
pascal@17369
|
71 cp -a $src/Module.symvers $1/$path/Module.symvers
|
pascal@17366
|
72 cp -a $src/scripts $1/$path
|
pascal@17366
|
73 # fix permissions on scripts dir
|
pascal@17366
|
74 chmod og-w -R $1/$path/scripts
|
pascal@17366
|
75 mkdir -p $1/$path/.tmp_versions
|
pascal@17366
|
76
|
pascal@17366
|
77 mkdir -p $1/$path/arch/x86/kernel
|
pascal@17366
|
78 cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
|
pascal@17366
|
79 cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
|
pascal@17366
|
80 cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
|
pascal@17366
|
81
|
pascal@17366
|
82 # add headers for lirc package
|
pascal@17366
|
83 mkdir -p $1/$path/drivers/media/video
|
pascal@17366
|
84 cp -a $src/drivers/media/video/*.h $1/$path/drivers/media/video/
|
pascal@17366
|
85
|
pascal@17366
|
86 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 ; do
|
pascal@17366
|
87 mkdir -p $1/$path/drivers/media/video/$i
|
pascal@17366
|
88 cp -a $src/drivers/media/video/$i/*.h $1/$path/drivers/media/video/$i
|
pascal@17366
|
89 done
|
pascal@17366
|
90
|
pascal@17366
|
91 # add docbook makefile
|
pascal@17366
|
92 install -D -m644 $src/Documentation/DocBook/Makefile \
|
pascal@17366
|
93 $1/$path/Documentation/DocBook/Makefile
|
pascal@17366
|
94
|
pascal@17366
|
95 # add dm headers
|
pascal@17366
|
96 mkdir -p $1/$path/drivers/md
|
pascal@17366
|
97 cp -a $src/drivers/md/*.h $1/$path/drivers/md
|
pascal@17366
|
98
|
pascal@17366
|
99 # add inotify.h
|
pascal@17366
|
100 mkdir -p $1/$path/include/linux
|
pascal@17366
|
101 cp -a $src/include/linux/inotify.h $1/$path/include/linux/
|
pascal@17366
|
102
|
pascal@17366
|
103 # add wireless headers
|
pascal@17366
|
104 mkdir -p $1/$path/net/mac80211/
|
pascal@17366
|
105 cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
|
pascal@17366
|
106
|
pascal@17366
|
107 # add dvb headers for external modules
|
pascal@17366
|
108 # in reference to:
|
pascal@17366
|
109 # http://bugs.archlinux.org/task/9912
|
pascal@17366
|
110 mkdir -p $1/$path/drivers/media/dvb/dvb-core
|
pascal@17366
|
111 cp -a $src/drivers/media/dvb/dvb-core/*.h $1/$path/drivers/media/dvb/dvb-core/
|
pascal@17366
|
112
|
pascal@17366
|
113 # add dvb headers for external modules
|
pascal@17366
|
114 # in reference to:
|
pascal@17366
|
115 # http://bugs.archlinux.org/task/11194
|
pascal@17366
|
116 if [ -d $src/include/config/dvb/ ]; then
|
pascal@17366
|
117 mkdir -p $1/$path/include/config/dvb/
|
pascal@17366
|
118 cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
|
pascal@17366
|
119 fi
|
pascal@17366
|
120
|
pascal@17366
|
121 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
|
pascal@17366
|
122 # in reference to:
|
pascal@17366
|
123 # http://bugs.archlinux.org/task/13146
|
pascal@17366
|
124 mkdir -p $1/$path/drivers/media/dvb/frontends/
|
pascal@17366
|
125 cp -a $src/drivers/media/dvb/frontends/lgdt330x.h $1/$path/drivers/media/dvb/frontends/
|
pascal@17366
|
126 cp -a $src/drivers/media/video/msp3400-driver.h $1/$path/drivers/media/dvb/frontends/
|
pascal@17366
|
127
|
pascal@17366
|
128 # add dvb headers
|
pascal@17366
|
129 # in reference to:
|
pascal@17366
|
130 # http://bugs.archlinux.org/task/20402
|
pascal@17366
|
131 mkdir -p $1/$path/drivers/media/dvb/dvb-usb
|
pascal@17366
|
132 cp -a $src/drivers/media/dvb/dvb-usb/*.h $1/$path/drivers/media/dvb/dvb-usb/
|
pascal@17366
|
133 mkdir -p $1/$path/drivers/media/dvb/frontends
|
pascal@17366
|
134 cp -a $src/drivers/media/dvb/frontends/*.h $1/$path/drivers/media/dvb/frontends/
|
pascal@17366
|
135 mkdir -p $1/$path/drivers/media/common/tuners
|
pascal@17366
|
136 cp -a $src/drivers/media/common/tuners/*.h $1/$path/drivers/media/common/tuners/
|
pascal@17366
|
137
|
pascal@17366
|
138 # add xfs and shmem for aufs building
|
pascal@17366
|
139 mkdir -p $1/$path/fs/xfs
|
pascal@17366
|
140 mkdir -p $1/$path/mm
|
pascal@17366
|
141 cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
|
pascal@17366
|
142
|
pascal@17366
|
143 # copy in Kconfig files
|
pascal@17366
|
144 for i in $(find . -name "Kconfig*"); do
|
pascal@17366
|
145 mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
|
pascal@17366
|
146 cp -a $src/$i $1/$path/$i
|
pascal@17366
|
147 done
|
pascal@17366
|
148
|
pascal@17366
|
149 chown -R root.root $1/$path
|
pascal@17366
|
150 find $1/$path -type d -exec chmod 755 {} \;
|
pascal@17366
|
151 # remove unneeded architectures
|
pascal@17366
|
152 rm -rf $1/$path/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
|
pascal@17366
|
153 }
|
pascal@17366
|
154
|
pankso@3
|
155 # Rules to configure and make the package.
|
pankso@3
|
156 compile_rules()
|
pankso@3
|
157 {
|
pankso@15921
|
158 if [ -f "/usr/share/boot/initrd" ]; then
|
pankso@15921
|
159 cp /usr/share/boot/initrd initrd.cpio
|
pankso@15921
|
160 fi
|
pankso@12803
|
161
|
pankso@15855
|
162 # Handle cross compilation
|
pankso@12803
|
163 case "$ARCH" in
|
pankso@12803
|
164 arm)
|
pankso@15855
|
165 echo "Compiling: $ARCH Kernel"
|
pankso@12824
|
166 make mrproper
|
pankso@12824
|
167 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
|
pankso@12824
|
168 cp -f $stuff/$ARCH/linux-arm.config .config
|
pascal@15733
|
169 yes '' | make ARCH=$ARCH oldconfig
|
pankso@12803
|
170 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
|
pankso@12803
|
171 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
|
pankso@12803
|
172 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
|
pankso@12803
|
173 INSTALL_MOD_PATH=$DESTDIR modules_install &&
|
pankso@12803
|
174 mkdir -p $DESTDIR/boot &&
|
pankso@12824
|
175 cp -a arch/arm/boot/zImage \
|
pankso@12803
|
176 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
|
pankso@15921
|
177 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
|
pankso@12803
|
178 return 0 ;;
|
pankso@12803
|
179 x86_64)
|
pankso@12803
|
180 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
|
pankso@12803
|
181 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
|
pankso@12803
|
182 return 0 ;;
|
pankso@12803
|
183 esac
|
pankso@12803
|
184
|
pankso@15855
|
185 # Check for Aufs and get source/patches if needed
|
pankso@9731
|
186 echo "Checking for Aufs packages..."
|
pankso@15855
|
187 AUFSVER=$(grep ^VERSION= $WOK/aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
|
pankso@15855
|
188 AUFSDIR="$WOK/aufs/source/aufs-${AUFSVER}"
|
pankso@15855
|
189 if [ ! -d "$AUFSDIR" ]; then
|
pankso@15855
|
190 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
|
pankso@12288
|
191 mkdir -p $WOK/aufs/source/
|
pankso@15855
|
192 echo "Extracting: aufs-${AUFSVER}.tar.bz2"
|
pankso@15855
|
193 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $WOK/aufs/source/
|
pankso@9731
|
194 fi
|
pankso@15855
|
195
|
pankso@12285
|
196 echo "cook:linux" > $command
|
pankso@12285
|
197
|
pankso@9731
|
198 echo "Copying Aufs files and patches..."
|
slaxemulator@7297
|
199 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
|
pankso@12285
|
200 cp -a $AUFSDIR/aufs3-*.patch $stuff
|
pankso@12285
|
201
|
pankso@15855
|
202 # SliTaz db stuff
|
pankso@15855
|
203 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
|
pankso@12285
|
204 mkdir -p $WOK/$PACKAGE/source/slitaz
|
pankso@12290
|
205 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
|
pankso@12285
|
206 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
|
pankso@12285
|
207 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
|
pankso@12803
|
208
|
pankso@5640
|
209 # Apply patches
|
pankso@9731
|
210 echo "Applying patches..."
|
pascal@521
|
211 while read patch_file; do
|
pankso@12285
|
212 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
|
pankso@12285
|
213 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
|
pascal@1442
|
214 if [ -f done.$patch_file ]; then
|
pankso@15855
|
215 echo "Skipping $patch_file" && continue
|
pascal@1442
|
216 fi
|
pascal@521
|
217 echo "Apply $patch_file"
|
pankso@15855
|
218 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
|
pascal@1442
|
219 touch done.$patch_file
|
pascal@521
|
220 done <<EOT
|
pankso@12285
|
221 $PACKAGE-diff.u
|
pankso@12285
|
222 $PACKAGE-header.u
|
pankso@12285
|
223 $PACKAGE-freeinitrd.u
|
pascal@14759
|
224 $PACKAGE-subroot.u
|
pascal@17267
|
225 $PACKAGE-romfs.u
|
pascal@17426
|
226 $PACKAGE-hardlinks.u
|
pankso@12285
|
227 aufs3-base.patch
|
pankso@12285
|
228 aufs3-standalone.patch
|
pankso@12285
|
229 aufs3-loopback.patch
|
mojo@15707
|
230 aufs3-mmap.patch
|
pankso@12285
|
231 channel-negative-one-maxim.patch
|
pankso@12285
|
232 mac80211.compat08082009.wl_frag+ack_v1.patch
|
pascal@521
|
233 EOT
|
pankso@15855
|
234
|
pankso@15855
|
235 # Mrproper and lguest
|
pankso@15855
|
236 echo "Make kernel proper and then build lguest..."
|
pankso@3864
|
237 make mrproper
|
pankso@12285
|
238 cd Documentation/virtual/lguest
|
pankso@15855
|
239 make lguest || return 1
|
pankso@15855
|
240 cd $src
|
pankso@15855
|
241
|
pankso@15855
|
242 #
|
pankso@15855
|
243 # Arch x86_64: TODO have a real cross environment
|
pankso@15855
|
244 #
|
pankso@15870
|
245 if [ ! "$nox64" ]; then
|
pankso@15855
|
246 echo "Compiling: x86_64 Kernel"
|
pankso@15855
|
247
|
pankso@15855
|
248 # Build bzImage64 without modules first
|
pankso@15870
|
249 if [ ! "$nonomods" ]; then
|
pankso@15855
|
250 cp -f $stuff/$PACKAGE-slitaz.config64 .config
|
pankso@15855
|
251 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
pankso@15855
|
252 # We can't keep every driver in staging ???
|
pankso@15855
|
253 sed -i -e 's/^CONFIG_RTL8192/#&/' \
|
pankso@15855
|
254 -e 's/^CONFIG_R8187SE/#&/' \
|
pankso@15855
|
255 -e 's/^CONFIG_RT2870/#&/' .config
|
pankso@15855
|
256 echo -e "\n* Configure bzImage64 without modules...\n"
|
pankso@15855
|
257 yes '' | make ARCH=x86_64 oldconfig
|
pankso@15855
|
258 echo -e "\n* Building bzImage64 without modules...\n"
|
pankso@15855
|
259 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage || exit 1
|
pankso@15855
|
260 [ -d $DESTDIR ] || mkdir -p $DESTDIR/linux64
|
pankso@15855
|
261 mv arch/x86/boot/bzImage $DESTDIR/linux64
|
pankso@15855
|
262 mv System.map System.map-without-modules64
|
pankso@15855
|
263 fi
|
pankso@15855
|
264
|
pankso@15855
|
265 # Build bzImage64 with modules
|
pankso@15855
|
266 cp -f $stuff/$PACKAGE-slitaz.config64 .config
|
pankso@15855
|
267 echo -e "\n* Configure bzImage64 with modules...\n"
|
pankso@15855
|
268 yes '' | make ARCH=x86_64 oldconfig
|
pankso@15855
|
269 echo -e "\n* Building bzImage64 with modules...\n"
|
pankso@15855
|
270 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- bzImage &&
|
pankso@15855
|
271 make -j 4 ARCH=x86_64 CROSS_COMPILE=uclibc-x86_64- modules &&
|
pankso@15855
|
272 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
|
pankso@15855
|
273 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
|
pankso@15855
|
274 ln .config $WOK/$PACKAGE/source/slitaz/config64
|
pankso@15855
|
275 [ -s arch/x86/boot/bzImage ] || return 1
|
pankso@15855
|
276 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
|
pascal@17031
|
277 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
|
pascal@17366
|
278 KVERSION=$VERSION-slitaz64
|
pascal@17366
|
279 install_module_headers $DESTDIR/linux64
|
pankso@15855
|
280 ln System.map System.map-modules64
|
pankso@15855
|
281 ln Module.symvers Module.symvers-modules64
|
pankso@15855
|
282 else
|
pankso@15855
|
283 echo "* Skipping: x86_64 Kernel..."
|
pankso@12285
|
284 fi
|
pankso@15855
|
285
|
pankso@12294
|
286 #
|
pankso@15855
|
287 # Linux Arch i386 - GCC arch i486
|
pankso@12294
|
288 #
|
pankso@15855
|
289 echo "Compiling: i386 Kernel..."
|
pankso@12803
|
290
|
pankso@12294
|
291 # Build bzImage without modules first
|
pankso@15870
|
292 if [ ! "$nonomods" ]; then
|
pankso@15855
|
293 cp -f $stuff/$PACKAGE-slitaz.config .config
|
pankso@15855
|
294 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
pankso@15855
|
295 # We can't keep every driver in staging ???
|
pankso@15855
|
296 sed -i -e 's/^CONFIG_RTL8192/#&/' \
|
pankso@15855
|
297 -e 's/^CONFIG_R8187SE/#&/' \
|
pankso@15855
|
298 -e 's/^CONFIG_RT2870/#&/' .config
|
pankso@15855
|
299 echo -e "\n* Configure bzImage without modules...\n"
|
pankso@15855
|
300 yes '' | make ARCH=i386 oldconfig
|
pankso@15855
|
301 echo -e "\n* Building bzImage without modules...\n"
|
pascal@15670
|
302 make ARCH=i386 -j 4 bzImage || exit 1
|
pankso@15855
|
303 [ -d $DESTDIR ] || mkdir -p $DESTDIR
|
pankso@15855
|
304 mv arch/x86/boot/bzImage $DESTDIR
|
pankso@15855
|
305 mv System.map System.map-without-modules
|
pankso@12294
|
306 fi
|
pankso@15855
|
307
|
pankso@12294
|
308 # Build bzImage with modules
|
pankso@12294
|
309 cp -f $stuff/$PACKAGE-slitaz.config .config
|
pankso@15855
|
310 echo -e "\n* Configure bzImage with modules...\n"
|
pascal@15733
|
311 yes '' | make ARCH=i386 oldconfig
|
pankso@12294
|
312 ln .config $WOK/$PACKAGE/source/slitaz/config
|
pankso@15855
|
313 echo -e "\n* Building bzImage with modules...\n"
|
pascal@15670
|
314 make ARCH=i386 -j 4 bzImage &&
|
pascal@15670
|
315 make ARCH=i386 -j 4 modules &&
|
pascal@15670
|
316 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
|
pascal@15670
|
317 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
|
pankso@15855
|
318 [ -s arch/x86/boot/bzImage ] || return 1
|
pankso@12294
|
319 mkdir -p $DESTDIR/boot 2> /dev/null
|
pankso@12294
|
320 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
|
pascal@17366
|
321 KVERSION=$VERSION-slitaz
|
pascal@17366
|
322 install_module_headers $DESTDIR
|
pankso@15855
|
323
|
slaxemulator@6719
|
324 # Compress all modules.
|
pankso@15855
|
325 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
|
pankso@15855
|
326 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
|
pankso@15855
|
327 else
|
pankso@15855
|
328 return 1
|
pankso@15855
|
329 fi
|
pascal@17031
|
330 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then
|
pascal@17031
|
331 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64
|
pankso@15855
|
332 fi
|
pascal@7667
|
333 ln System.map System.map-modules
|
pascal@7667
|
334 ln Module.symvers Module.symvers-modules
|
pankso@3864
|
335 }
|
erjo@253
|
336
|
pankso@3
|
337 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pankso@3
|
338 genpkg_rules()
|
pankso@3
|
339 {
|
pankso@12803
|
340 case "$ARCH" in
|
pankso@12803
|
341 arm)
|
pankso@12803
|
342 echo "Packing: ARM Kernel"
|
pankso@12803
|
343 cp -a $install/* $fs
|
pankso@12803
|
344 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
|
pankso@12803
|
345 return 0 ;;
|
pankso@12803
|
346 x86_64)
|
pankso@12803
|
347 echo "TODO: use default or custom x86_64 packing"
|
pankso@12803
|
348 return 0 ;;
|
pankso@12803
|
349 esac
|
pankso@12803
|
350
|
al@18734
|
351 export PACKAGE VERSION
|
al@18734
|
352 local path
|
al@18734
|
353 cp -a $install/boot $fs
|
al@18734
|
354
|
al@18734
|
355 # Compress all modules.
|
al@18734
|
356 path=$fs/lib/modules/$VERSION-slitaz/kernel
|
al@18734
|
357 mkdir -p $path
|
al@18734
|
358
|
al@18734
|
359 # Get the base modules
|
al@18734
|
360 export src install
|
al@18734
|
361 mkdir -p $WOK/$PACKAGE/source/tmp
|
al@18734
|
362 # Warning stuff/list_modules.sh must find the generated modules.list
|
al@18734
|
363 $stuff/list_modules.sh \
|
pankso@15855
|
364 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
|
al@18734
|
365 while read module; do
|
al@18734
|
366 dir=$(dirname $module)
|
al@18734
|
367 [ -d $path/$dir ] || mkdir -p $path/$dir
|
al@18734
|
368 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
|
al@18734
|
369 done < $WOK/$PACKAGE/source/tmp/modules.list
|
al@18734
|
370
|
al@18734
|
371 # Remove unresolved links
|
al@18734
|
372 rm -f $fs/lib/modules/$VERSION-slitaz/build
|
al@18734
|
373 rm -f $fs/lib/modules/$VERSION-slitaz/source
|
al@18734
|
374
|
al@18734
|
375 # We only need module.{order,builtin} because other map files are
|
al@18734
|
376 # generated by depmod in post_install
|
al@18734
|
377 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
|
pankso@15855
|
378 $install/lib/modules/$VERSION-slitaz/modules.builtin \
|
pankso@15855
|
379 $fs/lib/modules/$VERSION-slitaz
|
al@18734
|
380
|
al@18734
|
381 # Pack all packages with a kernel module
|
al@18734
|
382 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt); do
|
pankso@15855
|
383 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
|
pankso@15855
|
384 cook ${i%/receipt}
|
al@18734
|
385 done
|
al@18734
|
386
|
pankso@15855
|
387 # Check any module in kernel .config that's not added to a linux-* pkgs
|
pankso@15855
|
388 # and remove aufs patches: we dont need them in HG wok.
|
pankso@15855
|
389 $stuff/check_modules.sh
|
pankso@15855
|
390 rm -f $stuff/aufs3-*
|
pankso@3
|
391 }
|
pankso@3
|
392
|
pankso@3
|
393 # Pre and post install commands for Tazpkg.
|
pankso@3
|
394 post_install()
|
pankso@3
|
395 {
|
al@18734
|
396 chroot "$root/" depmod -a $VERSION-slitaz
|
al@18734
|
397
|
al@18734
|
398 # Handle multiarch installation
|
al@18734
|
399 case "$SLITAZ_ARCH" in
|
pankso@12803
|
400 arm)
|
pankso@12803
|
401 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
|
pankso@12803
|
402 echo "Modules: /lib/modules/$VERSION-slitaz"
|
pankso@12803
|
403 return 0 ;;
|
pankso@12803
|
404 esac
|
al@18734
|
405
|
pankso@15855
|
406 # GRUB stuff.
|
pankso@15855
|
407 if [ -f "$1/boot/grub/menu.lst" ]; then
|
pankso@15855
|
408 # Current root device
|
pankso@15855
|
409 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
|
pankso@15855
|
410 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
|
pankso@15855
|
411 # Use device.map to find grub device number
|
pankso@15855
|
412 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
|
pascal@18730
|
413 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
|
al@18734
|
414
|
pankso@15855
|
415 # Add and clean kernel entries in case of upgrade for installed system.
|
pascal@18730
|
416 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
|
al@18734
|
417
|
pankso@15855
|
418 # Clean the old entry
|
pankso@15855
|
419 # TODO: old vmlinuz file is removed but the entry is still there.
|
pankso@15855
|
420 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
|
border@13797
|
421
|
pankso@15855
|
422 # Add the new entry
|
pascal@18730
|
423 cat >> "$1/boot/grub/menu.lst" << EOT
|
pankso@4056
|
424
|
pankso@4056
|
425 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
border@13754
|
426 $grub_dev
|
border@13754
|
427 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
|
pankso@4056
|
428 EOT
|
border@13754
|
429 # Make it the default entry
|
pascal@18730
|
430 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
|
pascal@18730
|
431 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
|
pankso@4056
|
432 fi
|
al@18734
|
433
|
pankso@4056
|
434 # Display information message.
|
pankso@15855
|
435 cat <<EOT
|
al@18734
|
436
|
pankso@4056
|
437 ----
|
pankso@4056
|
438 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
|
pankso@1154
|
439
|
pankso@1154
|
440 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
pankso@1154
|
441 $grub_dev
|
pankso@4056
|
442 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
|
pascal@886
|
443 ----
|
pascal@886
|
444 EOT
|
pankso@1154
|
445 fi
|
pascal@18707
|
446 true
|
pankso@3
|
447 }
|