Skip to contentSkip to conversation

Introduce UBOOT_INITIAL_ENV/cfg files fixes/coding style fixes

PATCH Superseded Ming Liu 2 participants 7 messages May 28, 2020 – Jun 1, 2020

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

v3 cover Introduce UBOOT_INITIAL_ENV/cfg files fixes/coding style fixes

From: Ming Liu <[email protected]>

Changes in V2:

1 Introduce UBOOT_INITIAL_ENV as suggested by Denys Dmytriyenko. 2 Fix cfg files in case UBOOT_CONFIG is enabled.
3 Add fix for some inconsistent coding style.

Ming Liu (3):
u-boot: support merging .cfg files for UBOOT_CONFIG u-boot.inc: fix some inconsistent coding style
u-boot: introduce UBOOT_INITIAL_ENV

 meta/recipes-bsp/u-boot/u-boot.inc | 120 ++++++++++++++++++-----------
 1 file changed, 74 insertions(+), 46 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH v3 1/3 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 | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +17 -4
index 80f828df52..8cfd25020c 100644
@@ -77,7 +77,23 @@ 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
+                    oe_runmake -C ${S} O=${B}/${config} ${config}
+                    merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))}
+                    oe_runmake -C ${S} O=${B}/${config} oldconfig
+                fi
+            done
+            unset j
+        done
+        unset i
+        DEVTOOL_DISABLE_MENUCONFIG=true
+    else
         if [ -n "${UBOOT_MACHINE}" ]; then
             oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
         else
@@ -85,8 +101,6 @@ do_configure () {
         fi
         merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
         cml1_do_configure
-    else
-        DEVTOOL_DISABLE_MENUCONFIG=true
     fi
 }
 
@@ -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.2
#2 lore raw

Re: [OE-core] [PATCH V3 1/3] u-boot: support merging .cfg files for UBOOT_CONFIG

Is this change really required for UBOOT_INITIAL_ENV? I think you are merging several patch series together?

Quoted 63 lines · Ming Liu

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 | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +17 -4
index 80f828df52..8cfd25020c 100644
@@ -77,7 +77,23 @@ 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
+                    oe_runmake -C ${S} O=${B}/${config} ${config}
+                    merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))}
+                    oe_runmake -C ${S} O=${B}/${config} oldconfig
+                fi
+            done
+            unset j
+        done
+        unset i
+        DEVTOOL_DISABLE_MENUCONFIG=true
+    else
         if [ -n "${UBOOT_MACHINE}" ]; then
             oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
         else
@@ -85,8 +101,6 @@ do_configure () {
         fi
         merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
         cml1_do_configure
-    else
-        DEVTOOL_DISABLE_MENUCONFIG=true
     fi
 }
 
@@ -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.2
author
#3 lore raw

PATCH v3 2/3 u-boot.inc: fix some inconsistent coding style

In reply to Ming Liu

From: Ming Liu <[email protected]>

---
 meta/recipes-bsp/u-boot/u-boot.inc | 44 ++++++++++++++----------------
 1 file changed, 21 insertions(+), 23 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +21 -23
