Skip to content

Commit 6ac8957

Browse files
Gulshan Singhgsingh93
Gulshan Singh
authored andcommitted
Initial commit
0 parents  commit 6ac8957

22 files changed

+1108
-0
lines changed

Diff for: .github/workflows/build.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Build
2+
on: [workflow_dispatch]
3+
4+
jobs:
5+
build:
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
# TODO: Add 20.04
10+
# TODO: Build all LTS and latest kernels
11+
os: [ubuntu-22.04]
12+
ack: [0, 1]
13+
arch: [arm64, x86_64]
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 80
16+
env:
17+
ACK: ${{ matrix.ack }}
18+
ARCH: ${{ matrix.arch }}
19+
outputs:
20+
SHORT_HASH: ${{ steps.vars.outputs.SHORT_HASH }}
21+
steps:
22+
23+
- uses: actions/checkout@v3
24+
with:
25+
submodules: true
26+
27+
- name: Set output variables
28+
id: vars
29+
run: |
30+
set -x
31+
32+
SHORT_HASH=$(git rev-parse --short HEAD)
33+
34+
if [ $ACK -eq 0 ]; then
35+
KERNEL_TYPE=linux
36+
KERNEL_IMAGE=out/linux
37+
else
38+
KERNEL_TYPE=ack
39+
KERNEL_IMAGE=out/ack/common
40+
fi
41+
42+
KERNEL_IMAGE="$KERNEL_IMAGE/${ARCH}/arch/${ARCH}/boot"
43+
44+
if [ $ARCH == x86_64 ]; then
45+
KERNEL_IMAGE="$KERNEL_IMAGE/bzImage"
46+
elif [ $ARCH == arm64 ]; then
47+
KERNEL_IMAGE="$KERNEL_IMAGE/Image"
48+
fi
49+
50+
echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_OUTPUT
51+
echo "KERNEL_TYPE=$KERNEL_TYPE" >> $GITHUB_OUTPUT
52+
echo "KERNEL_IMAGE=$KERNEL_IMAGE" >> $GITHUB_OUTPUT
53+
54+
# TODO: We can make this step faster by splitting up ACK, arm64, and x86 dependencies
55+
- name: Install dependencies
56+
run: |
57+
sudo apt update && sudo apt install -y \
58+
qemu \
59+
qemu-system-x86 \
60+
qemu-system-arm \
61+
build-essential \
62+
bc \
63+
bison \
64+
flex \
65+
git \
66+
libelf-dev \
67+
libssl-dev \
68+
ncurses-dev \
69+
llvm \
70+
clang \
71+
clang-tools \
72+
lld \
73+
lz4 \
74+
pahole \
75+
binutils-aarch64-linux-gnu \
76+
gcc-aarch64-linux-gnu
77+
78+
- name: Initialize rootfs
79+
run: |
80+
make rootfs-init
81+
82+
- name: Build kernel
83+
run: |
84+
make -j$(nproc) linux
85+
86+
- name: Run kernel
87+
run: |
88+
mkdir shared
89+
echo poweroff > shared/init.sh
90+
chmod +x shared/init.sh
91+
make run
92+
93+
- run: |
94+
cp ${{ steps.vars.outputs.KERNEL_IMAGE }} \
95+
${{ steps.vars.outputs.KERNEL_IMAGE }}-${{ steps.vars.outputs.KERNEL_TYPE }}-${{ matrix.arch }}
96+
97+
- name: Upload kernel artifact
98+
uses: actions/upload-artifact@v3
99+
with:
100+
name: kernel-image
101+
path: ${{ steps.vars.outputs.KERNEL_IMAGE }}-${{ steps.vars.outputs.KERNEL_TYPE }}-${{ matrix.arch }}
102+
103+
- name: Upload rootfs artifact
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: rootfs
107+
path: rootfs/rootfs-${{ matrix.arch }}.img
108+
109+
release:
110+
runs-on: ubuntu-22.04
111+
needs: build
112+
permissions:
113+
contents: write
114+
steps:
115+
116+
- name: Download all workflow run artifacts
117+
uses: actions/download-artifact@v3
118+
119+
- run: ls -lR
120+
121+
- name: Set output variables
122+
id: vars
123+
run: |
124+
set -x
125+
126+
echo "DATE=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
127+
128+
- name: Publish release
129+
uses: softprops/action-gh-release@v1
130+
with:
131+
tag_name: ${{ steps.vars.outputs.DATE }}-${{ needs.build.outputs.SHORT_HASH }}
132+
files: |
133+
kernel-image/*
134+
rootfs/*

Diff for: .gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/rootfs/*.img
2+
/rootfs/*.cpio.gz
3+
/rootfs/alpine-*/
4+
5+
/shared
6+
/out
7+
/.cache
8+
compile_commands.json

Diff for: .gitmodules

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[submodule "ack/common-modules/virtual-device"]
2+
path = ack/common-modules/virtual-device
3+
url = https://android.googlesource.com/kernel/common-modules/virtual-device
4+
branch = android13-5.10
5+
[submodule "ack/common"]
6+
path = ack/common
7+
url = https://android.googlesource.com/kernel/common
8+
branch = android13-5.10
9+
[submodule "linux"]
10+
path = linux
11+
url = https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/

0 commit comments

Comments
 (0)