- 論壇徽章:
- 0
|
decompress = decompress_method(buf, len, &compress_name); 這個(gè)函數(shù)根據(jù)壓縮文件(ramdisk.img)的頭兩個(gè)字節(jié)(0x1f,0x8b)
在內(nèi)核文件lib/decompress.c中有- 34 static const struct compress_format {
- 35 unsigned char magic[2];
- 36 const char *name;
- 37 decompress_fn decompressor;
- 38 } compressed_formats[] = {
- 39 { {037, 0213}, "gzip", gunzip }, //轉(zhuǎn)為16進(jìn)制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 };
復(fù)制代碼 所以解壓調(diào)用的是內(nèi)核的lib/decompress_inflate.c中的gunzip這個(gè)函數(shù) |
|