android: declare some functions externally
In file boot_android.c, we use some functions belong to common/android_bootloader.c. BUt these functions attribute are static. So we modify these functions used in the boot_android.c. And android_avb_boot_flow is added to boot a/b android system. Change-Id: I3ebc0a6fb24691ab1a0f8475220e16ca633412f1 Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
parent
38de3d97e4
commit
de183ed0f1
|
|
@ -157,7 +157,7 @@ static int android_bootloader_boot_bootloader(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int android_bootloader_boot_kernel(unsigned long kernel_address)
|
||||
int android_bootloader_boot_kernel(unsigned long kernel_address)
|
||||
{
|
||||
char kernel_addr_str[12];
|
||||
char *fdt_addr = env_get("fdt_addr");
|
||||
|
|
@ -209,7 +209,7 @@ static char *strjoin(const char **chunks, char separator)
|
|||
/** android_assemble_cmdline - Assemble the command line to pass to the kernel
|
||||
* @return a newly allocated string
|
||||
*/
|
||||
static char *android_assemble_cmdline(const char *slot_suffix,
|
||||
char *android_assemble_cmdline(const char *slot_suffix,
|
||||
const char *extra_args)
|
||||
{
|
||||
const char *cmdline_chunks[16];
|
||||
|
|
@ -349,3 +349,29 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
|
|||
/* TODO: If the kernel doesn't boot mark the selected slot as bad. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int android_avb_boot_flow(char *slot_suffix, unsigned long kernel_address)
|
||||
{
|
||||
const char *dev_iface = "mmc";
|
||||
int dev_num = 0;
|
||||
struct blk_desc *dev_desc;
|
||||
disk_partition_t boot_part_info;
|
||||
int ret;
|
||||
dev_desc = blk_get_dev(dev_iface, dev_num);
|
||||
if (!dev_desc) {
|
||||
printf("Could not find %s %d\n", dev_iface, dev_num);
|
||||
return -1;
|
||||
}
|
||||
/* Load the kernel from the desired "boot" partition. */
|
||||
android_part_get_info_by_name_suffix(dev_desc,
|
||||
ANDROID_PARTITION_BOOT,
|
||||
slot_suffix, &boot_part_info);
|
||||
ret = android_image_load(dev_desc, &boot_part_info, kernel_address,
|
||||
-1UL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
android_bootloader_boot_kernel(kernel_address);
|
||||
|
||||
/* TODO: If the kernel doesn't boot mark the selected slot as bad. */
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,32 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
|
|||
const char *slot,
|
||||
unsigned long kernel_address);
|
||||
|
||||
/** android_avb_boot_flow - Execute the Android Bootloader Flow.
|
||||
* This fuction use to select and boot kernel through ab_suffix.
|
||||
*
|
||||
* @ab_suffix: the boot slot to boot from.
|
||||
* @kernel_address: address where to load the kernel if needed.
|
||||
*
|
||||
* @return a negative number in case of error, otherwise it doesn't return.
|
||||
*/
|
||||
int android_avb_boot_flow(char *ab_suffix, unsigned long kernel_address);
|
||||
|
||||
/** android_assemble_cmdline - Assemble args for cmdline.
|
||||
*
|
||||
* @ab_suffix: the boot slot to boot from.
|
||||
* @extra_args: select the args to command line.
|
||||
*
|
||||
* @return a negative number in case of error, otherwise it doesn't return.
|
||||
*/
|
||||
char *android_assemble_cmdline(const char *slot_suffix,
|
||||
const char *extra_args);
|
||||
|
||||
/** android_bootloader_boot_kernel- Execute the kernel boot.
|
||||
*
|
||||
* @kernel_address: address where to load the kernel if needed.
|
||||
*
|
||||
* @return a negative number in case of error, otherwise it doesn't return.
|
||||
*/
|
||||
int android_bootloader_boot_kernel(unsigned long kernel_address);
|
||||
|
||||
#endif /* __ANDROID_BOOTLOADER_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue