To be a better coder
分类: LINUX
2018-08-27 14:30:31
1.从网站下载 squashfs4.3.tar.gz 或者 squashfs4.2.tar.gz
2.解压 squashfs.tar.gz
3.cd squashfs.4.x
4.cd squashfs-tools
5.修改Makefile 去掉 XZ_SUPPORT 1 这一行首的 # 号,保存退出
6.make clean;make
7.没什么问题可以得到squashfs unsquashfs这两个工具
8.执行unsquashfs -h可以看到它支持的信息:
# ./unsquashfs -h
SYNTAX: ./unsquashfs [options] filesystem [directories or files to extract]
-v[ersion] print version, licence and copyright information
-d[est] unsquash to , default "squashfs-root"
-n[o-progress] don't display the progress bar
-no[-xattrs] don't extract xattrs in file system
-x[attrs] extract xattrs in file system (default)
-p[rocessors] use processors. By default will use
number of processors available
-i[nfo] print files as they are unsquashed
-li[nfo] print files as they are unsquashed with file
attributes (like ls -l output)
-l[s] list filesystem, but don't unsquash
-ll[s] list filesystem with file attributes (like
ls -l output), but don't unsquash
-f[orce] if file already exists then overwrite
-s[tat] display filesystem superblock information
-e[f] list of directories or files to extract.
One per line
-da[ta-queue] Set data queue to Mbytes. Default 256
Mbytes
-fr[ag-queue] Set fragment queue to Mbytes. Default
256 Mbytes
-r[egex] treat extract names as POSIX regular expressions
rather than use the default shell wildcard
expansion (globbing)
Decompressors available:
gzip
xz
9.解压指令:
例如文件rootfs-cpio.squashfs.img
./unsquashfs rootfs-cpio.squashfs.img
执行完毕后会在当前目录下创建squashfs-root目录,东西都在里头
From
1、普通squashfs文件解压缩及查看
(1) 可使用unsuqashfs命令直接解压缩。
[root@localhost squashfs]# unsquashfs squashfs.img
(2)也可mount到临时目录
[root@localhost squashfs]# mount -o loop squashfs.img -t squashfs temp/
2、XZ算法压缩后的squashfs.img解压缩与查看
下载Fedora 15 Live CD后,尝试解压缩ISO中的squashfs.img文件,发现无法mount,也无法通过unsquashfs命令解压缩。提示“Filesystem uses xz compression, this is unsupported by this version”。但下载到的最新squashfs 4.2版本,提示XZ压缩算法的。
下载最新的squashfs工具,发现Makefile有个选项,“#XZ_SUPPORT = 1”,选择打开XZ_SUPPORT=1,保存退出。重新编译后,就可以解压缩使用XZ算法压缩的squashfs.img文件了。