mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-30 19:11:37 +00:00
sandbox: Adjust bootm command to work with sandbox
Use map_sysmem() when converting from addresses to pointers, so that bootm can be used with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
53f375fa81
commit
aed161e5fe
1 changed files with 12 additions and 13 deletions
|
@ -336,12 +336,15 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
ulong image_len = os.image_len;
|
ulong image_len = os.image_len;
|
||||||
__maybe_unused uint unc_len = CONFIG_SYS_BOOTM_LEN;
|
__maybe_unused uint unc_len = CONFIG_SYS_BOOTM_LEN;
|
||||||
int no_overlap = 0;
|
int no_overlap = 0;
|
||||||
|
void *load_buf, *image_buf;
|
||||||
#if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
|
#if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
|
||||||
int ret;
|
int ret;
|
||||||
#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
|
#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
|
||||||
|
|
||||||
const char *type_name = genimg_get_type_name(os.type);
|
const char *type_name = genimg_get_type_name(os.type);
|
||||||
|
|
||||||
|
load_buf = map_sysmem(load, image_len);
|
||||||
|
image_buf = map_sysmem(image_start, image_len);
|
||||||
switch (comp) {
|
switch (comp) {
|
||||||
case IH_COMP_NONE:
|
case IH_COMP_NONE:
|
||||||
if (load == blob_start || load == image_start) {
|
if (load == blob_start || load == image_start) {
|
||||||
|
@ -349,8 +352,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
no_overlap = 1;
|
no_overlap = 1;
|
||||||
} else {
|
} else {
|
||||||
printf(" Loading %s ... ", type_name);
|
printf(" Loading %s ... ", type_name);
|
||||||
memmove_wd((void *)load, (void *)image_start,
|
memmove_wd(load_buf, image_buf, image_len, CHUNKSZ);
|
||||||
image_len, CHUNKSZ);
|
|
||||||
}
|
}
|
||||||
*load_end = load + image_len;
|
*load_end = load + image_len;
|
||||||
puts("OK\n");
|
puts("OK\n");
|
||||||
|
@ -358,8 +360,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
#ifdef CONFIG_GZIP
|
#ifdef CONFIG_GZIP
|
||||||
case IH_COMP_GZIP:
|
case IH_COMP_GZIP:
|
||||||
printf(" Uncompressing %s ... ", type_name);
|
printf(" Uncompressing %s ... ", type_name);
|
||||||
if (gunzip((void *)load, unc_len,
|
if (gunzip(load_buf, unc_len, image_buf, &image_len) != 0) {
|
||||||
(uchar *)image_start, &image_len) != 0) {
|
|
||||||
puts("GUNZIP: uncompress, out-of-mem or overwrite "
|
puts("GUNZIP: uncompress, out-of-mem or overwrite "
|
||||||
"error - must RESET board to recover\n");
|
"error - must RESET board to recover\n");
|
||||||
if (boot_progress)
|
if (boot_progress)
|
||||||
|
@ -378,9 +379,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
* use slower decompression algorithm which requires
|
* use slower decompression algorithm which requires
|
||||||
* at most 2300 KB of memory.
|
* at most 2300 KB of memory.
|
||||||
*/
|
*/
|
||||||
int i = BZ2_bzBuffToBuffDecompress((char *)load,
|
int i = BZ2_bzBuffToBuffDecompress(load_buf, &unc_len,
|
||||||
&unc_len, (char *)image_start, image_len,
|
image_buf, image_len,
|
||||||
CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
|
CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
|
||||||
if (i != BZ_OK) {
|
if (i != BZ_OK) {
|
||||||
printf("BUNZIP2: uncompress or overwrite error %d "
|
printf("BUNZIP2: uncompress or overwrite error %d "
|
||||||
"- must RESET board to recover\n", i);
|
"- must RESET board to recover\n", i);
|
||||||
|
@ -397,9 +398,8 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
SizeT lzma_len = unc_len;
|
SizeT lzma_len = unc_len;
|
||||||
printf(" Uncompressing %s ... ", type_name);
|
printf(" Uncompressing %s ... ", type_name);
|
||||||
|
|
||||||
ret = lzmaBuffToBuffDecompress(
|
ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len,
|
||||||
(unsigned char *)load, &lzma_len,
|
image_buf, image_len);
|
||||||
(unsigned char *)image_start, image_len);
|
|
||||||
unc_len = lzma_len;
|
unc_len = lzma_len;
|
||||||
if (ret != SZ_OK) {
|
if (ret != SZ_OK) {
|
||||||
printf("LZMA: uncompress or overwrite error %d "
|
printf("LZMA: uncompress or overwrite error %d "
|
||||||
|
@ -415,9 +415,8 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
||||||
case IH_COMP_LZO:
|
case IH_COMP_LZO:
|
||||||
printf(" Uncompressing %s ... ", type_name);
|
printf(" Uncompressing %s ... ", type_name);
|
||||||
|
|
||||||
ret = lzop_decompress((const unsigned char *)image_start,
|
ret = lzop_decompress(image_buf, image_len, load_buf,
|
||||||
image_len, (unsigned char *)load,
|
&unc_len);
|
||||||
&unc_len);
|
|
||||||
if (ret != LZO_E_OK) {
|
if (ret != LZO_E_OK) {
|
||||||
printf("LZO: uncompress or overwrite error %d "
|
printf("LZO: uncompress or overwrite error %d "
|
||||||
"- must RESET board to recover\n", ret);
|
"- must RESET board to recover\n", ret);
|
||||||
|
|
Loading…
Add table
Reference in a new issue