public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] bootstd: android: Add U-Boot version to cmdline
@ 2024-09-04  9:38 Mattijs Korpershoek
  2024-09-10  8:23 ` Julien Masson
  2024-09-12  0:59 ` Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Mattijs Korpershoek @ 2024-09-04  9:38 UTC (permalink / raw)
  To: Simon Glass, Tom Rini
  Cc: Guillaume La Roque, Julien Masson, u-boot, Mattijs Korpershoek

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@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@baylibre.com>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootstd: android: Add U-Boot version to cmdline
  2024-09-04  9:38 [PATCH] bootstd: android: Add U-Boot version to cmdline Mattijs Korpershoek
@ 2024-09-10  8:23 ` Julien Masson
  2024-09-10  9:34   ` Guillaume LA ROQUE
  2024-09-12  0:59 ` Simon Glass
  1 sibling, 1 reply; 5+ messages in thread
From: Julien Masson @ 2024-09-10  8:23 UTC (permalink / raw)
  To: Mattijs Korpershoek, Simon Glass, Tom Rini
  Cc: Guillaume La Roque, Julien Masson, u-boot, Mattijs Korpershoek


On Tue 10 Sep 2024 at 10:23, Mattijs Korpershoek <mkorpershoek@baylibre.com> wrote:

> 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@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@baylibre.com>
> 

Reviewed-by: Julien Masson <jmasson@baylibre.com>
-- 
Julien Masson

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootstd: android: Add U-Boot version to cmdline
  2024-09-10  8:23 ` Julien Masson
@ 2024-09-10  9:34   ` Guillaume LA ROQUE
  0 siblings, 0 replies; 5+ messages in thread
From: Guillaume LA ROQUE @ 2024-09-10  9:34 UTC (permalink / raw)
  To: Julien Masson, Mattijs Korpershoek, Simon Glass, Tom Rini; +Cc: u-boot

Le 10/09/2024 à 10:23, Julien Masson a écrit :
> On Tue 10 Sep 2024 at 10:23, Mattijs Korpershoek<mkorpershoek@baylibre.com>  wrote:
>
>> 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@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@baylibre.com>
>>
> Reviewed-by: Julien Masson<jmasson@baylibre.com>

Reviewed-by: Guillaume La Roque<glaroque@baylibre.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootstd: android: Add U-Boot version to cmdline
  2024-09-04  9:38 [PATCH] bootstd: android: Add U-Boot version to cmdline Mattijs Korpershoek
  2024-09-10  8:23 ` Julien Masson
@ 2024-09-12  0:59 ` Simon Glass
  2024-09-12 10:15   ` Mattijs Korpershoek
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2024-09-12  0:59 UTC (permalink / raw)
  To: Mattijs Korpershoek; +Cc: Tom Rini, Guillaume La Roque, Julien Masson, u-boot

Hi Mattijs,

On Wed, 4 Sept 2024 at 03:38, Mattijs Korpershoek
<mkorpershoek@baylibre.com> wrote:
>
> 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@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);

Error check? If for some reason you want to ignore the error, please
add a comment here.

> +
>         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@baylibre.com>
>

REgards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootstd: android: Add U-Boot version to cmdline
  2024-09-12  0:59 ` Simon Glass
@ 2024-09-12 10:15   ` Mattijs Korpershoek
  0 siblings, 0 replies; 5+ messages in thread
From: Mattijs Korpershoek @ 2024-09-12 10:15 UTC (permalink / raw)
  To: Simon Glass; +Cc: Tom Rini, Guillaume La Roque, Julien Masson, u-boot

Hi Simon,

Thank you for your review.

On mer., sept. 11, 2024 at 18:59, Simon Glass <sjg@chromium.org> wrote:

> Hi Mattijs,
>
> On Wed, 4 Sept 2024 at 03:38, Mattijs Korpershoek
> <mkorpershoek@baylibre.com> wrote:
>>
>> 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@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);
>
> Error check? If for some reason you want to ignore the error, please
> add a comment here.

I indeed want to ignore the error. We don't want to block the boot if
for some reason we cannot set the U-Boot version in the kernel
commandline.

I will rework the above comment to be more generic about this.

Thanks.
Mattijs

>
>> +
>>         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@baylibre.com>
>>
>
> REgards,
> Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-12 10:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04  9:38 [PATCH] bootstd: android: Add U-Boot version to cmdline Mattijs Korpershoek
2024-09-10  8:23 ` Julien Masson
2024-09-10  9:34   ` Guillaume LA ROQUE
2024-09-12  0:59 ` Simon Glass
2024-09-12 10:15   ` Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox