1
1
#! /usr/bin/env bash
2
-
3
- # This script is to build custom arch linux kernel from upstream linux kernel
4
- # source
5
-
6
- # Author: Bhaskar Chowdhury
7
- # Date: Tue 11 Mar 2025 03:47:05 AM IST
8
- # Email: unixbhaskar@gmail.com
9
-
10
- # License (GPL v2.0)
11
-
12
- # This program is free software: you can redistribute it and/or modify
13
- # it under the terms of the GNU General Public License as published by
14
- # the Free Software Foundation, either version 3 of the License, or
15
- # (at your option) any later version.
16
- #
17
- # This program is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- # GNU General Public License for more details.
21
-
22
-
23
2
get_make=$( command -v make)
24
3
get_elapsed_time=" /usr/bin/time -f"
25
4
untar_it=" tar -xJvf"
26
5
get_it=$( command -v secure_kernel_tarball)
27
6
NOTIFY=$( command -v notify-send)
7
+ NOCOLOR=" \033[0m"
28
8
DT=$( date ' +%d%m%Y' )
29
9
build_dir=" /home/bhaskar/custom_kernel_$( hostname) _$DT "
30
10
@@ -64,7 +44,7 @@ cd linux-$kernel
64
44
65
45
sed -i ' 8d' scripts/package/PKGBUILD
66
46
sed -i ' 8i _extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}' scripts/package/PKGBUILD
67
- sed -i ' 114 ,125 s/^/#/' scripts/package/PKGBUILD
47
+ sed -i ' 113 ,125 s/^/#/' scripts/package/PKGBUILD
68
48
69
49
# Creating a new checksum, because we have modified the PKGBUILD file
70
50
@@ -87,9 +67,13 @@ grep DEBUG_INFO .config
87
67
# Enable USB storage module for external HDD
88
68
scripts/config --enable USB_STORAGE
89
69
70
+ # Enable crypto_lz4
71
+ scripts/config --enable CRYPTO_LZ4
72
+
90
73
# Set the local version of the operating system name
91
74
scripts/config --set-str LOCALVERSION " -Archlinux"
92
75
76
+
93
77
# Make sure the flags symbols are set correctly with an updated value
94
78
# $get_make ARCH=x86_64 olddefconfig
95
79
yes ' ' | make localmodconfig
@@ -121,12 +105,13 @@ then
121
105
122
106
printf " \n Now install the generated headers,kernel and doc packages with pacman .. \n\n\n"
123
107
108
+ find . -name " linux-upstream*" -a ! -name " *.sig" -type f -exec sudo pacman -U --noconfirm {} \;
124
109
125
- sudo pacman -U --noconfirm linux-upstream-$kernel_Archlinux -1-x86_64.pkg.tar.zst
110
+ # sudo pacman -U --noconfirm linux-upstream-${kernel}_Archlinux -1-x86_64.pkg.tar.zst
126
111
127
- sudo pacman -U --noconfirm linux-upstream-headers-$kernel_Archinux -1-x86_64.pkg.tar.zst
112
+ # sudo pacman -U --noconfirm linux-upstream-headers-${kernel}_Archlinux -1-x86_64.pkg.tar.zst
128
113
129
- sudo pacman -U --noconfirm linux-upstream-api-headers-$kernel_Archlinux -1-x86_64.pkg.tar.zst
114
+ # sudo pacman -U --noconfirm linux-upstream-api-headers-${kernel}_Archlinux -1-x86_64.pkg.tar.zst
130
115
131
116
else
132
117
echo Something went wrong, manually check.
@@ -140,7 +125,7 @@ read response
140
125
141
126
if [[ $response == " S" ]]; then
142
127
# Get the stable kernel from kernel.org
143
- kernel=$( curl -s https://www.kernel.org/ | grep -A1 ' stable:' | grep -oP ' (?<=strong>).*(?=</strong.*)' | grep 6.13 )
128
+ kernel=$( curl -s https://www.kernel.org/ | grep -A1 ' stable:' | grep -oP ' (?<=strong>).*(?=</strong.*)' | grep 6.14 )
144
129
elif [[ $response == " M" ]]; then
145
130
# Get the mainline kernel from kernel.org
146
131
kernel=$( curl -s https://www.kernel.org/ | grep -A1 ' mainline:' | grep -oP ' (?<=strong>).*(?=</strong.*)' )
0 commit comments