-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_kernel.sh
57 lines (42 loc) · 1.53 KB
/
build_kernel.sh
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
#!/bin/bash
export CFLAGS=-"O2"
export CXXFLAGS="-O2"
PKG_VER=6.13.2
URL=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$PKG_VER.tar.xz
TAR=$(echo $URL | sed -r 's|(.*)/||')
DIR=$(echo $TAR | sed 's|.tar.*||g')
KERNEL_VERSION=$(echo $DIR | sed 's/linux-//')
set -e
cd /usr/src
wget $URL
tar -xvf $TAR
cd $DIR
cp /boot/config-tucana .config
sed -i 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -tucana/' Makefile
make olddefconfig
make -j16
mkdir -p ../linux-tucana/boot
mkdir -p ../linux-tucana/usr
make INSTALL_MOD_PATH=../linux-tucana/usr modules_install
sudo cp arch/x86/boot/bzImage ../linux-tucana/boot/vmlinuz-$KERNEL_VERSION-tucana
sudo cp .config ../linux-tucana/boot/config-tucana
sudo rm -r block certs/ crypto/ Documentation/ drivers/ fs/ init/ ipc/ kernel/ lib/ LICENSES/ mm/ MAINTAINERS modules.* net/ samples/ security/ sound/ usr/ virt/ vmlinux*
cd ../linux-tucana
echo "cd /boot" > postinst
echo "mkinitramfs $KERNEL_VERSION-tucana" >> postinst
echo "grub-mkconfig -o /boot/grub/grub.cfg" >> postinst
mkdir -p ../linux-tucana-headers/usr/src
cd ..
sudo cp -rpv $DIR linux-tucana-headers/usr/src
# Package
cd /usr/src
mv linux-tucana /pkgs
mv linux-tucana-headers /pkgs
echo "" > /pkgs/linux-tucana/depend
echo "bc check gcc make bison openssl gawk autoconf" > /pkgs/linux-tucana/make-depends
echo "linux-tucana rsync" > /pkgs/linux-tucana-headers/depend
cd /pkgs
tar -cvzpf linux-tucana.tar.xz linux-tucana
tar -cvzpf linux-tucana-headers.tar.xz linux-tucana-headers
cp linux-tucana.tar.xz /finished
cp linux-tucana-headers.tar.xz /finished