chishanmingshen 发表于 2014-05-26 20:48

回复 10# wangcong02345


    你看的函数decompressor是哪一个?:D

wangcong02345 发表于 2014-05-28 11:26

decompress = decompress_method(buf, len, &compress_name);这个函数根据压缩文件(ramdisk.img)的头两个字节(0x1f,0x8b)
在内核文件lib/decompress.c中有 34 static const struct compress_format {
35   unsigned char magic;
36   const char *name;
37   decompress_fn decompressor;
38 } compressed_formats[] = {
39   { {037, 0213}, "gzip", gunzip },            //转为16进制0x1f 0x8b
40   { {037, 0236}, "gzip", gunzip },
41   { {0x42, 0x5a}, "bzip2", bunzip2 },
42   { {0x5d, 0x00}, "lzma", unlzma },
43   { {0xfd, 0x37}, "xz", unxz },
44   { {0x89, 0x4c}, "lzo", unlzo },
45   { {0, 0}, NULL, NULL }
46 };所以解压调用的是内核的lib/decompress_inflate.c中的gunzip这个函数

chishanmingshen 发表于 2014-05-28 19:02

回复 12# wangcong02345


    谢谢!
页: 1 [2]
查看完整版本: 关于unpack_to_rootfs()的疑问