Skip to contentSkip to conversation

u-boot: support merging .cfg files for UBOOT_CONFIG

PATCH Superseded Ming Liu 2 participants 4 messages Apr 6, 2020 – May 15, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 u-boot: support merging .cfg files for UBOOT_CONFIG

From: Ming Liu <[email protected]>

U-boot recipe supports .cfg files in SRC_URI, but they would be merged to .config during do_configure only when UBOOT_MACHINE is set, we should also support merging .cfg files for UBOOT_CONFIG.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +15 -2
index 188e5295cf..9126fafe0b 100644
@@ -77,7 +77,21 @@ def find_cfgs(d):
     return sources_list
 
 do_configure () {
-    if [ -z "${UBOOT_CONFIG}" ]; then
+    if [ -n "${UBOOT_CONFIG}" ]; then
+        unset i j
+        for config in ${UBOOT_MACHINE}; do
+            i=$(expr $i + 1);
+            for type in ${UBOOT_CONFIG}; do
+                j=$(expr $j + 1);
+                if [ $j -eq $i ]; then
+                    KCONFIG_CONFIG=${S}/configs/${config%_*}_defconfig merge_config.sh -m ${S}/configs/${config%_*}_defconfig ${@" ".join(find_cfgs(d))}
+                    oe_runmake -C ${S} O=${B}/${config} ${config}
+                fi
+            done
+            unset  j
+        done
+        unset  i
+    else
         if [ -n "${UBOOT_MACHINE}" ]; then
             oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
         else
@@ -114,7 +128,6 @@ do_compile () {
                 j=$(expr $j + 1);
                 if [ $j -eq $i ]
                 then
-                    oe_runmake -C ${S} O=${B}/${config} ${config}
                     oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
                     for binary in ${UBOOT_BINARIES}; do
                         k=$(expr $k + 1);
Signature · 1 line
2.26.0
author
#1 lore raw

Hi, maintainers:

Ping! May I get some comments about this patch? It's been pending for weeks.

//Ming Liu

<[email protected]> 於 2020年4月6日 週一 下午9:21寫道:

Quoted 54 lines

From: Ming Liu <[email protected]>

U-boot recipe supports .cfg files in SRC_URI, but they would be merged to .config during do_configure only when UBOOT_MACHINE is set, we should also support merging .cfg files for UBOOT_CONFIG.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +8 -1
index 188e5295cf..9126fafe0b 100644
@@ -77,7 +77,21 @@ def find_cfgs(d):
     return sources_list
 
 do_configure () {
-    if [ -z "${UBOOT_CONFIG}" ]; then
+    if [ -n "${UBOOT_CONFIG}" ]; then
+        unset i j
+        for config in ${UBOOT_MACHINE}; do
+            i=$(expr $i + 1);
+            for type in ${UBOOT_CONFIG}; do
+                j=$(expr $j + 1);
+                if [ $j -eq $i ]; then
+                    KCONFIG_CONFIG=${S}/configs/${config%_*}_defconfig

merge_config.sh -m ${S}/configs/${config%_*}_defconfig ${@" ".join(find_cfgs(d))}

meta/recipes-bsp/u-boot/u-boot.inc +7 -1
+                    oe_runmake -C ${S} O=${B}/${config} ${config}
+                fi
+            done
+            unset  j
+        done
+        unset  i
+    else
         if [ -n "${UBOOT_MACHINE}" ]; then
             oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
         else
@@ -114,7 +128,6 @@ do_compile () {
                 j=$(expr $j + 1);
                 if [ $j -eq $i ]
                 then
-                    oe_runmake -C ${S} O=${B}/${config} ${config}
                     oe_runmake -C ${S} O=${B}/${config}
 ${UBOOT_MAKE_TARGET}
                     for binary in ${UBOOT_BINARIES}; do
                         k=$(expr $k + 1);

--
2.26.0

#2 lore raw
Quoted 3 lines · Ming Liu

Hi, maintainers:

Ping! May I get some comments about this patch? It's been pending for weeks.

I was just thinking about something like this the other day.... but I wonder if we want to apply the fragments to each config. It might be nice if there was a way to filter out which config fragments got applied to which u-boot configs?

Quoted 61 lines

//Ming Liu

<[email protected] <mailto:[email protected]>> 於 2020年4月6日 週一 下午9:21寫道:

    From: Ming Liu <[email protected] <mailto:[email protected]>>

    U-boot recipe supports .cfg files in SRC_URI, but they would be merged
    to .config during do_configure only when UBOOT_MACHINE is set, we
    should also support merging .cfg files for UBOOT_CONFIG.

    Signed-off-by: Ming Liu <[email protected]
    <mailto:[email protected]>>
    ---
     meta/recipes-bsp/u-boot/u-boot.inc | 17 +++++++++++++++--
     1 file changed, 15 insertions(+), 2 deletions(-)

    diff --git a/meta/recipes-bsp/u-boot/u-boot.inc
    b/meta/recipes-bsp/u-boot/u-boot.inc
    index 188e5295cf..9126fafe0b 100644
    --- a/meta/recipes-bsp/u-boot/u-boot.inc
    +++ b/meta/recipes-bsp/u-boot/u-boot.inc
    @@ -77,7 +77,21 @@ def find_cfgs(d):
         return sources_list

     do_configure () {
    -    if [ -z "${UBOOT_CONFIG}" ]; then
    +    if [ -n "${UBOOT_CONFIG}" ]; then
    +        unset i j
    +        for config in ${UBOOT_MACHINE}; do
    +            i=$(expr $i + 1);
    +            for type in ${UBOOT_CONFIG}; do
    +                j=$(expr $j + 1);
    +                if [ $j -eq $i ]; then
    + KCONFIG_CONFIG=${S}/configs/${config%_*}_defconfig
    merge_config.sh -m ${S}/configs/${config%_*}_defconfig ${@"
    ".join(find_cfgs(d))}
    +                    oe_runmake -C ${S} O=${B}/${config} ${config}
    +                fi
    +            done
    +            unset  j
    +        done
    +        unset  i
    +    else
             if [ -n "${UBOOT_MACHINE}" ]; then
                 oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
             else
    @@ -114,7 +128,6 @@ do_compile () {
                     j=$(expr $j + 1);
                     if [ $j -eq $i ]
                     then
    -                    oe_runmake -C ${S} O=${B}/${config} ${config}
                         oe_runmake -C ${S} O=${B}/${config}
    ${UBOOT_MAKE_TARGET}
                         for binary in ${UBOOT_BINARIES}; do
                             k=$(expr $k + 1);
    -- 
    2.26.0
author
#3 lore raw
Quoted 1 line

I was just thinking about something like this the other day.... but I

wonder if we want to apply the fragments to each config. It might be nice if there was a way to filter out which config fragments got applied to which u-boot configs?

Thanks for the input, yes, that would be even nicer for sure, but after some thinking, I could not figure out a way to implement that with the current .scc design without a complete refactoring, do you have some ideas?

In our use cases, we use .scc files as some 'feature' fragments applied to machine configs, usually we would like them to apply to all the configs, if there are some machine specific ones, they will be in the config file in uboot source rather than being applied by .scc.

//Ming Liu

Joshua Watt <[email protected]> 於 2020年5月14日 週四 下午7:03寫道:

Quoted 77 lines · Ming Liu

Hi, maintainers:

Ping! May I get some comments about this patch? It's been pending for weeks.

I was just thinking about something like this the other day.... but I wonder if we want to apply the fragments to each config. It might be nice if there was a way to filter out which config fragments got applied to which u-boot configs?

//Ming Liu

<[email protected]> 於 2020年4月6日 週一 下午9:21寫道:

Quoted 54 lines

From: Ming Liu <[email protected]>

U-boot recipe supports .cfg files in SRC_URI, but they would be merged to .config during do_configure only when UBOOT_MACHINE is set, we should also support merging .cfg files for UBOOT_CONFIG.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +8 -1
index 188e5295cf..9126fafe0b 100644
@@ -77,7 +77,21 @@ def find_cfgs(d):
     return sources_list
 
 do_configure () {
-    if [ -z "${UBOOT_CONFIG}" ]; then
+    if [ -n "${UBOOT_CONFIG}" ]; then
+        unset i j
+        for config in ${UBOOT_MACHINE}; do
+            i=$(expr $i + 1);
+            for type in ${UBOOT_CONFIG}; do
+                j=$(expr $j + 1);
+                if [ $j -eq $i ]; then
+                    KCONFIG_CONFIG=${S}/configs/${config%_*}_defconfig

merge_config.sh -m ${S}/configs/${config%_*}_defconfig ${@" ".join(find_cfgs(d))}

meta/recipes-bsp/u-boot/u-boot.inc +7 -1
+                    oe_runmake -C ${S} O=${B}/${config} ${config}
+                fi
+            done
+            unset  j
+        done
+        unset  i
+    else
         if [ -n "${UBOOT_MACHINE}" ]; then
             oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
         else
@@ -114,7 +128,6 @@ do_compile () {
                 j=$(expr $j + 1);
                 if [ $j -eq $i ]
                 then
-                    oe_runmake -C ${S} O=${B}/${config} ${config}
                     oe_runmake -C ${S} O=${B}/${config}
 ${UBOOT_MAKE_TARGET}
                     for binary in ${UBOOT_BINARIES}; do
                         k=$(expr $k + 1);

--
2.26.0