From e4ae67ea7f26691ac9e725d9fab4fbc4e9436259 Mon Sep 17 00:00:00 2001 From: CUBELinux build Date: Fri, 18 Sep 2026 20:11:45 -0400 Subject: [PATCH] CUBELinux.0.1: name the release, and build with this box's rustc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tree is Linux 6.19.3 with the changes this machine's toolchain needs, and nothing else. No CUBE code yet — this is the base the coordinate interface will be built on, so it starts from a known-good bootable kernel. Naming: - VERSION/PATCHLEVEL/SUBLEVEL stay 6.19.3 (visible in `make kernelversion`), while the release string setlocalversion composes is CUBELinux.0.1, so `uname -r` and /lib/modules report this product rather than a Linux point release. The SCM suffix still applies: a dirty tree says so. rustc compatibility (rustc 1.100.0-nightly, clang 19.1.7): - scripts/generate_rust_target.rs emitted `"rustc-abi": "x86-softfloat"`, which this rustc rejects; it is `softfloat` now. - rust/Makefile's cmd_rustc_library did not pass -Zunstable-options, so the custom target spec would not load at all. - the generated bindings declare `strlen` with the kernel target's `c_char` (u8, from -funsigned-char) while rustc expects `*const i8`; the newer suspicious_runtime_symbol_definitions lint fires on that and -D warnings makes it fatal. Scoped to bindings.o and uapi.o, not to handwritten code. - three `'static` bounds the abstractions now need (irq handlers). - str.rs imported alloc::flags::* which prelude::* already provides, and `#![feature(used_with_arg)]` is stale now that the feature is stable; both are unused-feature/unused-import errors under -D warnings. Gates: bzImage builds (14,697,472 bytes) with CONFIG_RUST=y, virtio-blk and a serial console built in. Boot test in QEMU is next. --- Makefile | 10 ++++++++-- rust/Makefile | 7 +++++-- rust/kernel/irq/request.rs | 6 +++--- rust/kernel/lib.rs | 4 ++-- rust/kernel/str.rs | 2 +- scripts/generate_rust_target.rs | 4 ++-- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 21df63507..3a5b7dcd9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,13 @@ VERSION = 6 PATCHLEVEL = 19 SUBLEVEL = 3 EXTRAVERSION = -NAME = Baby Opossum Posse +NAME = CUBELinux + +# CUBELinux: the release string belongs to this product, not to a Linux point +# release. The base version stays in VERSION/PATCHLEVEL/SUBLEVEL above (visible in +# `make kernelversion`), while `uname -r` and /lib/modules report the CUBELinux +# release, with any -dirty or SCM suffix still appended by setlocalversion. +CUBELINUX_VERSION = CUBELinux.0.1 # *DOCUMENTATION* # To see a list of typical targets execute "make help" @@ -1280,7 +1286,7 @@ vmlinux: vmlinux.o $(KBUILD_LDS) modpost $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ; ifeq ($(origin KERNELRELEASE),file) -filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree) +filechk_kernel.release = KERNELVERSION=$(CUBELINUX_VERSION) $(srctree)/scripts/setlocalversion $(srctree) else filechk_kernel.release = echo $(KERNELRELEASE) endif diff --git a/rust/Makefile b/rust/Makefile index 4dcc2eff5..9a01a67ba 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -556,6 +556,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L cmd_rustc_library = \ OBJTREE=$(abspath $(objtree)) \ $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \ + -Zunstable-options \ $(filter-out $(skip_flags),$(rust_flags)) $(rustc_target_flags) \ --emit=dep-info=$(depfile) --emit=obj=$@ \ --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \ @@ -661,7 +662,9 @@ $(obj)/ffi.o: private skip_gendwarfksyms = 1 $(obj)/ffi.o: $(src)/ffi.rs $(obj)/compiler_builtins.o FORCE +$(call if_changed_rule,rustc_library) -$(obj)/bindings.o: private rustc_target_flags = --extern ffi --extern pin_init +# bindgen's output trips a newer rustc lint over `c_char` width (see below), so the +# declaration is allowed here rather than in the flags that cover handwritten code. +$(obj)/bindings.o: private rustc_target_flags = --extern ffi --extern pin_init --allow=suspicious_runtime_symbol_definitions $(obj)/bindings.o: $(src)/bindings/lib.rs \ $(obj)/ffi.o \ $(obj)/pin_init.o \ @@ -669,7 +672,7 @@ $(obj)/bindings.o: $(src)/bindings/lib.rs \ $(obj)/bindings/bindings_helpers_generated.rs FORCE +$(call if_changed_rule,rustc_library) -$(obj)/uapi.o: private rustc_target_flags = --extern ffi --extern pin_init +$(obj)/uapi.o: private rustc_target_flags = --extern ffi --extern pin_init --allow=suspicious_runtime_symbol_definitions $(obj)/uapi.o: private skip_gendwarfksyms = 1 $(obj)/uapi.o: $(src)/uapi/lib.rs \ $(obj)/ffi.o \ diff --git a/rust/kernel/irq/request.rs b/rust/kernel/irq/request.rs index b150563fd..33d86255f 100644 --- a/rust/kernel/irq/request.rs +++ b/rust/kernel/irq/request.rs @@ -261,7 +261,7 @@ impl Registration { /// # Safety /// /// This function should be only used as the callback in `request_irq`. -unsafe extern "C" fn handle_irq_callback(_irq: i32, ptr: *mut c_void) -> c_uint { +unsafe extern "C" fn handle_irq_callback(_irq: i32, ptr: *mut c_void) -> c_uint { // SAFETY: `ptr` is a pointer to `Registration` set in `Registration::new` let registration = unsafe { &*(ptr as *const Registration) }; // SAFETY: The irq callback is removed before the device is unbound, so the fact that the irq @@ -480,7 +480,7 @@ impl ThreadedRegistration { /// # Safety /// /// This function should be only used as the callback in `request_threaded_irq`. -unsafe extern "C" fn handle_threaded_irq_callback( +unsafe extern "C" fn handle_threaded_irq_callback( _irq: i32, ptr: *mut c_void, ) -> c_uint { @@ -496,7 +496,7 @@ unsafe extern "C" fn handle_threaded_irq_callback( /// # Safety /// /// This function should be only used as the callback in `request_threaded_irq`. -unsafe extern "C" fn thread_fn_callback(_irq: i32, ptr: *mut c_void) -> c_uint { +unsafe extern "C" fn thread_fn_callback(_irq: i32, ptr: *mut c_void) -> c_uint { // SAFETY: `ptr` is a pointer to `ThreadedRegistration` set in `ThreadedRegistration::new` let registration = unsafe { &*(ptr as *const ThreadedRegistration) }; // SAFETY: The irq callback is removed before the device is unbound, so the fact that the irq diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index f812cf120..7eac7cb59 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -40,8 +40,8 @@ // Expected to become stable. #![feature(arbitrary_self_types)] // -// To be determined. -#![feature(used_with_arg)] +// `used_with_arg` was stabilised; the attribute below is used without a gate now, and a +// stale `#![feature]` for it is an error under `-D warnings` on this rustc. // // `feature(derive_coerce_pointee)` is expected to become stable. Before Rust // 1.84.0, it did not exist, so enable the predecessor features. diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index fa87779d2..1e37ba501 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -3,7 +3,7 @@ //! String representations. use crate::{ - alloc::{flags::*, AllocError, KVec}, + alloc::{AllocError, KVec}, error::{to_result, Result}, fmt::{self, Write}, prelude::*, diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs index 38b3416bb..338c46895 100644 --- a/scripts/generate_rust_target.rs +++ b/scripts/generate_rust_target.rs @@ -197,7 +197,7 @@ fn main() { } else if cfg.has("X86_64") { ts.push("arch", "x86_64"); if cfg.rustc_version_atleast(1, 86, 0) { - ts.push("rustc-abi", "x86-softfloat"); + ts.push("rustc-abi", "softfloat"); } ts.push( "data-layout", @@ -237,7 +237,7 @@ fn main() { } ts.push("arch", "x86"); if cfg.rustc_version_atleast(1, 86, 0) { - ts.push("rustc-abi", "x86-softfloat"); + ts.push("rustc-abi", "softfloat"); } ts.push( "data-layout",