-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkernel.SlackBuild
executable file
·93 lines (72 loc) · 2.82 KB
/
kernel.SlackBuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
# Copyright 2018, MDrights <[email protected]>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
PKGNAM=linux
VERSION=${VERSION:-5.10.4}
ARCH=x86_64
BUILD=${BUILD:-1_MD}
CWD=$(pwd)
TMP=${TMP:-/tmp}
SRC=$CWD/${PKGNAM}-${VERSION}
PKG=${TMP}/${PKGNAM}
rm -rf $PKG
mkdir -p $PKG
mkdir -p ${PKG}/boot/
mkdir -p ${PKG}/lib/modules/
mkdir -p ${PKG}/install/
# Unpack the kernel tar ball.
xzcat -cd linux-${VERSION}.tar.xz | tar xvf -
cd $SRC
make mrproper || echo ">> Error: make mrproper."
# Use the running kernel's config.
# cp /boot/config ./.config
zcat /proc/config.gz > ./.config
# Customize the config:
sed -i '/CONFIG_SECURITY_APPARMOR/s/.*/CONFIG_SECURITY_APPARMOR=y/' .config
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
# find . -name ".git*" -exec rm -rf "{}" \;
chown -R root:root .
# Compile it. Change the XXXconfig to suit to your need.
make olddefconfig || echo ">> Error: make olddefconfig"
make -j4 || echo ">> Error: make"
echo ">> Making modules installed to $PKG..."
#make modules_install install || exit 1
INSTALL_MOD_PATH=$PKG make modules_install || exit 1
# Copy the output.
cp .config ${PKG}/boot/config-${VERSION}
#cp /boot/vmlinuz ${PKG}/boot/vmlinuz-generic-${VERSION}
cat arch/x86/boot/bzImage > ${PKG}/boot/vmlinuz-generic-${VERSION}
#cp /boot/System.map ${PKG}/boot/System.map-${VERSION}
cat System.map > ${PKG}/boot/System.map-${VERSION}
#cp -r /lib/modules/${VERSION} ${PKG}/lib/modules/
cp ${CWD}/doinst.sh ${PKG}/install/
cd -
PKG_SRC=$CWD/linux-source
mkdir -p $PKG_SRC/usr/src/
mv $SRC $PKG_SRC/usr/src/
echo "Packaging kernel and its source code..."
cd $PKG
/sbin/makepkg -l y -c n $TMP/kernel-generic-$VERSION-$ARCH-$BUILD.txz
cd $PKG_SRC
/sbin/makepkg -l y -c n $TMP/kernel-source-$VERSION-$ARCH-$BUILD.txz
# Run the dummy script for modules.
sh ./kernel-modules.SlackBuild
exit