diff mbox series

add check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

Message ID 20201125101620.59718-2-mluis.reis@gmail.com
State Accepted
Delegated to: Patrick Delaunay
Headers show
Series add check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition | expand

Commit Message

Manuel Luís Reis Nov. 25, 2020, 10:16 a.m. UTC
Check whether user has explicitly defined device and partition where
environment file will be located before using 'auto' i.e. bootable
partition

Voids the need to set such partition as bootable to work with the
'dev:auto' tuple

Signed-off-by: Manuel Reis <mluis.reis@gmail.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
---

 board/st/stm32mp1/stm32mp1.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Patrick Delaunay Dec. 9, 2020, 9:06 a.m. UTC | #1
Hi Manuel,

On 12/9/20 9:59 AM, Patrick DELAUNAY wrote:
> From: Manuel Reis <mluis.reis@gmail.com>
> Sent: mercredi 25 novembre 2020 11:16
>
> Check whether user has explicitly defined device and partition where environment file will be located before using 'auto' i.e. bootable partition
>
> Voids the need to set such partition as bootable to work with the 'dev:auto' tuple
>
> Signed-off-by: Manuel Reis <mluis.reis@gmail.com>
> Cc: Patrick Delaunay <patrick.delaunay@st.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
> ---
>
>   board/st/stm32mp1/stm32mp1.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 03a19af930..09d9bbf07d 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -827,7 +827,12 @@ const char *env_ext4_get_intf(void)
>   
>   const char *env_ext4_get_dev_part(void)  {
> +	static char *const env_dev_part = CONFIG_ENV_EXT4_DEVICE_AND_PART;
>   	static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
> +
> +	if (strlen(env_dev_part) > 0)
> +		return env_dev_part;
> +
>   	u32 bootmode = get_bootmode();
>   
>   	return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
> --
> 2.27.0
>
In fact it just is V2 of previous patch

http://patchwork.ozlabs.org/project/uboot/patch/20201122151939.20005-1-mluis.reis@gmail.com/

Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Applied to u-boot-stm/master.


Thanks

Patrick
Patrick Delaunay Dec. 9, 2020, 10:28 a.m. UTC | #2
On 12/9/20 10:06 AM, Patrick DELAUNAY wrote:
> Hi Manuel,
>
> On 12/9/20 9:59 AM, Patrick DELAUNAY wrote:
>> From: Manuel Reis <mluis.reis@gmail.com>
>> Sent: mercredi 25 novembre 2020 11:16
>>
>> Check whether user has explicitly defined device and partition where 
>> environment file will be located before using 'auto' i.e. bootable 
>> partition
>>
>> Voids the need to set such partition as bootable to work with the 
>> 'dev:auto' tuple
>>
>> Signed-off-by: Manuel Reis <mluis.reis@gmail.com>
>> Cc: Patrick Delaunay <patrick.delaunay@st.com>
>> Cc: Patrice Chotard <patrice.chotard@st.com>
>> Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
>> ---
>>
>>   board/st/stm32mp1/stm32mp1.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/board/st/stm32mp1/stm32mp1.c 
>> b/board/st/stm32mp1/stm32mp1.c index 03a19af930..09d9bbf07d 100644
>> --- a/board/st/stm32mp1/stm32mp1.c
>> +++ b/board/st/stm32mp1/stm32mp1.c
>> @@ -827,7 +827,12 @@ const char *env_ext4_get_intf(void)
>>     const char *env_ext4_get_dev_part(void)  {
>> +    static char *const env_dev_part = CONFIG_ENV_EXT4_DEVICE_AND_PART;
>>       static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
>> +
>> +    if (strlen(env_dev_part) > 0)
>> +        return env_dev_part;
>> +
>>       u32 bootmode = get_bootmode();
>>         return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
>> -- 
>> 2.27.0
>>
> In fact it just is V2 of previous patch
>
> http://patchwork.ozlabs.org/project/uboot/patch/20201122151939.20005-1-mluis.reis@gmail.com/ 
>
>
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
>
> Applied to u-boot-stm/master.
>
>
> Thanks
>
> Patrick
>

To solve compilation issue when CONFIG_ENV_EXT4_DEVICE_AND_PART is not 
defined

I modify the patch before to apply it in u-boot-stm/master.

Regards

Patrick

------------------------- board/st/stm32mp1/stm32mp1.c 
-------------------------
index 8a3ce0a6f5..d3cffdd770 100644
@@ -827,11 +827,22 @@ const char *env_ext4_get_intf(void)

  const char *env_ext4_get_dev_part(void)
  {
+    static char *const env_dev_part =
+#ifdef CONFIG_ENV_EXT4_DEVICE_AND_PART
+        CONFIG_ENV_EXT4_DEVICE_AND_PART;
+#else
+        "";
+#endif
      static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
+
+    if (strlen(env_dev_part) > 0)
+        return env_dev_part;
+
      u32 bootmode = get_bootmode();

      return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
  }
+
Manuel Luís Reis Dec. 9, 2020, 11:55 a.m. UTC | #3
Hi Patrick,

Apologies. Must have missed that.

Thanks
Manuel

On Wed, 9 Dec 2020 at 10:28, Patrick DELAUNAY <patrick.delaunay@foss.st.com>
wrote:

>
> On 12/9/20 10:06 AM, Patrick DELAUNAY wrote:
> > Hi Manuel,
> >
> > On 12/9/20 9:59 AM, Patrick DELAUNAY wrote:
> >> From: Manuel Reis <mluis.reis@gmail.com>
> >> Sent: mercredi 25 novembre 2020 11:16
> >>
> >> Check whether user has explicitly defined device and partition where
> >> environment file will be located before using 'auto' i.e. bootable
> >> partition
> >>
> >> Voids the need to set such partition as bootable to work with the
> >> 'dev:auto' tuple
> >>
> >> Signed-off-by: Manuel Reis <mluis.reis@gmail.com>
> >> Cc: Patrick Delaunay <patrick.delaunay@st.com>
> >> Cc: Patrice Chotard <patrice.chotard@st.com>
> >> Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
> >> ---
> >>
> >>   board/st/stm32mp1/stm32mp1.c | 5 +++++
> >>   1 file changed, 5 insertions(+)
> >>
> >> diff --git a/board/st/stm32mp1/stm32mp1.c
> >> b/board/st/stm32mp1/stm32mp1.c index 03a19af930..09d9bbf07d 100644
> >> --- a/board/st/stm32mp1/stm32mp1.c
> >> +++ b/board/st/stm32mp1/stm32mp1.c
> >> @@ -827,7 +827,12 @@ const char *env_ext4_get_intf(void)
> >>     const char *env_ext4_get_dev_part(void)  {
> >> +    static char *const env_dev_part = CONFIG_ENV_EXT4_DEVICE_AND_PART;
> >>       static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
> >> +
> >> +    if (strlen(env_dev_part) > 0)
> >> +        return env_dev_part;
> >> +
> >>       u32 bootmode = get_bootmode();
> >>         return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
> >> --
> >> 2.27.0
> >>
> > In fact it just is V2 of previous patch
> >
> >
> http://patchwork.ozlabs.org/project/uboot/patch/20201122151939.20005-1-mluis.reis@gmail.com/
> >
> >
> > Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> >
> > Applied to u-boot-stm/master.
> >
> >
> > Thanks
> >
> > Patrick
> >
>
> To solve compilation issue when CONFIG_ENV_EXT4_DEVICE_AND_PART is not
> defined
>
> I modify the patch before to apply it in u-boot-stm/master.
>
> Regards
>
> Patrick
>
> ------------------------- board/st/stm32mp1/stm32mp1.c
> -------------------------
> index 8a3ce0a6f5..d3cffdd770 100644
> @@ -827,11 +827,22 @@ const char *env_ext4_get_intf(void)
>
>   const char *env_ext4_get_dev_part(void)
>   {
> +    static char *const env_dev_part =
> +#ifdef CONFIG_ENV_EXT4_DEVICE_AND_PART
> +        CONFIG_ENV_EXT4_DEVICE_AND_PART;
> +#else
> +        "";
> +#endif
>       static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
> +
> +    if (strlen(env_dev_part) > 0)
> +        return env_dev_part;
> +
>       u32 bootmode = get_bootmode();
>
>       return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
>   }
> +
>
>
>
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 03a19af930..09d9bbf07d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -827,7 +827,12 @@  const char *env_ext4_get_intf(void)
 
 const char *env_ext4_get_dev_part(void)
 {
+	static char *const env_dev_part = CONFIG_ENV_EXT4_DEVICE_AND_PART;
 	static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
+
+	if (strlen(env_dev_part) > 0)
+		return env_dev_part;
+
 	u32 bootmode = get_bootmode();
 
 	return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];