Skip to content

Commit 42c63a2

Browse files
committed
workflows: Add weekly U-Boot build for RB1
Resulting binaries are uploaded to fileserver and can be used in image generation jobs. Signed-off-by: Loïc Minier <[email protected]>
1 parent 11f4107 commit 42c63a2

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

.github/workflows/u-boot.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: U-Boot Android boot image for RB1
2+
3+
on:
4+
# run on pull requests to the main branch
5+
pull_request:
6+
branches: [main]
7+
# run on pushes to the main branch
8+
push:
9+
branches: [main]
10+
# run weekly on Monday at 8:30am
11+
schedule:
12+
- cron: '30 8 * * 1'
13+
# allow manual runs
14+
workflow_dispatch:
15+
16+
# only need permission to read repository; implicitely set all other
17+
# permissions to none
18+
permissions:
19+
contents: read
20+
21+
env:
22+
# where results will be posted/hosted
23+
FILESERVER_URL: https://quic-yocto-fileserver-1029608027416.us-central1.run.app
24+
# github runs are only unique per repository and may also be re-run; create a
25+
# build id for the current run
26+
BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
27+
28+
# cancel in progress builds for this workflow triggered by the same ref
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.ref }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
build-u-boot-rb1:
35+
# TODO test whether this builds on x86 too
36+
# XXX currently missing docker
37+
#runs-on: [self-hosted, x86]
38+
runs-on: [self-hosted, arm64, debbuilder]
39+
container:
40+
image: debian:trixie
41+
volumes:
42+
- /srv/gh-runners/quic-yocto/builds:/fileserver-builds
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
# make sure we have latest packages first, to get latest fixes, to avoid
49+
# an automated update while we're building, and to prevent version skews
50+
- name: Update OS packages
51+
run: |
52+
set -ux
53+
apt update
54+
apt -y upgrade
55+
apt -y full-upgrade
56+
57+
- name: Build U-Boot Android boot image for RB1
58+
run:
59+
set -ux
60+
# install build-dependencies
61+
apt -y install git crossbuild-essential-arm64 make bison flex bc \
62+
libssl-dev gnutls-dev gzip mkbootimg
63+
scripts/build-u-boot-rb1.sh
64+
65+
- name: Upload results to fileserver
66+
run: |
67+
set -ux
68+
# curl will be used to talk to fileserver; should be installed by
69+
# default
70+
apt -y install curl
71+
# create directory for results on fileserver
72+
dir="/fileserver-builds/${BUILD_ID}"
73+
mkdir -vp "${dir}"
74+
# copy output files
75+
cp -av \
76+
u-boot/u-boot-nodtb.bin \
77+
u-boot/u-boot-nodtb.bin.gz \
78+
u-boot/dts/upstream/src/arm64/qcom/qrb2210-rb1.dtb \
79+
u-boot/u-boot-nodtb.bin.gz-dtb \
80+
u-boot/u-boot.bin \
81+
u-boot/rb1-boot.img \
82+
"${dir}"
83+
# instruct fileserver to publish this directory
84+
url="${FILESERVER_URL}/${BUILD_ID}/"
85+
curl -X POST -H 'Accept: text/event-stream' "${url}"
86+
# create file with URL of these results
87+
echo "${url}" >u-boot-rb1.url
88+
89+
- name: Save URL of build results as an artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
path: u-boot-rb1.url
93+

scripts/build-u-boot-rb1.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
GIT_REPO="https:////github.com/b49020/u-boot"
6+
GIT_BRANCH="qcom-mainline"
7+
CONFIG="qcom_defconfig"
8+
U_BOOT_DEVICE_TREE="qcom/qrb2210-rb1"
9+
ABOOT_BASE_ADDRESS="0x80000000"
10+
ABOOT_PAGE_SIZE="4096"
11+
ABOOT_OUTPUT="rb1-boot.img"
12+
13+
log_i() {
14+
echo "I: $*" >&2
15+
}
16+
17+
fatal() {
18+
echo "F: $*" >&2
19+
exit 1
20+
}
21+
22+
# needed to clone repository
23+
packages="git"
24+
# will pull gcc-aarch64-linux-gnu; should pull a native compiler on arm64 and
25+
# a cross-compiler on other architectures
26+
packages="$packages crossbuild-essential-arm64"
27+
# u-boot build-dependencies
28+
packages="$packages make bison flex bc libssl-dev gnutls-dev"
29+
# needed to pack resulting u-boot binary into an Android boot image
30+
packages="$packages gzip mkbootimg"
31+
32+
log_i "Checking build-dependencies ($packages)"
33+
missing=""
34+
for pkg in $packages; do
35+
if ! dpkg -l "${pkg}" 2>&1 | grep -q "^ii ${pkg}"; then
36+
missing="${missing} ${pkg}"
37+
fi
38+
done
39+
if [ -n "${missing}" ]; then
40+
fatal "Missing build-dependencies: ${missing}"
41+
fi
42+
43+
log-i "Cloning U-Boot (${GIT_REPO}:${GIT_BRANCH})"
44+
git clone --depth=0 --branch "${GIT_BRANCH}" "${GIT_REPO}" u-boot
45+
46+
cd u-boot
47+
48+
log-i "Configuring U-Boot (${CONFIG})"
49+
make "${CONFIG}"
50+
51+
log-i "Building U-Boot (with device tree ${U_BOOT_DEVICE_TREE})"
52+
make -j`nproc` DEVICE_TREE="${U_BOOT_DEVICE_TREE}"
53+
54+
log_i "Creating Android boot image (${ABOOT_OUTPUT})"
55+
gzip u-boot-nodtb.bin
56+
cat u-boot-nodtb.bin.gz \
57+
"dts/upstream/src/arm64/qcom/${U_BOOT_DEVICE_TREE}.dtb" \
58+
>u-boot-nodtb.bin.gz-dtb
59+
mkbootimg --base "${ABOOT_BASE_ADDRESS}" \
60+
--pagesize "${ABOOT_PAGE_SIZE}" \
61+
--kernel u-boot-nodtb.bin.gz-dtb \
62+
--cmdline "root=/dev/notreal" \
63+
--ramdisk u-boot.bin \
64+
--output "${ABOOT_OUTPUT}"
65+

0 commit comments

Comments
 (0)