From 303760f602f6aca9f6fdd77feebe81bdd3255865 Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 01:38:10 +0100 Subject: [PATCH] Cross-build bootstrap BusyBox and report Vinix as the operating system --- busybox/PKGBUILD.vile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/busybox/PKGBUILD.vile b/busybox/PKGBUILD.vile index 87957ab..bd918cd 100644 --- a/busybox/PKGBUILD.vile +++ b/busybox/PKGBUILD.vile @@ -1,13 +1,19 @@ ; Kbuild runs the target compiler from the BusyBox source directory. The ; relative link keeps the sysroot's path out of make's split command words. -target-cc := "CC=gcc --sysroot=../vinix-sysroot -specs=../vinix-sysroot/usr/lib/musl-gcc-sysroot.specs" +selected-arch := get-environment-variable("VPAC_TARGET_ARCH") +host-arch := if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" } +target-arch := if string?(selected-arch) { selected-arch } else { host-arch } +cross-prefix := get-environment-variable("CROSS_COMPILE") +prefix := if string?(cross-prefix) { cross-prefix } else { "" } +target-cc := string-append("CC=", prefix, "gcc --sysroot=../vinix-sysroot -specs=../vinix-sysroot/usr/lib/musl-gcc-sysroot.specs") +run-target := if string=?(host-arch, target-arch) { list() } else { list(string-append("qemu-", target-arch)) } defpkgbuild(busybox, #:pkgname, "busybox", #:pkgver, "1.38.0", - #:pkgrel, 3, + #:pkgrel, 4, #:pkgdesc, "Static musl shell and bootstrap utilities for Vinix", - #:arch, [#:x86-64], + #:arch, [#:x86-64, #:aarch64], #:url, "https://busybox.net/", #:license, "GPL-2.0-only", #:makedepends, ["musl=1.2.6-1", "linux-headers"], @@ -34,7 +40,8 @@ defpkgbuild(busybox, run("cp", "busybox-1.38.0/.config", "busybox-1.38.0/vinix.defconfig") run("sed", "-i", "-f", "enable.sed", "busybox-1.38.0/vinix.defconfig") run("make", "-C", "busybox-1.38.0", "KBUILD_DEFCONFIG=vinix.defconfig", "defconfig") - + run("sed", "-i", "s|^CONFIG_UNAME_OSNAME=.*|CONFIG_UNAME_OSNAME=\"Vinix\"|", "busybox-1.38.0/.config") + run("grep", "-Fx", "CONFIG_UNAME_OSNAME=\"Vinix\"", "busybox-1.38.0/.config") }, #:build, fn() { run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", @@ -49,8 +56,8 @@ defpkgbuild(busybox, }, list("Scrt1.o", "crti.o", "libc.a", "crtn.o")) run("grep", "-F", "../vinix-sysroot/usr/include/stdio.h", "busybox-1.38.0/shell/.ash.o.cmd") run("grep", "-F", "../vinix-sysroot/usr/include/linux/vt.h", "busybox-1.38.0/init/.init.o.cmd") - run("busybox-1.38.0/busybox", "ash", "-n", "/dev/null") - run("busybox-1.38.0/busybox", "true") + apply(run, append(run-target, list("busybox-1.38.0/busybox", "ash", "-n", "/dev/null"))) + apply(run, append(run-target, list("busybox-1.38.0/busybox", "true"))) }, #:package, fn() { run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", -- 2.56.1