Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/kernel/tools/ck_gsp_bindata_extract.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / kernel / tools / ck_gsp_bindata_extract.c` 1155 lines ยท 65507 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* ck_gsp_bindata_extract.c -- hosted extractor for the GB10 GSP firmware 18 * arrays that the pinned NVIDIA open kernel driver (580.173.02) carries as 19 * generated C source (aienos#286 cut C, host work only). Never loads anything. 20 * 21 * Input: one generated file src/nvidia/generated/g_bindata_.c, e.g. 22 * g_bindata_kgspGetBinArchiveGspRmBoot_GB10B.c (4 arrays) 23 * g_bindata_kgspGetBinArchiveGspRmFmcGfwProdSigned_GB10B.c (4 arrays) 24 * 25 * The file format is the driver's own bindata layout: for every array a 26 * comment header (FUNCTION, FILE NAME, FILE TYPE, COMPRESSION, COMPLEX_STRUCT, 27 * DATA SIZE, COMPRESSED SIZE), the `static BINDATA_CONST NvU8 _data[]` 28 * hex array, a BINDATA_STORAGE_PVT record (uncompressed size, compressed 29 * size, pointer, bCompressed, ...) and at the end one BINDATA_ARCHIVE with 30 * entryNum and the { label, storage } list (SOURCE: the two files above; 31 * bin_data_pvt.h; bin_data.c:36-45 inflates compressed storage with the 32 * driver's zlib). Every one of those fields is cross-checked and any 33 * disagreement is a refusal: this tool never guesses sizes. 34 * 35 * Compressed arrays are gzip members without the 10-byte gzip header: a raw 36 * DEFLATE stream (RFC 1951) followed by the 8-byte gzip trailer CRC-32 and 37 * ISIZE, both little-endian (SOURCE: the driver's own 38 * extract-firmware-nouveau.py at tag 580.173.02, lines 107-108, prepends a 39 * synthetic gzip header and gzip-decompresses; OBSERVED 2026-10-12 on the 40 * 28-byte GB10B descriptor arrays: 20 bytes of fixed-Huffman deflate, CRC-32, 41 * then 0x54 = 84). The decoder and the CRC below are our own (no zlib, no 42 * outside dependency); the trailer is verified, never trusted. 43 * 44 * Semantic checks by label (SOURCE: rmRiscvUcode.h RM_RISCV_UCODE_DESC; 45 * kernel_gsp_gh100.c:303-333 kgspPopulateWprMeta_GH100 and :718-740 the 46 * RISC-V BootROM DMA programming, which shifts every offset by 47 * RISCV_BR_ADDR_ALIGNMENT = 8; kernel_gsp_gb10b.c:507-527 the chain-of-trust 48 * payload fields hash384 / publicKey / signature): 49 * UCODE_DESC_* 84 bytes, version 5, monitor enabled, manifest + monitor 50 * data + monitor code inside the matching UCODE_IMAGE_* and 51 * 256-byte aligned 52 * UCODE_HASH 48 bytes and equal to SHA-384 of UCODE_IMAGE (OBSERVED 53 * 2026-10-12 on the GB10B file; enforced here) 54 * UCODE_SIG, UCODE_PKEY 384 bytes (RSA-3072) 55 * 56 * Usage: 57 * ck_gsp_bindata_extract extract FILE [--out DIR] 58 * Prints one `array` line per label (size, compression, SHA-256), one 59 * `desc` line per descriptor and `RESULT OK`; with --out writes 60 * DIR/.