1+ name : Hyperion Kernel Build CI
2+
3+ on :
4+ workflow_dispatch :
5+
6+ env :
7+ KERNEL_VERSION : " 6.19.6"
8+ HYPERION_VERSION : " 0.1.0"
9+ KBUILD_BUILD_USER : " Soumalya Das"
10+ KBUILD_BUILD_HOST : " hyperion-ci"
11+
12+ permissions :
13+ contents : write # required for releases
14+ actions : write
15+
16+ jobs :
17+ validate-config :
18+ name : Validate Hyperion Config
19+ runs-on : ubuntu-latest
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : Validate config
24+ run : |
25+ python3 - << 'EOF'
26+ with open('hyperion.config') as f: lines = f.readlines()
27+ errs = []
28+ for i, l in enumerate(lines,1):
29+ l=l.strip()
30+ if not l or l.startswith('#'): continue
31+ if '=' not in l: errs.append(f"Line {i}: No '=': {l}")
32+ elif not l.startswith('CONFIG_'): errs.append(f"Line {i}: needs CONFIG_: {l}")
33+ if errs:
34+ printf='%s\n'; exit(1)
35+ print(f"Config OK")
36+ EOF
37+
38+ build-kernel :
39+ name : Build Linux ${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }}
40+ runs-on : ubuntu-latest
41+ needs : validate-config
42+
43+ steps :
44+ - uses : actions/checkout@v4
45+
46+ - name : Cache kernel source tarball
47+ id : cache-tar
48+ uses : actions/cache@v4
49+ with :
50+ path : linux-${{ env.KERNEL_VERSION }}.tar.xz
51+ key : kernel-tar-${{ env.KERNEL_VERSION }}
52+
53+ - name : Cache extracted kernel source
54+ id : cache-src
55+ uses : actions/cache@v4
56+ with :
57+ path : linux-${{ env.KERNEL_VERSION }}
58+ key : kernel-src-${{ env.KERNEL_VERSION }}
59+
60+ - name : Cache kernel build objects
61+ id : cache-build
62+ uses : actions/cache@v4
63+ with :
64+ path : |
65+ .cache-build/linux-${{ env.KERNEL_VERSION }}
66+ key : kernel-build-${{ env.KERNEL_VERSION }}-${{ hashFiles('hyperion.config') }}
67+ restore-keys : |
68+ kernel-build-${{ env.KERNEL_VERSION }}-
69+
70+ - name : Fetch kernel source
71+ if : steps.cache-tar.outputs.cache-hit != 'true'
72+ run : wget -q https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${{ env.KERNEL_VERSION }}.tar.xz
73+
74+ - name : Extract kernel source
75+ if : steps.cache-src.outputs.cache-hit != 'true'
76+ run : tar -xf linux-${{ env.KERNEL_VERSION }}.tar.xz
77+
78+ - name : Install build deps
79+ run : |
80+ sudo apt-get update -qq
81+ sudo apt-get install -y --no-install-recommends \
82+ build-essential libncurses-dev bison flex libssl-dev libelf-dev \
83+ dwarves bc pahole git make gcc xz-utils zstd cpio perl tar rsync
84+
85+ - name : Configure kernel
86+ run : |
87+ mkdir -p .cache-build/linux-${{ env.KERNEL_VERSION }}
88+ rsync -a linux-${{ env.KERNEL_VERSION }}/ .cache-build/linux-${{ env.KERNEL_VERSION }}/
89+ cd .cache-build/linux-${{ env.KERNEL_VERSION }}
90+ cp ../../hyperion.config .config
91+ make olddefconfig \
92+ LOCALVERSION="-Hyperion-${{ env.HYPERION_VERSION }}" \
93+ KBUILD_BUILD_USER="${{ env.KBUILD_BUILD_USER }}" \
94+ KBUILD_BUILD_HOST="${{ env.KBUILD_BUILD_HOST }}"
95+
96+ - name : Apply patches
97+ run : |
98+ cd .cache-build/linux-${{ env.KERNEL_VERSION }}
99+ for p in ../patches/*.patch 2>/dev/null; do
100+ git apply "$p" || patch -p1 < "$p"
101+ done || true
102+
103+ - name : Build kernel
104+ run : |
105+ cd .cache-build/linux-${{ env.KERNEL_VERSION }}
106+ make -j$(nproc) \
107+ LOCALVERSION="-Hyperion-${{ env.HYPERION_VERSION }}" \
108+ KBUILD_BUILD_USER="${{ env.KBUILD_BUILD_USER }}" \
109+ KBUILD_BUILD_HOST="${{ env.KBUILD_BUILD_HOST }}" \
110+ KBUILD_BUILD_TIMESTAMP="$(date -u '+%Y-%m-%d %H:%M:%S')" \
111+ 2>&1 | tee build.log
112+
113+ - name : Verify image
114+ run : |
115+ ls -lh .cache-build/linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage
116+ strings .cache-build/linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage | grep "Hyperion"
117+
118+ - name : Create/GH Release
119+ uses : softprops/action-gh-release@v2
120+ with :
121+ tag_name : v${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }}
122+ name : Linux ${ env.KERNEL_VERSION }-Hyperion-${{ env.HYPERION_VERSION }}
123+ env :
124+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
125+
126+ - name : Upload bzImage
127+ uses : softprops/action-gh-release@v2
128+ with :
129+ files : .cache-build/linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage
130+ env :
131+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132+
133+ - name : Upload Module.symvers
134+ uses : softprops/action-gh-release@v2
135+ with :
136+ files : .cache-build/linux-${{ env.KERNEL_VERSION }}/Module.symvers
137+ env :
138+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
139+
0 commit comments