2023年12月23日发(作者:)

LZMA压缩img文件实例

在制作内存系统RAMOS时,会用到wingzip来压缩img文件,但wingzip不能压缩超过4G的文件,新版本的Grub4DOS支持LZMA压缩文件,只好用LZMA代替wingzip。

下载LZMA,下载地址:

/grub2/

解压,里面的就是我们需要的程序, 把复制到D盘根目录。

第一步,用DiskGenius在D盘新建一个1024MB的img文件。

1

2

点击左上角的“保存更改”按钮

3

点击“是”按钮

4

第二步,用压缩img文件

在命令行提示符里运行

D:>lzma /?

LZMA 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06

Error: Incorrect command

Usage: LZMA inputFile outputFile [...]

e: encode file

d: decode file

b: Benchmark

-a{N}: set compression mode - [0, 1], default: 1 (max)

-d{N}: set dictionary - [0,30], default: 23 (8MB)

-fb{N}: set number of fast bytes - [5, 273], default: 128

-mc{N}: set number of cycles for match finder

-lc{N}: set number of literal context bits - [0, 8], default: 3

-lp{N}: set number of literal pos bits - [0, 4], default: 0

-pb{N}: set number of pos bits - [0, 4], default: 2

5

-mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, hc4], default: bt4

-mt{N}: set number of CPU threads

-eos: write End Of Stream marker

-si: read data from stdin

-so: write data to stdout

找到要用到的参数,e——压缩,-mt{N}——CPU线程数,我的CPU是4核的Q9500,输入命令:

D:>Lzma e D: D: –mt4

LZMA 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06

D:>

等待两分钟,压缩完毕。

6