mirror of
https://github.com/revyos/th1520-vendor-uboot.git
synced 2026-06-21 09:02:25 +02:00
cmd/boot: Try decompressing kernel through GZIP
This makes it possible to boot GZIP-compressed Linux kernel with sysboot. Signed-off-by: Yao Zi <ziyao@disroot.org>
This commit is contained in:
27
cmd/booti.c
27
cmd/booti.c
@@ -24,6 +24,10 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
ulong ld;
|
||||
ulong relocated_addr;
|
||||
ulong image_size;
|
||||
char *tmp;
|
||||
ulong dest_end;
|
||||
ulong decomp_dst;
|
||||
ulong comp_len;
|
||||
|
||||
ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
|
||||
images, 1);
|
||||
@@ -38,6 +42,29 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
|
||||
}
|
||||
|
||||
tmp = map_sysmem(ld, 0);
|
||||
|
||||
decomp_dst = env_get_ulong("kernel_comp_addr_r", 16, 0);
|
||||
comp_len = env_get_ulong("kernel_comp_size", 16, 0);
|
||||
|
||||
if (!decomp_dst || !comp_len) {
|
||||
puts("kernel_comp_addr_r or kernel_comp_size aren't defined!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = image_decomp(IH_COMP_GZIP, 0, ld, IH_TYPE_KERNEL,
|
||||
(void *)decomp_dst, (void *)ld, comp_len,
|
||||
comp_len * 10, &dest_end);
|
||||
|
||||
if (!ret) {
|
||||
printf("Kernel image compression size = 0x%08lx, address = 0x%08lx\n",
|
||||
comp_len, decomp_dst);
|
||||
|
||||
memmove((void *)ld, (void *)decomp_dst, dest_end);
|
||||
} else {
|
||||
printf("failed to decompress kernel image: %d\n", ret);
|
||||
}
|
||||
|
||||
ret = booti_setup(ld, &relocated_addr, &image_size, false);
|
||||
if (ret != 0)
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user