Skip to content

Commit 29e9ee1

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

File tree

2 files changed

+182
-0
lines changed

2 files changed

+182
-0
lines changed

.github/workflows/u-boot.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build U-Boot 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 xxd coreutils 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.gz \
77+
u-boot/dts/upstream/src/arm64/qcom/qrb2210-rb1.dtb \
78+
u-boot/u-boot-nodtb.bin.gz-dtb \
79+
u-boot/u-boot.bin \
80+
u-boot/rb1-boot.img \
81+
"${dir}"
82+
# instruct fileserver to publish this directory
83+
url="${FILESERVER_URL}/${BUILD_ID}/"
84+
curl -X POST -H 'Accept: text/event-stream' "${url}"
85+
# save directory and URL of these results
86+
echo "${dir}" >u-boot-rb1.dir
87+
echo "${url}" >u-boot-rb1.url
88+
89+
- name: Save links to build results as an artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: u-boot-rb1-links
93+
path: |
94+
u-boot-rb1.dir
95+
u-boot-rb1.url
96+

scripts/build-u-boot-rb1.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
# patches in this repo/branch were submitted upstream here:
6+
# https://lore.kernel.org/u-boot/[email protected]/
7+
GIT_REPO="https://github.com/b49020/u-boot"
8+
GIT_BRANCH="qcom-mainline"
9+
CONFIG="qcom_defconfig"
10+
U_BOOT_DEVICE_TREE="qcom/qrb2210-rb1"
11+
ABOOT_BASE_ADDRESS="0x80000000"
12+
ABOOT_PAGE_SIZE="4096"
13+
ABOOT_OUTPUT="rb1-boot.img"
14+
15+
log_i() {
16+
echo "I: $*" >&2
17+
}
18+
19+
fatal() {
20+
echo "F: $*" >&2
21+
exit 1
22+
}
23+
24+
# needed to clone repository
25+
packages="git"
26+
# will pull gcc-aarch64-linux-gnu; should pull a native compiler on arm64 and
27+
# a cross-compiler on other architectures
28+
packages="${packages} crossbuild-essential-arm64"
29+
# u-boot build-dependencies
30+
packages="${packages} make bison flex bc libssl-dev gnutls-dev xxd"
31+
# for nproc
32+
packages="${packages} coreutils"
33+
# needed to pack resulting u-boot binary into an Android boot image
34+
packages="${packages} gzip mkbootimg"
35+
36+
log_i "Checking build-dependencies ($packages)"
37+
missing=""
38+
for pkg in ${packages}; do
39+
# check if package with this name is installed
40+
if dpkg -l "${pkg}" 2>&1 | grep -q "^ii ${pkg}"; then
41+
continue
42+
fi
43+
# otherwise, check if it's a virtual package and if some package providing
44+
# it is installed
45+
providers="$(apt-cache showpkg "${pkg}" |
46+
sed -e '1,/^Reverse Provides: *$/ d' -e 's/ .*$//' |
47+
sort -u)"
48+
provider_found="no"
49+
for provider in ${providers}; do
50+
if dpkg -l "${provider}" 2>&1 | grep -q "^ii ${provider}"; then
51+
provider_found="yes"
52+
break
53+
fi
54+
done
55+
if [ "${provider_found}" = yes ]; then
56+
continue
57+
fi
58+
missing="${missing} ${pkg}"
59+
done
60+
if [ -n "${missing}" ]; then
61+
fatal "Missing build-dependencies: ${missing}"
62+
fi
63+
64+
log_i "Cloning U-Boot (${GIT_REPO}:${GIT_BRANCH})"
65+
git clone --depth=1 --branch "${GIT_BRANCH}" "${GIT_REPO}" u-boot
66+
67+
cd u-boot
68+
69+
log_i "Configuring U-Boot (${CONFIG})"
70+
make "${CONFIG}"
71+
72+
log_i "Building U-Boot (with device tree ${U_BOOT_DEVICE_TREE})"
73+
make -j`nproc` DEVICE_TREE="${U_BOOT_DEVICE_TREE}"
74+
75+
log_i "Creating Android boot image (${ABOOT_OUTPUT})"
76+
gzip u-boot-nodtb.bin
77+
cat u-boot-nodtb.bin.gz \
78+
"dts/upstream/src/arm64/${U_BOOT_DEVICE_TREE}.dtb" \
79+
>u-boot-nodtb.bin.gz-dtb
80+
mkbootimg --base "${ABOOT_BASE_ADDRESS}" \
81+
--pagesize "${ABOOT_PAGE_SIZE}" \
82+
--kernel u-boot-nodtb.bin.gz-dtb \
83+
--cmdline "root=/dev/notreal" \
84+
--ramdisk u-boot.bin \
85+
--output "${ABOOT_OUTPUT}"
86+

0 commit comments

Comments
 (0)