rev |
line source |
al@19772
|
1 # SliTaz package receipt v2.
|
pankso@3
|
2
|
pankso@3
|
3 PACKAGE="linux"
|
Hans-G?nter@21575
|
4 VERSION="4.17.7"
|
al@20892
|
5 KBASEVER="$(echo $VERSION | cut -d. -f1,2)"
|
pankso@3
|
6 CATEGORY="base-system"
|
al@19772
|
7 SHORT_DESC="The Linux Kernel"
|
pankso@3864
|
8 MAINTAINER="devel@slitaz.org"
|
pascal@14657
|
9 LICENSE="GPL2"
|
al@19583
|
10 WEB_SITE="https://www.kernel.org/"
|
pankso@12803
|
11
|
al@19595
|
12 TARBALL="$PACKAGE-$KBASEVER.tar.xz"
|
al@19583
|
13 WGET_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$TARBALL"
|
al@19583
|
14
|
al@21094
|
15 COOKOPTS="force-arch" # different files in linux-source and linux-without-modules
|
al@21094
|
16
|
al@20892
|
17 BUILD_DEPENDS_x86_64="perl xz patch kmod bc elfutils-dev openssl-dev"
|
al@20892
|
18 BUILD_DEPENDS="perl xz lzma patch kmod bc elfutils-dev openssl-dev" # git
|
al@20897
|
19 # Removed: lguest, linux-firmware, linux-logfs, linux-irda, linux-toshiba
|
al@20437
|
20 SPLIT="\
|
al@21020
|
21 $PACKAGE-acpi $PACKAGE-agp $PACKAGE-aoe \
|
al@21020
|
22 $PACKAGE-appletalk $PACKAGE-arcnet $PACKAGE-autofs \
|
al@21020
|
23 $PACKAGE-bluetooth $PACKAGE-bridge $PACKAGE-btrfs \
|
al@21020
|
24 $PACKAGE-cifs $PACKAGE-coda $PACKAGE-cpufreq \
|
al@21020
|
25 $PACKAGE-cramfs $PACKAGE-crypto $PACKAGE-cryptoloop \
|
al@21020
|
26 $PACKAGE-dialup $PACKAGE-dlm $PACKAGE-drm \
|
al@21020
|
27 $PACKAGE-ecryptfs $PACKAGE-efi $PACKAGE-ethernet \
|
al@21020
|
28 $PACKAGE-exofs $PACKAGE-firewire $PACKAGE-gfs2 \
|
al@21020
|
29 $PACKAGE-hfs $PACKAGE-hfsplus $PACKAGE-hid \
|
al@21020
|
30 $PACKAGE-hwmon $PACKAGE-ide $PACKAGE-input-misc \
|
al@21020
|
31 $PACKAGE-input-tablet $PACKAGE-input-touchscreen $PACKAGE-ipv6 \
|
al@21020
|
32 $PACKAGE-isdn $PACKAGE-jfs \
|
al@21020
|
33 $PACKAGE-joystick $PACKAGE-kvm $PACKAGE-md \
|
al@21020
|
34 $PACKAGE-media $PACKAGE-memstick $PACKAGE-minix \
|
al@21020
|
35 $PACKAGE-mmc $PACKAGE-module-headers $PACKAGE-mwave \
|
al@21020
|
36 $PACKAGE-ncpfs $PACKAGE-nbd $PACKAGE-netfilter \
|
al@21020
|
37 $PACKAGE-nfc $PACKAGE-nfs $PACKAGE-nfsd \
|
al@21020
|
38 $PACKAGE-ocfs2 $PACKAGE-orangefs $PACKAGE-radio \
|
al@21020
|
39 $PACKAGE-reiserfs $PACKAGE-romfs $PACKAGE-sched \
|
al@21020
|
40 $PACKAGE-scsi $PACKAGE-sound $PACKAGE-source \
|
al@21020
|
41 $PACKAGE-speakup $PACKAGE-squashfs $PACKAGE-staging \
|
al@21020
|
42 $PACKAGE-usb-gadget $PACKAGE-usb-misc $PACKAGE-usbdsl \
|
al@21020
|
43 $PACKAGE-usbip $PACKAGE-uwb $PACKAGE-video \
|
al@21020
|
44 $PACKAGE-wan $PACKAGE-watchdog $PACKAGE-wimax \
|
al@21020
|
45 $PACKAGE-wireless $PACKAGE-without-modules $PACKAGE-zram"
|
al@20892
|
46 COOKOPTS="skip-log-errors"
|
al@19595
|
47
|
al@19595
|
48 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
|
al@19595
|
49 PATCH="$(dirname $WGET_URL)/patch-$VERSION.xz"
|
al@19595
|
50 EXTRA_SOURCE_FILES="$(basename $PATCH)"
|
al@19595
|
51 fi
|
pankso@12824
|
52
|
pankso@15855
|
53 #
|
al@20437
|
54 # The Linux receipt handle cross compilation; for ARM we use a real cross env.
|
al@20437
|
55 # Please discuss any change and try to keep it simple.
|
pankso@15855
|
56 #
|
al@20437
|
57 # The receipt handle cook option for faster build:
|
pankso@15855
|
58 # --nonomods : Skip bzImage without modules build
|
pankso@15855
|
59 #
|
pankso@3
|
60
|
al@20441
|
61 # CONFIG_PAGE_TABLE_ISOLATION
|
al@20441
|
62 # against Meltdown currently available in 4.14 only for x86_64 architecture.
|
al@20441
|
63 # CONFIG_RETPOLINE
|
al@20441
|
64 # against Spectre v.2 available both for i386 and x86_64 architectures.
|
al@20441
|
65
|
pankso@12824
|
66
|
al@20437
|
67 compile_rules() {
|
al@20437
|
68 case $ARCH in
|
al@20441
|
69 # Linux don't supported i386 CPU, but ARCH should be 'i386' if we need 32bit CPU support
|
al@20441
|
70 i?86) ConfigFile="$stuff/linux-slitaz.config"; Arch='i386';;
|
al@20441
|
71 x86_64) ConfigFile="$stuff/linux-slitaz64.config"; Arch='x86_64';;
|
al@20437
|
72 esac
|
al@20437
|
73
|
al@19595
|
74 # Update sources to the $VERSION using base sources ($KBASEVER) and patch
|
al@19595
|
75 if [ "$KBASEVER" != "${VERSION%.0}" ]; then
|
al@19595
|
76 [ -s $SRC/$(basename $PATCH) ] || wget $PATCH -O $SRC/$(basename $PATCH)
|
al@19595
|
77 # don't patch twice for `cook $PACKAGE --continue`
|
al@19595
|
78 if [ ! -f "done.patch-$VERSION" ]; then
|
al@19595
|
79 xzcat $SRC/$(basename $PATCH) | patch -Np1
|
al@19595
|
80 touch done.patch-$VERSION
|
al@19595
|
81 fi
|
al@19595
|
82 fi
|
al@19595
|
83
|
al@19595
|
84 #
|
pankso@15921
|
85 if [ -f "/usr/share/boot/initrd" ]; then
|
pankso@15921
|
86 cp /usr/share/boot/initrd initrd.cpio
|
pankso@15921
|
87 fi
|
pankso@12803
|
88
|
al@19595
|
89 # Get and apply Aufs patches
|
al@19595
|
90 . $stuff/tools/aufs-patches
|
al@19583
|
91
|
pankso@12285
|
92 echo "cook:linux" > $command
|
pankso@12285
|
93
|
al@19595
|
94 # Apply misc patches
|
pankso@9731
|
95 echo "Applying patches..."
|
pascal@521
|
96 while read patch_file; do
|
pascal@1442
|
97 if [ -f done.$patch_file ]; then
|
al@19583
|
98 echo "Skipping $patch_file"; continue
|
pascal@1442
|
99 fi
|
al@19583
|
100 echo -e "\nApply $patch_file"
|
al@19595
|
101 patch -p1 -i $stuff/patches/$patch_file || return 1
|
pascal@1442
|
102 touch done.$patch_file
|
al@19595
|
103 done < $stuff/patches/patch.order
|
al@19583
|
104
|
al@20437
|
105 echo "Making kernel proper..."
|
pankso@3864
|
106 make mrproper
|
al@19583
|
107
|
al@20441
|
108
|
al@20441
|
109
|
al@20441
|
110 echo "Making $Arch Kernel..."
|
pankso@12803
|
111
|
pankso@12294
|
112 # Build bzImage without modules first
|
al@19583
|
113 if [ -z "$nonomods" ]; then
|
al@20437
|
114 cp -f $ConfigFile .config
|
pankso@15855
|
115 sed -i 's/CONFIG_MODULES=y/# CONFIG_MODULES is not set/' .config
|
al@19583
|
116 # We can't keep every driver in staging???
|
al@19595
|
117 sed -i \
|
al@19595
|
118 -e 's/^CONFIG_RTL8192/#&/' \
|
pankso@15855
|
119 -e 's/^CONFIG_R8187SE/#&/' \
|
pankso@15855
|
120 -e 's/^CONFIG_RT2870/#&/' .config
|
al@19583
|
121
|
al@19595
|
122 title 'Configure bzImage without modules...'
|
al@20441
|
123 yes '' | make ARCH=$Arch oldconfig
|
al@19583
|
124
|
al@19595
|
125 title 'Building bzImage without modules...'
|
al@21020
|
126 make ARCH=$Arch -j4 bzImage || return 1
|
al@19583
|
127
|
al@21020
|
128 mkdir -p $install
|
al@21020
|
129 mv arch/x86/boot/bzImage $install
|
pankso@15855
|
130 mv System.map System.map-without-modules
|
pankso@12294
|
131 fi
|
al@19583
|
132
|
pankso@12294
|
133 # Build bzImage with modules
|
al@20437
|
134 cp -f $ConfigFile .config
|
al@19583
|
135
|
al@19595
|
136 title 'Configure bzImage with modules...'
|
al@20441
|
137 yes '' | make ARCH=$Arch oldconfig
|
al@19583
|
138
|
al@19583
|
139
|
al@19595
|
140 title 'Building bzImage with modules...'
|
al@20441
|
141 make ARCH=$Arch -j4 bzImage &&
|
al@20441
|
142 make ARCH=$Arch -j4 modules &&
|
al@21020
|
143 make ARCH=$Arch INSTALL_MOD_PATH=$install modules_install &&
|
al@21020
|
144 make ARCH=$Arch INSTALL_HDR_PATH=$install/usr headers_install &&
|
al@19583
|
145
|
pankso@15855
|
146 [ -s arch/x86/boot/bzImage ] || return 1
|
al@21020
|
147 mkdir -p $install/boot
|
al@21020
|
148 mv arch/x86/boot/bzImage $install/boot/vmlinuz-$VERSION-slitaz
|
al@19583
|
149
|
al@21020
|
150 $stuff/tools/install_module_headers.sh $install $src $VERSION-slitaz
|
al@19583
|
151
|
pascal@7667
|
152 ln System.map System.map-modules
|
pascal@7667
|
153 ln Module.symvers Module.symvers-modules
|
al@19772
|
154
|
al@19772
|
155 # for linux-zram package
|
al@19772
|
156 mkdir -p $install/etc/init.d
|
al@20437
|
157 install -o root -m755 $stuff/compcache $install/etc/init.d/
|
al@20437
|
158 install -o root -m644 $stuff/compcache.conf $install/etc/
|
pankso@3864
|
159 }
|
erjo@253
|
160
|
al@20437
|
161
|
al@20437
|
162 genpkg_rules() {
|
al@19772
|
163 DEPENDS="linux" # default, may be subject to change later
|
al@19772
|
164
|
al@19772
|
165 case $PACKAGE in
|
al@19772
|
166 *-acpi) c="ACPI modules";;
|
al@19772
|
167 *-agp) c="AGP modules";;
|
al@19772
|
168 *-aoe) c="AoE (ATA over Ethernet) modules";;
|
al@19772
|
169 *-appletalk) c="Appletalk modules";;
|
al@19772
|
170 *-arcnet) c="ARCnet modules";;
|
al@19772
|
171 *-autofs) c="Automounter module";;
|
al@19772
|
172 *-bluetooth) c="Bluetooth modules";;
|
al@19772
|
173 *-bridge) c="Bridge modules";;
|
al@19772
|
174 *-btrfs) c="Btrfs module"; DEPENDS="linux-crypto";;
|
al@19772
|
175 *-cifs) c="CIFS module";;
|
al@19772
|
176 *-coda) c="Coda module";;
|
al@19772
|
177 *-cpufreq) c="Cpufreq modules";;
|
al@19772
|
178 *-cramfs) c="CramFs module";;
|
al@19772
|
179 *-crypto) c="Crypto modules";;
|
al@19772
|
180 *-cryptoloop) c="Cryptoloop modules"; DEPENDS="linux-crypto";;
|
al@19772
|
181 *-dialup) c="Dial-up modules";;
|
al@19772
|
182 *-dlm) c="DLMFS module";;
|
al@19772
|
183 *-drm) c="DRM module"; DEPENDS="linux-agp";;
|
al@19772
|
184 *-ecryptfs) c="eCrypt FS module";;
|
al@19772
|
185 *-efi) c="EFI modules";;
|
al@19777
|
186 *-ethernet) c="Ethernet drivers"; DEPENDS="linux-crypto";;
|
al@19772
|
187 *-exofs) c="OSD based FS module"; DEPENDS="linux-crypto";;
|
al@19772
|
188 *-firewire) c="Firewire modules";;
|
al@19772
|
189 *-gfs2) c="GFS2 module";;
|
al@19772
|
190 *-hfs) c="HFS module";;
|
al@19772
|
191 *-hfsplus) c="HFSplus module";;
|
al@19772
|
192 *-hid) c="HID (human interface device) modules";;
|
al@19772
|
193 *-hwmon) c="Hwmon modules";;
|
al@19772
|
194 *-ide) c="IDE modules";;
|
al@19772
|
195 *-input-misc) c="misc. input drivers";;
|
al@19772
|
196 *-input-tablet) c="tablet input drivers";;
|
al@19772
|
197 *-input-touchscreen) c="touchscreen input drivers";;
|
al@19772
|
198 *-ipv6) c="IPv6 modules"; DEPENDS="linux-netfilter";;
|
al@19772
|
199 *-isdn) c="ISDN modules";;
|
al@19772
|
200 *-jfs) c="JFS module";;
|
al@19772
|
201 *-joystick) c="joystick modules";;
|
al@19772
|
202 *-kvm) c="KVM and Virtio modules";;
|
al@19772
|
203 *-md) c="MD modules"; DEPENDS="linux-crypto";;
|
al@19772
|
204 *-media) c="media modules"; DEPENDS="linux-radio";;
|
al@19772
|
205 *-memstick) c="Sony memory stick modules";;
|
al@19772
|
206 *-minix) c="Minix module";;
|
al@19772
|
207 *-mmc) c="MMC modules - card reader";;
|
al@19772
|
208 *-mwave) c="ACP Modem driver module - for IBM Thinkpad";;
|
al@19772
|
209 *-nbd) c="NBD (network block device) modules";;
|
al@19772
|
210 *-ncpfs) c="NCPFS module";;
|
al@19772
|
211 *-netfilter) c="Netfilter modules";;
|
al@19772
|
212 *-nfc) c="NFC modules";;
|
al@19772
|
213 *-nfs) c="NFS modules"; DEPENDS="linux-crypto";;
|
al@19772
|
214 *-nfsd) c="NFS server module"; DEPENDS="linux-nfs";;
|
al@19772
|
215 *-ocfs2) c="OCFS2 modules"; DEPENDS="linux-dlm";;
|
al@19772
|
216 *-orangefs) c="OrangeFS module";;
|
al@19777
|
217 *-radio) c="radio modules"; DEPENDS="linux-sound";;
|
al@19772
|
218 *-reiserfs) c="ReiserFS module";;
|
al@19772
|
219 *-romfs) c="ROMFS module";;
|
al@19772
|
220 *-sched) c="Sched modules";;
|
al@19772
|
221 *-scsi) c="SCSI modules";;
|
al@19772
|
222 *-sound) c="sound modules"
|
al@19772
|
223 copy firmware/ess/ firmware/korg/ firmware/sun/ firmware/yamaha/
|
al@19772
|
224 ;;
|
al@19772
|
225 *-speakup) c="Speakup modules";;
|
al@19772
|
226 *-squashfs) c="Squashfs module"; PROVIDE="squashfs-module";;
|
al@19772
|
227 *-staging) c="staging kernel modules";;
|
al@19772
|
228 *-toshiba) c="Toshiba module";;
|
al@19772
|
229 *-usb-gadget) c="USB gadget modules";;
|
al@19772
|
230 *-usb-misc) c="misc. USB drivers";;
|
al@19772
|
231 *-usbdsl) c="USB DSL modem modules";;
|
al@19772
|
232 *-usbip) c="Usbip module"; PROVIDE="usbip-module";;
|
al@19772
|
233 *-uwb) c="UWB modules";;
|
al@19772
|
234 *-video) c="video modules";;
|
al@19772
|
235 *-wan) c="Wide Area Networks (WANs) modules"; DEPENDS="linux-wireless";;
|
al@19772
|
236 *-watchdog) c="watchdog drivers";;
|
al@19772
|
237 *-wimax) c="Wimax modules";;
|
al@19772
|
238 *-wireless) c="wireless modules"; DEPENDS="linux-crypto wireless_tools";;
|
al@19772
|
239 *-zram) c="compressed caching support"; PROVIDE="compcache"
|
al@19772
|
240 copy compcache compcache.conf
|
al@19772
|
241 ;;
|
pankso@12803
|
242 esac
|
pankso@12803
|
243
|
al@19772
|
244 case $PACKAGE in
|
al@19772
|
245 linux)
|
al@19777
|
246 DEPENDS="kmod"
|
al@18734
|
247
|
al@19772
|
248 # Copy the Kernel
|
al@19772
|
249 cp -a $install/boot $fs
|
al@18734
|
250
|
al@19772
|
251 # Copy base modules
|
al@19772
|
252 . $stuff/tools/copy_modules.sh
|
al@18734
|
253
|
al@20437
|
254 # We only need modules.{order,builtin} because other map files are
|
al@20437
|
255 # generated by depmod in post_install()
|
al@19772
|
256 copy modules.order modules.builtin
|
al@19772
|
257 rm -rf $fs/usr
|
al@18734
|
258
|
al@19772
|
259 # Pack all packages with a Kernel modules
|
al@19772
|
260 [ ! -d "$install/lib/modules/$VERSION-slitaz" ] && return 1
|
al@19772
|
261
|
al@19772
|
262 # Checking for Linux Kernel modules that don't belong to any of the packages
|
al@19772
|
263 # $stuff/tools/check_modules.sh
|
al@19777
|
264 # please, see web interface instead
|
al@19772
|
265 ;;
|
al@19772
|
266 *-firmware)
|
al@19772
|
267 mkdir -p $fs/lib
|
al@19772
|
268 cp -a $install/lib/firmware $fs/lib
|
al@19772
|
269 # remove linux-sound firmware files
|
al@19772
|
270 for i in ess korg sun yamaha; do
|
al@19772
|
271 rm -rf $fs/lib/firmware/$i
|
al@19772
|
272 done
|
al@19772
|
273 CAT="non-free|firmware thats compiled from Linux source code"
|
al@19772
|
274 PROVIDE="linux64-firmware"
|
al@19772
|
275 ;;
|
al@19772
|
276 *-module-headers)
|
al@19772
|
277 CAT="development|header files and scripts for building modules for Linux Kernel"
|
al@19772
|
278 KVERSION="$VERSION-slitaz"
|
al@19772
|
279 DEPENDS="slitaz-toolchain"
|
al@19772
|
280 mkdir -p $fs/lib/modules/$KVERSION $fs/usr
|
al@19772
|
281 cp -a $install/usr/src $fs/usr
|
al@19772
|
282 ;;
|
al@19772
|
283 *-source)
|
al@19772
|
284 CAT="development|source files"
|
al@19772
|
285 DEPENDS="linux slitaz-toolchain ncurses-dev perl xz lzma patch busybox-boot"
|
al@19772
|
286
|
al@19772
|
287 local _AUFSVER=$(. $WOK/aufs/receipt; echo $VERSION)
|
al@19772
|
288 local AUFSDIR="aufs-${_AUFSVER}"
|
al@19772
|
289 kps=$fs/usr/src/kernel-patches/slitaz
|
al@19772
|
290 mkdir -p $kps \
|
al@19772
|
291 $fs/lib/modules/$VERSION-slitaz \
|
al@19772
|
292 $fs/usr/bin $fs/usr/sbin
|
al@19772
|
293
|
al@19772
|
294 # URL
|
al@19772
|
295 echo $(. $WOK/linux/receipt; echo $WGET_URL) > $kps/url
|
al@19772
|
296 # stuff
|
al@19772
|
297 cp $stuff/tools/* $stuff/bootloader.sh $kps
|
al@19772
|
298 # Kernel patch
|
al@19772
|
299 xzcat $SRC/patch-$VERSION.xz > $kps/linux-$VERSION.patch
|
al@19772
|
300 echo "linux-$VERSION.patch" > $kps/patches
|
al@19772
|
301 # Aufs patches
|
al@19772
|
302 sed '/^aufs4.*patch$/!d' $stuff/tools/aufs-patches | \
|
al@19772
|
303 tee -a $kps/patches | \
|
al@19772
|
304 while read i; do
|
al@19772
|
305 cp $WOK/aufs/source/*/$i $kps
|
al@19772
|
306 done
|
al@19772
|
307 # misc. patches
|
al@19772
|
308 cat $stuff/patches/patch.order >> $kps/patches
|
al@19772
|
309 cp $stuff/patches/* $kps
|
al@19772
|
310 rm $kps/patch.order
|
al@19772
|
311 # config
|
al@19772
|
312 cp $WOK/linux/source/linux-$VERSION/.config $kps/config
|
al@19772
|
313
|
al@19772
|
314 cp -a $stuff/linux-source/buildtaz $kps
|
al@19772
|
315 cp -a $stuff/linux-source/make-tazpkg.u $kps
|
al@19772
|
316 cp -a $stuff/linux-source/get-linux-source $fs/usr/bin
|
al@19772
|
317 cp -a $stuff/linux-source/list_modules.sh $kps
|
al@19772
|
318 cp -a $stuff/linux-source/rdev $fs/usr/sbin
|
al@19772
|
319 ln -s rdev $fs/usr/sbin/rootflags
|
al@19772
|
320 ln -s rdev $fs/usr/sbin/ramsize
|
al@19772
|
321 ln -s rdev $fs/usr/sbin/vidmode
|
al@19772
|
322 sed -i "s|=XXX|=$VERSION|g" $fs/usr/bin/get-linux-source
|
al@19772
|
323
|
al@19772
|
324 # Copy Aufs4 source files
|
al@20437
|
325 if [ -d $WOK/aufs/$AUFSDIR ]; then
|
al@19772
|
326 mkdir $fs/usr/src/kernel-patches/slitaz/aufs4
|
al@20437
|
327 cp -a $WOK/aufs/$AUFSDIR/Documentation \
|
al@20437
|
328 $WOK/aufs/$AUFSDIR/fs \
|
al@20437
|
329 $WOK/aufs/$AUFSDIR/include \
|
al@20437
|
330 $fs/usr/src/kernel-patches/slitaz/aufs4
|
al@19772
|
331 fi
|
al@19772
|
332
|
al@19772
|
333 ln -s ../../../usr/src/linux-$VERSION $fs/lib/modules/$VERSION-slitaz/source
|
al@19772
|
334
|
al@19772
|
335 chown -R root:root $fs
|
al@19772
|
336 ;;
|
al@19772
|
337 *-without-modules)
|
al@19772
|
338 CAT="base-system|without module support"
|
al@19772
|
339 PROVIDE="linux"
|
al@19772
|
340 mkdir -p $fs/boot
|
al@19772
|
341 cp -a $install/bzImage $fs/boot/vmlinuz-$VERSION-slitaz-without-modules
|
al@19772
|
342 ;;
|
al@19772
|
343 *)
|
al@19772
|
344 . $stuff/tools/copy_modules.sh
|
al@19772
|
345 CAT="base-system|$c"
|
al@19772
|
346 ;;
|
al@19772
|
347 esac
|
al@19772
|
348
|
al@19772
|
349 case $PACKAGE in
|
al@19772
|
350 *fs|*fs2|*-coda|*-dlm|*-hfsplus|*-minix|*-nfsd)
|
al@19772
|
351 CONFIG_FILES="/etc/filesystems";;
|
al@19772
|
352 *-zram)
|
al@19772
|
353 CONFIG_FILES="/etc/compcache.conf";;
|
al@19772
|
354 esac
|
pankso@3
|
355 }
|
pankso@3
|
356
|
al@19772
|
357
|
al@19772
|
358 post_install_linux() {
|
pankso@15855
|
359 # GRUB stuff.
|
pankso@15855
|
360 if [ -f "$1/boot/grub/menu.lst" ]; then
|
pankso@15855
|
361 # Current root device
|
pankso@15855
|
362 root_dev="/dev/$(lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*')"
|
pankso@15855
|
363 grub_part="$(( $(echo $root_dev | grep -o '[0-9]*$')-1 ))"
|
pankso@15855
|
364 # Use device.map to find grub device number
|
pankso@15855
|
365 grub_dev="$(grep $(echo $root_dev | grep -o '^/dev/.d.' ) \
|
al@19583
|
366 "$1/boot/grub/device.map" | cut -f1 | sed "s/)$/.$grub_part)/g")"
|
al@18734
|
367
|
al@19583
|
368 # Add and clean Kernel entries in case of upgrade for installed system.
|
pascal@18730
|
369 if ! grep -q vmlinuz-$VERSION-slitaz "$1/boot/grub/menu.lst"; then
|
al@18734
|
370
|
pankso@15855
|
371 # Clean the old entry
|
pankso@15855
|
372 # TODO: old vmlinuz file is removed but the entry is still there.
|
pankso@15855
|
373 # So grub error:15 when selected: http://bugs.slitaz.org/?id=74
|
border@13797
|
374
|
pankso@15855
|
375 # Add the new entry
|
al@19583
|
376 cat >> "$1/boot/grub/menu.lst" <<EOT
|
pankso@4056
|
377
|
pankso@4056
|
378 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
Hans-G?nter@21575
|
379 $grub_dev
|
border@13754
|
380 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev quiet
|
pankso@4056
|
381 EOT
|
border@13754
|
382 # Make it the default entry
|
pascal@18730
|
383 last_entry=$(( $(grep -c '^title' "$1/boot/grub/menu.lst")-1 ))
|
pascal@18730
|
384 sed -e "s/^default.*/default $last_entry/g" -i "$1/boot/grub/menu.lst"
|
pankso@4056
|
385 fi
|
al@18734
|
386
|
pankso@4056
|
387 # Display information message.
|
al@19595
|
388 [ -z "$quiet" ] && cat <<EOT
|
al@18734
|
389
|
pankso@4056
|
390 ----
|
al@19583
|
391 GRUB is installed, these three lines must be in your /boot/grub/menu.lst:
|
pankso@1154
|
392
|
pankso@1154
|
393 title SliTaz GNU/Linux (Kernel $VERSION-slitaz)
|
pankso@1154
|
394 $grub_dev
|
pankso@4056
|
395 kernel /boot/vmlinuz-$VERSION-slitaz root=$root_dev
|
pascal@886
|
396 ----
|
pascal@886
|
397 EOT
|
pankso@1154
|
398 fi
|
al@19586
|
399 :
|
pankso@3
|
400 }
|
al@19772
|
401
|
al@19772
|
402 pre_remove_linux_module_headers() {
|
al@19772
|
403 if [ -e "$1/usr/src/linux" ]; then
|
al@19772
|
404 rm -rf "$1/usr/src/linux"
|
al@19772
|
405 fi
|
al@19772
|
406 }
|
al@19772
|
407
|
al@19772
|
408 # Added soft link to make it easier to point to kernel folder
|
al@19772
|
409 post_install_linux_module_headers() {
|
al@19772
|
410 KVERSION="$VERSION-slitaz"
|
al@19772
|
411 [ -L "$1/usr/src/linux" ] && rm -f "$1/usr/src/linux"
|
al@19772
|
412 ln -sf /usr/src/linux-$KVERSION "$1/usr/src/linux"
|
al@19772
|
413 ln -sf /usr/src/linux-$KVERSION "$1/lib/modules/$KVERSION/build"
|
al@19772
|
414 }
|
al@19772
|
415
|
al@19772
|
416 post_install_linux_zram() {
|
al@19772
|
417 chroot "$1/" depmod -a $VERSION-slitaz &&
|
al@19777
|
418 RAM=$(grep MemTotal /proc/meminfo | tr -dc 0-9) &&
|
al@19772
|
419 echo "SIZE_KB="$(($RAM/2)) > "$1/etc/compcache.conf"
|
al@19772
|
420 [ -n "$quiet" ] || cat <<EOT
|
al@19772
|
421
|
al@19772
|
422 You can add compressed swap according /etc/compcache.conf configuration with:
|
al@19772
|
423 # /etc/init.d/compcache start
|
al@19772
|
424 Or add compcache to the RUN_DAEMONS list of /etc/rcS.conf.
|
al@19772
|
425 EOT
|
al@19772
|
426 }
|