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