jetson-build-source

Use when you need to rebuild the BSP overlay — DT, OOT modules, or kernel — from changes under bsp_sources/. Triggers: build bsp, rebuild dtb, rebuild kernel.

By nvidia · 1,127 installs

npx skills add nvidia/skills --skill jetson-build-source

Source repository · Upstream listing

Build BSP Source Purpose Rebuild the kernel side artifacts (DTBs, OOT modules, in tree modules, kernel Image ) implied by changes under <source.root path /bsp sources/ , and write a manifest that /jetson promote image reads to stage those outputs into the BSP image. The skill never writes into <bsp image.root path itself. Prerequisites Active target platform profile with bsp image: and source.toolchain: resolved (run /jetson init image and /jetson init source first). <source.root path /bsp sources/ populated with the kernel side checkout layout /jetson init source materializes. <bsp image.root path /Linux for Tegra/source/kernel src build env.sh present (extracted from public sources.tbz2 ). Host packages: flex , bison , libssl dev (hard); git , build essential , bc , zstd (warn only). Cross toolchain at ${source.toolchain}gcc resolvable on disk. Overview This skill is the Build stage of the workflow — see [ ../../context/bsp customization workflow.md ](../../context/bsp customization workflow.md) for where it sits in the Setup → Customize → Build → Deploy pipeline and what triggers it. The skill takes source side customization commits, rebuilds the implied artifacts, and records which were rebuilt in a manifest. Outputs stay in tree under <source.root path /bsp sources/ ; [ jetson promote image ](../jetson promote image/SKILL.md) reads the manifest at Deploy to copy each rebuilt artifact into the matching path under <bsp image.root path /Linux for Tegra/ . Overlay only edits ( nvpmodel.conf , nvfancontrol.conf , BPMP DTB) skip Build — customize stages them directly to the overlay tracker; BPMP DTB uses the dtc decompile → edit → recompile loop in [ ../../references/bsp customization bpmp dtb.md ](../../references/bsp customization bpmp dtb.md). Custom overlay slot ownership. Kernel DT customizations from every customize skill collect into a single composite tegra<soc <carrier id sku +<module id xxxx custom.dts per active target — see [ ../../references/bsp customization kernel dtb.md ](../../references/bsp customization kernel dtb.md) for the filename / location / append protocol. This skill is the sole owner of the composite's per dir Makefile registration ( dtbo y += <name .dtbo ) and the carrier flash conf's OVERLAY DTB FILE+= line (the "Register composite custom overlay" step). Four build modes matched to the dirty repo profile: Mode What's built Auto picks when dt NVIDIA DTBs only only hardware/nvidia/ or kernel devicetree dirty oot OOT modules (six repos) only OOT repos dirty kernel Kernel Image + full in tree .ko set + kernel side dtbs only kernel/$KERNEL SRC DIR dirty full Everything above + optional install consolidation mixed dirty set Mode selection: auto (default — invoke /jetson build source with no argument) walks the dirty repo set; force a specific mode by passing it as the skill argument. Design principle: delegate to upstream. Every build primitive already exists in <bsp image.root path /Linux for Tegra/source/ — the env file, top level Makefile ( nvidia dtbs / modules / modules install ), kernel Makefile ( kernel / install ). The skill drives those primitives against <source.root path /bsp sources/ — never duplicates their logic in shell. When to invoke Auto chained at the end of a Customize customize invocation whenever Customize committed to a kernel side source repo. Manual re run via /jetson build source [<mode ] when: the auto chained build was interrupted, source commits arrived via git pull from other users, the user wants to force a rebuild without a fresh edit, the user wants a specific mode (e.g. install consolidation for a manual scp deploy to a DUT). Instructions Resolve active target + paths + upstream env Resolve the active profile per [ ../../context/target platform contract.md ](../../context/target platform contract.md). Refuse and route in these cases: Condition Route to No active profile, or active: NA /jetson set target or /jetson init target Profile lacks bsp image: /jetson init image Profile lacks source.toolchain: /jetson init source <source.root path /bsp sources/ missing or empty /jetson init source <bsp image.root path /Linux for Tegra/source/kernel src build env.sh missing /jetson init image (BSP not properly extracted) Bind: Source the NVIDIA build env to inherit canonical names — never hardcode kernel noble , the OOT module list, or KERNEL DEF CONFIG : Refuse if $KS/kernel/$KERNEL SRC DIR/ is missing or if any name in $OOT SOURCE LIST is missing under $KS/ . Route to /jetson init source . Resolve toolchain (read only) Read source.toolchain from the active profile (authored by jetson init source ). Validate: A trailing dash on CROSS COMPILE is mandatory — kbuild treats it as a prefix ( ${CROSS COMPILE}gcc ); a missing dash breaks with command not found . The [ f ] check catches it before any make runs. This skill never prompts for the toolchain or attempts to resolve a missing one — that's jetson init source 's exclusive responsibility. A missing field is a Setup gap; route there. Verify build host prerequisites once: Detect dirty source repos The watermark file $STATE records the last successfully built commit per kernel side repo. The repo list is derived at runtime from OOT SOURCE LIST + kernel/$KERNEL SRC DIR . For each repo: HEAD ≠ watermark → dirty; uncommitted edits ( git diff quiet non zero) → also dirty. Branch A note : when bsp sources/ is one mono repo with a single .git , every canonical sub path shares the same HEAD — the watermark schema still keys per sub path and the dirty set still works (any change anywhere flips every sub path's HEAD). If STATE is absent (first build), treat all repos as clean unless the auto chain context says "Customize just committed". If DIRTY is empty and no mode argument was passed: report "nothing to build" and return. Pick build mode Map the dirty set to a mode (auto), or honor the mode argument: Dirty repos (auto) Mode Only hardware/nvidia/ or kernel devicetree dt Only OOT subset of $OOT SOURCE LIST oot Only kernel/$KERNEL SRC DIR kernel Any mix spanning the above full Modes are union able: full runs kernel → oot → dt in that order (kernel produces headers OOT needs; nvidia dtbs uses the same generated headers). A manually passed mode argument skips auto detection. Execute build Common setup + per mode build snippets Common setup (validate orchestrator Makefiles, cd $KS ) and the exact make invocations for each mode ( dt , oot , kernel , full ) plus the optional install consolidation pass live in [ references/build modes.md ](references/build modes.md). Drive the relevant mode's snippet against the bindings from the "Resolve active target + paths + upstream env" step. Register composite custom overlay (dt + full only) Skip unless the selected mode is dt or full . The composite overlay slot is documented in [ ../../references/bsp customization kernel dtb.md ](../../references/bsp customization kernel dtb.md); this sub step owns the build / Makefile / flash conf side of it. Resolve the composite path for the active target ( $COMPOSITE BASE , $COMPOSITE DTS , $COMPOSITE MK ) using the active profile's chip family, carrier ID/SKU, and module ID — full snippet in [ references/composite registration.md ](references/composite registration.md path resolution). Gate (symmetric). $COMPOSITE DTS drives both directions: present → apply the two idempotent patches below; absent → run the [cleanup pass](references/composite registration.md cleanup pass on composite removal) to strip any stale dtbo y += / OVERLAY DTB FILE+= line from a prior run. Either path keeps OVERLAY DTB FILE+= from referencing an unbuilt .dtbo — the build time enforcement of the [no direct in tree DT edits rule](../../references/bsp customization kernel dtb.md hard rule no direct in tree dts dtsi edits). 1. Per dir Makefile — append dtbo y += <name .dtbo after the last literal named dtbo y += entry. Inserting after the $(old dtbo) merge back line skips the $(addprefix makefile path/,…) prefix pass and the build silently drops the composite. Commit to the bsp sources/ mono repo. Full snippet + rationale: [ references/composite registration.md ](references/composite registration.md makefile patch idempotent position sensitive). 2. Carrier flash conf — append OVERLAY DTB FILE+=",<name .dtbo" with first touch pristine import on the overlay tracker. On a fresh workspace the tracker is empty git init; import the conf from bsp image and commit as pristine: before the customization commit (workflow contract). Full snippet: [ references/composite registration.md ](references/composite registration.md flash conf patch idempotent with first touch pristine import). The composite's parent sub repo flipping HEAD during a customize append is what the "Detect dirty source repos" step's dirty detection consumes — no extra bookkeeping needed here. Self check before invoking nvidia dtbs : Write the build manifest Walk the DIRTY set and emit a manifest entry per implied artifact, following the trace to dirty policy — only artifacts traceable to a dirty source repo. Promoting baseline divergence noise would attribute it to a customization's audit trail (forbidden). The full source → kbuild → destination mapping, YAML schema, and filter rules live in [ references/manifest schema.md ](references/manifest schema.md). Atomic write: stage to ${MANIFEST}.tmp , then mv f . Update watermark + summary On success, rewrite $STATE with the new per repo HEADs, toolchain, bsp image.version , and last run mode (schema in [ references/manifest schema.md ](references/manifest schema.md)). Report: Toolchain (from source.toolchain ). Build mode: <dt oot kernel full (auto picked or forced by skill argument). Dirty repos and their new HEADs. Artifacts built: counts per kind ( .dtb , in tree .ko , OOT .ko , Image ). Manifest path + entry count. Consolidated install stage path (if the "Install consolidation" step ran). Next step: /jetson promote image . If a Customize skill triggered this run, prompt the user to re issue their original request. Limitations The top tier — failure modes that block a build or silently produce wrong artifacts. See [ references/long tail gotchas.md ](references/long tail gotchas.md) for invariants, deploy patterns, and performance hints. Toolchain resolution is jetson init source 's job. This skill only reads source.toolchain and exports CROSS COMPILE . Missing field → refuse and route, never resolve in skill. R36.x Branch A $KS/Makefile collision. R36.x's public sources.tbz2 can leave the dGPU/OpenRM proprietary Makefile at $KS/Makefile instead of the Tegra orchestrator; its modules target recurses into kernel open/ + src/nvidia/ , pulls host /lib/modules headers, and breaks arm64 cross builds with ' mlittle endian' unrecognized . R38+ extractions are unaffected. /jetson init source 's step 3a is the primary defense (extract time); the "Common setup" check here is the safety net. Don't relax the regex. Kernel DT changes: composite overlay only, split ownership. Direct edits to in tree .dts / .dtsi files under bsp sources/ are forbidden for customize \ skills — every kernel DT change lands as a fragment in the composite overlay slot ([rule + rationale](../../references/bsp customization kernel dtb.md hard rule no direct in tree dts dtsi edits)). The composite .dts content is owned by each customize \ skill; the b