-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-kernel.sh
executable file
·60 lines (46 loc) · 1.54 KB
/
update-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
57
58
59
60
#!/usr/bin/env bash
set -e
# shellcheck source=common.sh
source "$(dirname $0)/common.sh"
goto-kernel-dir
sudo make clean
sudo make mrproper
syshook pre-update-kernel
syshook pre-update-kernel-pull-changes
git checkout "${KERNEL_BRANCH}"
git pull
syshook post-update-kernel-pull-changes
syscript apply-kernel-patches.sh
sudo rm -rf .config
cp "${USER_CFG_DIR}/configs/kernel-config" .config
syshook post-update-kernel-copy-config
git add .
git commit -m "Prepare for Kernel Build" || true
# shellcheck disable=SC2153
for BUNDLE in "${BUNDLES[@]}"
do
BUNDLE_PATH="${SCRIPTS}/bundles/${BUNDLE}"
if [ -f "${BUNDLE_PATH}/kernel-config-options" ]
then
echo "[Apply Bundle Kernel Options] ${BUNDLE}"
cat "${BUNDLE_PATH}/kernel-config-options" >> .config
fi
done
make olddefconfig
make prepare
syshook post-update-kernel-update-config
cp "${USER_CFG_DIR}/configs/kernel-config" "${USER_CFG_DIR}/configs/kernel-config-bak"
cp .config "${USER_CFG_DIR}/configs/kernel-config"
syshook post-update-kernel-apply-config
make ARCH="$(uname -m)" CC="${KERNEL_CC}" -j ${BUILD_JOBS}
syshook post-update-kernel-make
git reset --hard "origin/${KERNEL_BRANCH}"
KERNEL_VERSION=$(strings vmlinux | grep "Linux version" | awk '{print $3}')
sudo make modules_install
#sudo make headers_install
sudo cp -v arch/x86/boot/bzImage "/boot/vmlinuz-linux-${KERNEL_SUFFIX}"
sudo mkinitcpio -p "linux-${KERNEL_SUFFIX}"
sudo cp System.map "/boot/System.map-${KERNEL_SUFFIX}"
syshook post-update-kernel-tasks
echo "[Updated Kernel] ${KERNEL_VERSION}"
syshook post-update-kernel