Skip to contentSkip to conversation

added check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

PATCH New Manuel Reis 3 participants 4 messages Nov 22, 2020 – Nov 25, 2020 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 added check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

Check whether user has explicitly defined device and partition where environment file will be located. Voids the need to set such partition as bootable to work with the 'dev:auto'

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>

---

 board/st/stm32mp1/stm32mp1.c | 5 +++++
 1 file changed, 5 insertions(+)
board/st/stm32mp1/stm32mp1.c +5 -0
index 4553329b25..4dda70740d 100644
@@ -868,6 +868,11 @@ 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;
+
+	if (strlen(env_dev_part) > 0)
+		return env_dev_part;
+
 	static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
 	u32 bootmode = get_bootmode();
 
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 added check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

Hi Manuel,

Thanks for this fix. Indeed, without it, I don't manage to get U-Boot to use the EXT4 partition for the environment on stm32mp1 with the below configuration:

CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="0:4"

Quoted 18 lines · Manuel Reis

Check whether user has explicitly defined device and partition where environment file will be located. Voids the need to set such partition as bootable to work with the 'dev:auto'

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>

---

 board/st/stm32mp1/stm32mp1.c | 5 +++++
 1 file changed, 5 insertions(+)
board/st/stm32mp1/stm32mp1.c +0 -0
index 4553329b25..4dda70740d 100644
@@ -868,6 +868,11 @@ const char *env_ext4_get_intf(void)
 

board/st/stm32mp1/stm32mp1.c const char *env_ext4_get_intf(void) · line 878

Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +5 -0
 const char *env_ext4_get_dev_part(void)
 {
+	static char *const env_dev_part = CONFIG_ENV_EXT4_DEVICE_AND_PART;
+
+	if (strlen(env_dev_part) > 0)
+		return env_dev_part;
+
 	static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
 	u32 bootmode = get_bootmode();
 
Signature · 3 lines
Michael Opdenacker, CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 added check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

In reply to Manuel Reis

Hi,

Quoted 32 lines

From: Manuel Reis <[email protected]>
Sent: dimanche 22 novembre 2020 16:20

Check whether user has explicitly defined device and partition where environment file will be located. Voids the need to set such partition as bootable to work with the 'dev:auto'

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>

---

 board/st/stm32mp1/stm32mp1.c | 5 +++++
 1 file changed, 5 insertions(+)
board/st/stm32mp1/stm32mp1.c +5 -1
index 4553329b25..4dda70740d 100644
@@ -868,6 +868,11 @@ 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;
+
+	if (strlen(env_dev_part) > 0)
+		return env_dev_part;
+
 	static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
 	u32 bootmode = get_bootmode();
 
--
Quoted 1 line

2.27.0

Behavior seems ok, but patch mixes code and variables. can you move the code part after the variables definitions ?

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

Regards

PAtrick

#3 lore raw

PATCH 1/1 added check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition

Hi,

thanks for the feedback.

Just sent a new corrected patch with fixed commit message title:
[PATCH] add check for ignored CONFIG_ENV_EXT4_DEVICE_AND_PART definition.

regards,
Manuel

Quoted 55 lines · Patrick DELAUNAY

Hi,

Quoted 34 lines

From: Manuel Reis <[email protected]>
Sent: dimanche 22 novembre 2020 16:20

Check whether user has explicitly defined device and partition
where environment
file will be located. Voids the need to set such partition as
bootable to work with
the 'dev:auto'

Cc Patrick Delaunay <[email protected]>
Cc Patrice Chotard <[email protected]>

---

  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 4553329b25..4dda70740d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -868,6 +868,11 @@ 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;
+
+ if (strlen(env_dev_part) > 0)
+ return env_dev_part;
+
static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"}; u32 bootmode = get_bootmode();

Quoted 2 lines

--
2.27.0

Behavior seems ok, but patch mixes code and variables. can you move the code part after the variables definitions ?

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

Regards

PAtrick