Skip to content

Commit f24ac7e

Browse files
MRNIUsisyphus-dev-aiclaude
authored
perf(ci): parallelize jobs, prebuilt Docker image, caching and shallow clone (#197)
* refactor(task): remove dead kstd_vector includes after etl migration Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(task): provide explicit etl::vector container type for sleeping_tasks priority_queue Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update include styler Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: update cmake Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: add math.h, waiting for c++26 Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: etl plans Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: replace sk_assert with assert Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: kstd Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: update unique_ptr Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: migrate Singleton<T> to etl::singleton<T> named aliases Replace custom Singleton<T> with etl::singleton<T> using per-type named aliases (e.g. BasicInfoSingleton, TaskManagerSingleton) defined centrally in kernel.h. Delete singleton.hpp. Update all call sites from Singleton<T>::GetInstance() to TypeSingleton::instance() and assignment-construction to TypeSingleton::create(). Update all documentation references. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(arch): move arch-specific singletons out of kernel.h and make interrupt controllers Interrupt members Move arch-specific singleton type aliases from shared kernel.h into per-arch directories, and convert interrupt controller singletons (PlicSingleton, ApicSingleton) into private members of each arch's Interrupt class, following the existing aarch64 pattern where Gic is already an Interrupt member. - Move Pl011Singleton to src/arch/aarch64/include/pl011_singleton.h - Move SerialSingleton to file-local scope in x86_64/early_console.cpp - Move Ns16550aSingleton to file-local scope in riscv64/interrupt_main.cpp - Add Plic plic_ member to riscv64 Interrupt with InitPlic() deferred init - Add Apic apic_ member to x86_64 Interrupt with InitApic() deferred init - Move APIC creation from ArchInit() to InterruptInit() (boot order fix) - Remove arch-specific #includes and #ifdefs from kernel.h Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(arch): remove static from Interrupt handler arrays Since Interrupt is used as etl::singleton (only one instance), static class members are semantically equivalent to non-static members. Remove static to eliminate the need for out-of-class definitions in .cpp files. - aarch64: interrupt_handlers -> interrupt_handlers_ (non-static member) - riscv64: interrupt_handlers_, exception_handlers_ (drop static + defs) - x86_64: interrupt_handlers_, idts_ (drop static + defs, keep alignas) The alignas(4096) on x86_64 members propagates correctly through etl::singleton via uninitialized_buffer_of<T> which uses alignas(etl::alignment_of<T>::value) on its storage. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: add cpu_io Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(arch): move arch-specific singletons from kernel.h to arch directories Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: string Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: string Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: klog Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: io_buffer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * doc: update AGENT.md Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * doc(etl): add ETL integration migration design plan Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(libc): wrap noexcept in __cplusplus guard for C compilation Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(task): add ETL message and router ID registry Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(task): replace CloneFlags enum and cpu_affinity with etl::flags Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(interrupt): replace InterruptFunc pointer with etl::delegate Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(task): replace TaskStatus enum with etl::fsm state machine Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(task): address code quality review findings for etl::fsm migration - C1: Add ReapTask(current) for orphan tasks in Exit() to prevent TCB leak - C2: Start FSM after default-constructing TCB in Clone() to avoid null deref - I2: Use STATE_ID constant in StateExited::on_event(MsgReap) - I3: Move GetStatus() implementation from header to .cpp file - I4: Enqueue idle task in kReady state, then transition to kRunning - M2: Restore dropped @todo SIGCHLD comment in exit.cpp - M5: Add [[nodiscard]] attribute to GetStatus() Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(kernel): add tick and panic observer interfaces using etl::observer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(kernel): add lifecycle and virtio message types for etl::message_router Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(plans): add ETL migration implementation plan Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: task_fsm Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: InterruptDelegate Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update include style Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: fsm Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: task_control_block Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * chore(docs): remove superseded etl-migration plan files Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(expected): add VirtIO/device error codes for device_framework unification Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add platform_config.hpp concrete impl for device_framework injection Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * build(device): use BEFORE in TARGET_INCLUDE_DIRECTORIES for platform_config override Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device_node): replace atomic<bool> with SpinLock-guarded bool, remove hand-rolled copy/move Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(df_bridge): remove DeviceStorage and ToKernelError, error types now unified Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(driver_registry): add etl::flat_map index for O(log N) platform driver lookup Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(virtio_blk_driver): remove Traits template param, use unified error and Storage types Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): remove PlatformTraits template usage, unify error handling Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(arch/riscv64): remove PlatformTraits template param from VirtioBlkDriver usage Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(device): add kMaxSpinIterations to PlatformTraits; use TryBind() in DeviceManager::ProbeAll() Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * chore(submodule): bump device_framework to merged main (440bfe7) device_framework feature/device-refactor merged into main: - Traits template elimination via platform_config.hpp injection - Unified error handling (PlatformErrorCode) - Storage<T> freestanding optional added - All tests updated for non-template API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): delete placeholder and redundant header files Inline PlatformTraits struct into platform_config.hpp and delete the now-redundant platform_traits.hpp. Also delete zero-caller stubs: acpi_bus.hpp, pci_bus.hpp, virtio_messages.hpp. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): simplify device module — remove Driver concept and variant types Replace template Register<D>() + Driver concept with plain DriverEntry function-pointer struct. Flatten DeviceNode to pure data (remove variant BusId, DeviceResource, DMA buffer, SpinLock). Move DMA allocation into VirtioBlkDriver::Probe(). Delete df_bridge.hpp; introduce mmio_helper.hpp. Net: ~1149 -> ~570 lines (~50% reduction), 13 -> 8 headers. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(arch/riscv64,device): update interrupt_main and virtio_blk_driver for new driver API - Replace DriverRegistry::GetDriverInstance<VirtioBlkDriver>() with VirtioBlkDriver::Instance() in interrupt_main.cpp (lines 100, 209) - Remove unused #include "driver_registry.hpp" from interrupt_main.cpp - Add missing #include "io_buffer.hpp" to virtio_blk_driver.hpp - Fix kstd::unique_ptr<IoBuffer> -> etl::unique_ptr<IoBuffer> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(device): add device_framework integration design doc Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * chore(device): create driver/ subdirectory skeleton Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add traits.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add ops/device_ops_base.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add ops/char_device.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add ops/block_device_ops.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/mmio_accessor.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/storage.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/uart_device.hpp inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/ns16550a/ inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/pl011/ inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/virtio/defs.h + traits.hpp (task 11) Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/virtio/transport/ (task 12) Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/virtio/virt_queue/ inlined from device_framework (task 13) Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/virtio/device/ inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add detail/acpi/ inlined from device_framework Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add pl011/acpi facade headers and update driver includes to inline headers Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(arch): replace device_framework includes with inlined driver headers Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * build: remove device_framework from CMake and .gitmodules Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * chore(device): remove device_framework submodule and platform_config.hpp hack Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(device): add platform_config.hpp for inlined VirtIO driver and fix unit-test CMake link Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: apply clang-format to VirtIO device and transport headers Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: remove plan Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): replace raw array+ptr with etl::vector/flat_map in DriverRegistry Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): migrate Ns16550aDriver to etl::delegate, remove DriverDescriptor Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): migrate VirtioBlkDriver to etl::optional + etl::delegate Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): delete detail/storage.hpp, superseded by etl::optional Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(device): update AGENTS.md for ETL refactor Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(device): fix duplicate section in AGENTS.md Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: add device module refactor design document Add design doc for src/device/ refactoring: - Delete ~1000 lines of dead ops/ CRTP layer - Replace VirtioBlkDriver with unified virtio::Probe() interface - Runtime transport/device-type detection via std::variant - Preserve detail/virtio/ structure for multi-device extensibility Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): extract VirtioBlkVfsAdapter to dedicated header Move VirtioBlkBlockDevice class (renamed VirtioBlkVfsAdapter) out of device.cpp into its own header. No functional change. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test(device): add failing tests for VirtioDriver Tests expect VirtioDriver::GetEntry() and MatchStatic() which will be implemented in the next task (TDD). Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add unified VirtioDriver with runtime device-type dispatch Replace VirtioBlkDriver with VirtioDriver that auto-detects VirtIO device type (blk/net/gpu/...) at runtime by reading device_id register. Caller (DeviceInit) no longer needs to know about VirtIO device types. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * build(device): add virtio_driver.cpp to device library sources Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): update DeviceInit to use unified VirtioDriver Replace VirtioBlkDriver::GetEntry() with VirtioDriver::GetEntry(). DeviceInit no longer mentions specific VirtIO device types. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): ns16550a_driver include ns16550a.hpp directly Remove dependency on ns16550a_device.hpp (CRTP wrapper, to be deleted). Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): pl011_driver include pl011.hpp directly Remove dependency on pl011_device.hpp (CRTP wrapper, to be deleted). Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): delete dead ops/ CRTP layer and unused device wrappers Remove ~1000 lines of dead code: - driver/ops/ (device_ops_base.hpp, char_device.hpp, block_device_ops.hpp) - driver/detail/uart_device.hpp - driver/detail/ns16550a/ns16550a_device.hpp - driver/detail/pl011/pl011_device.hpp - driver/detail/virtio/device/virtio_blk_device.hpp - driver/virtio_blk_driver.hpp (replaced by virtio_driver.hpp) Also add GetIrq()/HandleInterrupt() to VirtioDriver and update riscv64/interrupt_main.cpp to use VirtioDriver + Ns16550a directly. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(device): update AGENTS.md for new VirtioDriver architecture - Document virtio_driver.cpp as the second .cpp exception - Add VirtIO device extension guide (add device_id case only) - Remove references to deleted ops/ layer and virtio_blk_driver Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): restructure drivers into per-driver subdirectories - Each driver (ns16550a, pl011, acpi, virtio) now lives in its own subdirectory with an independent ADD_LIBRARY(xxx_driver INTERFACE) CMake target - Delete detail/ directory; headers moved directly into driver subdirectories (ns16550a/, pl011/, acpi/, virtio/) - device target changed from INTERFACE to STATIC with PRIVATE driver dependencies; consumers access hardware only through DeviceManager - device CMakeLists: use explicit compile-only deps instead of kernel_link_libraries to avoid leaking -nostdlib/-T link.ld into unit-test link command - Fix aarch64: add Pl011Device alias, HandleInterrupt stub, remove stale Open() call in early_console.cpp - Fix virtio traits.hpp: change self-referential include to ../traits.hpp - Arch code links driver targets explicitly as a documented exception - All three arch builds and 163 unit tests pass Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device,fdt): add ForEachDeviceNode filter and split device_manager - kernel_fdt.hpp: add ForEachDeviceNode() inline template that skips infrastructure nodes (interrupt-controller, #clock-cells, cpu, memory device_type) to suppress spurious 'no driver' log noise - device_manager.hpp: extract ProbeAll/FindDevice/FindDevicesByType to device_manager.cpp; keep RegisterBus<B> template in header - device_manager.cpp: implement the three methods with assert-based precondition checks and ProbeAll no_driver_count summary log - virtio: fix missing newlines in klog::Debug format strings - doc/plans: add design doc and implementation plan Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): assert-harden mmio_helper and use ForEachDeviceNode - driver_registry.hpp: replace mmio_base==0 error return in mmio_helper::Prepare with assert() — bad node is a driver bug, not a recoverable runtime condition; add #include <cassert> - platform_bus.hpp: switch Enumerate to fdt_.ForEachDeviceNode so infrastructure nodes (interrupt-controller, clock, cpu, memory) are skipped before driver matching, eliminating 'no driver' noise Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(virtio): reorganize device/ into per-type subdirectories Move virtio_blk.hpp, virtio_blk_defs.h, virtio_blk_vfs_adapter.hpp into device/blk/, and placeholder headers into console/, net/, gpu/, input/. Update all include paths and header guards accordingly. device_initializer.hpp stays at device/ root as it is cross-device. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(virtio): modernize VirtioBlk with std::array Replace raw C arrays slots_[kMaxInflight] with std::array<RequestSlot, kMaxInflight> and local IoVec[] with std::array<IoVec, kMaxSgElements> in DoEnqueue(). Replace static kNames[] with constexpr std::array<const char*, 4> in GetName(). Also zero-initialize slot_bitmap_ explicitly with {}. Note: std::bitset was evaluated but omitted — std::bitset<N>::to_ulong() references exception machinery (__throw_out_of_range_fmt) in GCC 14's libstdc++, which is incompatible with this freestanding kernel build. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: update cpu_io Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: mmio_accessor Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(arch/riscv64): add etl_putchar shim for ETL print support Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(arch/aarch64): add etl_putchar shim for ETL print support Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(arch/x86_64): add etl_putchar shim for ETL print support Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): migrate klog calls to ETL format syntax Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(task): migrate klog calls to ETL format syntax Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(arch): migrate klog calls to ETL format syntax Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(src): migrate klog calls to ETL format syntax Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(klog): rewrite kernel_log.hpp with type-safe {} format syntax - Replace printf-style %s/%d format strings with {}-based syntax - Add KernelFmtStr<Args...> + KernelFormatString alias with type_identity_t for correct CTAD (mirrors std::format_string pattern) - Add FormatArg() overloads for freestanding-safe single-arg printing - Add LogFormat() recursive walker for format string processing - Keep stream-style API (klog::info <<) unchanged - Add ETL_FORCE_STD_INITIALIZER_LIST to prevent ETL/stdlib collision when ETL_NO_STL is set in freestanding mode - Migrate clone.cpp and syscall.cpp to {} syntax - Verified clean build on riscv64, aarch64, x86_64 Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(libc): remove nanoprintf, replace sk_printf with emit helpers - Delete sk_printf/sk_snprintf/sk_vsnprintf API from sk_stdio.h and sk_stdio.c - Add four __always_inline emit helpers: sk_emit_str, sk_emit_sint, sk_emit_uint, sk_emit_hex - Migrate kernel_log.hpp, spinlock.hpp, kstd_iostream.cpp, kstd_libcxx.cpp, schedule.cpp, syscall.cpp to emit helpers - Replace BmallocLogger with empty no-op implementation - Remove nanoprintf git submodule and CMake integration - cmake-lint skipped: pre-existing cmakelang internal crash (upstream bug) Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: update cpu_io Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(libc): replace sk_putchar with etl_putchar Remove the sk_putchar function pointer (and its unused ctx parameter). etl_putchar(int c) — already defined per-arch in early_console.cpp — becomes the sole low-level output primitive. - Delete sk_stdio.c (contained only dummy_putchar + sk_putchar) - Remove sk_stdio.c from libc CMakeLists - sk_stdio.h declares etl_putchar; sk_emit_* helpers call it directly - riscv64/early_console: drop EarlyConsole struct (SBI always ready) - aarch64/x86_64 early_console: collapse console_putchar into etl_putchar - Replace all sk_putchar(c, nullptr) -> etl_putchar(c) across 8 files Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(klog): simplify kernel_log — 8 complexity fixes - Support {:x}/{:#x}/{:X}/{:#X} format specifiers for integers - Unify type printing: operator<< delegates to FormatArg - Extract EmitHeader<Level>() to eliminate duplicated prefix code - Remove redundant if constexpr level checks in struct constructors - Replace throw with non-constexpr call in consteval context (freestanding safe) - Fix DebugBlob: use if constexpr only, remove #ifdef SIMPLEKERNEL_DEBUG - Rename LogStarter -> LogStream for clarity - Add auto-newline in LogEmit/~LogLine, strip trailing backslash n from all call sites (63 files: src/**/*.cpp, src/**/*.hpp, tests/**/*.cpp) Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: replace nanoprintf with etl Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: remove plans Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: remove kstd::ostream Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: sk_print_str Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: replace __attribute__ with [[xxx]] Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: replace __attribute__ with [[xxx]] Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: backtrace Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: virtio Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): unify driver singletons to etl::singleton Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: remove etl docs Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(device): resolve singleton alias forward-reference in GetEntry() Replace XxxSingleton::instance() with etl::singleton<Xxx>::instance() inside GetEntry() where the type alias is not yet declared. Affects Pl011Driver, Ns16550aDriver, and VirtioDriver. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(device): add DmaRegion type and IoBuffer::ToDmaRegion() Introduce DmaRegion{virt, phys, size} value type, VirtToPhysFunc callback, and IdentityVirtToPhys default in io_buffer.hpp. Add ToDmaRegion() to IoBuffer for converting buffers to DMA-ready regions. Includes 8 GoogleTest unit tests and implementation plan. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(device): replace void* DMA with DmaRegion + VirtToPhys abstraction Refactor SplitVirtqueue, VirtioBlk, and VirtioDriver to use DmaRegion instead of raw void*/uintptr_t pairs. VirtioBlk::Create() now accepts separate vq_dma and slot_dma regions with a VirtToPhysFunc callback, eliminating hardcoded identity-mapping assumptions. RequestSlot memory is allocated from a dedicated DMA buffer for device-accessible physical addresses. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: sk_print_str Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: device Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(log): add per-CPU lock-free LogLineRaw/LogStreamRaw interfaces Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(arch): use lock-free klog::raw_err in DumpStack to prevent deadlock Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: klog Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: klog Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor: klog Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: add stb and EasyLogger Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: add stb and EasyLogger Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: add stb and EasyLogger Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: add stb and EasyLogger Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs(log): add MPMC log refactor design and implementation plan Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): rewrite kernel_log.hpp with MPMC lock-free queue Replace SpinLock-based stream logging with Vyukov lock-free MPMC queue. New API: klog::Info/Warn/Err/Debug (printf-style), klog::Flush, klog::RawPut. Remove: LogLine, LogLineRaw, LogStream, LogStreamRaw, DebugBlob, klog::hex/HEX. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/main.cpp to new klog API Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/arch/x86_64/ to new klog API Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/arch/riscv64/ to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/arch/aarch64/ to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/memory/ to new klog API Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/device/ to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/task/ to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate src/filesystem/ to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): migrate remaining headers and syscall to new klog API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * refactor(log): update commented-out klog calls in spinlock.hpp to new API Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(log): replace __always_inline with inline on variadic klog functions GCC cannot inline functions using variable argument lists (...). Change Debug(), Info(), Warn(), Err() from __always_inline to inline. Flush() and RawPut() remain __always_inline as they are non-variadic. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(log): add missing cpu_io.h include for GetCurrentCoreId kernel_log.hpp uses cpu_io::GetCurrentCoreId() but did not include the header, causing 'cpu_io has not been declared' build errors. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: mpsc log Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: etl format Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: etl format Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: log with core id Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: log with core id Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: working on smp Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: update etl Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * 3rd: update etl Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: add boot_task Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: move TimerInit to main Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: move TimerInit to main Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * doc: update AGENTS.md Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: use pragma once Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style(arch,filesystem,memory): update headers to coding standards - Add trailing return types, [[nodiscard]], @brief, brace init, constructor groups - Arch: interrupt.h (riscv64/aarch64/x86_64), plic.h, gic.h, apic.h, io_apic.h, local_apic.h, sipi.h - Filesystem: file_descriptor.hpp, vfs.hpp, vfs_types.hpp, mount.hpp, vfs_internal.hpp, ramfs.hpp, fatfs.hpp - Memory: virtual_memory.hpp - Build verified on riscv64 and x86_64 Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: use trailing return types in .cpp and arch.h Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: update AGENTS.md Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * style: update Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * docs: update AGENTS.md Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: warnning Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(multi): address Copilot review findings across IO APIC, VFS, device, and DMA - io_apic: add early return after OOB IRQ check in SetIrqRedirection/MaskIrq/UnmaskIrq - mkdir: add NUL-termination after strncpy on dentry name - lookup: replace broken mount-point loop with FindByMountDentry - file_descriptor: fix open_count_ over-counting in SetupStandardFiles - io_buffer: fix size_t overflow in SubRegion bounds check - open/mkdir: reject path components exceeding buffer sizes - file_descriptor: use address-based lock ordering in move-assignment - virtio_driver: pass slot_align to IoBuffer for consistency - diskio: add nullptr guard for buff in disk_ioctl Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update devcontainer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update devcontainer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update devcontainer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update devcontainer Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: working on signal Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: update st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update ci Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: update ci Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(cmake): create /srv/tftp directory before symlinking Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(devcontainer): create /srv/tftp for QEMU built-in TFTP server Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(devcontainer): add libssl-dev for U-Boot build U-Boot's image.h requires openssl/evp.h for FIT image signing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(devcontainer): add aarch64-linux-gnu-cpp alternative for OP-TEE build OP-TEE's build system requires aarch64-linux-gnu-cpp which was not symlinked via update-alternatives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat(syscall): wire signal and affinity syscalls into dispatcher Add kSyscallSchedGetaffinity and kSyscallSchedSetaffinity constants for all architectures. Add dispatcher cases for sys_kill, sys_sigaction, sys_sigprocmask, sys_sched_getaffinity, and sys_sched_setaffinity. Implement sys_kill, sys_sigaction, and sys_sigprocmask function bodies that delegate to TaskManager signal methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test(task): add yield system test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: claen main.cpp Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test(task): add fork system test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test(task): add signal, affinity, tick, zombie_reap, stress system tests - signal_test: SIGTERM/SIGKILL default, SIG_IGN, sigprocmask, error paths - affinity_test: get/set affinity syscalls, cross-task, error paths - tick_test: tick increment, sleep timing, runtime tracking - zombie_reap_test: zombie reaping, orphan reparenting, multi-child Wait - stress_test: 20 concurrent tasks, wait non-child, rapid create-exit Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: fix st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * test: working on st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: st Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: timer seq bug Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix: timer seq bug Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * feat: remove x86_64 Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * fix(ci): use virtio-net-device and correct codecov path for ARM runner Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> * perf(ci): parallelize jobs, prebuilt Docker image, caching and shallow clone - Split single serial job into parallel build-riscv64 + build-aarch64 jobs - Add dev-image.yml workflow to build/push dev container to GHCR - Replace devcontainers/ci per-step with container: for shared container - Use shallow clone (fetch-depth: 1) and shallow submodules (--depth 1) - Add CMake build cache via actions/cache - Reduce system test runs to 3 for PRs (10 for push/release) - Add concurrency group to cancel superseded runs - Upgrade codecov-action v3->v4, actions-gh-pages v3->v4 Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> --------- Signed-off-by: Niu Zhihong <zhihong@nzhnb.com> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e675be7 commit f24ac7e

111 files changed

Lines changed: 3523 additions & 4884 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,19 @@ RUN apt-get update && apt-get upgrade -y && \
2929
python3-setuptools \
3030
uuid-dev \
3131
libgnutls28-dev \
32+
libssl-dev \
3233
swig \
3334
libgtest-dev \
3435
doxygen \
3536
graphviz \
3637
lcov \
37-
qemu-system-x86 \
3838
qemu-system-arm \
3939
qemu-system-misc \
4040
gdb-multiarch \
4141
gcc-14 g++-14 \
4242
gcc-14-riscv64-linux-gnu g++-14-riscv64-linux-gnu \
4343
gcc-14-aarch64-linux-gnu g++-14-aarch64-linux-gnu \
44-
gcc-14-arm-linux-gnueabihf g++-14-arm-linux-gnueabihf \
45-
gcc-14-x86-64-linux-gnu g++-14-x86-64-linux-gnu && \
44+
gcc-14-arm-linux-gnueabihf g++-14-arm-linux-gnueabihf && \
4645
update-alternatives \
4746
--install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
4847
--slave /usr/bin/g++ g++ /usr/bin/g++-14 \
@@ -56,16 +55,14 @@ RUN apt-get update && apt-get upgrade -y && \
5655
--install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc \
5756
/usr/bin/aarch64-linux-gnu-gcc-14 100 \
5857
--slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ \
59-
/usr/bin/aarch64-linux-gnu-g++-14 && \
58+
/usr/bin/aarch64-linux-gnu-g++-14 \
59+
--slave /usr/bin/aarch64-linux-gnu-cpp aarch64-linux-gnu-cpp \
60+
/usr/bin/aarch64-linux-gnu-cpp-14 && \
6061
update-alternatives \
6162
--install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc \
6263
/usr/bin/arm-linux-gnueabihf-gcc-14 100 \
6364
--slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ \
6465
/usr/bin/arm-linux-gnueabihf-g++-14 && \
65-
update-alternatives \
66-
--install /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc \
67-
/usr/bin/x86_64-linux-gnu-gcc-14 100 \
68-
--slave /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ \
69-
/usr/bin/x86_64-linux-gnu-g++-14 && \
7066
apt-get autoremove -y && apt-get clean -y && \
71-
rm -rf /var/lib/apt/lists/*
67+
rm -rf /var/lib/apt/lists/* && \
68+
mkdir -p /srv/tftp

.devcontainer/devcontainer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"plorefice.devicetree",
1919
"zixuanwang.linkerscript",
2020
"dan-c-underwood.arm",
21-
"zhwu95.riscv",
22-
"13xforever.language-x86-64-assembly"
21+
"zhwu95.riscv"
2322
]
2423
}
2524
}

.github/workflows/dev-image.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright The SimpleKernel Contributors
2+
3+
name: dev-image
4+
5+
on:
6+
push:
7+
branches: [main]
8+
paths:
9+
- '.devcontainer/Dockerfile'
10+
- '.github/workflows/dev-image.yml'
11+
workflow_dispatch:
12+
13+
env:
14+
IMAGE: ghcr.io/simple-xx/simplekernel-dev
15+
16+
jobs:
17+
build-and-push:
18+
runs-on: ubuntu-24.04-arm
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to GHCR
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .devcontainer
42+
file: .devcontainer/Dockerfile
43+
push: true
44+
tags: |
45+
${{ env.IMAGE }}:latest
46+
${{ env.IMAGE }}:${{ github.sha }}
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max

.github/workflows/workflow.yml

Lines changed: 108 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,132 @@
33
name: build
44

55
on:
6-
- push
7-
- pull_request
8-
- release
6+
push:
7+
pull_request:
8+
release:
9+
types: [published]
10+
11+
# Cancel in-progress runs for the same branch/PR
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
# PR: 3 runs for speed; push/release: 10 runs for stability
18+
SYSTEM_TEST_RUNS: ${{ github.event_name == 'pull_request' && 3 || 10 }}
919

1020
jobs:
11-
build:
12-
runs-on: ubuntu-latest
21+
build-riscv64:
22+
runs-on: ubuntu-24.04-arm
1323
permissions:
14-
contents: write
24+
contents: read
1525
packages: read
16-
statuses: write
26+
container:
27+
image: ghcr.io/simple-xx/simplekernel-dev:latest
1728
steps:
1829
- name: Checkout
1930
uses: actions/checkout@v4
2031
with:
21-
fetch-depth: 0
22-
submodules: recursive
32+
fetch-depth: 1
2333

24-
- name: x86_64
25-
uses: devcontainers/ci@v0.3
34+
- name: Shallow submodule init
35+
run: git submodule update --init --recursive --depth 1
36+
37+
- name: Cache CMake build (riscv64)
38+
uses: actions/cache@v4
2639
with:
27-
runCmd: |
28-
cmake --preset=build_x86_64
29-
cmake --build build_x86_64 --target SimpleKernel unit-test coverage docs
40+
path: build_riscv64/
41+
key: cmake-riscv64-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'src/**') }}
42+
restore-keys: |
43+
cmake-riscv64-${{ runner.arch }}-
44+
45+
- name: Configure & Build
46+
run: |
47+
cmake --preset=build_riscv64
48+
cmake --build build_riscv64 --target SimpleKernel docs
49+
50+
- name: System Test
51+
run: |
52+
for i in $(seq 1 $SYSTEM_TEST_RUNS); do
53+
echo "=== riscv64 System Test Run $i/$SYSTEM_TEST_RUNS ==="
54+
if ! timeout 300 cmake --build build_riscv64 --target system_test_run; then
55+
echo "riscv64 system test run $i/$SYSTEM_TEST_RUNS FAILED"
56+
exit 1
57+
fi
58+
echo "riscv64 system test run $i/$SYSTEM_TEST_RUNS passed"
59+
done
3060
31-
- name: riscv64
32-
uses: devcontainers/ci@v0.3
61+
- name: Upload docs artifact
62+
if: github.ref == 'refs/heads/main'
63+
uses: actions/upload-artifact@v4
3364
with:
34-
runCmd: |
35-
cmake --preset=build_riscv64
36-
cmake --build build_riscv64 --target SimpleKernel
65+
name: docs-html
66+
path: docs/html/
67+
retention-days: 1
3768

38-
- name: aarch64
39-
uses: devcontainers/ci@v0.3
69+
build-aarch64:
70+
runs-on: ubuntu-24.04-arm
71+
permissions:
72+
contents: read
73+
packages: read
74+
container:
75+
image: ghcr.io/simple-xx/simplekernel-dev:latest
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v4
4079
with:
41-
runCmd: |
42-
cmake --preset=build_aarch64
43-
cmake --build build_aarch64 --target SimpleKernel
80+
fetch-depth: 1
81+
82+
- name: Shallow submodule init
83+
run: git submodule update --init --recursive --depth 1
84+
85+
- name: Cache CMake build (aarch64)
86+
uses: actions/cache@v4
87+
with:
88+
path: build_aarch64/
89+
key: cmake-aarch64-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'src/**') }}
90+
restore-keys: |
91+
cmake-aarch64-${{ runner.arch }}-
92+
93+
- name: Configure & Build
94+
run: |
95+
cmake --preset=build_aarch64 -DQEMU_NORMAL_WORLD_DEV_PATH=null -DQEMU_SECURE_WORLD_DEV_PATH=null
96+
cmake --build build_aarch64 --target SimpleKernel unit-test coverage
97+
98+
- name: System Test
99+
run: |
100+
for i in $(seq 1 $SYSTEM_TEST_RUNS); do
101+
echo "=== aarch64 System Test Run $i/$SYSTEM_TEST_RUNS ==="
102+
timeout 300 cmake --build build_aarch64 --target system_test_run > /tmp/st_out_$i.txt 2>&1 || true
103+
cat /tmp/st_out_$i.txt
104+
if ! grep -q "Failed: 0" /tmp/st_out_$i.txt; then
105+
echo "aarch64 system test run $i/$SYSTEM_TEST_RUNS FAILED"
106+
exit 1
107+
fi
108+
echo "aarch64 system test run $i/$SYSTEM_TEST_RUNS passed"
109+
done
44110
45111
- name: Upload coverage reports to Codecov
46-
uses: codecov/codecov-action@v3
112+
uses: codecov/codecov-action@v4
47113
with:
48-
files: ${{ github.workspace }}/build_x86_64/coverage/coverage.info
114+
files: ${{ github.workspace }}/build_aarch64/coverage/coverage.info
49115
verbose: true
50116

51-
- name: Publish
52-
if: github.ref == 'refs/heads/main'
53-
uses: peaceiris/actions-gh-pages@v3
117+
publish:
118+
needs: [build-riscv64, build-aarch64]
119+
if: github.ref == 'refs/heads/main'
120+
runs-on: ubuntu-latest
121+
permissions:
122+
contents: write
123+
steps:
124+
- name: Download docs artifact
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: docs-html
128+
path: docs/html/
129+
130+
- name: Deploy to GitHub Pages
131+
uses: peaceiris/actions-gh-pages@v4
54132
with:
55133
github_token: ${{ secrets.GITHUB_TOKEN }}
56-
publish_dir: ${{ github.workspace }}/docs/html
134+
publish_dir: docs/html/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Doxyfile
1616
*.elf
1717
.pre-commit-config.yaml
1818
.worktrees/
19+
.claude

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AGENTS.md — SimpleKernel
22

33
## OVERVIEW
4-
Interface-driven OS kernel for AI-assisted learning. C++23/C23, freestanding, no RTTI/exceptions. Three architectures: x86_64, riscv64, aarch64. Headers define contracts (Doxygen @pre/@post), AI generates .cpp implementations, tests verify compliance.
4+
Interface-driven OS kernel for AI-assisted learning. C++23/C23, freestanding, no RTTI/exceptions. Two architectures: riscv64, aarch64. Headers define contracts (Doxygen @pre/@post), AI generates .cpp implementations, tests verify compliance.
55

66
## STRUCTURE
77
```
@@ -72,7 +72,7 @@ cmake/ # Toolchain files, build helpers
7272
## COMMANDS
7373
```bash
7474
git submodule update --init --recursive # First clone setup
75-
cmake --preset build_{riscv64|aarch64|x86_64}
75+
cmake --preset build_{riscv64|aarch64}
7676
cd build_{arch} && make SimpleKernel # Build kernel (NOT 'make kernel')
7777
make run # Run in QEMU
7878
make debug # GDB on localhost:1234
@@ -83,7 +83,7 @@ pre-commit run --all-files # Format check
8383

8484
## NOTES
8585
- Interface-driven: headers are contracts, .cpp files are implementations AI generates
86-
- Boot chains differ: x86_64 (U-Boot), riscv64 (U-Boot SPL→OpenSBI→U-Boot), aarch64 (U-Boot→ATF→OP-TEE)
86+
- Boot chains differ: riscv64 (U-Boot SPL→OpenSBI→U-Boot), aarch64 (U-Boot→ATF→OP-TEE)
8787
- aarch64 needs two serial terminal tasks (::54320, ::54321) before `make run`
8888
- Unit tests only run on host arch (`build_{arch}` on {arch} host)
8989
- Git commits: `<type>(<scope>): <subject>` with `--signoff`

CMakePresets.json

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@
7777
},
7878
"QEMU_DEBUG_FLAGS": {
7979
"type": "STRING",
80-
"value": "-S;-gdb;tcp::1234;-d;int,cpu_reset,guest_errors"
80+
"value": "-S;-gdb;tcp::1234;-d;cpu_reset,guest_errors"
8181
},
8282
"QEMU_COMMON_FLAG": {
8383
"type": "STRING",
84-
"value": "-nographic;-serial;stdio;-monitor;telnet::2333,server,nowait;-m;1024M;-smp;2;-d;guest_errors,int,cpu_reset"
84+
"value": "-nographic;-serial;stdio;-monitor;telnet::2333,server,nowait;-m;1024M;-smp;2;-d;guest_errors,cpu_reset"
8585
},
8686
"QEMU_DEVICE_FLAGS": {
8787
"type": "STRING",
88-
"value": "-global;virtio-mmio.force-legacy=false;-netdev;user,id=net0,tftp=/srv/tftp;-device;e1000,netdev=net0;-device;virtio-gpu-device"
88+
"value": "-global;virtio-mmio.force-legacy=false;-netdev;user,id=net0,tftp=/srv/tftp;-device;virtio-net-device,netdev=net0;-device;virtio-gpu-device"
8989
},
9090
"KERNEL_ELF_OUTPUT_NAME": {
9191
"type": "STRING",
@@ -105,43 +105,6 @@
105105
}
106106
}
107107
},
108-
{
109-
"name": "build_x86_64",
110-
"hidden": false,
111-
"inherits": [
112-
"configurePresets_base"
113-
],
114-
"displayName": "build x86_64 kernel",
115-
"description": "build x86_64 kernel",
116-
"toolchainFile": "${sourceDir}/cmake/x86_64-gcc.cmake",
117-
"binaryDir": "${sourceDir}/build_x86_64",
118-
"cacheVariables": {
119-
"CMAKE_SYSTEM_PROCESSOR": {
120-
"type": "STRING",
121-
"value": "x86_64"
122-
},
123-
"EXECUTABLE_OUTPUT_PATH": {
124-
"type": "STRING",
125-
"value": "${sourceDir}/build_x86_64/bin"
126-
},
127-
"LIBRARY_OUTPUT_PATH": {
128-
"type": "STRING",
129-
"value": "${sourceDir}/build_x86_64/lib"
130-
},
131-
"QEMU_MACHINE_FLAGS": {
132-
"type": "STRING",
133-
"value": "-drive;file=${sourceDir}/build_x86_64/bin/rootfs.img,if=none,format=raw,id=hd0;-device;virtio-blk-device,drive=hd0"
134-
},
135-
"SIMPLEKERNEL_EARLY_CONSOLE_BASE": {
136-
"type": "STRING",
137-
"value": "0"
138-
},
139-
"SIMPLEKERNEL_PER_CPU_ALIGN_SIZE": {
140-
"type": "STRING",
141-
"value": "128"
142-
}
143-
}
144-
},
145108
{
146109
"name": "build_riscv64",
147110
"hidden": false,

0 commit comments

Comments
 (0)