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
- Linux壓縮解壓Linux
- CentOS 壓縮解壓CentOS
- Linux tar分卷壓縮與解壓縮Linux
- linuxtar解壓和壓縮Linux
- linux分卷壓縮解壓Linux
- Linux下的tar壓縮解壓縮命令詳解Linux
- Linux 常用的壓縮與解壓縮命令詳解Linux
- 分卷壓縮怎麼解壓 快速解壓電腦分卷壓縮檔案方法
- CentOS中zip壓縮和unzip解壓縮命令詳解CentOS
- linux 高效壓縮工具之xz的壓縮解壓使用Linux
- Linux打包壓縮解壓工具Linux
- .NET 壓縮/解壓檔案
- Keka for Mac(壓縮解壓工具)Mac
- Keka for Mac壓縮解壓工具Mac
- MyZip for mac解壓壓縮工具Mac
- Mac壓縮解壓工具:Keka for MacMac
- A-Zippr for Mac 壓縮解壓工具Mac
- linux下壓縮、解壓命令大全Linux
- Nginx網路壓縮 CSS壓縮 圖片壓縮 JSON壓縮NginxCSSJSON
- linux 下面壓縮、解壓.rar檔案Linux
- 壓縮命令tar詳解
- mysql壓縮解決方案MySql
- Linux科研武器庫 - 檔案壓縮與解壓縮 - zip / unzipLinux
- Linux常用命令之檔案壓縮與解壓縮命令詳解Linux
- 檔案壓縮和解壓縮
- Linux下檔案的壓縮與解壓Linux
- linux 下壓縮與解壓資料夾Linux
- 實用的壓縮解壓工具:WinZip for MacMac
- FastZip for Mac_Mac解壓軟體_Mac壓縮_Mac解壓工具ASTMac
- 壓縮解壓軟體:解壓專家Oka for Mac中文版Mac
- 哈夫曼實現檔案壓縮解壓縮(c語言)C語言
- Nginx R31 doc-11-Compression and Decompression 壓縮與解壓縮Nginx
- 用ASP實現線上壓縮與解壓縮功能程式碼
- 電腦怎麼壓縮檔案 檔案壓縮方法詳解
- 【轉載】Rocksdb壓縮詳解
- Ashampoo ZIP Pro 4,解壓縮
- BetterZip for Mac解壓縮軟體Mac
- Python實現壓縮和解壓縮Python