garage44.eu/jeroen/pinnacle

logclone: git clone https://garage44.eu/jeroen/pinnacle.git

.. /ports

README.md

Ports

Crates from crates.io with a Pinnacle branch added, for apps built for Pinnacle (aarch64-unknown-pinnacle, Rust's std of std/). Each folder is the crate as crates.io has it, one version, with the changes below; their licences are their own (MIT / Apache-2.0, Stylo's MPL-2.0, beside each). They are not part of the system: an app's build switches them in with --config patch.crates-io… (port_patches in xtask), so the app keeps its own manifest and builds everywhere else with the originals.

A port is of one version. A build that resolves another leaves it unused, and cargo says so ("patch … was not used"): pin the version (as check/ does), or port the version it resolves.

CrateWhat Pinnacle needed
getrandom 0.2, 0.3, 0.4A backend: the kernel's randomness through std::os::pinnacle::random
errno 0.3Its placeholder (Pinnacle has no errno), as Hermit's
hostname 0.4The device's name: what Settings keeps in system:/settings/name
mio 1.2.2 and 1.2.4 (which one a build resolves depends on the machine's crates.io index; the same changes in both)A selector (src/sys/pinnacle.rs): sockets are channels, readiness a message waiting, which the wait system call reports without taking it; edge-triggered as mio's poll(2) selector is (a source reported readable is watched again once an operation on it would block); a Waker and registrations from other threads wake the selector through a channel of its own. Sockets are made by std (connect, bind), not by socket(2)
tokio 1.53No socket2 (sockets take no options: no TcpSocket, no TOS, linger or quick-ack); into_std through mio's conversions; ctrl_c never comes (no signals)
winit 0.30A backend (src/platform_impl/pinnacle/): the app's one window from the display server (its whole area of the screen, sized again when the screen turns), touch and pointer as the left mouse button, keys from Linux key codes on a US layout, the window shown or hidden as focus; the pixels drawn into directly through platform::pinnacle::WindowExtPinnacle (with_pixels, present). A raw window handle for a GPU to draw into the window (raw-window-handle's Orbital variant, a pointer to a C-laid-out Surface: the window's size, and a frame presented into its pixels), which Pinnacle's Vulkan driver makes a surface of; is_visible unsaid, as on Wayland (an app's window is shown from the start, and AccessKit's adapter, made first, takes "visible" as too late)
bevy_asset 0.20Files read as on Windows: no async-io (whose reactor, polling and rustix Pinnacle has no use for), only for a timer that caps open files
ring 0.17Its public modules in Rust on Pinnacle's own crypto (src/pinnacle/), with ring's C and assembly taken out of the port (on Pinnacle its build script compiles nothing): AES-GCM, ChaCha20-Poly1305 and QUIC header protection, SHA-2, HMAC, HKDF, X25519, and checking ECDSA (P-256, P-384), Ed25519 and RSA (PKCS#1, PSS) signatures, which is what rustls and webpki use. Signing keys and P-256/P-384 key agreement answer errors (a TLS client needs neither)
stylo 0.24 (MPL-2.0)Servo's CSS engine, for Flitz (jeroen/flitz): its style threads' handles as on wasm, a placeholder (global_style_data.rs), since Pinnacle has neither pthreads nor Windows handles to give
url 2.5.9file: URLs of Pinnacle's paths (to_file_path, from_file_path), which it gives only on Unix, Windows, WASI and Hermit: a path's volume is the URL's first segment (data:/notes/a is file:///data:/notes/a), a path from the root is as on Unix; paths are text
ash 0.38No library loaded: Entry::load/load_from take Pinnacle's Vulkan driver, linked in (vulkan/, vkGetInstanceProcAddr), so libloading is everyone's but Pinnacle's
wgpu 30.0.1, wgpu-core 30.0.1Their Vulkan backend on Pinnacle too (it is on per platform: Windows, Linux, Android); wgpu-core's vulkan feature turns on wgpu-hal's directly, where the platforms' dependency crate is not had
wgpu-hal 30.0.2A surface on a Pinnacle window: winit's handle (Orbital) made a VkSurfaceKHR by Pinnacle's driver (pinnacle_vulkan::create_surface); host-visible memory in blocks of 4 to 16 MiB, for the GPU's 256 MiB window

winit-demo/ is a winit app: cargo xtask winit-demo installs it as "Winit", opens it from the launcher, drags a loop across it and photographs it into target/demo-winit/.

wgpu-demo/ is a wgpu app: cargo xtask wgpu-demo installs it as "wgpu" (its manifest granting the GPU: gpu=yes), opens it, and photographs the triangle the host's GPU drew into its window through Pinnacle's Vulkan driver into target/demo-wgpu/.

After a port is added or changed, cargo xtask ports-lock makes these programs' lockfiles afresh (--locked holds them to the ports as they were).

check/ is the self-check's program on them: tokio's runtime on three workers, its timers, tasks, a blocking task, and a tokio::net::TcpStream fetching the package source's catalog; and ring against the standards' vectors (SHA-2, HMAC, HKDF, ChaCha20-Poly1305, AES-GCM, X25519, Ed25519); and, with a 3D GPU, Vulkan through ash on Pinnacle's driver and wgpu on it (a WGSL compute shader). cargo xtask test puts it on the system disk as /tests/ports-check, and the boot's self-check runs it: "ports ok". cargo xtask ports builds it alone.

With these, Cartopolis's client checks clean for Pinnacle (its own Pinnacle arms are in its repo, docs/notes/pinnacle.md there), and wgpu runs on Pinnacle's Vulkan, into a window. Next: Cartopolis on it; socket2 only for the simulator.