{"id":19929266,"url":"https://github.com/cyruscyliu/llbic","last_synced_at":"2026-05-01T23:32:50.330Z","repository":{"id":94216112,"uuid":"219249159","full_name":"cyruscyliu/llbic","owner":"cyruscyliu","description":"Compile Linux kernels to LLVM bitcode with a reproducible CLI, machine-readable manifests, and agent-friendly   status tracking across kernel, arch, and Clang versions.","archived":false,"fork":false,"pushed_at":"2026-03-25T13:04:58.000Z","size":1272,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-26T15:46:08.317Z","etag":null,"topics":["agent","agent-workflows","bitcode","clang","cli","docker","kernel-build","linux-kernel","llvm","program-analysis","reproducible-builds","reproducible-research","system-research","system-securty-research"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyruscyliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-03T04:05:18.000Z","updated_at":"2026-03-25T13:05:01.000Z","dependencies_parsed_at":"2024-11-19T20:48:37.175Z","dependency_job_id":null,"html_url":"https://github.com/cyruscyliu/llbic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cyruscyliu/llbic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyruscyliu%2Fllbic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyruscyliu%2Fllbic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyruscyliu%2Fllbic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyruscyliu%2Fllbic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyruscyliu","download_url":"https://codeload.github.com/cyruscyliu/llbic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyruscyliu%2Fllbic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32517206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agent-workflows","bitcode","clang","cli","docker","kernel-build","linux-kernel","llvm","program-analysis","reproducible-builds","reproducible-research","system-research","system-securty-research"],"created_at":"2024-11-12T22:42:23.770Z","updated_at":"2026-05-01T23:32:50.318Z","avatar_url":"https://github.com/cyruscyliu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# llbic\n\nCompile Linux kernels to LLVM bitcode and kernel images with one stable\ncommand.\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)\n[![Status Board](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/cyruscyliu/llbic/master/status/badges/overall.json)](#status)\n[![Bitcode](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/cyruscyliu/llbic/master/status/badges/bitcode.json)](#status)\n[![vmlinux](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/cyruscyliu/llbic/master/status/badges/vmlinux.json)](#status)\n\n`llbic` is a Linux kernel build CLI for researchers, tool builders, and agent\nworkflows that need reproducible kernel artifacts instead of ad hoc scripts. It\npairs an explicit staged command model with a stable machine-readable manifest\nso builds are easy to automate, inspect, and reuse.\n\n## News\n\n`llbic` now supports Rust-enabled Linux kernel builds for kernel families with\npublished Rust LLVM toolchains on kernel.org (`6.19`, `6.18`, `6.17`, `6.12`,\n`6.6`, `6.1`), including scoped Rust sample targets such as\n`samples/rust/rust_print.o`. Rust mode uses the matching LLVM toolchain set for\nthe selected kernel family so the emitted C and Rust bitcode can be inspected\nwith one coherent LLVM toolchain.\n\n## Quick start\n\n```bash\n./llbic build 6.18.16 --out-of-tree --json\n```\n\nThat single command:\n\n- Downloads the requested kernel tarball from `kernel.org`\n- Extracts the source into `sources/linux-6.18.16`\n- Compiles the kernel with the selected backend and toolchain\n- Writes logs, a machine-readable manifest, and the bitcode list under `out/linux-6.18.16-x86_64-clang18/`\n- Prints the same build summary to stdout because `--json` was requested\n\nYou run `./llbic` from the repository root. The CLI creates and manages\n`sources/` and `out/` automatically, so you do not need to prepare build\ndirectories by hand.\n\nExpected output layout:\n\n```text\nout/linux-6.18.16-x86_64-clang18/\n  llbic.log\n  kernel-build.log\n  llbic.json\n  bitcode_files.txt\n```\n\n```bash\n./llbic inspect out/linux-6.18.16-x86_64-clang18/llbic.json --json\n```\n\nUse `inspect` to read back the manifest from a completed build without\nrerunning any build steps. This is useful in scripts and agent workflows when\nyou want to verify the recorded kernel version, architecture, artifact paths,\nand bitcode summary from `out/linux-6.18.16-x86_64-clang18/llbic.json`. Stable path fields are\nworkspace-relative, even when `./llbic` runs inside Docker. Use the `runtime`\nand `paths` blocks when you need the local container or host resolution.\n\nExample response shape (abridged):\n\n```json\n{\n  \"status\": \"success\",\n  \"exit_code\": 0,\n  \"error_step\": null,\n  \"error\": null,\n  \"kernel_version\": \"6.18.16\",\n  \"kernel_name\": \"linux-6.18.16\",\n  \"source_url\": \"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.16.tar.xz\",\n  \"source_dir\": \"sources/linux-6.18.16\",\n  \"output_dir\": \"out/linux-6.18.16-x86_64-clang18\",\n  \"log_file\": \"out/linux-6.18.16-x86_64-clang18/llbic.log\",\n  \"strategy\": \"lto\",\n  \"kernel_build_log\": \"out/linux-6.18.16-x86_64-clang18/kernel-build.log\",\n  \"arch\": \"x86_64\",\n  \"arch_is_default\": 1,\n  \"cross_compile\": null,\n  \"cross_compile_is_default\": 1,\n  \"defconfig\": \"defconfig\",\n  \"defconfig_is_default\": 1,\n  \"build_layout\": \"outtree\",\n  \"build_layout_is_default\": 0,\n  \"scope\": \"full\",\n  \"requested_files\": [],\n  \"make_targets\": [],\n  \"kconfig_fragments\": [],\n  \"kconfig_fragments_count\": 0,\n  \"requested_clang\": \"18\",\n  \"kbuild_dir\": \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18\",\n  \"config_path\": \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18/.config\",\n  \"config_sha256\": \"\u003csha256\u003e\",\n  \"bitcode_root\": \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18\",\n  \"bitcode_list_file\": \"out/linux-6.18.16-x86_64-clang18/bitcode_files.txt\",\n  \"clang\": \"clang-18\",\n  \"llvm_major\": \"18\",\n  \"runtime\": {\n    \"execution\": \"host\",\n    \"workspace_root\": \"\u003cworkspace-root\u003e\",\n    \"sources_root\": \"\u003csources-root\u003e\",\n    \"output_root\": \"\u003coutput-root\u003e\"\n  },\n  \"paths\": {\n    \"source_dir\": {\n      \"portable\": \"sources/linux-6.18.16\",\n      \"runtime_path\": \"\u003cruntime-specific\u003e\",\n      \"resolved_path\": \"\u003chost-specific\u003e\"\n    }\n  },\n  \"bitcode_files\": [\n    \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18/kernel/sched/core.bc\"\n  ],\n  \"bitcode_files_rel\": [\n    \"kernel/sched/core.bc\"\n  ],\n  \"bitcode_count\": 1,\n  \"vmlinux_bc\": null,\n  \"kernel_images\": [\n    \"vmlinux\",\n    \"arch/x86/boot/bzImage\"\n  ],\n  \"kernel_images_abs\": [\n    \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18/vmlinux\",\n    \"out/linux-6.18.16-x86_64-clang18/kbuild-x86_64-clang18/arch/x86/boot/bzImage\"\n  ]\n}\n```\n\n## Usage\n\nThe public command tree is:\n\n```text\nllbic build \u003cversion\u003e\nllbic download [version|url ...]\nllbic extract\nllbic compile [kernel-name]\nllbic inspect \u003coutput-dir|llbic.json\u003e\nllbic clean [build|sources|all]\n```\n\nUse `build` when you want the full workflow in one command:\n\n```bash\n./llbic build 6.18.16 --arch arm64 --out-of-tree\n```\n\nUse `--rust` when you want `llbic` to enable Rust support, Rust samples, and\nthe Rust sample configs automatically. The current Rust path is intentionally\ngated to kernel families with published Rust LLVM toolchains on kernel.org:\n`6.19`, `6.18`, `6.17`, `6.12`, `6.6`, and `6.1`.\n\nIn Rust mode, `llbic` selects the matching LLVM+Rust toolchain for the kernel\nfamily automatically. `--clang` is not accepted together with `--rust`.\n\n```bash\n./llbic build 6.19.7 --rust --out-of-tree --json\n```\n\nUse scoped compilation to build only selected translation units for debugging,\nverification, or targeted bitcode generation:\n\n```bash\n./llbic build 6.18.16 --out-of-tree --file kernel/sched/core.c --json\n```\n\nUse `download` when you only want to fetch kernel archives:\n\n```bash\n./llbic download 6.18.16 --json\n./llbic download https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.16.tar.xz --json\n```\n\nUse `extract` when archives already exist locally and you want unpacked source trees:\n\n```bash\n./llbic extract --json\n```\n\nUse `compile` when the extracted `linux-*` tree already exists and you do not\nwant to re-download or re-extract. `compile` reuses the same build pipeline and\nartifact contract as `build`; it just requires the source tree to already be\npresent:\n\n```bash\n./llbic compile linux-6.18.16 --json\n```\n\nUse `inspect` to summarize an existing build without rerunning it:\n\n```bash\n./llbic inspect ./out/linux-6.18.16-x86_64-clang18/llbic.json --json\n```\n\nUse `clean` to remove generated artifacts:\n\n```bash\n./llbic clean build --json\n./llbic clean sources --json\n./llbic clean all --json\n```\n\nFlags let you shape the build itself: target architecture, toolchain version,\nconfig source, build layout, output identity, and whether the result should be\nhuman-readable or machine-readable.\n\nFlags:\n\n- `--arch, -a`: `x86_64` (default), `arm`, `arm64`, `mips`, `riscv`\n- `--clang`: select the LLVM/Clang major version for non-Rust builds\n- `--cross`: `CROSS_COMPILE` prefix (defaults are applied for some arches; override as needed)\n- `--defconfig`: kbuild config target (default: `defconfig`)\n- `--kconfig, -K`: merge one or more Kconfig fragments into the generated `.config` (repeatable)\n- `--file, -f`: compile only selected source-relative translation units\n- `--rust`: enable Rust support, `SAMPLES`, `SAMPLES_RUST`, and the Rust sample configs automatically for supported kernel families (`6.19`, `6.18`, `6.17`, `6.12`, `6.6`, `6.1`); `llbic` selects the matching LLVM+Rust toolchain automatically\n- `--output, -o`: write the build to an explicit output directory; otherwise `llbic` uses `out/linux-\u003cversion\u003e-\u003carch\u003e-clang\u003cversion\u003e/`\n- `--json`: print a structured status or manifest to stdout\n- `--verbose, -V`: pass `V=1` to the kernel build\n- `--outtree`, `--out-of-tree`: use `make O=\u003cdir\u003e` for an out-of-tree build\n- `--intree`: build in the source tree and run `make clean` first\n\nExample: build ARM64 `defconfig` plus your own config fragment:\n\n```bash\n./llbic build 6.18.16 --arch arm64 --out-of-tree -K ./my-kconfig.fragment\n```\n\nEnvironment variables control how `llbic` runs the build backend. They are\nruntime overrides, not build-definition flags. `llbic` now uses the prepared\nhost toolchain by default. Set `LLBIC_BACKEND=docker` when you want the\ncontainerized toolchain path, and use `LLBIC_REBUILD=1` to force rebuilding the\nselected Docker image.\n\nFor host Rust builds, `llbic` can prepare the required Rust toolchain\nautomatically via `scripts/install_rust_env.sh` when the selected version is\nmissing. You can also run it manually:\n\n```bash\nbash scripts/install_rust_env.sh --toolchain 1.93.0\n```\n\nThe Docker images use the same installer in system mode, so the host and\ncontainer Rust paths stay aligned.\n\n`build` always writes `llbic.json`, even on failure. `--json` additionally\nemits structured output to stdout. Staged commands such as `download`,\n`extract`, `compile`, `inspect`, and `clean` use `--json` for their stdout\nresponse.\n\nArtifacts are written under `out/linux-\u003cversion\u003e-\u003carch\u003e-clang\u003cversion\u003e/` by default (override with\n`--output`):\n\n- `llbic.log`: end-to-end build log\n- `kernel-build.log`: raw kernel build output from the underlying `make` steps\n- `bitcode_files.txt`: list of detected LLVM bitcode files (relative paths under `bitcode_root`)\n- `llbic.json`: machine-readable build summary\n\nThe `build` manifest includes these top-level fields:\n\n- `status`\n- `exit_code`\n- `error_step`\n- `error`\n- `kernel_version`\n- `kernel_name`\n- `source_url`\n- `source_dir`\n- `output_dir`\n- `log_file`\n- `strategy`\n- `arch`\n- `arch_is_default`\n- `cross_compile`\n- `cross_compile_is_default`\n- `defconfig`\n- `defconfig_is_default`\n- `build_layout`\n- `build_layout_is_default`\n- `scope`\n- `requested_files`\n- `make_targets`\n- `kconfig_fragments`\n- `kconfig_fragments_count`\n- `requested_clang`\n- `kbuild_dir`\n- `bitcode_root`\n- `kernel_build_log`\n- `bitcode_list_file`\n- `bitcode_files`\n- `bitcode_files_rel`\n- `bitcode_count`\n- `config_path`\n- `config_sha256`\n- `clang`\n- `llvm_major`\n- `kernel_images`\n- `kernel_images_abs`\n- `vmlinux_bc`\n\nTreat the portable scalar path fields such as `source_dir`, `output_dir`,\n`bitcode_root`, `kernel_build_log`, and `bitcode_list_file` as the stable\nartifact identities.\n\nNote: `kernel/time/timeconst.bc` in the Linux source tree is an input for the `bc`\ncalculator (used to generate `include/generated/timeconst.h`), not LLVM bitcode.\n\n## Status\n\nThe README reflects build status through generated files under `status/`, not\nthrough hand-edited prose.\n\nThe flow is:\n\n1. `llbic` writes one `llbic.json` manifest per build under `out/`\n2. `python3 scripts/collect_status.py` reads the completed manifests\n3. the collector rewrites the committed status artifacts and badge payloads\n4. the README links to those generated outputs\n\nIn practice, that means the README status can be refreshed automatically after\nnew build results are collected. You do not edit the status summary by hand;\nyou regenerate it from the manifests.\n\nThe generated outputs are:\n\n- `status/status.json`: machine-readable support rows\n- `status/STATUS.md`: rendered support table\n- `status/badges/overall.json`: overall pass/fail badge payload\n- `status/badges/bitcode.json`: bitcode-emission badge payload\n- `status/badges/vmlinux.json`: `vmlinux` build badge payload\n\nRefresh the status artifacts with:\n\n```bash\npython3 scripts/collect_status.py\n```\n\nPrint the current badge summary locally with:\n\n```bash\npython3 scripts/collect_status.py --print-badges\n```\n\nThe board is derived from completed `out/**/llbic.json` manifests and tracked\nby `arch + requested_clang + kernel`, so the same kernel and architecture built\nunder different Clang versions remain distinguishable.\n\nThe status board follows `llbic`'s active backend selection. Use the prepared\nhost toolchain when available, or set `LLBIC_BACKEND=docker` when you want the\ncontainerized path and the image-defined toolchain selection.\n\n| Image | Kernels | Clang |\n|---|---|---|\n| `ghcr.io/cyruscyliu/llbic:latest` | 6.x, 7.x | 14, 15, 16, 18 |\n| `ghcr.io/cyruscyliu/llbic:mid` | 4.x, 5.x | 8, 9, 10, 11, 12 |\n| `ghcr.io/cyruscyliu/llbic:legacy` | 2.6, 3.x | 6.0, 7, 8 |\n\n## Contribute\n\nContributions are welcome through issues and pull requests.\n\nIf a change affects CLI behavior, backend selection, manifests, artifacts,\nstatus workflow, or agent guidance, update `README.md`.\n\n## License\n\nSee [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyruscyliu%2Fllbic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyruscyliu%2Fllbic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyruscyliu%2Fllbic/lists"}