xref: /rk3399_rockchip-uboot/cmd/bootrkp.c (revision 1225f03eaae14cb42fe62e1cf8c8a5c050447cd2)
1 /*
2  * (C) Copyright 2017 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <android_bootloader.h>
9 #include <boot_rkimg.h>
10 
11 static int do_boot_rockchip(cmd_tbl_t *cmdtp, int flag, int argc,
12 		      char * const argv[])
13 {
14 	disk_partition_t part_info;
15 	struct blk_desc *dev_desc;
16 	int mode = 0;
17 	char *boot_partname = PART_BOOT;
18 	int ret = 0;
19 
20 	dev_desc = rockchip_get_bootdev();
21 	mode = rockchip_get_boot_mode();
22 	if (mode == BOOT_MODE_RECOVERY)
23 		boot_partname = PART_RECOVERY;
24 	ret = part_get_info_by_name(dev_desc, boot_partname, &part_info);
25 
26 	if(boot_rockchip_image(dev_desc, &part_info))
27 		ret = CMD_RET_FAILURE;
28 
29 	return ret;
30 }
31 
32 U_BOOT_CMD(
33 	bootrkp,  CONFIG_SYS_MAXARGS,     1,      do_boot_rockchip,
34 	"Boot Linux Image from rockchip image type",
35 	"kernel.img: zImage/Image\n"
36 	"boot.img: ramdisk\n"
37 	"resource.img: dtb, u-boot logo, kernel logo"
38 );
39