Skip to content

Commit ff02bed

Browse files
authored
ARM: native build support (#754)
1 parent 0146c9d commit ff02bed

File tree

7 files changed

+240
-11
lines changed

7 files changed

+240
-11
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Daily OS 8 ARM64
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: "0 0 * * *"
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-24.04-arm
14+
15+
container:
16+
image: debian:sid
17+
volumes:
18+
- /proc:/proc
19+
options: --privileged
20+
21+
steps:
22+
- name: Clone build scripts
23+
uses: actions/checkout@v4
24+
25+
- name: Build and upload daily .iso
26+
run: |
27+
./workflows-arm64.sh etc/terraform-daily-8.0-azure-arm64.conf "${{ secrets.key }}" "${{ secrets.secret }}" "${{ secrets.endpoint }}" "${{ secrets.bucket }}"

build-arm64.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# check for root permissions
6+
if [[ "$(id -u)" != 0 ]]; then
7+
echo "E: Requires root permissions" > /dev/stderr
8+
exit 1
9+
fi
10+
11+
# get config
12+
if [ -n "$1" ]; then
13+
CONFIG_FILE="$1"
14+
else
15+
CONFIG_FILE="etc/terraform.conf"
16+
fi
17+
BASE_DIR="$PWD"
18+
source "$BASE_DIR"/"$CONFIG_FILE"
19+
20+
echo -e "
21+
#----------------------#
22+
# INSTALL DEPENDENCIES #
23+
#----------------------#
24+
"
25+
26+
apt-get update
27+
apt-get install -y live-build patch gnupg2 binutils zstd
28+
29+
# The Debian repositories don't seem to have the `ubuntu-keyring` or `ubuntu-archive-keyring` packages
30+
# anymore, so we add the archive keys manually. This may need to be updated if Ubuntu changes their signing keys
31+
# To get the current key ID, find `ubuntu-keyring-xxxx-archive.gpg` in /etc/apt/trusted.gpg.d on a running
32+
# system and run `gpg --keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-xxxx-archive.gpg --list-public-keys `
33+
gpg --homedir /tmp --no-default-keyring --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com F6ECB3762474EDA9D21B7022871920D1991BC93C
34+
35+
# TODO: Remove this once debootstrap can natively build noble images:
36+
ln -sfn /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/noble
37+
38+
build () {
39+
BUILD_ARCH="$1"
40+
41+
mkdir -p "$BASE_DIR/tmp/$BUILD_ARCH"
42+
cd "$BASE_DIR/tmp/$BUILD_ARCH" || exit
43+
44+
# remove old configs and copy over new
45+
rm -rf config auto
46+
cp -r "$BASE_DIR"/etc/* .
47+
# Make sure conffile specified as arg has correct name
48+
cp -f "$BASE_DIR"/"$CONFIG_FILE" terraform.conf
49+
50+
# copy appcenter list & key
51+
if [ "$INCLUDE_APPCENTER" = "yes" ]; then
52+
cp "config/appcenter/appcenter.list.binary" "config/archives/appcenter.list.binary"
53+
cp "config/appcenter/appcenter.key.binary" "config/archives/appcenter.key.binary"
54+
fi
55+
56+
echo -e "
57+
#------------------#
58+
# LIVE-BUILD CLEAN #
59+
#------------------#
60+
"
61+
lb clean
62+
63+
echo -e "
64+
#-------------------#
65+
# LIVE-BUILD CONFIG #
66+
#-------------------#
67+
"
68+
lb config
69+
70+
echo -e "
71+
#------------------#
72+
# LIVE-BUILD BUILD #
73+
#------------------#
74+
"
75+
lb build
76+
77+
echo -e "
78+
#---------------------------#
79+
# MOVE OUTPUT TO BUILDS DIR #
80+
#---------------------------#
81+
"
82+
83+
YYYYMMDD="$(date +%Y%m%d)"
84+
OUTPUT_DIR="$BASE_DIR/builds/$BUILD_ARCH"
85+
mkdir -p "$OUTPUT_DIR"
86+
FNAME="elementaryos-$VERSION-$CHANNEL-$BUILD_ARCH.$YYYYMMDD$OUTPUT_SUFFIX"
87+
mv "$BASE_DIR/tmp/$BUILD_ARCH/live-image-$BUILD_ARCH.hybrid.iso" "$OUTPUT_DIR/${FNAME}.iso"
88+
89+
# cd into output to so {FNAME}.sha256.txt only
90+
# includes the filename and not the path to
91+
# our file.
92+
cd $OUTPUT_DIR
93+
md5sum "${FNAME}.iso" | tee "${FNAME}.md5.txt"
94+
sha256sum "${FNAME}.iso" | tee "${FNAME}.sha256.txt"
95+
cd $BASE_DIR
96+
}
97+
98+
# remove old builds before creating new ones
99+
rm -rf "$BASE_DIR"/builds
100+
101+
if [[ "$ARCH" == "all" ]]; then
102+
build amd64
103+
build i386
104+
else
105+
build "$ARCH"
106+
fi

etc/auto/config

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ if [ "$HWE_X11" = "yes" ]; then
1414
XORG_HWE="xserver-xorg-hwe-${BASEVERSION}"
1515
fi
1616

17+
case "$ARCH" in
18+
amd64|i386)
19+
MIRROR_BINARY_URL="http://archive.ubuntu.com/ubuntu/"
20+
MIRROR_BINARY_SECURITY_URL="http://security.ubuntu.com/ubuntu/"
21+
;;
22+
arm64)
23+
MIRROR_BINARY_URL="http://ports.ubuntu.com/ubuntu-ports/"
24+
MIRROR_BINARY_SECURITY_URL="http://ports.ubuntu.com/ubuntu-ports/"
25+
;;
26+
esac
27+
1728
lb config noauto \
1829
--architectures "$ARCH" \
1930
--mode debian \
@@ -29,12 +40,12 @@ lb config noauto \
2940
--checksums md5 \
3041
--mirror-bootstrap "$MIRROR_URL" \
3142
--parent-mirror-bootstrap "$MIRROR_URL" \
32-
--mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \
33-
--parent-mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \
34-
--mirror-binary-security "http://security.ubuntu.com/ubuntu/" \
35-
--parent-mirror-binary-security "http://security.ubuntu.com/ubuntu/" \
36-
--mirror-binary "http://archive.ubuntu.com/ubuntu/" \
37-
--parent-mirror-binary "http://archive.ubuntu.com/ubuntu/" \
43+
--mirror-chroot-security "$MIRROR_BINARY_SECURITY_URL" \
44+
--parent-mirror-chroot-security "$MIRROR_BINARY_SECURITY_URL" \
45+
--mirror-binary-security "$MIRROR_BINARY_SECURITY_URL" \
46+
--parent-mirror-binary-security "$MIRROR_BINARY_SECURITY_URL" \
47+
--mirror-binary "$MIRROR_BINARY_URL" \
48+
--parent-mirror-binary "$MIRROR_BINARY_URL" \
3849
--keyring-packages ubuntu-keyring \
3950
--apt-options "--yes --option Acquire::Retries=2 --option Acquire::http::Timeout=45" \
4051
--cache-packages false \
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
b43-fwcutter
2-
bcmwl-kernel-source
32
dkms
4-
intel-microcode
5-
iucode-tool
63
open-vm-tools-desktop
74
setserial
85
user-setup
96

107
efibootmgr
118
secureboot-db
9+
shim
10+
shim-signed
1211

1312
#if ARCHITECTURES amd64
13+
bcmwl-kernel-source
14+
intel-microcode
15+
iucode-tool
16+
1417
grub-efi-amd64
1518
grub-efi-amd64-bin
1619
grub-efi-amd64-signed
17-
shim
18-
shim-signed
20+
#endif
21+
22+
#if ARCHITECTURES arm64
23+
grub-efi-arm64
24+
grub-efi-arm64-bin
25+
grub-efi-arm64-signed
1926
#endif

etc/terraform-arm64.conf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# target architecture - i386, amd64 or all
2+
ARCH="arm64"
3+
4+
# base codename
5+
BASECODENAME="noble"
6+
7+
# base version
8+
BASEVERSION="24.04"
9+
10+
# distribution codename
11+
CODENAME="circe"
12+
13+
# distribution version
14+
VERSION="8.0"
15+
16+
# distribution channel
17+
CHANNEL="stable"
18+
19+
# distribution name
20+
NAME="elementary OS"
21+
22+
# mirror to fetch packages from
23+
MIRROR_URL="http://ports.ubuntu.com/ubuntu-ports/"
24+
25+
# use HWE kernel and packages?
26+
HWE_KERNEL="yes"
27+
HWE_X11="no"
28+
29+
# use appcenter ppa
30+
INCLUDE_APPCENTER=""
31+
32+
# suffix for generated .iso files
33+
OUTPUT_SUFFIX=""
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# target architecture - i386, amd64 or all
2+
ARCH="arm64"
3+
4+
# base codename
5+
BASECODENAME="noble"
6+
7+
# base version
8+
BASEVERSION="24.04"
9+
10+
# distribution codename
11+
CODENAME="circe"
12+
13+
# distribution version
14+
VERSION="8.0"
15+
16+
# distribution channel
17+
CHANNEL="daily"
18+
19+
# distribution name
20+
NAME="elementary OS"
21+
22+
# mirror to fetch packages from
23+
MIRROR_URL="http://azure.ports.ubuntu.com/ubuntu-ports/"
24+
25+
# use HWE kernel and packages?
26+
HWE_KERNEL="yes"
27+
HWE_X11="no"
28+
29+
# use appcenter ppa
30+
INCLUDE_APPCENTER=""
31+
32+
# suffix for generated .iso files
33+
OUTPUT_SUFFIX=""

workflows-arm64.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
CONFIG_FILE="$1"
6+
KEY="$2"
7+
SECRET="$3"
8+
ENDPOINT="$4"
9+
BUCKET="$5"
10+
11+
./build-arm64.sh "$CONFIG_FILE"
12+
./upload.sh "$CONFIG_FILE" "$KEY" "$SECRET" "$ENDPOINT" "$BUCKET"

0 commit comments

Comments
 (0)