boot/loader: Add Zstd support.

This commit is contained in:
Augustin Cavalier 2021-10-19 17:45:42 -04:00
parent 7bd549882a
commit d3ed786f07
3 changed files with 34 additions and 1 deletions

View File

@ -335,6 +335,7 @@ for platform in [ MultiBootSubDirSetup ] {
# needed by tarfs, packagefs, and video_splash.cpp
boot_zlib.a
boot_zstd.a
]
# libroot functions needed by the stage2 boot loader
boot_libroot_$(platform:G=).o

View File

@ -16,6 +16,19 @@ local zlibSources =
zutil.c
;
local zstdSourceDirectory = [ BuildFeatureAttribute zstd : sources : path ] ;
UseHeaders [ FDirName $(zstdSourceDirectory) lib ] ;
UseHeaders [ FDirName $(zstdSourceDirectory) lib common ] ;
local zstdCommonSources =
error_private.c
entropy_common.c fse_decompress.c zstd_common.c
xxhash.c
;
local zstdDecSources =
huf_decompress.c zstd_ddict.c zstd_decompress.c zstd_decompress_block.c
;
local platform ;
for platform in [ MultiBootSubDirSetup ] {
on $(platform) {
@ -30,5 +43,20 @@ for platform in [ MultiBootSubDirSetup ] {
BootStaticLibrary [ MultiBootGristFiles boot_zlib ] :
$(zlibSources)
;
# zstd
LOCATE on [ FGristFiles $(zstdCommonSources) ] =
[ FDirName $(zstdSourceDirectory) lib common ] ;
LOCATE on [ FGristFiles $(zstdDecSources) ] =
[ FDirName $(zstdSourceDirectory) lib decompress ] ;
# tune build for smaller size
DEFINES += HUF_FORCE_DECOMPRESS_X1 ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ;
BootStaticLibrary [ MultiBootGristFiles boot_zstd ] :
$(zstdCommonSources) $(zstdDecSources)
;
Depends [ FGristFiles $(zstdCommonSources) $(zstdDecSources) ]
: [ BuildFeatureAttribute zstd : sources ] ;
}
}

View File

@ -2,8 +2,9 @@ SubDir HAIKU_TOP src system boot loader file_systems packagefs ;
UsePrivateHeaders kernel shared storage support ;
UseBuildFeatureHeaders zlib ;
UseBuildFeatureHeaders zstd ;
DEFINES += _BOOT_MODE ;
DEFINES += _BOOT_MODE ZSTD_ENABLED ;
local kernelC++Header = [ FDirName $(HAIKU_TOP) headers private kernel util
kernel_cpp.h ] ;
@ -44,9 +45,12 @@ for platform in [ MultiBootSubDirSetup ] {
# support kit
CompressionAlgorithm.cpp
ZlibCompressionAlgorithm.cpp
ZstdCompressionAlgorithm.cpp
;
Includes [ FGristFiles ZlibCompressionAlgorithm.cpp ]
: [ BuildFeatureAttribute zlib : headers ] ;
Includes [ FGristFiles ZstdCompressionAlgorithm.cpp ]
: [ BuildFeatureAttribute zstd : headers ] ;
}
}