Christophe Leroy
2019-Jan-23 06:16 UTC
[klibc] [PATCH v2] fix build failure when CONFIG_KLIBC_ZLIB is not set
When CONFIG_KLIBC_ZLIB is not set, related functions shall not be called otherwise build failure is encountered: KLIBCLD usr/kinit/static/kinit usr/kinit/ramdisk_load.o: In function `load_ramdisk_compressed': /root/ldb_base/ofl/packages/klibc/usr/kinit/ramdisk_load.c:68: undefined reference to `inflateInit2_' /root/ldb_base/ofl/packages/klibc/usr/kinit/ramdisk_load.c:116: undefined reference to `inflate' /root/ldb_base/ofl/packages/klibc/usr/kinit/ramdisk_load.c:128: undefined reference to `inflateEnd' /root/ldb_base/ofl/packages/klibc/usr/kinit/ramdisk_load.c:132: undefined reference to `inflateEnd' make[2]: *** [usr/kinit/shared/kinit] Error 1 When CONFIG_KLIBC_ZLIB is not set, this patch redefines load_ramdisk_compressed() as a simple function printing an error message and returning -1 Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr> --- v2: defined an alternative load_ramdisk_compressed() instead of an ifdef mess. usr/kinit/ramdisk_load.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/usr/kinit/ramdisk_load.c b/usr/kinit/ramdisk_load.c index 2b3503ad..f43339c8 100644 --- a/usr/kinit/ramdisk_load.c +++ b/usr/kinit/ramdisk_load.c @@ -46,6 +46,7 @@ static int change_disk(const char *devpath, int rfd, int disk) return open(devpath, O_RDONLY); } +#ifdef CONFIG_KLIBC_ZLIB /* Also used in initrd.c */ int load_ramdisk_compressed(const char *devpath, FILE * wfd, off_t ramdisk_start) @@ -133,6 +134,14 @@ err2: err1: return -1; } +#else +int load_ramdisk_compressed(const char *devpath, FILE * wfd, + off_t ramdisk_start) +{ + fprintf(stderr, "Compressed ramdisk not supported\n"); + return -1; +} +#endif static int load_ramdisk_raw(const char *devpath, FILE * wfd, off_t ramdisk_start, -- 2.13.3
Reasonably Related Threads
- [PATCH] fix build failure when CONFIG_KLIBC_ZLIB is not set
- [klibc:master] fix build failure when CONFIG_KLIBC_ZLIB is not set
- [PATCH] Kbuild for klibc and nfsmount: add -fcommon
- [PATCH] Kbuild for klibc and nfsmount: fix multiple definitions
- [klibc:master] Clean up clang warnings