diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2019-01-23 06:16:01 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-01-24 23:11:11 +0000 |
commit | 534a04d85defc627b031906d27cd9d09a913adc4 (patch) | |
tree | 53d8e913914bc3a97dc259f6f682969a7d996883 | |
parent | 8418552770110e9864ab24d60d8481fac58d3a65 (diff) | |
download | klibc-534a04d85defc627b031906d27cd9d09a913adc4.tar.gz |
[klibc] 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@c-s.fr>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/kinit/ramdisk_load.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/usr/kinit/ramdisk_load.c b/usr/kinit/ramdisk_load.c index 2b3503ad6a45d..f43339c8fc74d 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, |