index 8cfd25020c..be15e1760f 100644
@@ -105,19 +105,19 @@ do_configure () {
 }
 
 do_compile () {
-	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
-		sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
-	fi
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
+        sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
+    fi
 
-	unset LDFLAGS
-	unset CFLAGS
-	unset CPPFLAGS
+    unset LDFLAGS
+    unset CFLAGS
+    unset CPPFLAGS
 
-	if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
-	then
-		echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
-		echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
-	fi
+    if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
+    then
+        echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
+        echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
+    fi
 
     if [ -n "${UBOOT_CONFIG}" ]
     then
@@ -143,16 +143,15 @@ do_compile () {
                     unset k
                 fi
             done
-            unset  j
+            unset j
         done
-        unset  i
+        unset i
     else
         oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
 
         # Generate the uboot-initial-env
         oe_runmake -C ${S} O=${B} u-boot-initial-env
     fi
-
 }
 
 do_install () {
@@ -175,9 +174,9 @@ do_install () {
                     ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env
                 fi
             done
-            unset  j
+            unset j
         done
-        unset  i
+        unset i
     else
         install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
         ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
@@ -232,9 +231,9 @@ do_install () {
                          ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}
                     fi
                 done
-                unset  j
+                unset j
             done
-            unset  i
+            unset i
         else
             install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
             ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME}
@@ -251,7 +250,6 @@ do_install () {
     then
         install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
     fi
-
 }
 
 PACKAGE_BEFORE_PN += "${PN}-env"
@@ -288,9 +286,9 @@ do_deploy () {
                     ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${type}
                 fi
             done
-            unset  j
+            unset j
         done
-        unset  i
+        unset i
     else
         install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
 
@@ -359,9 +357,9 @@ do_deploy () {
                         ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}
                     fi
                 done
-                unset  j
+                unset j
             done
-            unset  i
+            unset i
         else
             install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
             rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}
Signature · 1 line
2.26.2
author
#4 lore raw

PATCH v3 3/3 u-boot: introduce UBOOT_INITIAL_ENV

In reply to Ming Liu

From: Ming Liu <[email protected]>

It defaults to ${PN}-initial-env, no functional changes with current implementation, but this allows it to be changed in individual u-boot recipes.

If UBOOT_INITIAL_ENV is empty, then no initial env would be compiled/ installed/deployed, set ALLOW_EMPTY_${PN}-env = "1".

The major purpose for introducing this, is that the users might have some scripts on targets like:

```
/sbin/fw_setenv -f /etc/u-boot-initial-env
```

and it should be able to run against a identical path generated by different u-boot recipes.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 55 +++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 19 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +36 -19
index be15e1760f..8e60615e5c 100644
@@ -60,6 +60,10 @@ UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
 UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
 UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
 
+# Default name of u-boot initial env, but enable individual recipes to change
+# this value.
+UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
+
 # U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf
 # to find EXTLINUX conf file.
 UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
@@ -137,8 +141,10 @@ do_compile () {
                     done
 
                     # Generate the uboot-initial-env
-                    oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
-                    cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
+                        cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
+                    fi
 
                     unset k
                 fi
@@ -150,7 +156,9 @@ do_compile () {
         oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
 
         # Generate the uboot-initial-env
-        oe_runmake -C ${S} O=${B} u-boot-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            oe_runmake -C ${S} O=${B} u-boot-initial-env
+        fi
     fi
 }
 
@@ -168,10 +176,12 @@ do_install () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
 
                     # Install the uboot-initial-env
-                    install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
+                    fi
                 fi
             done
             unset j
@@ -182,9 +192,11 @@ do_install () {
         ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
 
         # Install the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${PV}-${PR}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
+        fi
     fi
 
     if [ -n "${UBOOT_ELF}" ]
@@ -255,8 +267,9 @@ do_install () {
 PACKAGE_BEFORE_PN += "${PN}-env"
 
 RPROVIDES_${PN}-env += "u-boot-default-env"
+ALLOW_EMPTY_${PN}-env = "1"
 FILES_${PN}-env = " \
-    ${sysconfdir}/${PN}-initial-env* \
+    ${sysconfdir}/${UBOOT_INITIAL_ENV}* \
     ${sysconfdir}/fw_env.config \
 "
 
@@ -280,10 +293,12 @@ do_deploy () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
 
                     # Deploy the uboot-initial-env
-                    install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
-                    cd ${DEPLOYDIR}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${MACHINE}-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${type}
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
+                        cd ${DEPLOYDIR}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
+                    fi
                 fi
             done
             unset j
@@ -298,10 +313,12 @@ do_deploy () {
         ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
 
         # Deploy the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${PV}-${PR}
-        cd ${DEPLOYDIR}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env-${MACHINE}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
+            cd ${DEPLOYDIR}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
+        fi
     fi
 
     if [ -e ${WORKDIR}/fw_env.config ] ; then
Signature · 1 line
2.26.2
#5 lore raw

Re: [OE-core] [PATCH V3 3/3] u-boot: introduce UBOOT_INITIAL_ENV

Quoted 95 lines · Ming Liu

From: Ming Liu <[email protected]>

It defaults to ${PN}-initial-env, no functional changes with current implementation, but this allows it to be changed in individual u-boot recipes.

If UBOOT_INITIAL_ENV is empty, then no initial env would be compiled/ installed/deployed, set ALLOW_EMPTY_${PN}-env = "1".

The major purpose for introducing this, is that the users might have some scripts on targets like:

```
/sbin/fw_setenv -f /etc/u-boot-initial-env
```

and it should be able to run against a identical path generated by different u-boot recipes.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 55 +++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 19 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +22 -10
index be15e1760f..8e60615e5c 100644
@@ -60,6 +60,10 @@ UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
 UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
 UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
 
+# Default name of u-boot initial env, but enable individual recipes to change
+# this value.
+UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
+
 # U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf
 # to find EXTLINUX conf file.
 UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
@@ -137,8 +141,10 @@ do_compile () {
                     done
 
                     # Generate the uboot-initial-env
-                    oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
-                    cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
+                        cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
+                    fi
 
                     unset k
                 fi
@@ -150,7 +156,9 @@ do_compile () {
         oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
 
         # Generate the uboot-initial-env
-        oe_runmake -C ${S} O=${B} u-boot-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            oe_runmake -C ${S} O=${B} u-boot-initial-env
+        fi
     fi
 }
 
@@ -168,10 +176,12 @@ do_install () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
 
                     # Install the uboot-initial-env
-                    install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
+                    fi
                 fi
             done
             unset j
@@ -182,9 +192,11 @@ do_install () {
         ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
 
         # Install the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${PV}-${PR}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
+        fi
     fi
 
     if [ -n "${UBOOT_ELF}" ]

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 270

Quoted 4 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
@@ -255,8 +267,9 @@ do_install () {
 PACKAGE_BEFORE_PN += "${PN}-env"
 
 RPROVIDES_${PN}-env += "u-boot-default-env"
+ALLOW_EMPTY_${PN}-env = "1"

I don't think this ^ is required, as there are other files in ${PN}-env, e.g. fw_env.config:

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 274

Quoted 5 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
 FILES_${PN}-env = " \
-    ${sysconfdir}/${PN}-initial-env* \
+    ${sysconfdir}/${UBOOT_INITIAL_ENV}* \
     ${sysconfdir}/fw_env.config \
 "

So, what happens whe UBOOT_INITIAL_ENV is empty? You get ${sysconfdir}/* in there. Mayve you need a better check here?

Quoted 39 lines
meta/recipes-bsp/u-boot/u-boot.inc +12 -8
@@ -280,10 +293,12 @@ do_deploy () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
 
                     # Deploy the uboot-initial-env
-                    install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
-                    cd ${DEPLOYDIR}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${MACHINE}-${type}
-                    ln -sf ${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${type}
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
+                        cd ${DEPLOYDIR}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
+                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}
+                    fi
                 fi
             done
             unset j
@@ -298,10 +313,12 @@ do_deploy () {
         ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
 
         # Deploy the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${PV}-${PR}
-        cd ${DEPLOYDIR}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env-${MACHINE}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR} ${PN}-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
+            cd ${DEPLOYDIR}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${UBOOT_INITIAL_ENV}
+        fi
     fi
 
     if [ -e ${WORKDIR}/fw_env.config ] ; then
Signature · 1 line
2.26.2
author
#6 lore raw

Re: [OE-core] [PATCH V3 3/3] u-boot: introduce UBOOT_INITIAL_ENV

Hi, Denys:

To install fw_env.config or not is also optional, attempt to say that "ALLOW_EMPTY_${PN}-dev = "1"" is needed.

Will send a V4 according to your other comments.

//Ming Liu

Denys Dmytriyenko <[email protected]> 於 2020年5月29日 週五 下午10:11寫道:

Quoted 206 lines · Ming Liu
Quoted 18 lines

From: Ming Liu <[email protected]>

It defaults to ${PN}-initial-env, no functional changes with current implementation, but this allows it to be changed in individual u-boot recipes.

If UBOOT_INITIAL_ENV is empty, then no initial env would be compiled/ installed/deployed, set ALLOW_EMPTY_${PN}-env = "1".

The major purpose for introducing this, is that the users might have some scripts on targets like:

```
/sbin/fw_setenv -f /etc/u-boot-initial-env
```

and it should be able to run against a identical path generated by different u-boot recipes.

Review

Quoted 6 lines
---
 meta/recipes-bsp/u-boot/u-boot.inc | 55 +++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-bsp/u-boot/u-boot.inc

meta/recipes-bsp/u-boot/u-boot.inc UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" · line 60

Quoted 5 lines

index be15e1760f..8e60615e5c 100644

meta/recipes-bsp/u-boot/u-boot.inc +0 -0
@@ -60,6 +60,10 @@ UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
 UBOOT_ENV_IMAGE ?=

"${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"

meta/recipes-bsp/u-boot/u-boot.inc UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"

Quoted 3 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
 UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
 
+# Default name of u-boot initial env, but enable individual recipes to

change

meta/recipes-bsp/u-boot/u-boot.inc UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"

Quoted 4 lines
meta/recipes-bsp/u-boot/u-boot.inc +3 -0
+# this value.
+UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
+
 # U-Boot EXTLINUX variables. U-Boot searches for

/boot/extlinux/extlinux.conf

meta/recipes-bsp/u-boot/u-boot.inc do_compile () { · line 140

Quoted 7 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
 # to find EXTLINUX conf file.
 UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux"
@@ -137,8 +141,10 @@ do_compile () {
                     done
 
                     # Generate the uboot-initial-env
-                    oe_runmake -C ${S} O=${B}/${config}

u-boot-initial-env

meta/recipes-bsp/u-boot/u-boot.inc do_compile () { · line 141

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-                    cp ${B}/${config}/u-boot-initial-env

${B}/${config}/u-boot-initial-env-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_compile () { · line 145

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        oe_runmake -C ${S} O=${B}/${config}

u-boot-initial-env

meta/recipes-bsp/u-boot/u-boot.inc do_compile () { · line 146

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+                        cp ${B}/${config}/u-boot-initial-env

${B}/${config}/u-boot-initial-env-${type}

Quoted 16 lines
meta/recipes-bsp/u-boot/u-boot.inc +4 -1
+                    fi
 
                     unset k
                 fi
@@ -150,7 +156,9 @@ do_compile () {
         oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
 
         # Generate the uboot-initial-env
-        oe_runmake -C ${S} O=${B} u-boot-initial-env
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            oe_runmake -C ${S} O=${B} u-boot-initial-env
+        fi
     fi
 }
 

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 176

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
@@ -168,10 +176,12 @@ do_install () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}

${D}/boot/${UBOOT_BINARY}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 170

Quoted 3 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
                     # Install the uboot-initial-env
-                    install -D -m 644

${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 171

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-                    ln -sf

${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 172

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-                    ln -sf

${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
${D}/${sysconfdir}/${PN}-initial-env-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 173

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-                    ln -sf

${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
${D}/${sysconfdir}/${PN}-initial-env

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 179

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644

${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 180

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+                        ln -sf

${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 181

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+                        ln -sf

${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 182

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+                        ln -sf

${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 185

Quoted 9 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
+                    fi
                 fi
             done
             unset j
@@ -182,9 +192,11 @@ do_install () {
         ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
 
         # Install the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env

${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 186

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR}

${D}/${sysconfdir}/${PN}-initial-env-${MACHINE}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 187

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR}

${D}/${sysconfdir}/${PN}-initial-env

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 196

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env

${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 197

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 198

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 270

Quoted 9 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+        fi
     fi
 
     if [ -n "${UBOOT_ELF}" ]
@@ -255,8 +267,9 @@ do_install () {
 PACKAGE_BEFORE_PN += "${PN}-env"
 
 RPROVIDES_${PN}-env += "u-boot-default-env"
+ALLOW_EMPTY_${PN}-env = "1"

I don't think this ^ is required, as there are other files in ${PN}-env, e.g.
fw_env.config:

meta/recipes-bsp/u-boot/u-boot.inc do_install () { · line 274

Quoted 5 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
 FILES_${PN}-env = " \
-    ${sysconfdir}/${PN}-initial-env* \
+    ${sysconfdir}/${UBOOT_INITIAL_ENV}* \
     ${sysconfdir}/fw_env.config \
 "

So, what happens whe UBOOT_INITIAL_ENV is empty? You get ${sysconfdir}/* in
there. Mayve you need a better check here?

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 293

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
@@ -280,10 +293,12 @@ do_deploy () {
                     ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}

${UBOOT_BINARY}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 282

Quoted 3 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
                     # Deploy the uboot-initial-env
-                    install -D -m 644

${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 284

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -2
-                    cd ${DEPLOYDIR}
-                    ln -sf

${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR}
${PN}-initial-env-${MACHINE}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 285

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-                    ln -sf

${PN}-initial-env-${MACHINE}-${type}-${PV}-${PR} ${PN}-initial-env-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 296

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+                        install -D -m 644

${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 298

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+                        cd ${DEPLOYDIR}
+                        ln -sf

${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 299

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+                        ln -sf

${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${UBOOT_INITIAL_ENV}-${type}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 301

Quoted 9 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
+                    fi
                 fi
             done
             unset j
@@ -298,10 +313,12 @@ do_deploy () {
         ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
 
         # Deploy the uboot-initial-env
-        install -D -m 644 ${B}/u-boot-initial-env

${DEPLOYDIR}/${PN}-initial-env-${MACHINE}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 303

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +0 -2
-        cd ${DEPLOYDIR}
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR}

${PN}-initial-env-${MACHINE}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 304

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +0 -1
-        ln -sf ${PN}-initial-env-${MACHINE}-${PV}-${PR}

${PN}-initial-env

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 317

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
+            install -D -m 644 ${B}/u-boot-initial-env

${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 319

Quoted 2 lines
meta/recipes-bsp/u-boot/u-boot.inc +2 -0
+            cd ${DEPLOYDIR}
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

${UBOOT_INITIAL_ENV}-${MACHINE}

meta/recipes-bsp/u-boot/u-boot.inc do_deploy () { · line 320

Quoted 1 line
meta/recipes-bsp/u-boot/u-boot.inc +1 -0
+            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}

${UBOOT_INITIAL_ENV}

Quoted 9 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
+        fi
     fi
 
     if [ -e ${WORKDIR}/fw_env.config ] ; then
--

2.26.2