1010 KBUILD_BUILD_HOST : " hyperion-ci"
1111
1212permissions :
13- contents : write # required for releases
13+ contents : write
1414 actions : write
1515
1616jobs :
@@ -20,62 +20,64 @@ jobs:
2020 steps :
2121 - uses : actions/checkout@v4
2222
23- - name : Validate config
23+ - name : Validate hyperion. config
2424 run : |
2525 python3 - << 'EOF'
2626 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}")
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}")
3333 if errs:
34- printf='%s\n'; exit(1)
35- print(f"Config OK")
34+ print("\n".join(errs))
35+ exit(1)
36+ print("Config OK")
3637 EOF
3738
3839 build-kernel :
39- name : Build Linux ${{ env.KERNEL_VERSION }}- Hyperion-${{ env.HYPERION_VERSION }}
40+ name : Build Linux Hyperion Kernel
4041 runs-on : ubuntu-latest
4142 needs : validate-config
43+ env :
44+ KERNEL_VERSION : 6.19.6
45+ HYPERION_VERSION : 0.1.0
46+ KBUILD_BUILD_USER : Soumalya Das
47+ KBUILD_BUILD_HOST : hyperion-ci
4248
4349 steps :
4450 - uses : actions/checkout@v4
4551
46- - name : Cache kernel source tarball
52+ - name : Restore kernel tarball cache
4753 id : cache-tar
4854 uses : actions/cache@v4
4955 with :
5056 path : linux-${{ env.KERNEL_VERSION }}.tar.xz
5157 key : kernel-tar-${{ env.KERNEL_VERSION }}
5258
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
59+ - name : Restore build cache
6160 id : cache-build
6261 uses : actions/cache@v4
6362 with :
64- path : |
65- .cache-build/linux-${{ env.KERNEL_VERSION }}
66- key : kernel-build-${{ env.KERNEL_VERSION }}-${{ hashFiles('hyperion.config') }}
63+ path : .cache-build/linux-${{ env.KERNEL_VERSION }}
64+ key : kernel-build-${{ env.KERNEL_VERSION }}-hyperion-${{ hashFiles('hyperion.config') }}
6765 restore-keys : |
6866 kernel-build-${{ env.KERNEL_VERSION }}-
6967
70- - name : Fetch kernel source
68+ - name : Download kernel source if missing
7169 if : steps.cache-tar.outputs.cache-hit != 'true'
7270 run : wget -q https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${{ env.KERNEL_VERSION }}.tar.xz
7371
74- - name : Extract kernel source
75- if : steps.cache-src.outputs.cache-hit != 'true'
76- run : tar -xf linux-${{ env.KERNEL_VERSION }}.tar.xz
72+ - name : Prepare build tree
73+ run : |
74+ mkdir -p .cache-build
75+ if [ ! -d ".cache-build/linux-${KERNEL_VERSION}" ]; then
76+ tar -xf linux-${KERNEL_VERSION}.tar.xz -C .cache-build
77+ mv .cache-build/linux-${KERNEL_VERSION}* .cache-build/linux-${KERNEL_VERSION}
78+ fi
7779
78- - name : Install build deps
80+ - name : Install build dependencies
7981 run : |
8082 sudo apt-get update -qq
8183 sudo apt-get install -y --no-install-recommends \
@@ -84,56 +86,56 @@ jobs:
8486
8587 - name : Configure kernel
8688 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 }}
89+ cd .cache-build/linux-${KERNEL_VERSION}
9090 cp ../../hyperion.config .config
9191 make olddefconfig \
92- LOCALVERSION="-Hyperion-${{ env. HYPERION_VERSION } }" \
93- KBUILD_BUILD_USER="${{ env. KBUILD_BUILD_USER } }" \
94- KBUILD_BUILD_HOST="${{ env. KBUILD_BUILD_HOST } }"
92+ LOCALVERSION="-Hyperion-${HYPERION_VERSION}" \
93+ KBUILD_BUILD_USER="${KBUILD_BUILD_USER}" \
94+ KBUILD_BUILD_HOST="${KBUILD_BUILD_HOST}"
9595
9696 - name : Apply patches
9797 run : |
98- cd .cache-build/linux-${{ env. KERNEL_VERSION } }
99- for p in ../patches/*.patch 2>/dev/null; do
98+ cd .cache-build/linux-${KERNEL_VERSION}
99+ for p in ../../ patches/*.patch 2>/dev/null; do
100100 git apply "$p" || patch -p1 < "$p"
101101 done || true
102102
103- - name : Build kernel
103+ - name : Build kernel (incremental)
104104 run : |
105- cd .cache-build/linux-${{ env. KERNEL_VERSION } }
105+ cd .cache-build/linux-${KERNEL_VERSION}
106106 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 } }" \
107+ LOCALVERSION="-Hyperion-${HYPERION_VERSION}" \
108+ KBUILD_BUILD_USER="${KBUILD_BUILD_USER}" \
109+ KBUILD_BUILD_HOST="${KBUILD_BUILD_HOST}" \
110110 KBUILD_BUILD_TIMESTAMP="$(date -u '+%Y-%m-%d %H:%M:%S')" \
111111 2>&1 | tee build.log
112112
113- - name : Verify image
113+ - name : Verify build
114114 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"
115+ ls -lh .cache-build/linux-${KERNEL_VERSION}/arch/x86/boot/bzImage
116+ strings .cache-build/linux-${KERNEL_VERSION}/arch/x86/boot/bzImage | grep "Hyperion"
117117
118- - name : Create/GH Release
118+ - name : Package artifacts into .tar.xz
119+ run : |
120+ cd .cache-build/linux-${KERNEL_VERSION}
121+ tar -cJf ../../Hyperion-Kernel-${KERNEL_VERSION}.tar.xz \
122+ arch/x86/boot/bzImage \
123+ Module.symvers \
124+ build.log \
125+ ../../hyperion.config
126+
127+ - name : Create GitHub Release
119128 uses : softprops/action-gh-release@v2
120129 with :
121130 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
131+ name : Linux ${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }}
130132 env :
131133 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132134
133- - name : Upload Module.symvers
135+ - name : Upload compressed kernel archive
134136 uses : softprops/action-gh-release@v2
135137 with :
136- files : .cache-build/linux -${{ env.KERNEL_VERSION }}/Module.symvers
138+ files : Hyperion-Kernel -${{ env.KERNEL_VERSION }}.tar.xz
137139 env :
138140 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
139141
0 commit comments