内核版本 2.6.33.9
make zImage时出现如下错误:
LD arch/arm/boot/compressed/vmlinux
arch/arm/boot/compressed/decompress.o(.text+0x23c0): In function `do_decompress':
arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:67: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x23e0):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:73: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2404):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:80: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2468):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:95: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2548):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:152: undefined reference to `error'
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/boot/compressed/Makefile:111: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/boot/Makefile:54: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/Makefile:252: recipe for target 'zImage' failed
make: *** [zImage] Error 2
根据提示中目录 ./arch/arm/boot/compressed/decompress.o找到decompress.c文件,查看源码,发现do_decompress函数并无问题。
void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{
decompress(input, len, NULL, NULL, output, NULL, error); }
然后查看源码中所引用目录及文件,发现./lib/decompress_inflate.c 找到其所在目录,打开文件,发现末尾行对decompress 函数的定义为 #define decompress gunzip
再在当前文件下找到 gunzip 的定义,
STATIC int INIT gunzip(unsigned char *buf, int len,
int(*fill)(void*, unsigned int),
int(*flush)(void*, unsigned int),
unsigned char *out_buf,
int *pos,
void(*error_fn)(char *x))
发现所用为error_fn 而非 error,于是改回error后发现仍然出现错误,
参考http://blog.csdn.net/einsteinz/article/details/5757607 文章中所提,将decompress.c 中所有error 改为error_fn 发现可以继续编译。