|
| 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 | +jobs: |
| 13 | + validate-config: |
| 14 | + name: Validate Hyperion Config |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - name: Validate config |
| 19 | + run: | |
| 20 | + python3 - <<'EOF' |
| 21 | + with open('hyperion.config') as f: |
| 22 | + lines = f.readlines() |
| 23 | + errors = [] |
| 24 | + for i, line in enumerate(lines, 1): |
| 25 | + line = line.strip() |
| 26 | + if not line or line.startswith('#'): |
| 27 | + continue |
| 28 | + if '=' not in line: |
| 29 | + errors.append(f'Line {i}: Invalid config line: {line}') |
| 30 | + elif not line.startswith('CONFIG_'): |
| 31 | + errors.append(f'Line {i}: Expected CONFIG_ prefix: {line}') |
| 32 | + if errors: |
| 33 | + for e in errors: |
| 34 | + print(e) |
| 35 | + exit(1) |
| 36 | + print(f"Config validated: {len(lines)} lines, no errors") |
| 37 | + EOF |
| 38 | + - name: Check critical options |
| 39 | + run: | |
| 40 | + critical_opts=( |
| 41 | + "CONFIG_MODULES=y" |
| 42 | + "CONFIG_MODULE_UNLOAD=y" |
| 43 | + "CONFIG_MODVERSIONS=y" |
| 44 | + "CONFIG_KALLSYMS=y" |
| 45 | + "CONFIG_DEVTMPFS=y" |
| 46 | + "CONFIG_DEVTMPFS_MOUNT=y" |
| 47 | + "CONFIG_IKHEADERS=y" |
| 48 | + "CONFIG_BLK_DEV_NVME=y" |
| 49 | + "CONFIG_PREEMPT=y" |
| 50 | + "CONFIG_HZ_1000=y" |
| 51 | + "CONFIG_LRU_GEN=y" |
| 52 | + "CONFIG_BPF_JIT=y" |
| 53 | + "CONFIG_TCP_CONG_BBR=y" |
| 54 | + ) |
| 55 | + failed=0 |
| 56 | + for opt in "${critical_opts[@]}"; do |
| 57 | + if grep -q "^${opt}" hyperion.config; then |
| 58 | + echo "✓ $opt" |
| 59 | + else |
| 60 | + echo "✗ MISSING: $opt" |
| 61 | + failed=$((failed+1)) |
| 62 | + fi |
| 63 | + done |
| 64 | + if [ $failed -gt 0 ]; then exit 1; fi |
| 65 | + echo "All critical options present" |
| 66 | +
|
| 67 | + build-kernel: |
| 68 | + name: Build Linux ${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }} |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: validate-config |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Install build dependencies |
| 75 | + run: | |
| 76 | + sudo apt-get update -qq |
| 77 | + sudo apt-get install -y --no-install-recommends \ |
| 78 | + build-essential libncurses-dev bison flex libssl-dev \ |
| 79 | + libelf-dev dwarves bc pahole git make gcc xz-utils zstd \ |
| 80 | + cpio perl tar rsync |
| 81 | +
|
| 82 | + - name: Cache kernel tarball |
| 83 | + uses: actions/cache@v4 |
| 84 | + with: |
| 85 | + path: linux-${{ env.KERNEL_VERSION }}.tar.xz |
| 86 | + key: linux-${{ env.KERNEL_VERSION }}-tarball |
| 87 | + |
| 88 | + - name: Cache extracted kernel source |
| 89 | + uses: actions/cache@v4 |
| 90 | + with: |
| 91 | + path: linux-${{ env.KERNEL_VERSION }} |
| 92 | + key: linux-${{ env.KERNEL_VERSION }}-source |
| 93 | + |
| 94 | + - name: Download kernel source |
| 95 | + if: steps.cache.outputs.cache-hit != 'true' |
| 96 | + run: | |
| 97 | + wget -q "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${{ env.KERNEL_VERSION }}.tar.xz" |
| 98 | +
|
| 99 | + - name: Extract kernel source |
| 100 | + if: steps.cache.outputs.cache-hit != 'true' |
| 101 | + run: tar -xf linux-${{ env.KERNEL_VERSION }}.tar.xz |
| 102 | + |
| 103 | + - name: Apply Hyperion config |
| 104 | + run: | |
| 105 | + cd linux-${{ env.KERNEL_VERSION }} |
| 106 | + cp ../hyperion.config .config |
| 107 | + make olddefconfig \ |
| 108 | + LOCALVERSION="-Hyperion-${{ env.HYPERION_VERSION }}" \ |
| 109 | + KBUILD_BUILD_USER="${{ env.KBUILD_BUILD_USER }}" \ |
| 110 | + KBUILD_BUILD_HOST="${{ env.KBUILD_BUILD_HOST }}" |
| 111 | +
|
| 112 | + - name: Apply patches |
| 113 | + run: | |
| 114 | + cd linux-${{ env.KERNEL_VERSION }} |
| 115 | + set -e |
| 116 | + if ls ../patches/*.patch 2>/dev/null | grep -q .; then |
| 117 | + for patch in ../patches/*.patch; do |
| 118 | + git apply "$patch" || patch -p1 < "$patch" |
| 119 | + echo "Applied: $(basename $patch)" |
| 120 | + done |
| 121 | + else |
| 122 | + echo "No patches to apply" |
| 123 | + fi |
| 124 | +
|
| 125 | + - name: Build kernel |
| 126 | + run: | |
| 127 | + cd linux-${{ env.KERNEL_VERSION }} |
| 128 | + make -j$(nproc) \ |
| 129 | + LOCALVERSION="-Hyperion-${{ env.HYPERION_VERSION }}" \ |
| 130 | + KBUILD_BUILD_USER="${{ env.KBUILD_BUILD_USER }}" \ |
| 131 | + KBUILD_BUILD_HOST="${{ env.KBUILD_BUILD_HOST }}" \ |
| 132 | + KBUILD_BUILD_TIMESTAMP="$(date '+%Y-%m-%d %H:%M:%S UTC')" \ |
| 133 | + 2>&1 | tee build.log |
| 134 | +
|
| 135 | + - name: Verify kernel image |
| 136 | + run: | |
| 137 | + ls -lh linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage |
| 138 | + KVER=$(strings linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage | grep "Linux version" | head -1) |
| 139 | + echo "Kernel release: $KVER" |
| 140 | + if echo "$KVER" | grep -q "Hyperion"; then |
| 141 | + echo "✓ Hyperion branding confirmed" |
| 142 | + else |
| 143 | + exit 1 |
| 144 | +
|
| 145 | + - name: Create GitHub release |
| 146 | + id: release |
| 147 | + uses: softprops/action-gh-release@v2 |
| 148 | + with: |
| 149 | + tag_name: v${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }} |
| 150 | + name: Linux ${{ env.KERNEL_VERSION }}-Hyperion-${{ env.HYPERION_VERSION }} |
| 151 | + env: |
| 152 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 153 | + |
| 154 | + - name: Upload bzImage to release |
| 155 | + uses: softprops/action-gh-release@v2 |
| 156 | + with: |
| 157 | + files: linux-${{ env.KERNEL_VERSION }}/arch/x86/boot/bzImage |
| 158 | + env: |
| 159 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 160 | + |
| 161 | + - name: Upload Module.symvers to release |
| 162 | + uses: softprops/action-gh-release@v2 |
| 163 | + with: |
| 164 | + files: linux-${{ env.KERNEL_VERSION }}/Module.symvers |
| 165 | + env: |
| 166 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments