rev |
line source |
pankso@3
|
1 # SliTaz package receipt.
|
pankso@3
|
2
|
pankso@3
|
3 PACKAGE="linux"
|
shann@25634
|
4 VERSION="4.19.298"
|
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"
|
pascal@20421
|
10 WEB_SITE="https://www.kernel.org/"
|
pascal@20261
|
11 WGET_URL="https://cdn.kernel.org/pub/linux/kernel/v${VERSION%%.*}.x/$TARBALL"
|
pankso@12803
|
12 HOST_ARCH="i486 arm x86_64"
|
pankso@12803
|
13
|
pankso@15855
|
14 DEPENDS="kmod"
|
shann@25629
|
15 BUILD_DEPENDS="bash perl git xz lzma patch kmod bc \
|
shann@25629
|
16 sysfsutils-dev libtool glib-dev libwrap libwrap-dev openssl-dev udev-dev \
|
shann@25629
|
17 autoconf automake"
|
pankso@12824
|
18
|
pankso@15855
|
19 #
|
pankso@15855
|
20 # The Linux receipt handle cross compilation. For x86_64 we actually use
|
pankso@15855
|
21 # the uclibc-cross-compiler-x86_64 and for ARM we use a real cross env.
|
pankso@15855
|
22 # Please discuss any change and keep it simple, dont play with VERSION
|
pankso@15855
|
23 # string or Kernel SUBLEVEL because depmod and Pankso dont like that!
|
pankso@15855
|
24 #
|
pankso@15855
|
25 # The receipt also handle some cook options for faster build:
|
shann@25629
|
26 # --nox32 : skip the x86 compilation
|
pankso@15855
|
27 # --nox64 : Skip the x86_64 cross compilation
|
pankso@15855
|
28 # --nonomods : Skip bzImage without modules build
|
pankso@15855
|
29 #
|
pankso@12812
|
30
|
pankso@12803
|
31 # Aufs enable chroot
|
shann@25629
|
32 #AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
|
pankso@3
|
33
|
pascal@24051
|
34 current_version()
|
pascal@24051
|
35 {
|
pascal@24051
|
36 wget -O - $WEB_SITE 2> /dev/null | grep -A 1 longterm | \
|
pascal@24051
|
37 sed '/strong/!d;s|.*<strong>||;s|</s.*||;q'
|
pascal@24051
|
38 }
|
pascal@24051
|
39
|
pankso@12824
|
40 # Handle multiarch compilation. Less bdeps when cross-compiling for ARM
|
pankso@12803
|
41 case "$ARCH" in
|
pankso@15855
|
42 arm) BUILD_DEPENDS="xz" ;;
|
pankso@12824
|
43 x86_64) BUILD_DEPENDS="xz" ;;
|
pankso@12824
|
44 esac
|
pankso@12824
|
45
|
pankso@15855
|
46 # Handle multiarch installation. ARM use Busybox modutils, so avoid any
|
pankso@15855
|
47 # deps on kmod. SLITAZ_ARCH can have also custom post_install commands
|
pankso@15921
|
48 if [ -f $root/etc/slitaz/slitaz.conf ]; then
|
pankso@15921
|
49 . $root/etc/slitaz/slitaz.conf
|
pankso@15921
|
50 case "$SLITAZ_ARCH" in
|
pankso@15921
|
51 arm) DEPENDS="" ;;
|
pankso@15921
|
52 esac
|
pankso@15921
|
53 fi
|
pankso@12824
|
54
|
pascal@17366
|
55 install_module_headers()
|
pascal@17366
|
56 {
|
pascal@17366
|
57 local path
|
pascal@17366
|
58 path=usr/src/linux-$KVERSION
|
pascal@17366
|
59 mkdir -p $1/lib/modules/$KVERSION
|
pascal@17366
|
60 ln -sf /$path $1/lib/modules/$KVERSION/build
|
pascal@17366
|
61 install -D -m644 $src/Makefile \
|
pascal@17366
|
62 $1/$path/Makefile
|
pascal@17366
|
63 install -D -m644 $src/kernel/Makefile \
|
pascal@17366
|
64 $1/$path/kernel/Makefile
|
pascal@17366
|
65 install -D -m644 $src/.config \
|
pascal@17366
|
66 $1/$path/.config
|
pascal@17366
|
67 mkdir -p $1/$path/include
|
pascal@17366
|
68
|
pascal@20261
|
69 cp -a $src/include/* $1/$path/include/
|
pascal@20261
|
70 rm -f $1/$path/include/Kbuild
|
pascal@17366
|
71
|
pascal@17366
|
72 # copy arch includes for external modules
|
pascal@17366
|
73 mkdir -p $1/$path/arch/x86
|
pascal@17366
|
74 cp -a $src/arch/x86/include $1/$path/arch/x86/
|
pascal@17366
|
75
|
pascal@17366
|
76 # copy files necessary for later builds, like nvidia and vmware
|
pascal@17369
|
77 cp -a $src/Module.symvers $1/$path/Module.symvers
|
pascal@17366
|
78 cp -a $src/scripts $1/$path
|
pascal@17366
|
79 # fix permissions on scripts dir
|
pascal@17366
|
80 chmod og-w -R $1/$path/scripts
|
pascal@17366
|
81 mkdir -p $1/$path/.tmp_versions
|
pascal@17366
|
82
|
pascal@17366
|
83 mkdir -p $1/$path/arch/x86/kernel
|
pascal@17366
|
84 cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
|
pascal@17366
|
85 cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
|
pascal@17366
|
86 cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
|
pascal@17366
|
87
|
pascal@17366
|
88 # add headers for lirc package
|
pascal@20261
|
89 mkdir -p $1/$path/drivers/media
|
pascal@20261
|
90 ( cd $src/drivers/media ; find i2c -name '*.h' | cpio -o -H newc ) | \
|
pascal@20261
|
91 ( cd $1/$path/drivers/media ; cpio -idmu )
|
pascal@17366
|
92
|
pascal@17366
|
93 # add dm headers
|
pascal@17366
|
94 mkdir -p $1/$path/drivers/md
|
pascal@17366
|
95 cp -a $src/drivers/md/*.h $1/$path/drivers/md
|
pascal@17366
|
96
|
pascal@17366
|
97 # add inotify.h
|
pascal@17366
|
98 mkdir -p $1/$path/include/linux
|
pascal@17366
|
99 cp -a $src/include/linux/inotify.h $1/$path/include/linux/
|
pascal@17366
|
100
|
pascal@17366
|
101 # add wireless headers
|
pascal@17366
|
102 mkdir -p $1/$path/net/mac80211/
|
pascal@17366
|
103 cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
|
pascal@17366
|
104
|
pascal@17366
|
105 # add dvb headers for external modules
|
pascal@17366
|
106 # in reference to:
|
pascal@17366
|
107 # http://bugs.archlinux.org/task/9912
|
shann@25629
|
108 #mkdir -p $1/$path/drivers/media/dvb-core
|
shann@25629
|
109 #cp -a $src/drivers/media/dvb-core/*.h $1/$path/drivers/media/dvb-core/
|
pascal@17366
|
110
|
pascal@17366
|
111 # add dvb headers for external modules
|
pascal@17366
|
112 # in reference to:
|
pascal@17366
|
113 # http://bugs.archlinux.org/task/11194
|
pascal@17366
|
114 if [ -d $src/include/config/dvb/ ]; then
|
pascal@17366
|
115 mkdir -p $1/$path/include/config/dvb/
|
pascal@17366
|
116 cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
|
pascal@17366
|
117 fi
|
pascal@17366
|
118
|
pascal@17366
|
119 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
|
pascal@17366
|
120 # in reference to:
|
pascal@17366
|
121 # http://bugs.archlinux.org/task/13146
|
pascal@20261
|
122 mkdir -p $1/$path/drivers/media/dvb-frontends/
|
pascal@20261
|
123 cp -a $src/drivers/media/dvb-frontends/lgdt330x.h $1/$path/drivers/media/dvb-frontends/
|
pascal@20261
|
124 cp -a $src/drivers/media/i2c/msp3400-driver.h $1/$path/drivers/media/dvb-frontends/
|
pascal@17366
|
125
|
pascal@17366
|
126 # add dvb headers
|
pascal@17366
|
127 # in reference to:
|
pascal@17366
|
128 # http://bugs.archlinux.org/task/20402
|
pascal@20261
|
129 mkdir -p $1/$path/drivers/media/usb/dvb-usb
|
pascal@20261
|
130 cp -a $src/drivers/media/usb/dvb-usb/*.h $1/$path/drivers/media/usb/dvb-usb/
|
pascal@20261
|
131 mkdir -p $1/$path/drivers/media/dvb-frontends
|
pascal@20261
|
132 cp -a $src/drivers/media/dvb-frontends/*.h $1/$path/drivers/media/dvb-frontends/
|
pascal@20261
|
133 mkdir -p $1/$path/drivers/media/tuners
|
pascal@20261
|
134 cp -a $src/drivers/media/tuners/*.h $1/$path/drivers/media/tuners/
|
pascal@17366
|
135
|
pascal@17366
|
136 # add xfs and shmem for aufs building
|
pascal@17366
|
137 mkdir -p $1/$path/fs/xfs
|
pascal@17366
|
138 mkdir -p $1/$path/mm
|
shann@25629
|
139 #cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
|
pascal@20261
|
140 cp -a $src/fs/*.h $1/$path/fs/
|
pascal@17366
|
141
|
pascal@17366
|
142 # copy in Kconfig files
|
pascal@17366
|
143 for i in $(find . -name "Kconfig*"); do
|
pascal@17366
|
144 mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
|
pascal@17366
|
145 cp -a $src/$i $1/$path/$i
|
pascal@17366
|
146 done
|
pascal@17366
|
147
|
pascal@17366
|
148 chown -R root.root $1/$path
|
pascal@17366
|
149 find $1/$path -type d -exec chmod 755 {} \;
|
pascal@17366
|
150 # remove unneeded architectures
|
pascal@17366
|
151 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
|
152 }
|
pascal@17366
|
153
|
pankso@3
|
154 # Rules to configure and make the package.
|
pankso@3
|
155 compile_rules()
|
pankso@3
|
156 {
|
pankso@15921
|
157 if [ -f "/usr/share/boot/initrd" ]; then
|
pankso@15921
|
158 cp /usr/share/boot/initrd initrd.cpio
|
pankso@15921
|
159 fi
|
pankso@12803
|
160
|
pankso@15855
|
161 # Handle cross compilation
|
pankso@12803
|
162 case "$ARCH" in
|
pankso@12803
|
163 arm)
|
pankso@15855
|
164 echo "Compiling: $ARCH Kernel"
|
pankso@12824
|
165 make mrproper
|
pankso@12824
|
166 patch -Np1 < $stuff/$ARCH/linux-arm.patch || exit 1
|
pankso@12824
|
167 cp -f $stuff/$ARCH/linux-arm.config .config
|
pascal@15733
|
168 yes '' | make ARCH=$ARCH oldconfig
|
pankso@12803
|
169 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- bzImage &&
|
pankso@12803
|
170 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- modules &&
|
pankso@12803
|
171 make ARCH=$ARCH CROSS_COMPILE=${HOST_SYSTEM}- \
|
pankso@12803
|
172 INSTALL_MOD_PATH=$DESTDIR modules_install &&
|
pankso@12803
|
173 mkdir -p $DESTDIR/boot &&
|
pankso@12824
|
174 cp -a arch/arm/boot/zImage \
|
pankso@12803
|
175 $DESTDIR/boot/linux-$VERSION-slitaz-$ARCH
|
pankso@15921
|
176 #$stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
|
pankso@12803
|
177 return 0 ;;
|
pankso@12803
|
178 x86_64)
|
pankso@12803
|
179 echo "TODO: Maybe use default ? But cross compile in x86_64 chroot"
|
pankso@12803
|
180 echo "so we can remove the 64 build by uclibc-cross-compiler-x86_64"
|
pankso@12803
|
181 return 0 ;;
|
pankso@12803
|
182 esac
|
pankso@12803
|
183
|
pankso@15855
|
184 # Check for Aufs and get source/patches if needed
|
pankso@9731
|
185 echo "Checking for Aufs packages..."
|
pascal@20324
|
186 AUFSVER=$(grep ^VERSION= $WOK/linux-aufs/receipt | cut -d "=" -f2 | sed -e 's/"//g')
|
pascal@20324
|
187 AUFSSRCDIR="$WOK/linux-aufs/source"
|
pascal@20324
|
188 AUFSDIR="$AUFSSRCDIR/linux-aufs-${AUFSVER}"
|
pankso@15855
|
189 if [ ! -d "$AUFSDIR" ]; then
|
pankso@15855
|
190 [ ! -f "$SRC/aufs-${AUFSVER}.tar.bz2" ] && cook aufs --getsrc
|
pascal@20324
|
191 mkdir -p $AUFSSRCDIR
|
pankso@15855
|
192 echo "Extracting: aufs-${AUFSVER}.tar.bz2"
|
pascal@20324
|
193 tar xjf $SRC/aufs-${AUFSVER}.tar.bz2 -C $AUFSSRCDIR/
|
shann@25629
|
194 mv $AUFSSRCDIR/aufs-${AUFSVER} $AUFSDIR
|
pascal@20324
|
195 ( cd $AUFSDIR ; [ -d fs ] || git checkout origin/aufs${VERSION%.*} )
|
pankso@9731
|
196 fi
|
pankso@15855
|
197
|
pankso@12285
|
198 echo "cook:linux" > $command
|
pankso@12285
|
199
|
pankso@9731
|
200 echo "Copying Aufs files and patches..."
|
slaxemulator@7297
|
201 cp -a $AUFSDIR/Documentation $AUFSDIR/fs $AUFSDIR/include $src
|
pascal@20261
|
202
|
pascal@20261
|
203 # Use fixed patchs from stuff
|
shann@25629
|
204 cp -a $AUFSDIR/aufs4-*.patch $stuff
|
pankso@12285
|
205
|
pankso@15855
|
206 # SliTaz db stuff
|
pankso@15855
|
207 [ -d $WOK/$PACKAGE/source/slitaz ] && rm -rf $WOK/$PACKAGE/source/slitaz
|
pankso@12285
|
208 mkdir -p $WOK/$PACKAGE/source/slitaz
|
pankso@12290
|
209 echo "$WGET_URL" > $WOK/$PACKAGE/source/slitaz/url
|
pankso@12285
|
210 cp $stuff/gztazmod.sh $stuff/list_modules.sh $WOK/$PACKAGE/source/slitaz
|
pankso@12285
|
211 cp $stuff/bootloader.sh $WOK/$PACKAGE/source/slitaz
|
pankso@12803
|
212
|
pankso@5640
|
213 # Apply patches
|
pankso@9731
|
214 echo "Applying patches..."
|
pascal@521
|
215 while read patch_file; do
|
pankso@12285
|
216 echo "$patch_file" >> $WOK/$PACKAGE/source/slitaz/patches
|
pankso@12285
|
217 cp $stuff/$patch_file $WOK/$PACKAGE/source/slitaz
|
pascal@1442
|
218 if [ -f done.$patch_file ]; then
|
pankso@15855
|
219 echo "Skipping $patch_file" && continue
|
pascal@1442
|
220 fi
|
pascal@521
|
221 echo "Apply $patch_file"
|
pankso@15855
|
222 patch -p1 < $WOK/$PACKAGE/source/slitaz/$patch_file || return 1
|
pascal@1442
|
223 touch done.$patch_file
|
pascal@521
|
224 done <<EOT
|
shann@25629
|
225 aufs4-base.patch
|
shann@25629
|
226 aufs4-standalone.patch
|
shann@25629
|
227 aufs4-mmap.patch
|
pascal@521
|
228 EOT
|
shann@25585
|
229
|
shann@25629
|
230 # Patch for 3.16.55, need tweak for 4.x
|
shann@25629
|
231 #$PACKAGE-diff.u
|
shann@25629
|
232 #$PACKAGE-freeinitrd.u
|
shann@25629
|
233 #$PACKAGE-subroot.u
|
shann@25629
|
234 #$PACKAGE-romfs.u
|
shann@25629
|
235 #$PACKAGE-tcp_stealth.u
|
shann@25629
|
236 #$PACKAGE-efi.u
|
shann@25629
|
237
|
shann@25586
|
238 # Patch for GCC > 6.x
|
shann@25586
|
239 # usbip (format overflow / implicit-fallthrough)
|
shann@25586
|
240 # kernel (format overflow)
|
shann@25588
|
241 #patch -p1 < $stuff/linux-usbip-fix-format-overflow-gcc8.patch
|
shann@25588
|
242 #patch -p1 < $stuff/linux-usbip-fix-implicit-fallthrough-gcc8.patch
|
shann@25588
|
243 #patch -p1 < $stuff/linux-fix-format-overflow-gcc8.patch
|
shann@25588
|
244 #patch -p1 < $stuff/linux-fix-noreturn-attributes-gcc8.patch
|
shann@25585
|
245
|
shann@25634
|
246 # Patch for Picasso AMDGPU, until switch to 5.x
|
shann@25634
|
247 # see https://bugs.gentoo.org/696164
|
shann@25634
|
248 patch -p1 < $stuff/picasso-amdgpu.patch
|
shann@25634
|
249
|
shann@25629
|
250 # Mrproper
|
shann@25629
|
251 echo "Make kernel proper..."
|
pankso@3864
|
252 make mrproper
|
pascal@20271
|
253
|
pascal@20271
|
254 echo "Build usbip..."
|
shann@25629
|
255 cd $src/tools/usb/usbip
|
pascal@20271
|
256 ./autogen.sh
|
pascal@20271
|
257 ./configure CFLAGS="$CFLAGS -Wno-error=uninitialized" \
|
pascal@20271
|
258 --with-usbids-dir=/usr/share/misc \
|
pascal@20271
|
259 --mandir=/usr/share/man $CONFIGURE_ARGS &&
|
pascal@20273
|
260 make && make DESTDIR=$DESTDIR/usbip install || return 1
|
pascal@20271
|
261
|
pankso@15855
|
262 cd $src
|
pankso@15855
|
263
|
pankso@15855
|
264 #
|
pankso@15855
|
265 # Arch x86_64: TODO have a real cross environment
|
pankso@15855
|
266 #
|
pankso@15870
|
267 if [ ! "$nox64" ]; then
|
pankso@15855
|
268 echo "Compiling: x86_64 Kernel"
|
shann@25629
|
269
|
shann@25629
|
270 # Use cross toolchain x86_64
|
shann@25629
|
271 export PATH=$PATH:/cross/x86_64/tools/bin
|
shann@25629
|
272
|
pankso@15855
|
273 # Build bzImage64 without modules first
|
pankso@15870
|
274 if [ ! "$nonomods" ]; then
|
pascal@20274
|
275 [ -d $DESTDIR/linux64 ] || mkdir -p $DESTDIR/linux64 ||
|
pascal@20274
|
276 return 1
|
pankso@15855
|
277 cp -f $stuff/$PACKAGE-slitaz.config64 .config
|
pankso@15855
|
278 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
pankso@15855
|
279 echo -e "\n* Configure bzImage64 without modules...\n"
|
shann@25629
|
280 yes '' | make ARCH=x86_64 CROSS_COMPILE=x86_64-slitaz-linux- oldconfig
|
pankso@15855
|
281 echo -e "\n* Building bzImage64 without modules...\n"
|
shann@25629
|
282 make ARCH=x86_64 CROSS_COMPILE=x86_64-slitaz-linux- bzImage || exit 1
|
pankso@15855
|
283 mv arch/x86/boot/bzImage $DESTDIR/linux64
|
pankso@15855
|
284 mv System.map System.map-without-modules64
|
pascal@20169
|
285 mv vmlinux vmlinux-without-modules64
|
pascal@20169
|
286 mv .config config-without-modules64
|
pankso@15855
|
287 fi
|
pankso@15855
|
288
|
pankso@15855
|
289 # Build bzImage64 with modules
|
pankso@15855
|
290 cp -f $stuff/$PACKAGE-slitaz.config64 .config
|
pankso@15855
|
291 echo -e "\n* Configure bzImage64 with modules...\n"
|
shann@25629
|
292 yes '' | make ARCH=x86_64 CROSS_COMPILE=x86_64-slitaz-linux- oldconfig
|
pankso@15855
|
293 echo -e "\n* Building bzImage64 with modules...\n"
|
shann@25629
|
294 make ARCH=x86_64 CROSS_COMPILE=x86_64-slitaz-linux- bzImage &&
|
shann@25629
|
295 make ARCH=x86_64 CROSS_COMPILE=x86_64-slitaz-linux- modules &&
|
pankso@15855
|
296 make ARCH=x86_64 INSTALL_MOD_PATH=$DESTDIR/linux64 modules_install &&
|
pankso@15855
|
297 make ARCH=x86_64 INSTALL_HDR_PATH=$DESTDIR/linux64/usr headers_install &&
|
pankso@15855
|
298 ln .config $WOK/$PACKAGE/source/slitaz/config64
|
pankso@15855
|
299 [ -s arch/x86/boot/bzImage ] || return 1
|
pankso@15855
|
300 mkdir -p $DESTDIR/linux64/boot 2> /dev/null
|
pascal@17031
|
301 mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
|
pascal@17366
|
302 KVERSION=$VERSION-slitaz64
|
pascal@17366
|
303 install_module_headers $DESTDIR/linux64
|
shann@25629
|
304
|
shann@25629
|
305 if [ -d "$DESTDIR/linux64/lib/modules/$VERSION-slitaz64" ]; then
|
shann@25629
|
306 $stuff/gztazmod.sh $DESTDIR/linux64/lib/modules/$VERSION-slitaz64
|
shann@25629
|
307 fi
|
shann@25629
|
308
|
pankso@15855
|
309 ln System.map System.map-modules64
|
pascal@20169
|
310 ln vmlinux vmlinux-modules64
|
pankso@15855
|
311 ln Module.symvers Module.symvers-modules64
|
pascal@20170
|
312 cp .config config-modules64
|
pankso@15855
|
313 else
|
pankso@15855
|
314 echo "* Skipping: x86_64 Kernel..."
|
pankso@12285
|
315 fi
|
pankso@15855
|
316
|
pankso@12294
|
317 #
|
pankso@15855
|
318 # Linux Arch i386 - GCC arch i486
|
pankso@12294
|
319 #
|
shann@25629
|
320 if [ ! "$nox32" ]; then
|
shann@25629
|
321 echo "Compiling: i386 Kernel..."
|
pankso@12803
|
322
|
shann@25629
|
323 # Build bzImage without modules first
|
shann@25629
|
324 if [ ! "$nonomods" ]; then
|
shann@25629
|
325 cp -f $stuff/$PACKAGE-slitaz.config .config
|
shann@25629
|
326 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
shann@25629
|
327 echo -e "\n* Configure bzImage without modules...\n"
|
shann@25629
|
328 yes '' | make ARCH=i386 oldconfig
|
shann@25629
|
329 echo -e "\n* Building bzImage without modules...\n"
|
shann@25629
|
330 make ARCH=i386 bzImage || exit 1
|
shann@25629
|
331 [ -d $DESTDIR ] || mkdir -p $DESTDIR
|
shann@25629
|
332 mv arch/x86/boot/bzImage $DESTDIR
|
shann@25629
|
333 mv System.map System.map-without-modules
|
shann@25629
|
334 mv vmlinux vmlinux-without-modules
|
shann@25629
|
335 mv .config config-without-modules
|
shann@25629
|
336 fi
|
shann@25629
|
337
|
shann@25629
|
338 # Build bzImage with modules
|
pankso@15855
|
339 cp -f $stuff/$PACKAGE-slitaz.config .config
|
shann@25629
|
340 echo -e "\n* Configure bzImage with modules...\n"
|
pankso@15855
|
341 yes '' | make ARCH=i386 oldconfig
|
shann@25629
|
342 ln .config $WOK/$PACKAGE/source/slitaz/config
|
shann@25629
|
343 echo -e "\n* Building bzImage with modules...\n"
|
shann@25629
|
344 make ARCH=i386 bzImage &&
|
shann@25629
|
345 make ARCH=i386 modules &&
|
shann@25629
|
346 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR modules_install &&
|
shann@25629
|
347 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/usr headers_install &&
|
shann@25629
|
348 [ -s arch/x86/boot/bzImage ] || return 1
|
shann@25629
|
349 mkdir -p $DESTDIR/boot 2> /dev/null
|
shann@25629
|
350 mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
|
shann@25629
|
351 KVERSION=$VERSION-slitaz
|
shann@25629
|
352 install_module_headers $DESTDIR
|
pankso@15855
|
353
|
shann@25629
|
354 # Compress all modules.
|
shann@25629
|
355 if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then
|
shann@25629
|
356 $stuff/gztazmod.sh $DESTDIR/lib/modules/$VERSION-slitaz
|
shann@25629
|
357 else
|
shann@25629
|
358 return 1
|
shann@25629
|
359 fi
|
shann@25629
|
360 ln System.map System.map-modules
|
shann@25629
|
361 ln vmlinux vmlinux-modules
|
shann@25629
|
362 ln Module.symvers Module.symvers-modules
|
shann@25629
|
363 cp .config config-modules
|
shann@25629
|
364 else
|
shann@25629
|
365 echo "* Skipping: x86 Kernel..."
|
shann@25634
|
366 fi
|
shann@25634
|
367
|
shann@25634
|
368 #
|
shann@25634
|
369 # Linux Arch i386 - GCC arch i486 - PAE
|
shann@25634
|
370 #
|
shann@25634
|
371 if [ ! "$nopae" ]; then
|
shann@25634
|
372 echo "Compiling: PAE Kernel..."
|
shann@25634
|
373
|
shann@25634
|
374 # Build PAE bzImage without modules first
|
shann@25634
|
375 if [ ! "$nonomods" ]; then
|
shann@25634
|
376 [ -d $DESTDIR/linux-pae ] || mkdir -p $DESTDIR/linux-pae ||
|
shann@25634
|
377 return 1
|
shann@25634
|
378 cp -f $stuff/$PACKAGE-slitaz-pae.config .config
|
shann@25634
|
379 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
shann@25634
|
380 echo -e "\n* Configure bzImage PAE without modules...\n"
|
shann@25634
|
381 yes '' | make ARCH=i386 oldconfig
|
shann@25634
|
382 echo -e "\n* Building bzImage PAE without modules...\n"
|
shann@25634
|
383 make ARCH=i386 bzImage || exit 1
|
shann@25634
|
384 mv arch/x86/boot/bzImage $DESTDIR/linux-pae
|
shann@25634
|
385 mv System.map System.map-without-modules-pae
|
shann@25634
|
386 mv vmlinux vmlinux-without-modules-pae
|
shann@25634
|
387 mv .config config-without-modules-pae
|
shann@25634
|
388 fi
|
shann@25634
|
389
|
shann@25634
|
390 # Build PAE bzImage with modules
|
shann@25634
|
391 cp -f $stuff/$PACKAGE-slitaz-pae.config .config
|
shann@25634
|
392 echo -e "\n* Configure bzImage PAE with modules...\n"
|
shann@25634
|
393 yes '' | make ARCH=i386 oldconfig
|
shann@25634
|
394 echo -e "\n* Building bzImage PAE with modules...\n"
|
shann@25634
|
395 make ARCH=i386 bzImage &&
|
shann@25634
|
396 make ARCH=i386 modules &&
|
shann@25634
|
397 make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR/linux-pae modules_install &&
|
shann@25634
|
398 make ARCH=i386 INSTALL_HDR_PATH=$DESTDIR/linux-pae/usr headers_install &&
|
shann@25634
|
399 ln .config $WOK/$PACKAGE/source/slitaz/configpae
|
shann@25634
|
400 [ -s arch/x86/boot/bzImage ] || return 1
|
shann@25634
|
401 mkdir -p $DESTDIR/linux-pae/boot 2> /dev/null
|
shann@25634
|
402 mv arch/x86/boot/bzImage $DESTDIR/linux-pae/boot/vmlinuz-$VERSION-slitaz-pae
|
shann@25634
|
403 KVERSION=$VERSION-slitaz-pae
|
shann@25634
|
404 install_module_headers $DESTDIR/linux-pae
|
shann@25634
|
405
|
shann@25634
|
406 # Compress all modules.
|
shann@25634
|
407 if [ -d "$DESTDIR/linux-pae/lib/modules/$VERSION-slitaz-pae" ]; then
|
shann@25634
|
408 $stuff/gztazmod.sh $DESTDIR/linux-pae/lib/modules/$VERSION-slitaz-pae
|
shann@25634
|
409 else
|
shann@25634
|
410 return 1
|
shann@25634
|
411 fi
|
shann@25634
|
412 ln System.map System.map-modules-pae
|
shann@25634
|
413 ln vmlinux vmlinux-modules-pae
|
shann@25634
|
414 ln Module.symvers Module.symvers-modules-pae
|
shann@25634
|
415 cp .config config-modules-pae
|
shann@25634
|
416 else
|
shann@25634
|
417 echo "* Skipping: x86 PAE Kernel..."
|
shann@25634
|
418 fi
|
pankso@3864
|
419 }
|
erjo@253
|
420
|
pankso@3
|
421 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pankso@3
|
422 genpkg_rules()
|
pankso@3
|
423 {
|
pankso@12803
|
424 case "$ARCH" in
|
pankso@12803
|
425 arm)
|
pankso@12803
|
426 echo "Packing: ARM Kernel"
|
pankso@12803
|
427 cp -a $install/* $fs
|
pankso@12803
|
428 rm -f $fs/lib/modules/*/build $fs/lib/modules/*/source
|
pankso@12803
|
429 return 0 ;;
|
pankso@12803
|
430 x86_64)
|
pankso@12803
|
431 echo "TODO: use default or custom x86_64 packing"
|
pankso@12803
|
432 return 0 ;;
|
pankso@12803
|
433 esac
|
pankso@12803
|
434
|
al@18734
|
435 export PACKAGE VERSION
|
al@18734
|
436 local path
|
al@18734
|
437 cp -a $install/boot $fs
|
al@18734
|
438
|
al@18734
|
439 # Compress all modules.
|
al@18734
|
440 path=$fs/lib/modules/$VERSION-slitaz/kernel
|
al@18734
|
441 mkdir -p $path
|
al@18734
|
442
|
al@18734
|
443 # Get the base modules
|
al@18734
|
444 export src install
|
al@18734
|
445 mkdir -p $WOK/$PACKAGE/source/tmp
|
al@18734
|
446 # Warning stuff/list_modules.sh must find the generated modules.list
|
al@18734
|
447 $stuff/list_modules.sh \
|
pankso@15855
|
448 $(cat $stuff/modules.list) > $WOK/$PACKAGE/source/tmp/modules.list
|
al@18734
|
449 while read module; do
|
al@18734
|
450 dir=$(dirname $module)
|
al@18734
|
451 [ -d $path/$dir ] || mkdir -p $path/$dir
|
al@18734
|
452 cp -a $install/lib/modules/$VERSION-slitaz/kernel/$module $path/$dir
|
al@18734
|
453 done < $WOK/$PACKAGE/source/tmp/modules.list
|
al@18734
|
454
|
al@18734
|
455 # Remove unresolved links
|
al@18734
|
456 rm -f $fs/lib/modules/$VERSION-slitaz/build
|
al@18734
|
457 rm -f $fs/lib/modules/$VERSION-slitaz/source
|
al@18734
|
458
|
al@18734
|
459 # We only need module.{order,builtin} because other map files are
|
al@18734
|
460 # generated by depmod in post_install
|
al@18734
|
461 cp -a $install/lib/modules/$VERSION-slitaz/modules.order \
|
pankso@15855
|
462 $install/lib/modules/$VERSION-slitaz/modules.builtin \
|
pankso@15855
|
463 $fs/lib/modules/$VERSION-slitaz
|
al@18734
|
464
|
al@18734
|
465 # Pack all packages with a kernel module
|
pascal@20274
|
466 sed -i "/^$PACKAGE\$/d" $CACHE/broken 2>/dev/null || true
|
al@18734
|
467 for i in $(cd $WOK; grep -l '^WANTED="linux"' */receipt); do
|
pankso@15855
|
468 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
|
pankso@15855
|
469 cook ${i%/receipt}
|
al@18734
|
470 done
|
al@18734
|
471
|
pankso@15855
|
472 # Check any module in kernel .config that's not added to a linux-* pkgs
|
pankso@15855
|
473 # and remove aufs patches: we dont need them in HG wok.
|
pankso@15855
|
474 $stuff/check_modules.sh
|
pascal@20261
|
475
|
pascal@20261
|
476 # Keep fixed patches !
|
pascal@20261
|
477 #rm -f $stuff/aufs3-*
|
pankso@3
|
478 }
|
pankso@3
|
479
|
pankso@3
|
480 # Pre and post install commands for Tazpkg.
|
pankso@3
|
481 post_install()
|
pankso@3
|
482 {
|
al@18734
|
483 chroot "$root/" depmod -a $VERSION-slitaz
|
al@18734
|
484
|
al@18734
|
485 # Handle multiarch installation
|
al@18734
|
486 case "$SLITAZ_ARCH" in
|
pankso@12803
|
487 arm)
|
pankso@12803
|
488 echo "Kernel : /boot/linux-$VERSION-slitaz-$ARCH"
|
pankso@12803
|
489 echo "Modules: /lib/modules/$VERSION-slitaz"
|
pankso@12803
|
490 return 0 ;;
|
pankso@12803
|
491 esac
|
al@18734
|
492
|
pankso@15855
|
493 # GRUB stuff.
|
pankso@15855
|
494 if [ -f "$1/boot/grub/menu.lst" ]; then
|
pankso@15855
|
495 # Current root device
|
pankso@15855
|
496 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
|
pankso@15855
|
497 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
|
pankso@15855
|
498 # Use device.map to find grub device number
|
pankso@15855
|
499 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
|
pascal@18730
|
500 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
|
al@18734
|
501
|
pankso@15855
|
502 # Add and clean kernel entries in case of upgrade for installed system.
|
pascal@18730
|
503 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
|
al@18734
|
504
|
pankso@15855
|
505 # Clean the old entry
|
pankso@15855
|
506 # TODO: old vmlinuz file is removed but the entry is still there.
|
pankso@15855
|
507 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
|
border@13797
|
508
|
pankso@15855
|
509 # Add the new entry
|
pascal@18730
|
510 cat >> "$1/boot/grub/menu.lst" << EOT
|
pankso@4056
|
511
|
pankso@4056
|
512 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
border@13754
|
513 $grub_dev
|
border@13754
|
514 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
|
pankso@4056
|
515 EOT
|
border@13754
|
516 # Make it the default entry
|
pascal@18730
|
517 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
|
pascal@18730
|
518 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
|
pankso@4056
|
519 fi
|
al@18734
|
520
|
pankso@4056
|
521 # Display information message.
|
pankso@15855
|
522 cat <<EOT
|
al@18734
|
523
|
pankso@4056
|
524 ----
|
pankso@4056
|
525 GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
|
pankso@1154
|
526
|
pankso@1154
|
527 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
pankso@1154
|
528 $grub_dev
|
pankso@4056
|
529 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
|
pascal@886
|
530 ----
|
pascal@886
|
531 EOT
|
pankso@1154
|
532 fi
|
pascal@18707
|
533 true
|
pankso@3
|
534 }
|