unos-repository

APK repository for unos
git clone git://git.finwo.net/misc/unos-repository
Log | Files | Refs | README

commit 2a110f9c3d928a7a2e5beca2d3ad226bd9ac347d
parent 9b64e7c363fc963e8631fb16de33b88e9b96108d
Author: Robin Bron <robin.bron@yourhosting.nl>
Date:   Thu,  1 Oct 2026 10:38:34 +0200

Let linkd bring up eth0 over dhcp instead of hardcoding it in rcS

Diffstat:
M.conductor.yml | 6+++---
Mchannels/base/packages/base-files/files/linkd.cnf | 9++++-----
Achannels/base/packages/base-files/files/network/interfaces.d/eth0.cnf | 2++
Mchannels/base/packages/base-files/files/rcS | 23-----------------------
Mchannels/base/packages/base-files/template | 5+++--
Achannels/base/packages/busybox/files/linkd-udhcpc.cnf | 2++
Mchannels/base/packages/busybox/template | 53+++++++++++++++++++++--------------------------------
Mchannels/base/packages/linkd/template | 2+-
8 files changed, 36 insertions(+), 66 deletions(-)

diff --git a/.conductor.yml b/.conductor.yml @@ -468,7 +468,7 @@ tasks: arch: [x86_64] requires: [unos-sign-key] script: - - ./mk/check-revision.sh --channel lts base-files --pkgver 0.1.0-r6 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } + - ./mk/check-revision.sh --channel lts base-files --pkgver 0.1.0-r7 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } - ./mk/channel-assemble.sh lts - ./mk/bootstrap-host.sh - ./mk/sysroot.sh --channel lts --arch "$ARCH" --repo "$BUCKET_PUBLIC_URL" base-files @@ -481,7 +481,7 @@ tasks: arch: [x86_64] requires: [unos-sign-key] script: - - ./mk/check-revision.sh --channel lts busybox --pkgver 1.36.1-r8 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } + - ./mk/check-revision.sh --channel lts busybox --pkgver 1.36.1-r9 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } - ./mk/channel-assemble.sh lts - ./mk/bootstrap-host.sh - ./mk/sysroot.sh --channel lts --arch "$ARCH" --repo "$BUCKET_PUBLIC_URL" busybox @@ -678,7 +678,7 @@ tasks: arch: [x86_64] requires: [unos-sign-key] script: - - ./mk/check-revision.sh --channel lts linkd --pkgver 0.1.0-r1 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } + - ./mk/check-revision.sh --channel lts linkd --pkgver 0.2.0-r1 --repo "$BUCKET_PUBLIC_URL" || { rc=$?; [ "$rc" = 1 ] && exit 0; exit "$rc"; } - ./mk/channel-assemble.sh lts - ./mk/bootstrap-host.sh - ./mk/sysroot.sh --channel lts --arch "$ARCH" --repo "$BUCKET_PUBLIC_URL" linkd diff --git a/channels/base/packages/base-files/files/linkd.cnf b/channels/base/packages/base-files/files/linkd.cnf @@ -1,8 +1,5 @@ -# linkd configuration. -# -# The socket path differs from linkd's own default (/var/run/linkd.sock): -# UNOS mounts a tmpfs on /run and ships no /var/run, so the daemon and every -# client are pointed at the path that exists here. +# Socket path differs from linkd's default (/var/run/linkd.sock): UNOS mounts +# a tmpfs on /run and ships no /var/run. config_ports /etc/network/ports /etc/network/ports.d/*.cnf config_iface /etc/network/interfaces /etc/network/interfaces.d/*.cnf @@ -18,3 +15,5 @@ listen unix:///run/linkd.sock # Hardware dataplanes are declared here; the openbcm package drops one in. # # plugin /usr/lib/linkd/bcm + +source /etc/linkd/*.cnf diff --git a/channels/base/packages/base-files/files/network/interfaces.d/eth0.cnf b/channels/base/packages/base-files/files/network/interfaces.d/eth0.cnf @@ -0,0 +1,2 @@ +auto eth0 +iface eth0 inet dhcp diff --git a/channels/base/packages/base-files/files/rcS b/channels/base/packages/base-files/files/rcS @@ -13,29 +13,6 @@ if [ -f /etc/hostname ]; then hostname -F /etc/hostname 2>/dev/null || hostname unos 2>/dev/null || true echo "rcS: hostname $(hostname 2>/dev/null || cat /etc/hostname)" fi -echo "rcS: bringing up loopback" -ip link set lo up 2>/dev/null || ifconfig lo up 2>/dev/null || true -echo "rcS: bringing up eth0" -ip link set eth0 up 2>&1 | head -1 -sleep 1 -# qemu user-mode net: dhcp via udhcpc if available, else static fallback -if command -v udhcpc >/dev/null 2>&1; then - udhcpc -i eth0 -q 2>&1 || true - # fallback if dhcp left no address - ip addr show eth0 2>/dev/null | grep -q "inet " || { - echo "rcS: dhcp failed, using static 10.0.2.15/24" - ip addr add 10.0.2.15/24 dev eth0 2>/dev/null || ifconfig eth0 10.0.2.15 netmask 255.255.255.0 2>/dev/null || true - ip route add default via 10.0.2.2 2>/dev/null || route add default gw 10.0.2.2 2>/dev/null || true - echo "nameserver 10.0.2.3" > /etc/resolv.conf 2>/dev/null || true - } -else - ip addr add 10.0.2.15/24 dev eth0 2>/dev/null || ifconfig eth0 10.0.2.15 netmask 255.255.255.0 2>/dev/null || true - ip link set eth0 up 2>/dev/null || true - ip route add default via 10.0.2.2 2>/dev/null || true -fi -echo "rcS: network ready" -ip addr show 2>&1 | head -20 -# start supervision (runsvdir manages /etc/sv/*) if [ -d /etc/sv ]; then echo "rcS: starting runsvdir" runsvdir /etc/sv & diff --git a/channels/base/packages/base-files/template b/channels/base/packages/base-files/template @@ -1,7 +1,7 @@ # Template file for 'base-files' pkgname=base-files version=0.1.0 -revision=6 +revision=7 short_desc="UNOS filesystem skeleton - passwd, profile, nsswitch, fstab" maintainer="finwo <finwo@pm.me>" license="GPL-2.0-only" @@ -29,9 +29,10 @@ do_install() { vinstall ${FILESDIR}/rcS 755 etc/init.d rcS vinstall ${FILESDIR}/network/ports 644 etc/network ports vinstall ${FILESDIR}/network/interfaces 644 etc/network interfaces + vinstall ${FILESDIR}/network/interfaces.d/eth0.cnf 644 etc/network/interfaces.d eth0.cnf vinstall ${FILESDIR}/linkd.cnf 644 etc linkd.cnf + install -d "${DESTDIR}/etc/linkd" install -d "${DESTDIR}/etc/network/ports.d" - install -d "${DESTDIR}/etc/network/interfaces.d" install -d -m700 "${DESTDIR}/root" install -d "${DESTDIR}/etc/ld.so.conf.d" # standard mount points (fstab references /run and /tmp; init mounts the diff --git a/channels/base/packages/busybox/files/linkd-udhcpc.cnf b/channels/base/packages/busybox/files/linkd-udhcpc.cnf @@ -0,0 +1,2 @@ +# -f: linkd owns the pid and stops it on ifdown. +dhcp_client udhcpc -f -i {{interface}} diff --git a/channels/base/packages/busybox/template b/channels/base/packages/busybox/template @@ -1,7 +1,7 @@ # Template file for 'busybox' pkgname=busybox version=1.36.1 -revision=8 +revision=9 short_desc="Swiss Army knife of embedded Linux utilities" maintainer="finwo <finwo@pm.me>" license="GPL-2.0-only" @@ -10,34 +10,20 @@ distfiles="https://busybox.net/downloads/busybox-1.36.1.tar.bz2" checksum=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314 depends= -# Applet policy (locked in PLAN.md section 10, enforced by assertions in -# do_build - a missing symbol fails the build, never the boot): +# Applet policy, asserted in do_build. No checked-in .config: defconfig + +# CFG_* is the source of truth, and this kconfig has no savedefconfig. # -# ON: init sequence + supervision + shell + connection handling, i.e. the -# whole reason busybox is here, plus console login and mgmt DHCP. -# (INIT/HALT/POWEROFF/REBOOT/GETTY/LOGIN/MOUNT/UMOUNT/SWITCH_ROOT are -# defconfig defaults; listing them makes the requirement explicit.) -# OFF: IP applets (iproute2 is the only `ip`), TC (iproute2's `tc` is -# full-featured; busybox's references kernel-removed CBQ UAPI and does not -# build against modern headers), LDCONFIG (glibc's real ldconfig owns -# /sbin/ldconfig; the applet would conflict on that path and its cache -# output must never feed glibc's loader), the xz family (real xz owns -# usr/bin/{xz,xzcat,unxz,lzma,unlzma,lzcat} - apk refuses the overwrite -# otherwise; six symbols gate them in bbunzip.c, all six go; kernel -# initramfs xz stays independent via CONFIG_RD_XZ), -# udhcpd (dnsmasq covers the server side), httpd/inetd (tcpsvd is our -# super-server), IFUP (linkd owns /etc/network/interfaces via linkctl, busybox -# ifupdown would conflict and its `iface <name>` parser is for old -# `iface <name> inet static` only -- cumulus `iface <name>` fails there), -# MKFS_VFAT/MKDOSFS (dosfstools owns mkfs.vfat; two providers of one command -# resolved by PATH order is a trap, and busybox's variant warns about -# codepage conversion on every run because it wants iconv data our -# C.UTF-8-only glibc does not ship. dosfstools also brings fsck.fat, which -# busybox has no equivalent of at all -- and the ESP is the one partition -# whose corruption stops the switch booting). -# Untouched (defconfig default) until their design lands: SYSLOGD/KLOGD. -# No checked-in .config on purpose: defconfig + CFG_* is the source of truth -# (this kconfig has no savedefconfig anyway); the assertions below enforce it. +# OFF, by owner of the path: +# IP/TC iproute2. busybox tc needs kernel-removed CBQ UAPI. +# LDCONFIG glibc. Its cache must never feed glibc's loader. +# xz family xz owns usr/bin/{xz,xzcat,unxz,lzma,unlzma,lzcat}; apk +# refuses the overwrite. Kernel initramfs xz is CONFIG_RD_XZ. +# IFUP/IFDOWN linkd. Its parser rejects cumulus `iface <name>`. +# MKFS_VFAT dosfstools, which also brings the fsck.fat busybox lacks. +# busybox's warns about iconv data our C.UTF-8 glibc lacks. +# UDHCPD dnsmasq. +# HTTPD/INETD tcpsvd. +# SYSLOGD/KLOGD left at defconfig until their design lands. CFG_ON="INIT HALT POWEROFF REBOOT GETTY LOGIN MOUNT UMOUNT SWITCH_ROOT ASH ASH_JOB_CONTROL RUNSV RUNSVDIR SV SVLOGD CHPST SETUIDGID TCPSVD UDHCPC" CFG_OFF="IP FEATURE_IP_ADDRESS FEATURE_IP_LINK FEATURE_IP_ROUTE FEATURE_IP_RULE FEATURE_IP_TUNNEL TC LDCONFIG UNLZMA LZCAT LZMA UNXZ XZCAT XZ UDHCPD HTTPD INETD IFUP IFDOWN MKFS_VFAT MKDOSFS" @@ -59,7 +45,7 @@ do_configure() { make defconfig >/dev/null for c in ${CFG_ON}; do set_config "${c}" y; done for c in ${CFG_OFF}; do set_config "${c}" n; done - # this kconfig has no olddefconfig; resolve non-interactively instead + # No olddefconfig in this kconfig. yes "" | make oldconfig >/dev/null for c in ${CFG_ON}; do grep -q "^CONFIG_${c}=y$" .config || die "busybox: CONFIG_${c} did not stick" @@ -81,8 +67,11 @@ do_build() { do_install() { cd "${WRKSRC}" make CONFIG_PREFIX="${DESTDIR}" install - # initrd-era fossil: the kernel runs /linuxrc only on classic initrd, and - # UNOS boots initramfs-style (/init + switch_root). Prune it so the rootfs - # carries no dead symlinks. + # Dead symlink here: /linuxrc runs only on classic initrd, we boot /init. rm -f "${DESTDIR}/linuxrc" + + # udhcpc's compiled-in default path. Absent, a lease is obtained and nothing + # is configured. + vinstall examples/udhcp/simple.script 755 usr/share/udhcpc default.script + vinstall "${FILESDIR}/linkd-udhcpc.cnf" 644 etc/linkd udhcpc.cnf } diff --git a/channels/base/packages/linkd/template b/channels/base/packages/linkd/template @@ -1,6 +1,6 @@ # Template file for 'linkd' pkgname=linkd -version=0.1.0 +version=0.2.0 revision=1 short_desc="Network interface manager - ifupdown replacement with RESP plugins" maintainer="finwo <finwo@pm.me>"