1414
1515 validate-config :
1616 runs-on : ubuntu-latest
17-
1817 outputs :
1918 VERSION : ${{ steps.parse.outputs.VERSION }}
2019 FULL_VERSION : ${{ steps.parse.outputs.FULL_VERSION }}
@@ -30,68 +29,42 @@ jobs:
3029 id : parse
3130 run : |
3231 set -euo pipefail
33-
3432 python3 << 'EOF'
3533 import os, hashlib, glob
36-
3734 config={}
3835 with open("hyperion.config") as f:
3936 for line in f:
4037 line=line.strip()
4138 if not line or line.startswith("#"): continue
4239 k,v=line.split("=",1)
4340 config[k.strip()]=v.strip().strip('"')
44-
4541 VERSION=int(config.get("CONFIG_VERSION",0))
4642 PATCH=int(config.get("CONFIG_PATCHLEVEL",0))
4743 SUB=int(config.get("CONFIG_SUBLEVEL",0))
48-
4944 FULL_VERSION=f"{VERSION}.{PATCH}" if SUB==0 else f"{VERSION}.{PATCH}.{SUB}"
50-
5145 LOCAL=config.get("CONFIG_LOCALVERSION","")
52-
5346 HYPERION_VER=LOCAL.split("-Hyperion-",1)[-1] if "-Hyperion-" in LOCAL else LOCAL.lstrip("-")
54-
5547 TAG=HYPERION_VER
56-
5748 CONFIG_HASH=hashlib.sha256(open("hyperion.config","rb").read()).hexdigest()[:12]
58-
5949 patches=sorted(glob.glob("patches/*.patch"))
60- if patches:
61- data=b''.join(open(p,"rb").read() for p in patches)
62- PATCHES_HASH=hashlib.sha256(data).hexdigest()[:12]
63- else:
64- PATCHES_HASH="none"
65-
50+ PATCHES_HASH=hashlib.sha256(b''.join(open(p,"rb").read() for p in patches)).hexdigest()[:12] if patches else "none"
6651 out=os.environ["GITHUB_OUTPUT"]
67-
68- for k,v in {
69- "VERSION":VERSION,
70- "FULL_VERSION":FULL_VERSION,
71- "TAG":TAG,
72- "HYPERION_VER":HYPERION_VER,
73- "CONFIG_HASH":CONFIG_HASH,
74- "PATCHES_HASH":PATCHES_HASH
75- }.items():
76- open(out,"a").write(f"{k}={v}\n")
52+ for k,v in {"VERSION":VERSION,"FULL_VERSION":FULL_VERSION,"TAG":TAG,"HYPERION_VER":HYPERION_VER,"CONFIG_HASH":CONFIG_HASH,"PATCHES_HASH":PATCHES_HASH}.items():
53+ open(out,"a").write(f"{k}={v}\n")
7754 EOF
7855
79-
8056 build-kernel :
8157 needs : validate-config
8258 runs-on : ubuntu-latest
83-
8459 env :
8560 KERNEL_VERSION : ${{ needs.validate-config.outputs.VERSION }}
8661 FULL_VERSION : ${{ needs.validate-config.outputs.FULL_VERSION }}
8762 TAG_NAME : ${{ needs.validate-config.outputs.TAG }}
8863 HYPERION_VER : ${{ needs.validate-config.outputs.HYPERION_VER }}
8964 CONFIG_HASH : ${{ needs.validate-config.outputs.CONFIG_HASH }}
9065 PATCHES_HASH : ${{ needs.validate-config.outputs.PATCHES_HASH }}
91-
9266 KBUILD_BUILD_USER : Soumalya
9367 KBUILD_BUILD_HOST : github-runner
94-
9568 CCACHE_DIR : ${{ github.workspace }}/.ccache
9669 CCACHE_MAXSIZE : 5G
9770 CCACHE_COMPRESS : true
10275
10376 - uses : actions/checkout@v4
10477
105- # deterministic timestamp
10678 - name : Generate reproducible timestamp
10779 run : |
10880 SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
@@ -119,48 +91,59 @@ jobs:
11991 dwarves rsync cpio git wget curl \
12092 ccache zstd ca-certificates
12193
122- # ccache layer
12394 - name : Restore compiler cache
95+ id : cache-ccache
12496 uses : actions/cache@v4
12597 with :
12698 path : .ccache
12799 key : ccache-${{ runner.os }}-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
128100 restore-keys : |
129101 ccache-${{ runner.os }}-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-
130102 ccache-${{ runner.os }}-${{ env.FULL_VERSION }}-
131- ccache-
103+ ccache-${{ runner.os }}-
132104
133- # kernel tarball cache
134- - name : Restore kernel source
135- id : kernel
105+ - name : Restore kernel source tarball
106+ id : kernel-src
136107 uses : actions/cache@v4
137108 with :
138109 path : linux-${{ env.FULL_VERSION }}.tar.xz
139110 key : kernel-src-${{ env.FULL_VERSION }}
140111
141- - name : Download kernel
142- if : steps.kernel.outputs.cache-hit != 'true'
112+ - name : Download kernel tarball
113+ if : steps.kernel-src .outputs.cache-hit != 'true'
143114 run : |
144115 wget https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/linux-${FULL_VERSION}.tar.xz
145116 wget https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc
146117 grep "linux-${FULL_VERSION}.tar.xz" sha256sums.asc | sha256sum -c -
147118
148- # kernel object tree cache
149- - name : Restore kernel build cache
150- id : kernel-build
119+ - name : Restore object cache
120+ id : cache-obj
151121 uses : actions/cache@v4
152122 with :
153123 path : kernel
154- key : kernel-build -${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
124+ key : kernel-obj -${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
155125 restore-keys : |
156- kernel-build-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-
157- kernel-build-${{ env.FULL_VERSION }}-
126+ kernel-obj-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-
127+ kernel-obj-${{ env.FULL_VERSION }}-
128+
129+ - name : Restore module object cache
130+ id : cache-mod
131+ uses : actions/cache@v4
132+ with :
133+ path : |
134+ kernel/.modlib
135+ kernel/.tmp_mod
136+ key : kernel-mod-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
137+ restore-keys : |
138+ kernel-mod-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-
139+ kernel-mod-${{ env.FULL_VERSION }}-
158140
159141 - name : Extract kernel
160- if : steps.kernel-build .outputs.cache-hit != 'true'
142+ if : steps.cache-obj .outputs.cache-hit != 'true'
161143 run : |
162- tar -xf linux-${FULL_VERSION}.tar.xz
163- mv linux-${FULL_VERSION} kernel
144+ rm -rf kernel
145+ mkdir kernel
146+ tar -xf linux-${FULL_VERSION}.tar.xz -C kernel --strip-components=1
164147
165148 - name : Apply config
166149 working-directory : kernel
@@ -193,12 +176,10 @@ jobs:
193176 - name : Package artifacts
194177 run : |
195178 mkdir artifacts
196-
197179 cp kernel/arch/x86/boot/bzImage artifacts/
198180 cp kernel/System.map artifacts/ || true
199181 cp kernel/vmlinux artifacts/ || true
200182 cp hyperion.config artifacts/
201-
202183 tar --zstd -cf Hyperion-Kernel-${FULL_VERSION}.tar.zst artifacts
203184
204185 - name : Generate checksum
@@ -212,4 +193,4 @@ jobs:
212193 files : |
213194 Hyperion-Kernel-${{ env.FULL_VERSION }}.tar.zst
214195 Hyperion-Kernel-${{ env.FULL_VERSION }}.sha256
215-
196+
0 commit comments