uboot 解壓縮
在uboot中進行解壓縮是很有用的
uboot中完成delay 使用者進行互動的段
if(BootType == '3') {
char *argv[3];
printf(" \n3: System Boot system code via Flash.\n");。。。。
以下就是要進入kernel拷貝內容了
因為kernel的尺寸比較大 一般會達到3M以上 這樣用串列埠或者網路都會比較耗費時間 也會浪費寶貴的記憶體
解決方法就是傳輸和儲存都用壓縮過的 應用的時候在進行解壓
uboot中已經整合了集中常用的解壓縮程式,一般常見的gzip 、 bzip 、 lzma 都已經存在。
我們只需要呼叫就可以了,這裡給出一個建立解壓縮命令的方法。建立新的命令在簽名的部落格已經寫了 ,這裡就直接引用結果了
#include <common.h>
#include <command.h>
u32 ret_decomps;
#ifdef CONFIG_CMD_DECOMPRESS
do_compress(cmd_tbl_t *cmdtp,int flag,int argc,char *argv[])
{
u32 destLen = 0,len;
len = simple_strtoul(argv[1], NULL, 16);
printf("decompress start");
//lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize, unsigned char *inStream, SizeT length)
ret_decomps = lzmaBuffToBuffDecompress ((char *)0xa2000000, &destLen, (char *)0xa1000000, len);
printf("decompress finish");
return 0;
}
U_BOOT_CMD(
decomps,5,1,do_compress,"decompress test\n","decompress:addr \n"
);
#endif
這裡明有一些除錯的資訊沒除去,反正不影響結果。
插一點,開啟debug列印的方法
在uboot中可以看到有很多的debug列印資訊
debug ("LZMA: Image address............... 0x%lx\n", inStream);
debug ("LZMA: Properties address.......... 0x%lx\n", inStream + LZMA_PROPERTIES_OFFSET);
debug ("LZMA: Uncompressed size address... 0x%lx\n", inStream + LZMA_SIZE_OFFSET);
debug ("LZMA: Compressed data address..... 0x%lx\n", inStream + LZMA_DATA_OFFSET);
debug ("LZMA: Destination address......... 0x%lx\n", outStream);
雖然自己也可以用print函式實現 , 但是不如直接開啟省事的 。可以在對應的.h檔案中增加一個
#define DEBUG
這樣上面那些列印就可以列印出來了
下面繼續我們命令的部分
這倆要開始增加lzma編譯連線在make中的設定,因為預設lzma是不編譯連結的。方法就是主目錄下的makefile中加
LIBS += lib/lzma/liblzma.a
這樣就可以編譯連線進去了
然後我們就可以呼叫解壓縮的介面函式進行解壓縮操作了
相關文章
- linux壓縮解壓縮Linux
- aix 下壓縮與解壓縮AI
- tar 分卷壓縮&解壓縮命令
- AIX 上壓縮與解壓縮AI
- linux壓縮(解壓縮)命令詳解-轉Linux
- linux下壓縮解壓縮命令Linux
- Linux壓縮及解壓縮命令Linux
- Linux壓縮解壓Linux
- Linux tar分卷壓縮與解壓縮Linux
- aix 檔案的壓縮與解壓縮AI
- bootmgr解壓縮boot
- zip解壓縮
- 分卷壓縮怎麼解壓 快速解壓電腦分卷壓縮檔案方法
- CentOS中zip壓縮和unzip解壓縮命令詳解CentOS
- Linux 常用的壓縮與解壓縮命令詳解Linux
- Linux下的tar壓縮解壓縮命令詳解Linux
- linuxtar解壓和壓縮Linux
- MyZip for mac解壓壓縮工具Mac
- Keka for Mac(壓縮解壓工具)Mac
- Keka for Mac壓縮解壓工具Mac
- 壓縮解壓命令(tar, zip)
- linux分卷壓縮解壓Linux
- 利用Java實現zip壓縮/解壓縮 (轉)Java
- Linux下壓縮,解壓縮RAR包(轉)Linux
- linux 高效壓縮工具之xz的壓縮解壓使用Linux
- Linux下常用壓縮格式的壓縮與解壓方法Linux
- tar的打包-壓縮與解壓縮,並解壓到指定的目錄
- Linux下zip壓縮和unzip解壓縮命令全解Linux
- Linux 常用基本命令 壓縮 解壓縮 tarLinux
- A-Zippr for Mac 壓縮解壓工具Mac
- Linux打包壓縮解壓工具Linux
- Mac壓縮解壓工具:Keka for MacMac
- linux壓縮解壓打包解包Linux
- CentOS7中zip壓縮和unzip解壓縮命令詳解CentOS
- 常用的壓縮解壓縮以及網路通訊命令
- 檔案的壓縮與解壓縮zz--linuxLinux
- Linux下常用壓縮格式的壓縮與解壓方法---轉載Linux
- Nginx網路壓縮 CSS壓縮 圖片壓縮 JSON壓縮NginxCSSJSON