-
Notifications
You must be signed in to change notification settings - Fork 95
bcachefs: enable in-tree module and add userspace-tools sysext #4136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ananthb
wants to merge
6
commits into
flatcar:main
Choose a base branch
from
ananthb:add-bcachefs-sysext
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
02773a4
bcachefs: add Flatcar OS sysext for bcachefs
ananthb a3bb664
bcachefs: gate sysext on kernel floor and harden mangle relocation
ananthb d3f2bd7
bcachefs: ship module in-tree, keep sysext userspace-only
ananthb e617fd9
bcachefs-tools: fix src_unpack double-unpack and QA nits
ananthb 0491fdd
bcachefs-tools: install under /usr/, make modules opt-in
ananthb 79288fd
bcachefs: address copilot review nits
ananthb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
| rootfs="${1}" | ||
|
|
||
| pushd "${rootfs}" | ||
|
|
||
| # Drop dev/debug/initramfs files — the sysext only needs runtime bits. | ||
| rm -rf ./usr/{lib/debug/,lib64/cmake/,include/} | ||
| rm -rf ./usr/lib/dracut/ | ||
| rm -rf ./usr/share/initramfs-tools | ||
| rm -rf ./usr/src | ||
| rm -rf ./usr/share/man | ||
| rm -rf ./usr/share/doc | ||
| rm -rf ./usr/lib/pkgconfig | ||
| rm -rf ./usr/lib64/pkgconfig | ||
|
|
||
| # /usr/sbin on Flatcar is a symlink to /usr/bin; shipping a /usr/sbin | ||
| # directory in a sysext would clobber the symlink at merge time. Relocate | ||
| # anything the tools ebuild installed there. `cp -a src/. dst/` includes | ||
| # dotfiles (Portage `.keep*` placeholders) so nothing lingers to make the | ||
| # subsequent `rm -rf` racy. | ||
| if [ -d ./usr/sbin ]; then | ||
| mkdir -p ./usr/bin | ||
| cp -a ./usr/sbin/. ./usr/bin/ | ||
| rm -rf ./usr/sbin | ||
| fi | ||
|
ananthb marked this conversation as resolved.
Comment on lines
+23
to
+27
|
||
|
|
||
| popd | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Enabled the in-tree bcachefs kernel module (`CONFIG_BCACHEFS_FS=m` with POSIX ACLs) and provided a companion bcachefs Flatcar extension as an optional systemd-sysext image with the release. Write `bcachefs` to `/etc/flatcar/enabled-sysext.conf` through Ignition and the sysext will be installed during provisioning; it ships the userspace utilities (`mkfs.bcachefs`, `mount.bcachefs`, ...) that pair with the kernel module. bcachefs is still experimental (pre-1.0 on-disk format) and is not supported for the root partition. | ||
|
ananthb marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
sdk_container/src/third_party/portage-stable/sys-fs/bcachefs-tools/Manifest
Large diffs are not rendered by default.
Oops, something went wrong.
350 changes: 350 additions & 0 deletions
350
...ntainer/src/third_party/portage-stable/sys-fs/bcachefs-tools/bcachefs-tools-1.38.6.ebuild
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,350 @@ | ||
| # Copyright 1999-2026 Gentoo Authors | ||
| # Distributed under the terms of the GNU General Public License v2 | ||
|
|
||
| EAPI=8 | ||
|
|
||
| CRATES=" | ||
| aho-corasick@1.1.3 | ||
| android_system_properties@0.1.5 | ||
| anstream@0.6.15 | ||
| anstyle-parse@0.2.5 | ||
| anstyle-query@1.1.1 | ||
| anstyle-wincon@3.0.4 | ||
| anstyle@1.0.8 | ||
| anyhow@1.0.89 | ||
| ascii@1.1.0 | ||
| autocfg@1.5.0 | ||
| bindgen@0.72.1 | ||
| bitfield@0.14.0 | ||
| bitflags@1.3.2 | ||
| bitflags@2.11.0 | ||
| bumpalo@3.19.1 | ||
| cc@1.2.55 | ||
| cexpr@0.6.0 | ||
| cfg-if@1.0.0 | ||
| cfg_aliases@0.2.1 | ||
| chrono@0.4.43 | ||
| chunked_transfer@1.5.0 | ||
| clang-sys@1.8.1 | ||
| clap@4.5.20 | ||
| clap_builder@4.5.20 | ||
| clap_complete@4.5.33 | ||
| clap_derive@4.5.18 | ||
| clap_lex@0.7.2 | ||
| colorchoice@1.0.2 | ||
| core-foundation-sys@0.8.7 | ||
| crossterm@0.28.1 | ||
| either@1.13.0 | ||
| env_logger@0.10.2 | ||
| equivalent@1.0.2 | ||
| errno@0.3.9 | ||
| fiemap@0.2.0 | ||
| find-msvc-tools@0.1.9 | ||
| fuser@0.17.0 | ||
| getrandom@0.2.17 | ||
| glob@0.3.1 | ||
| hashbrown@0.16.1 | ||
| heck@0.5.0 | ||
| httpdate@1.0.3 | ||
| iana-time-zone-haiku@0.1.2 | ||
| iana-time-zone@0.1.65 | ||
| indexmap@2.13.0 | ||
| is_terminal_polyfill@1.70.1 | ||
| itertools@0.12.1 | ||
| itoa@1.0.17 | ||
| js-sys@0.3.85 | ||
| libc@0.2.180 | ||
| libloading@0.8.5 | ||
| libudev-sys@0.1.4 | ||
| linux-raw-sys@0.4.14 | ||
| lock_api@0.4.14 | ||
| log@0.4.22 | ||
| memchr@2.7.4 | ||
| memoffset@0.9.1 | ||
| minimal-lexical@0.2.1 | ||
| mio@1.1.1 | ||
| nix@0.30.1 | ||
| nom@7.1.3 | ||
| num-traits@0.2.19 | ||
| num_enum@0.7.5 | ||
| num_enum_derive@0.7.5 | ||
| once_cell@1.20.2 | ||
| owo-colors@4.1.0 | ||
| page_size@0.6.0 | ||
| parking_lot@0.12.5 | ||
| parking_lot_core@0.9.12 | ||
| paste@1.0.15 | ||
| pkg-config@0.3.31 | ||
| prettyplease@0.2.22 | ||
| proc-macro-crate@3.4.0 | ||
| proc-macro2@1.0.87 | ||
| quote@1.0.37 | ||
| redox_syscall@0.5.18 | ||
| ref-cast-impl@1.0.25 | ||
| ref-cast@1.0.25 | ||
| regex-automata@0.4.8 | ||
| regex-syntax@0.8.5 | ||
| regex@1.11.0 | ||
| rustc-demangle@0.1.27 | ||
| rustc-hash@2.1.1 | ||
| rustix@0.38.37 | ||
| rustversion@1.0.17 | ||
| ryu@1.0.22 | ||
| scopeguard@1.2.0 | ||
| serde@1.0.228 | ||
| serde_core@1.0.228 | ||
| serde_derive@1.0.228 | ||
| serde_json@1.0.143 | ||
| shlex@1.3.0 | ||
| signal-hook-mio@0.2.5 | ||
| signal-hook-registry@1.4.8 | ||
| signal-hook@0.3.18 | ||
| smallvec@1.15.1 | ||
| strsim@0.11.1 | ||
| strum@0.26.3 | ||
| strum_macros@0.26.4 | ||
| syn@2.0.87 | ||
| terminal_size@0.4.0 | ||
| tiny_http@0.12.0 | ||
| toml_datetime@0.7.5+spec-1.1.0 | ||
| toml_edit@0.23.10+spec-1.0.0 | ||
| toml_parser@1.0.9+spec-1.1.0 | ||
| udev@0.7.0 | ||
| unicode-ident@1.0.13 | ||
| utf8parse@0.2.2 | ||
| uuid@1.10.0 | ||
| wasi@0.11.1+wasi-snapshot-preview1 | ||
| wasm-bindgen-macro-support@0.2.108 | ||
| wasm-bindgen-macro@0.2.108 | ||
| wasm-bindgen-shared@0.2.108 | ||
| wasm-bindgen@0.2.108 | ||
| winapi-i686-pc-windows-gnu@0.4.0 | ||
| winapi-x86_64-pc-windows-gnu@0.4.0 | ||
| winapi@0.3.9 | ||
| windows-core@0.62.2 | ||
| windows-implement@0.60.2 | ||
| windows-interface@0.59.3 | ||
| windows-link@0.2.1 | ||
| windows-result@0.4.1 | ||
| windows-strings@0.5.1 | ||
| windows-sys@0.52.0 | ||
| windows-sys@0.59.0 | ||
| windows-sys@0.61.2 | ||
| windows-targets@0.52.6 | ||
| windows_aarch64_gnullvm@0.52.6 | ||
| windows_aarch64_msvc@0.52.6 | ||
| windows_i686_gnu@0.52.6 | ||
| windows_i686_gnullvm@0.52.6 | ||
| windows_i686_msvc@0.52.6 | ||
| windows_x86_64_gnu@0.52.6 | ||
| windows_x86_64_gnullvm@0.52.6 | ||
| windows_x86_64_msvc@0.52.6 | ||
| winnow@0.7.14 | ||
| zerocopy-derive@0.8.27 | ||
| zerocopy@0.8.27 | ||
| zeroize@1.8.1 | ||
| zeroize_derive@1.4.2 | ||
| " | ||
|
|
||
| LLVM_COMPAT=( {17..21} ) | ||
| MODULES_INITRAMFS_IUSE=+initramfs | ||
| MODULES_KERNEL_MIN=6.16 | ||
| MODULES_OPTIONAL_IUSE=+modules | ||
|
ananthb marked this conversation as resolved.
Outdated
|
||
| PYTHON_COMPAT=( python3_{11..14} ) | ||
| RUST_MIN_VER="1.85.0" | ||
| VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kentoverstreet.asc | ||
|
|
||
| inherit cargo flag-o-matic linux-mod-r1 llvm-r2 python-any-r1 | ||
| inherit shell-completion sysroot toolchain-funcs unpacker verify-sig | ||
|
|
||
| DESCRIPTION="Tools for bcachefs" | ||
| HOMEPAGE="https://bcachefs.org/" | ||
| if [[ ${PV} == "9999" ]]; then | ||
| inherit git-r3 | ||
| EGIT_REPO_URI="https://evilpiepirate.org/git/bcachefs-tools.git" | ||
| else | ||
| SRC_URI="https://evilpiepirate.org/bcachefs-tools/bcachefs-tools-${PV}.tar.zst | ||
| ${CARGO_CRATE_URIS} | ||
| " | ||
| SRC_URI+=" verify-sig? ( https://evilpiepirate.org/bcachefs-tools/bcachefs-tools-${PV}.tar.sign )" | ||
| S="${WORKDIR}/${P}" | ||
| KEYWORDS="~amd64 ~arm64" | ||
| fi | ||
|
|
||
| LICENSE="GPL-2" | ||
| # Dependent crate licenses | ||
| LICENSE+=" Apache-2.0 BSD ISC MIT Unicode-DFS-2016" | ||
| SLOT="0" | ||
| IUSE="debug llvm-libunwind verify-sig" | ||
| RESTRICT="test" | ||
|
|
||
| DEPEND=" | ||
| app-arch/lz4:= | ||
| app-arch/zstd:= | ||
| dev-libs/libaio | ||
| dev-libs/libsodium:= | ||
| dev-libs/userspace-rcu:= | ||
| sys-apps/keyutils:= | ||
| sys-apps/util-linux | ||
| llvm-libunwind? ( llvm-runtimes/libunwind:= ) | ||
| !llvm-libunwind? ( sys-libs/libunwind:= ) | ||
| virtual/udev | ||
| virtual/zlib:= | ||
| " | ||
|
|
||
| RDEPEND="${DEPEND}" | ||
|
|
||
| # Clang is required for bindgen | ||
| BDEPEND=" | ||
| ${PYTHON_DEPS} | ||
| $(python_gen_any_dep ' | ||
| dev-python/docutils[${PYTHON_USEDEP}] | ||
| ') | ||
| $(unpacker_src_uri_depends) | ||
| $(llvm_gen_dep ' | ||
| llvm-core/clang:${LLVM_SLOT} | ||
| ') | ||
| elibc_musl? ( >=sys-libs/musl-1.2.5 ) | ||
| virtual/pkgconfig | ||
| modules? ( >=sys-kernel/linux-headers-6.16.0 ) | ||
| verify-sig? ( >=sec-keys/openpgp-keys-kentoverstreet-20241012 ) | ||
| " | ||
|
|
||
| QA_FLAGS_IGNORED="/sbin/bcachefs" | ||
|
ananthb marked this conversation as resolved.
Outdated
|
||
|
|
||
| python_check_deps() { | ||
| python_has_version "dev-python/docutils[${PYTHON_USEDEP}]" | ||
| } | ||
|
|
||
| pkg_setup() { | ||
| llvm-r2_pkg_setup | ||
| python-any-r1_pkg_setup | ||
| rust_pkg_setup | ||
| if use modules; then | ||
| # grep -r 'depends on\|select ' ${S}/libbcachefs/Kconfig | grep -v '^#' | ||
| local CONFIG_CHECK=" | ||
| !BCACHEFS_FS | ||
| BLOCK | ||
| EXPORTFS | ||
| CRC32 | ||
| CRC64 | ||
| FS_POSIX_ACL | ||
| LZ4_COMPRESS | ||
| LZ4_DECOMPRESS | ||
| LZ4HC_COMPRESS | ||
| ZLIB_DEFLATE | ||
| ZLIB_INFLATE | ||
| ZSTD_COMPRESS | ||
| ZSTD_DECOMPRESS | ||
| CRYPTO_LIB_SHA256 | ||
| CRYPTO_LIB_CHACHA | ||
| CRYPTO_LIB_POLY1305 | ||
| KEYS | ||
| RAID6_PQ | ||
| RUST | ||
| XOR_BLOCKS | ||
| XXHASH | ||
| SYMBOLIC_ERRNAME | ||
| " | ||
| use debug && CONFIG_CHECK+=" | ||
| DEBUG_INFO | ||
| FRAME_POINTER | ||
| !DEBUG_INFO_REDUCED | ||
| " | ||
| linux-mod-r1_pkg_setup | ||
| fi | ||
| } | ||
|
|
||
| src_unpack() { | ||
| if [[ ${PV} == "9999" ]]; then | ||
| git-r3_src_unpack | ||
| S="${S}/src" cargo_live_src_unpack | ||
| else | ||
| if use verify-sig; then | ||
| # Upstream signs the uncompressed tarball. Stream-verify the | ||
| # detached signature while extracting the tarball via tee, | ||
| # leaving the source tree in place. | ||
| einfo "Verifying and unpacking ${P}.tar.zst ..." | ||
| verify-sig_verify_detached - "${DISTDIR}"/${P}.tar.sign \ | ||
| < <(zstd -fdc "${DISTDIR}"/${P}.tar.zst | tee >(tar -xf -)) | ||
| assert "Unpack failed" | ||
| # Filter the tarball and its detached signature out of ${A} | ||
| # so cargo_src_unpack doesn't re-extract the tarball or feed | ||
| # the .sign file to unpack (which would die). | ||
| local A=${A//${P}.tar.zst/} | ||
| A=${A//${P}.tar.sign/} | ||
| fi | ||
|
ananthb marked this conversation as resolved.
|
||
| # cargo_src_unpack extracts the vendored Cargo crates and, when | ||
| # not filtered above, the source tarball itself. | ||
| cargo_src_unpack | ||
| fi | ||
| } | ||
|
ananthb marked this conversation as resolved.
|
||
|
|
||
| src_prepare() { | ||
| default | ||
| tc-export CC | ||
|
|
||
| echo "${PV}" > .version || die | ||
| sed \ | ||
| -e '/^CFLAGS/s:-O2::' \ | ||
| -e '/^CFLAGS/s:-g::' \ | ||
| -i Makefile || die | ||
|
|
||
| if use llvm-libunwind; then | ||
| sed -i s/libunwind// Makefile || die | ||
| fi | ||
|
|
||
| append-lfs-flags | ||
| } | ||
|
|
||
| src_configure() { | ||
| cargo_src_configure | ||
|
|
||
| MODULE_SRC="module/${PN%-*}-${PV}" | ||
| use modules && emake DESTDIR="${WORKDIR}" DKMSDIR="/${MODULE_SRC}" install_dkms | ||
| } | ||
|
|
||
| src_compile() { | ||
| export BUILD_VERBOSE=1 | ||
| export VERSION=${PV} | ||
|
|
||
| local modlist=( "bcachefs=:../${MODULE_SRC}:../${MODULE_SRC}/src/fs/bcachefs" ) | ||
| local modargs=( | ||
| KDIR=${KV_OUT_DIR} | ||
| ) | ||
|
|
||
| # Makefile calls `cargo` directly, so make sure we set our rustflags (etc) | ||
| cargo_env emake bcachefs || die | ||
| use modules && linux-mod-r1_src_compile | ||
|
|
||
| # Recent versions mangle the 'bcachefs' symbolic link. Force the link | ||
| # unconditionally so this keeps working once upstream stops mangling. | ||
| ln -rsf target/release/bcachefs bcachefs || die | ||
|
|
||
| local shell | ||
| for shell in bash fish zsh; do | ||
| sysroot_try_run_prefixed ./bcachefs completions ${shell} > ${shell}.completion || die | ||
| done | ||
| } | ||
|
|
||
| src_install() { | ||
| into / | ||
| dosbin bcachefs | ||
|
|
||
| dosym bcachefs /sbin/fsck.bcachefs | ||
| dosym bcachefs /sbin/mkfs.bcachefs | ||
| dosym bcachefs /sbin/mount.bcachefs | ||
|
|
||
|
ananthb marked this conversation as resolved.
Outdated
|
||
| # Uses a crate-based implementation of FUSE, no dependency on sys-fs/fuse and unconditionally included. | ||
| dosym bcachefs /sbin/fsck.fuse.bcachefs | ||
| dosym bcachefs /sbin/mkfs.fuse.bcachefs | ||
| dosym bcachefs /sbin/mount.fuse.bcachefs | ||
|
|
||
|
ananthb marked this conversation as resolved.
Outdated
|
||
| newbashcomp bash.completion bcachefs | ||
| newfishcomp fish.completion bcachefs.fish | ||
| newzshcomp zsh.completion _bcachefs | ||
|
|
||
| doman bcachefs.8 | ||
|
|
||
| use modules && linux-mod-r1_src_install | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.