-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (100 loc) · 4.75 KB
/
kernel.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
name: Build Noble Custom Kernel
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Install necessary dependencies
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential fakeroot libncurses5-dev libssl-dev ccache bison flex libelf-dev libudev-dev libpci-dev libiberty-dev
# Download and compile the custom kernel
- name: Download and Compile Custom Kernel
run: |
# Define the kernel version
KERNEL_VERSION=6.10.7
# Create a directory for our build
mkdir -p kernel-build
cd kernel-build
# Download the kernel source
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_VERSION}.tar.xz
tar -xvf linux-${KERNEL_VERSION}.tar.xz
cd linux-${KERNEL_VERSION}
# Generate default config
make defconfig
# Automatically modify the .config file to set the required parameters
# Enable and set the following kernel options
sed -i 's/# CONFIG_IPU_BRIDGE is not set/CONFIG_IPU_BRIDGE=y/' .config
sed -i 's/# CONFIG_VIDEO_INTEL_IPU6 is not set/CONFIG_VIDEO_INTEL_IPU6=y/' .config
sed -i 's/# CONFIG_INTEL_VSC is not set/CONFIG_INTEL_VSC=y/' .config
sed -i 's/# CONFIG_VIDEO_IPU3_CIO2 is not set/CONFIG_VIDEO_IPU3_CIO2=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP is not set/CONFIG_VIDEO_ATOMISP=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP_OV2722 is not set/CONFIG_VIDEO_ATOMISP_OV2722=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP_GC2235 is not set/CONFIG_VIDEO_ATOMISP_GC2235=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER is not set/CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP_MT9M114 is not set/CONFIG_VIDEO_ATOMISP_MT9M114=y/' .config
sed -i 's/# CONFIG_VIDEO_ATOMISP_GC0310 is not set/CONFIG_VIDEO_ATOMISP_GC0310=y/' .config
# Alternatively, append to the config if they aren't present at all
echo "CONFIG_IPU_BRIDGE=y" >> .config
echo "CONFIG_VIDEO_INTEL_IPU6=y" >> .config
echo "CONFIG_INTEL_VSC=y" >> .config
echo "CONFIG_VIDEO_IPU3_CIO2=y" >> .config
echo "CONFIG_VIDEO_ATOMISP=y" >> .config
echo "CONFIG_VIDEO_ATOMISP_OV2722=y" >> .config
echo "CONFIG_VIDEO_ATOMISP_GC2235=y" >> .config
echo "CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER=y" >> .config
echo "CONFIG_VIDEO_ATOMISP_MT9M114=y" >> .config
echo "CONFIG_VIDEO_ATOMISP_GC0310=y" >> .config
# Compile the kernel
make -j$(nproc)
# Compile and install modules to a local directory
make INSTALL_MOD_PATH=../modules modules_install
# Package the kernel
- name: Package Kernel
run: |
# Ensure KERNEL_VERSION is set
KERNEL_VERSION=6.10.7
cd kernel-build/linux-${KERNEL_VERSION}
# Create a temporary directory for packaging
mkdir -p ../kernel-package/DEBIAN
mkdir -p ../kernel-package/boot
mkdir -p ../kernel-package/lib/modules
# Copy kernel image
cp arch/x86/boot/bzImage ../kernel-package/boot/vmlinuz-${KERNEL_VERSION}-custom
# Copy System.map and config
cp System.map ../kernel-package/boot/System.map-${KERNEL_VERSION}-custom
cp .config ../kernel-package/boot/config-${KERNEL_VERSION}-custom
# Copy modules from our local modules directory
cp -r ../modules/lib/modules/${KERNEL_VERSION} ../kernel-package/lib/modules/${KERNEL_VERSION}-custom
# Create control file
cat << EOF > ../kernel-package/DEBIAN/control
Package: linux-image-${KERNEL_VERSION}-custom
Version: ${KERNEL_VERSION}-1
Architecture: amd64
Maintainer: Your Name <[email protected]>
Description: Custom Linux kernel
This package contains a custom compiled Linux kernel.
EOF
# Create postinst script
cat << EOF > ../kernel-package/DEBIAN/postinst
#!/bin/sh
set -e
depmod ${KERNEL_VERSION}-custom
update-initramfs -c -k ${KERNEL_VERSION}-custom
update-grub
EOF
chmod 755 ../kernel-package/DEBIAN/postinst
# Build the package
cd ..
dpkg-deb --build kernel-package linux-image-${KERNEL_VERSION}-custom.deb
# Store the generated .deb file as artifact
- name: Upload Kernel .deb File
uses: actions/upload-artifact@v3
with:
name: kernel-deb
path: kernel-build/linux-image-*.deb