aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@google.com>2017-02-16 13:08:38 -0500
committerDavid Zeuthen <zeuthen@google.com>2017-02-16 13:11:44 -0500
commit19c38437eb77101ac30b29135cca58fbc684eace (patch)
tree84163548256a566ccc4ffb96972f30d6864cfa7e /examples
parentd247fcb8ab222ef4923533cb2c0f648029865e3b (diff)
downloadavb-19c38437eb77101ac30b29135cca58fbc684eace.tar.gz
libavb: Don't pass androidboot.slot_suffix in generated kernel command-line.
It's not appropriate to do this since the boot loader's A/B stack will likely do this. Also add new avb_strdupv() utility function so it's easy to do this yourself and update UEFI example bootloader to use this. Bug: None Test: New unit tests + all unit tests pass. Test: Manually tested on UEFI based bootloader. Change-Id: I9f9596b1f273330e80a38d857233167fefcce01b
Diffstat (limited to 'examples')
-rw-r--r--examples/uefi/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/uefi/main.c b/examples/uefi/main.c
index 8d9c0ee..c5a0030 100644
--- a/examples/uefi/main.c
+++ b/examples/uefi/main.c
@@ -38,6 +38,7 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle,
UEFIAvbBootKernelResult boot_result;
const char* requested_partitions[] = {"boot", NULL};
bool unlocked = true;
+ char* additional_cmdline = NULL;
InitializeLib(ImageHandle, SystemTable);
@@ -69,14 +70,24 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle,
case AVB_AB_FLOW_RESULT_OK_WITH_VERIFICATION_ERROR:
avb_printv("slot_suffix: ", slot_data->ab_suffix, "\n", NULL);
avb_printv("cmdline: ", slot_data->cmdline, "\n", NULL);
- /* Pass 'skip_initramfs' since we're not booting into recovery mode. */
+ /* Pass 'skip_initramfs' since we're not booting into recovery
+ * mode. Also pass the selected slot in androidboot.slot_suffix.
+ */
+ additional_cmdline = avb_strdupv("skip_initramfs ",
+ "androidboot.slot_suffix=",
+ slot_data->ab_suffix,
+ NULL);
+ if (additional_cmdline == NULL) {
+ avb_fatal("Error allocating additional_cmdline.\n");
+ }
boot_result =
- uefi_avb_boot_kernel(ImageHandle, slot_data, "skip_initramfs");
+ uefi_avb_boot_kernel(ImageHandle, slot_data, additional_cmdline);
avb_fatalv("uefi_avb_boot_kernel() failed with error ",
uefi_avb_boot_kernel_result_to_string(boot_result),
"\n",
NULL);
avb_slot_verify_data_free(slot_data);
+ avb_free(additional_cmdline);
break;
case AVB_AB_FLOW_RESULT_ERROR_OOM:
avb_fatal("OOM error while doing A/B select flow.\n");