Skip to content

Commit af2120c

Browse files
Torxed0xdeadd
andauthored
mkosi for test image builds (#4539)
Added a `mkosi` profile as well as organized test tooling a bit. --------- Co-authored-by: 0xdeadd <clintdotphillips@gmail.com>
1 parent d92a98d commit af2120c

18 files changed

Lines changed: 712 additions & 2 deletions

File tree

.github/workflows/iso-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- run: cat /etc/os-release
3333
- run: pacman-key --init
3434
- run: pacman --noconfirm -Sy archlinux-keyring
35-
- run: ./build_iso.sh
35+
- run: ./test_tooling/mkarchiso/build_iso.sh
3636
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
3737
with:
3838
name: Arch Live ISO

.github/workflows/uki-build.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will build an Arch Linux UKI file with the commit on it
2+
3+
name: Build Arch UKI with ArchInstall Commit
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
- main # In case we adopt this convention in the future
10+
pull_request:
11+
paths-ignore:
12+
- 'docs/**'
13+
- '**.editorconfig'
14+
- '**.gitignore'
15+
- '**.md'
16+
- 'LICENSE'
17+
- 'PKGBUILD'
18+
release:
19+
types:
20+
- created
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
container:
26+
image: archlinux/archlinux:latest
27+
options: --privileged
28+
steps:
29+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
30+
- run: pwd
31+
- run: find .
32+
- run: cat /etc/os-release
33+
- run: pacman-key --init
34+
- run: pacman --noconfirm -Sy archlinux-keyring
35+
- run: pacman --noconfirm -Sy mkosi
36+
- run: (cd test_tooling/mkosi/ && mkosi build -B)
37+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
38+
with:
39+
name: Arch Live UKI
40+
path: test_tooling/mkosi/mkosi.output/*.efi

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ requirements.txt
4141
/cmd_output.txt
4242
node_modules/
4343
uv.lock
44+
test_tooling/mkosi/mkosi.output/*image*
45+
test_tooling/mkosi/mkosi.cache/**
46+
test_tooling/mkosi/mkosi.tools/**
47+
test_tooling/mkosi/mkosi.tools.manifest

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ archinstall = "archinstall"
6969
[tool.mypy]
7070
python_version = "3.14"
7171
files = "."
72-
exclude = "^build/"
72+
exclude = [
73+
"^build/",
74+
"^test_tooling/",
75+
]
7376
disallow_any_explicit = false
7477
disallow_any_expr = false
7578
disallow_any_unimported = true

test_tooling/mkosi/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To build
2+
3+
mkosi build -B
4+
5+
# To run
6+
7+
mkosi qemu \
8+
--drive=archinstall_small:25G \
9+
-- \
10+
-device nvme,serial=archinstall_small,drive=archinstall_small
11+
12+
*note: in order to boot the installation, we need to disable UKI being added to -kernel. I don't know of a way to do this yet, unless we tinker with mkosi/qemu.py - https://github.com/Torxed/mkosi/commit/6f3c20802bd73f88b672cc96ef0db1e542084316 - in which case we could do: `mkosi qemu --drive=archinstall_small:25G -- -device nvme,serial=archinstall_small,drive=archinstall_small,bootindex=0 -kernel none` but it still won't boot properly.*

test_tooling/mkosi/mkosi.cache/.gitkeep

Whitespace-only changes.

test_tooling/mkosi/mkosi.conf

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[Distribution]
2+
Distribution=arch
3+
# LocalMirror=file:///var/lib/localmirror
4+
5+
[Output]
6+
Format=uki
7+
# Format=disk
8+
9+
[Include]
10+
Include=mkosi-vm
11+
12+
[Validation]
13+
SecureBoot=false
14+
SecureBootAutoEnroll=false
15+
Sign=false
16+
# Signing artifacts (hashsums etc) using a GPG key:
17+
# Key=D4B58E897A929F2E
18+
# Signing secure boot using PIV on yubikey:
19+
# SecureBoot=true
20+
# SecureBootKey=pkcs11:
21+
# SecureBootCertificate=secureboot.crt
22+
23+
[Content]
24+
Packages=
25+
pacman
26+
archlinux-keyring
27+
amd-ucode
28+
intel-ucode
29+
# tpm2-tss
30+
# libfido2
31+
# libp11-kit
32+
WithDocs=false
33+
RootPassword=toor
34+
Timezone=Europe/Stockholm
35+
Keymap=sv-latin1
36+
InitrdProfiles=network
37+
38+
[Config]
39+
Profiles=archinstall
40+
41+
[Build]
42+
Incremental=true
43+
ToolsTree=default
44+
ToolsTreeProfiles=devel,misc,package-manager,runtime,gui
45+
WithNetwork=yes
46+
47+
[Runtime]
48+
Console=gui
49+
CPUs=4
50+
RAM=8G
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[Match]
2+
# Matching with "Type=ether" causes issues with containers because it also matches virtual Ethernet interfaces (veth*).
3+
# See https://bugs.archlinux.org/task/70892
4+
# Instead match by globbing the network interface name.
5+
Name=en*
6+
Name=eth*
7+
8+
[Link]
9+
RequiredForOnline=routable
10+
11+
[Network]
12+
DHCP=yes
13+
MulticastDNS=yes
14+
15+
# systemd-networkd does not set per-interface-type default route metrics
16+
# https://github.com/systemd/systemd/issues/17698
17+
# Explicitly set route metric, so that Ethernet is preferred over Wi-Fi and Wi-Fi is preferred over mobile broadband.
18+
# Use values from NetworkManager. From nm_device_get_route_metric_default in
19+
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/src/core/devices/nm-device.c
20+
[DHCPv4]
21+
RouteMetric=100
22+
23+
[IPv6AcceptRA]
24+
RouteMetric=100
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/usr/bin/agetty --noreset --noclear --autologin root - ${TERM}

0 commit comments

Comments
 (0)