The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c61ee49cd06a610193493f033f04d38cf61f11e2
commit c61ee49cd06a610193493f033f04d38cf61f11e2 Author: Warner Losh <[email protected]> AuthorDate: 2026-07-11 14:46:19 +0000 Commit: Warner Losh <[email protected]> CommitDate: 2026-07-11 19:28:47 +0000 loader: zstd based filesystem, zstdfs like gzipfs Off by default. Sponsored by: Netflix --- stand/efi/loader/conf.c | 1 + stand/i386/loader/conf.c | 1 + stand/kboot/kboot/conf.c | 4 ++++ stand/libsa/Makefile | 6 ++++++ stand/libsa/libsa.3 | 14 ++++++++++++++ stand/libsa/stand.h | 1 + stand/userboot/userboot/conf.c | 1 + 7 files changed, 28 insertions(+) diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c index 4f257dc5ba23..30d9b95739e8 100644 --- a/stand/efi/loader/conf.c +++ b/stand/efi/loader/conf.c @@ -57,6 +57,7 @@ struct devsw *devsw[] = { struct fs_ops *file_system[] = { #ifdef EFI_ZFS_BOOT &zfs_fsops, + &zstdfs_fsops, #endif &dosfs_fsops, &ufs_fsops, diff --git a/stand/i386/loader/conf.c b/stand/i386/loader/conf.c index 643990699ca1..3360c2722035 100644 --- a/stand/i386/loader/conf.c +++ b/stand/i386/loader/conf.c @@ -62,6 +62,7 @@ struct devsw *devsw[] = { struct fs_ops *file_system[] = { #if defined(LOADER_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif #if defined(LOADER_UFS_SUPPORT) &ufs_fsops, diff --git a/stand/kboot/kboot/conf.c b/stand/kboot/kboot/conf.c index 5d384c5270e6..03c3ea750e76 100644 --- a/stand/kboot/kboot/conf.c +++ b/stand/kboot/kboot/conf.c @@ -85,11 +85,15 @@ struct fs_ops *file_system[] = { #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, #endif +#if defined(LOADER_XZ_SUPPORT) + &xzfs_fsops, +#endif #if defined(LOADER_MSDOS_SUPPORT) &dosfs_fsops, #endif #if defined(LOADER_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif &hostfs_fsops, NULL diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 2bb33060ee2a..173dec69657d 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -192,6 +192,12 @@ SRCS+= g_eli_hmac.c pkcs5v2.c # Maybe ZFS .if ${MK_LOADER_ZFS} == "yes" .include "${SASRC}/zfs/Makefile.inc" + +# zstdfs.c is a stacked filesystem for .zst files, like gzipfs.c/bzipfs.c +# above; it's only buildable here because zfs/Makefile.inc already pulled +# the zstd decompressor in for ZFS's on-disk compression. +SRCS+= zstdfs.c +CFLAGS.zstdfs.c+= ${ZSTD_CFLAGS} .endif # Crypto hashing functions diff --git a/stand/libsa/libsa.3 b/stand/libsa/libsa.3 index 0947f97a0a1f..a44588901f8b 100644 --- a/stand/libsa/libsa.3 +++ b/stand/libsa/libsa.3 @@ -781,6 +781,20 @@ The same as but for .Xr bzip2 1 Ns -compressed files. +.It Va xzfs_fsops +The same as +.Va gzipfs_fsops , +but for +.Xr xz 1 Ns -compressed +files. +.It Va zstdfs_fsops +The same as +.Va gzipfs_fsops , +but for +.Xr zstd 1 Ns -compressed +files. +Only available when built with ZFS support, since that is the only +source of the zstd decompressor in the boot loader environment. .It Va pkgfs_fsops File access from a tar file typically streamed via TFTP. The order of files in the tar file must match the order they are diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 3cb227ce2079..6e363b145595 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -131,6 +131,7 @@ extern struct fs_ops cd9660_fsops; extern struct fs_ops gzipfs_fsops; extern struct fs_ops bzipfs_fsops; extern struct fs_ops xzfs_fsops; +extern struct fs_ops zstdfs_fsops; extern struct fs_ops dosfs_fsops; extern struct fs_ops ext2fs_fsops; extern struct fs_ops splitfs_fsops; diff --git a/stand/userboot/userboot/conf.c b/stand/userboot/userboot/conf.c index 8d37f241c9bf..662f4e405f0a 100644 --- a/stand/userboot/userboot/conf.c +++ b/stand/userboot/userboot/conf.c @@ -67,6 +67,7 @@ struct fs_ops *file_system[] = { &cd9660_fsops, #if defined(USERBOOT_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif &gzipfs_fsops, &bzipfs_fsops,
