[PATCH] bootstd: android: Add U-Boot version to cmdline

Mattijs Korpershoek mkorpershoek at baylibre.com
Wed Sep 4 11:38:16 CEST 2024


When booting into Android fastbootd (a subset of recovery), the default
UI shows the bootloader version in the screen [1].
This is done via the ro.bootloader property which should come from the
bootloader.

Provide the U-Boot version via a kernel commandline argument so that
fastbootd can show it properly on the screen.

[1] https://android.googlesource.com/platform/bootable/recovery/+/refs/heads/main/fastboot/fastboot.cpp#42

Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
---
 boot/bootmeth_android.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
index 6e8d3e615db0..2fb82a5073de 100644
--- a/boot/bootmeth_android.c
+++ b/boot/bootmeth_android.c
@@ -22,6 +22,7 @@
 #include <malloc.h>
 #include <mapmem.h>
 #include <part.h>
+#include <version.h>
 #include "bootmeth_android.h"
 
 #define BCB_FIELD_COMMAND_SZ 32
@@ -171,6 +172,12 @@ static int configure_serialno(struct bootflow *bflow)
 	return bootflow_cmdline_set_arg(bflow, "androidboot.serialno", serialno, false);
 }
 
+static int configure_bootloader_version(struct bootflow *bflow)
+{
+	return bootflow_cmdline_set_arg(bflow, "androidboot.bootloader",
+					PLAIN_VERSION, false);
+}
+
 static int android_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
@@ -267,6 +274,8 @@ static int android_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 	/* Ignoring return code: setting serial number is not mandatory for booting */
 	configure_serialno(bflow);
 
+	configure_bootloader_version(bflow);
+
 	if (priv->boot_mode == ANDROID_BOOT_MODE_NORMAL) {
 		ret = bootflow_cmdline_set_arg(bflow, "androidboot.force_normal_boot",
 					       "1", false);

---
base-commit: 360aaddd9cea8c256f50c576794415cadfb61819
change-id: 20240904-bootmeth-bootloader-version-2a2b35fce4cf

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek at baylibre.com>



More information about the U-Boot mailing list