From a06046eac474e2d7f948d380068acfbc89d06a68 Mon Sep 17 00:00:00 2001 From: "Michal S." Date: Thu, 6 Aug 2026 19:38:17 +0100 Subject: [PATCH] fix x86_64 build --- Containerfile | 3 ++- base/kernel/x86_64.config | 8 +++++++- base/patches/m4-1.4.21-aarch64.patch | 11 +++++++++++ base/patches/shadow-4.20.0-stdint.patch | 18 ------------------ scripts/build-boot-disk.sh | 3 +++ scripts/build-kernel.sh | 19 ++++++++++++++++--- scripts/build-world-autotools.sh | 14 ++++++++++---- scripts/static-base/libraries-and-accounts.sh | 14 ++++++++++++-- 8 files changed, 61 insertions(+), 29 deletions(-) create mode 100644 base/patches/m4-1.4.21-aarch64.patch delete mode 100644 base/patches/shadow-4.20.0-stdint.patch diff --git a/Containerfile b/Containerfile index 9be5a31..4099231 100644 --- a/Containerfile +++ b/Containerfile @@ -147,7 +147,6 @@ RUN MOUSE_SOURCE_DIR=/opt/mouse-sources \ FROM static-base-bootstrap AS static-base-libraries -COPY mouse-src/base/patches/shadow-4.20.0-stdint.patch /work/mouse-src/base/patches/shadow-4.20.0-stdint.patch COPY mouse-src/scripts/static-base/libraries-and-accounts.sh /work/mouse-src/scripts/static-base/libraries-and-accounts.sh RUN MOUSE_SOURCE_DIR=/opt/mouse-sources \ @@ -178,6 +177,8 @@ COPY --from=static-base-toolchain /work/mouse-src/build/static/sysroot /work/mou COPY --from=static-base-toolchain /work/mouse-src/build/static/cross-tools /work/mouse-src/build/static/cross-tools COPY --from=static-base-toolchain /work/mouse-src/build/static/rust-eh-personality.o /work/mouse-src/build/static/rust-eh-personality.o COPY --from=autotools-sources /opt/mouse-sources/ /opt/mouse-sources/ +COPY mouse-src/base/patches/m4-1.4.21-aarch64.patch /work/mouse-src/base/patches/m4-1.4.21-aarch64.patch +COPY mouse-src/scripts/mouse-arch.sh /usr/libexec/mouse-arch.sh COPY mouse-src/scripts/build-world-autotools.sh /usr/libexec/mouse-build-world-autotools RUN MOUSE_BUILD_JOBS="$MOUSE_BUILD_JOBS" \ diff --git a/base/kernel/x86_64.config b/base/kernel/x86_64.config index 53a01b0..380aa00 100644 --- a/base/kernel/x86_64.config +++ b/base/kernel/x86_64.config @@ -11,9 +11,11 @@ CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_FAN=y +CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y CONFIG_ACPI_VIDEO=y CONFIG_ACPI_WMI=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_EFI=y CONFIG_EFI_STUB=y CONFIG_MICROCODE=y @@ -22,6 +24,7 @@ CONFIG_X86_MCE=y CONFIG_MULTIUSER=y CONFIG_PRINTK=y CONFIG_BUG=y +CONFIG_LEGACY_TIOCSTI=n CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SIGNALFD=y @@ -101,12 +104,14 @@ CONFIG_PCI_MSI=y CONFIG_PCIEPORTBUS=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=y +CONFIG_THERMAL=y CONFIG_VIRTIO_MENU=y CONFIG_VIRTIO=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_NET=y +CONFIG_ETHTOOL_NETLINK=y CONFIG_NET_VENDOR_INTEL=y CONFIG_E1000=y CONFIG_E1000E=y @@ -126,7 +131,6 @@ CONFIG_IWLWIFI=m CONFIG_IWLMVM=m CONFIG_WLAN_VENDOR_ATH=y CONFIG_ATH9K=m -CONFIG_ATH9K_PCI=y CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m @@ -140,6 +144,7 @@ CONFIG_VMD=y CONFIG_USB_SUPPORT=y CONFIG_USB=y +CONFIG_USB_PCI=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PCI=y CONFIG_USB_EHCI_HCD=y @@ -160,6 +165,7 @@ CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VGA_CONSOLE=y CONFIG_INPUT=y +CONFIG_HID_SUPPORT=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_ATKBD=y diff --git a/base/patches/m4-1.4.21-aarch64.patch b/base/patches/m4-1.4.21-aarch64.patch new file mode 100644 index 0000000..e60e36e --- /dev/null +++ b/base/patches/m4-1.4.21-aarch64.patch @@ -0,0 +1,11 @@ +--- a/lib/sigsegv.c ++++ b/lib/sigsegv.c +@@ -80,7 +80,7 @@ + + # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.sc_regs[30] + +-# elif defined __arm64__ /* 64-bit */ ++# elif defined __arm64__ || defined __aarch64__ /* 64-bit */ + + /* See glibc/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h. + Note that the 'mcontext_t' defined in diff --git a/base/patches/shadow-4.20.0-stdint.patch b/base/patches/shadow-4.20.0-stdint.patch deleted file mode 100644 index a2d34e0..0000000 --- a/base/patches/shadow-4.20.0-stdint.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/lib/find_new_sub_gids.c -+++ b/lib/find_new_sub_gids.c -@@ -7,6 +7,7 @@ - - #ifdef ENABLE_SUBIDS - -+#include - #include - #include ---- a/lib/find_new_sub_uids.c -+++ b/lib/find_new_sub_uids.c -@@ -7,6 +7,7 @@ - - #ifdef ENABLE_SUBIDS - -+#include - #include - #include diff --git a/scripts/build-boot-disk.sh b/scripts/build-boot-disk.sh index 6d61bef..98f0de1 100644 --- a/scripts/build-boot-disk.sh +++ b/scripts/build-boot-disk.sh @@ -64,12 +64,15 @@ rm -f "$disk_image" truncate -s $((disk_sectors * sector_size)) "$disk_image" if [ "$MOUSE_ARCH" = x86_64 ]; then bios_partition="start=34, size=$((boot_start - 34)), type=21686148-6449-6e6f-744e-656564454649, uuid=4d4f5553-4500-4000-8000-000000000003, name=\"MOUSE_BIOS\"" + gpt_first_lba=34 else bios_partition= + gpt_first_lba=$boot_start fi sfdisk --quiet "$disk_image" <&2 - exit 1 + missing_requested_settings=1 fi done <"$kernel_config" +if [ "$missing_requested_settings" -ne 0 ]; then + exit 1 +fi + if grep -Fqx 'CONFIG_LEGACY_TIOCSTI=y' "$kernel_output/.config"; then printf '%s\n' \ "kernel enables legacy TIOCSTI, which is unsafe across privilege boundaries" >&2 diff --git a/scripts/build-world-autotools.sh b/scripts/build-world-autotools.sh index 2da69ec..b15df02 100755 --- a/scripts/build-world-autotools.sh +++ b/scripts/build-world-autotools.sh @@ -5,6 +5,7 @@ source_dir=${MOUSE_SOURCE_DIR:-/opt/mouse-sources} static_dir=${MOUSE_STATIC_DIR:-/work/mouse-src/build/static} destination=${MOUSE_AUTOTOOLS_ROOT:-/opt/mouse-autotools} jobs=${MOUSE_BUILD_JOBS:-1} +. /usr/libexec/mouse-arch.sh case "$destination" in /opt/mouse-autotools) ;; @@ -37,9 +38,12 @@ extract perl-5.44.0.tar.xz extract autoconf-2.72.tar.xz extract automake-1.16.3.tar.xz -cc=$(find "$static_dir/cross-tools/bin" -name '*-cc' -type l -print | head -1) -ar=$(find "$static_dir/cross-tools/bin" -name '*-ar' -type l -print | head -1) -ranlib=$(find "$static_dir/cross-tools/bin" -name '*-ranlib' -type l -print | head -1) +patch -d "$build_root/m4-1.4.21" -p1 \ + <"/work/mouse-src/base/patches/m4-1.4.21-aarch64.patch" + +cc="$static_dir/cross-tools/bin/$MOUSE_CROSS_TARGET-cc" +ar="$static_dir/cross-tools/bin/$MOUSE_CROSS_TARGET-ar" +ranlib="$static_dir/cross-tools/bin/$MOUSE_CROSS_TARGET-ranlib" for tool in "$cc" "$ar" "$ranlib"; do [ -x "$tool" ] || { printf '%s\n' "missing MOUSE cross-build tool: $tool" >&2 @@ -53,9 +57,11 @@ export PATH ( cd "$build_root/m4-1.4.21" CC="$cc" AR="$ar" RANLIB="$ranlib" \ - CFLAGS=-O2 LDFLAGS=-static \ + CFLAGS=-O2 LDFLAGS=-static \ ./configure \ --prefix=/usr \ + --host="$MOUSE_RUST_TARGET" \ + --disable-gcc-warnings \ --disable-dependency-tracking \ --disable-nls make -s -j"$jobs" diff --git a/scripts/static-base/libraries-and-accounts.sh b/scripts/static-base/libraries-and-accounts.sh index 02f99a1..76ae093 100644 --- a/scripts/static-base/libraries-and-accounts.sh +++ b/scripts/static-base/libraries-and-accounts.sh @@ -4,8 +4,18 @@ set -eu component_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) . "$component_dir/common.sh" -patch -d "$source_build_dir/shadow-4.20.0" -p1 \ - <"$repo_dir/base/patches/shadow-4.20.0-stdint.patch" +for source_file in \ + "$source_build_dir/shadow-4.20.0/lib/find_new_sub_gids.c" \ + "$source_build_dir/shadow-4.20.0/lib/find_new_sub_uids.c" +do + if ! grep -q '^#include $' "$source_file"; then + awk ' + /^#include $/ { print "#include " } + { print } + ' "$source_file" >"$source_file.new" + mv "$source_file.new" "$source_file" + fi +done ( cd "$source_build_dir/zlib-1.3.2"