Add libkrun, libkrunfw, and build deps cpio + pyelftools - #271
Conversation
Packages the libkrun KVM backend and its libkrunfw guest-kernel firmware (from gominimal/minimal's scripts/build-libkrun.sh), plus two missing build dependencies. - libkrun 1.19.0: built `--features blk` (exports krun_add_disk2). libkrunfw is dlopen()ed at runtime, so it is a runtime_dep, not a link dep. bindgen/libclang dropped (only feeds input/display crates, not blk). - libkrunfw 5.5.0: compiles linux-6.12.91 into the firmware .so. Kernel tarball vendored as a Source so the build is hermetic. - pyelftools 0.33: bin2cbundle.py imports elftools. - cpio 2.15: required by the kernel's CONFIG_IKHEADERS. Built -std=gnu17 for GCC's C23 default; sourced from mirrors.kernel.org (ftp.gnu.org 403s the fetcher). Both Makefiles install to lib (LIBDIR_Linux=lib override) and link with CC=gcc since the sandbox has no cc symlink. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds four new package build definitions forming a dependency chain: ChangesNew package chain: cpio → pyelftools → libkrunfw → libkrun
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cpio/build.sh`:
- Line 2: In the build.sh file, replace the `set -ex` command at the beginning
of the script with `set -euo pipefail`. The `-u` flag ensures unset variables
cause an error, the `-o pipefail` option makes pipe operations fail if any
command in the pipeline fails, and this combination provides the strict error
handling and variable expansion required for build scripts.
In `@packages/libkrun/build.sh`:
- Line 2: Update the shell options at the beginning of the build script from
`set -ex` to `set -euo pipefail` to enforce strict mode that includes error
handling for unset variables and pipeline failures. This ensures the build
script follows the required guidelines by making it exit on any error, treating
unset variables as an error, and ensuring pipelines fail if any command in the
pipeline fails.
In `@packages/libkrunfw/build.sh`:
- Around line 18-20: The make commands for kernel build do not export the
required KBUILD_* environment variables needed for reproducible builds. Before
executing both the make command on line 18 and the make install command on line
20, export the three required variables: KBUILD_BUILD_TIMESTAMP set to `@0`,
KBUILD_BUILD_USER set to builder, and KBUILD_BUILD_HOST set to minimal. These
can be exported as environment variables before the make commands or passed
directly to each make invocation to ensure deterministic kernel build metadata.
- Line 2: Replace the `set -ex` command at the beginning of the build.sh script
with `set -euo pipefail`. The current flags only enable echo mode and exit on
error, but the `-u` flag is needed to error on undefined variables and `-o
pipefail` is needed to ensure the script exits on failures within piped
commands, which aligns with the project's coding guidelines for shell scripts.
In `@packages/pyelftools/build.ncl`:
- Around line 26-31: The build specification in the pyelftools package is
missing the build_args field needed to forward the version variable to the build
script. Add a build_args field with the value { include version } at the same
level as the existing cmd and outputs fields to forward the version variable to
the build script as an environment variable for build consistency.
In `@packages/pyelftools/build.sh`:
- Around line 4-5: The Python build steps in the build.sh script are missing
reproducibility environment variables. Before the first pip3 wheel command,
export SOURCE_DATE_EPOCH=0 and PYTHONHASHSEED=0 environment variables to ensure
consistent builds across different environments and eliminate non-deterministic
behavior from Python's build process.
- Line 2: The build script in packages/pyelftools/build.sh uses set -ex on line
2, but this does not properly handle unset variables or pipe failures. Replace
the set -ex line with set -euo pipefail to enable strict mode with proper error
handling for unset variables (u flag) and pipe failures (o pipefail flag),
ensuring the script follows the build script guidelines.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c0983b25-082f-4690-bcea-f155d143eeab
📒 Files selected for processing (8)
packages/cpio/build.nclpackages/cpio/build.shpackages/libkrun/build.nclpackages/libkrun/build.shpackages/libkrunfw/build.nclpackages/libkrunfw/build.shpackages/pyelftools/build.nclpackages/pyelftools/build.sh
|
@coderabbitai review |
✅ Action performedReview finished.
|
Packages the libkrun KVM backend and its libkrunfw guest-kernel firmware (from
gominimal/minimal'sscripts/build-libkrun.sh), plus two missing build dependencies.Packages
libkrun--features blklibkrunfwpyelftoolsbin2cbundle.pyimportselftoolscpioCONFIG_IKHEADERSneeds itDesign
containers/libkrunfw,containers/libkrun);libkrunfwis a dependency oflibkrun.libkrundlopen()slibkrunfw.so.5vialibloading(src/libkrun/src/lib.rs), so it is inruntime_deps, notbuild_deps.bindgenonly feeds theinput/displaycrates, which--features blkdoes not pull in.Sourceinlibkrunfw, so the firmware build is hermetic.libkrunkeepsneeds.internetfor cargo.Build notes
int xstat()breaks under GCC's C23 default →-std=gnu17.ftp.gnu.org403s the sandbox fetcher → cpio sourced frommirrors.kernel.org(byte-identical)..sowith barecc(absent in sandbox) →CC=gcc, and install tolib64by default →LIBDIR_Linux=liboverride (keeps the.pclibdir consistent).Verification
All four built via
min patched-pkgand passmin check(50 checks, 0 failures) on the compiled outputs.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes