I am currently using the 4.9 kernel, which does not support the zstd compression method. However, I want to add zstd compression support to it, but I don't know how to do that.
attempted to follow the method of adding zstd in the x86 architecture of the 6.7 kernel, but it seems I failed. This might be due to not modifying the essential parts. Currently, I have: 1、Added the following code in arch/arm/boot/compressed/decompress.c:
#ifdef CONFIG_KERNEL_ZSTD
#include "../../../../lib/decompress_unzstd.c"
#endif
2、Added the following line in arch/arm/boot/compressed/Makefile:
compress-$(CONFIG_KERNEL_ZSTD) = zstd
I also made some modifications to the Makefile to ensure that I can select zstd in kernel_menuconfig. However, I am unsure about how to determine if I have the relevant decompression code for zstd. I think decompress_unzstd.c is the relevant code. After compilation, I received the following error:
/bin/sh: 1: Syntax error: ";" unexpected
make[7]: *** [arch/arm/boot/compressed/Makefile:187: arch/arm/boot/compressed/piggy_data] Error 2
make[6]: *** [arch/arm/boot/Makefile:62: arch/arm/boot/compressed/vmlinux] Error 2
make[5]: *** [arch/arm/Makefile:331: zImage] Error 2
you should add follow config in you config file,and recompile again
Here it indicates a compilation error. Could you please double-check whether the line containing CONFIG_KERNEL_ZSTD is at line 187? If it is, then CONFIG_KERNEL_ZSTD might not be configured in the config file, and the configuration method is as mentioned above.