-
Notifications
You must be signed in to change notification settings - Fork 5
115 lines (95 loc) · 3.97 KB
/
build-debian-image.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
106
107
108
109
110
111
112
113
114
115
name: Build Debian Image
on:
workflow_dispatch:
inputs:
kernel_version:
description: "Kernel version to build"
required: true
default: "5.10.228"
kernel_branch:
description: "Kernel branch to build"
required: true
default: "v5.x"
debian_version:
description: "Debian version to use"
required: true
default: "bullseye"
jobs:
build-kernel:
runs-on: ubuntu-latest
container: debian:bookworm-slim
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Install dependencies
run: apt-get update && apt-get install -y --no-install-recommends bash ca-certificates git tar xz-utils wget build-essential flex bison libssl-dev libelf-dev bc kmod
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: "true"
- name: Download Kernel
run: wget https://cdn.kernel.org/pub/linux/kernel/${{ inputs.kernel_branch }}/linux-${{ inputs.kernel_version }}.tar.xz
- name: Extract Kernel
run: tar -xf linux-${{ inputs.kernel_version }}.tar.xz
- name: Copy Kernel Config
run: cp ./kernel/${{ inputs.kernel_version }}.config ./linux-${{ inputs.kernel_version }}/.config
- name: Build Kernel
env:
KERNEL_VERSION: ${{ inputs.kernel_version }}
run: ./kernel/build.sh
- name: Prepare Artifacts
working-directory: linux-${{ inputs.kernel_version }}
run: |
mv /tmp/build-modules/lib/modules/${{ inputs.kernel_version }}-steam ../boot/
mv arch/arm/boot/zImage ../boot/
mv arch/arm/boot/dts/berlin2cd-valve-steamlink.dtb ../boot/
rm -rf ../boot/${{ inputs.kernel_version }}-steam/build
rm -rf ../boot/${{ inputs.kernel_version }}-steam/source
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: kernel-${{ inputs.kernel_version }}-steam
path: boot/
build-rootfs:
runs-on: ubuntu-latest
needs: build-kernel
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bash parted xz-utils
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: "false"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@master
with:
name: kernel-${{ inputs.kernel_version }}-steam
path: kernel-${{ inputs.kernel_version }}
- name: Build RootFS Docker Image
run: docker buildx build --platform linux/arm/v7 --build-arg KERNEL_VERSION=${{ inputs.kernel_version }} --build-arg DEBIAN_VERSION=${{ inputs.debian_version }} --rm -f rootfs/Dockerfile --tag steamlink-debian:latest --output type=docker,dest=steamlink-debian.tar .
- name: Create RootFS tarball
run: |
docker load -i steamlink-debian.tar
docker create -t -i --name steamlink-debian-rootfs steamlink-debian:latest
docker export steamlink-debian-rootfs -o rootfs.tar
- name: Upload RootFS tarball
uses: actions/upload-artifact@v4
with:
name: steamlink-debian-${{ inputs.debian_version }}-${{ inputs.kernel_version }}-rootfs
path: rootfs.tar
- name: Create disk image
env:
KERNEL_VERSION: ${{ inputs.kernel_version }}
DEBIAN_VERSION: ${{ inputs.debian_version }}
run: sudo ./rootfs/build.sh
- name: Compress disk image
run: xz -z steamlink-debian-${{ inputs.debian_version }}-${{ inputs.kernel_version }}.img
- name: Upload disk image
uses: actions/upload-artifact@v4
with:
name: steamlink-debian-${{ inputs.debian_version }}-${{ inputs.kernel_version }}-image
path: steamlink-debian-${{ inputs.debian_version }}-${{ inputs.kernel_version }}.img.xz