-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_kernel.sh
executable file
·46 lines (33 loc) · 1.2 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
#!/bin/sh
set -ex
if [ ! -f kernel.tar.xz ]; then
wget -q -O kernel.tar.xz http://kernel.org/pub/linux/kernel/v4.x/linux-$KERNEL_VERSION.tar.xz
fi
if [ -d linux-$KERNEL_VERSION ]; then
rm -rf linux-$KERNEL_VERSION
fi
if [ -d linux_install ]; then
rm -rf linux_install
fi
mkdir linux_install
tar -xf kernel.tar.xz
cd linux-$KERNEL_VERSION
make -j5 defconfig
# Kernel config options
sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"LeOS\"/" .config
sed -i "s/.*\\(CONFIG_KERNEL_.*\\)=y/\\#\\ \\1 is not set/" .config
sed -i "s/.*CONFIG_KERNEL_XZ.*/CONFIG_KERNEL_XZ=y/" .config
sed -i "s/.*CONFIG_FB_VESA.*/CONFIG_FB_VESA=y/" .config
sed -i "s/.*CONFIG_LOGO_LINUX_CLUT224.*/CONFIG_LOGO_LINUX_CLUT224=y/" .config
sed -i "s/^CONFIG_DEBUG_KERNEL.*/\\# CONFIG_DEBUG_KERNEL is not set/" .config
sed -i "s/.*CONFIG_EFI_STUB.*/CONFIG_EFI_STUB=y/" .config
echo "CONFIG_RESET_ATTACK_MITIGATION=y" >> .config
echo "CONFIG_APPLE_PROPERTIES=n" >> .config
if [ "`grep "CONFIG_X86_64=y" .config`" = "CONFIG_X86_64=y" ] ; then
echo "CONFIG_EFI_MIXED=y" >> .config
fi
make -j5 bzImage
cp arch/x86/boot/bzImage ../isoimage/kernel.xz
make INSTALL_HDR_PATH=`realpath ../linux_install` headers_install -j 5
cd ..
set +ex