All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ming Liu" <liu.ming50@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: stefan.agner@toradex.com, max.krummenacher@toradex.com,
	denys@ti.com, Ming Liu <ming.liu@toradex.com>
Subject: [OE-core] [PATCH V3 3/3] u-boot: introduce UBOOT_INITIAL_ENV
Date: Thu, 28 May 2020 14:41:29 +0200	[thread overview]
Message-ID: <20200528124129.15100-4-liu.ming50@gmail.com> (raw)
In-Reply-To: <20200528124129.15100-1-liu.ming50@gmail.com>

From: Ming Liu <ming.liu@toradex.com>

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.

Signed-off-by: Ming Liu <ming.liu@toradex.com>
---
 meta/recipes-bsp/u-boot/u-boot.inc | 55 +++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc
index be15e1760f..8e60615e5c 100644
--- a/meta/recipes-bsp/u-boot/u-boot.inc
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -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
-- 
2.26.2


  parent reply	other threads:[~2020-05-28 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 12:41 [OE-core] [PATCH V3 0/3] Introduce UBOOT_INITIAL_ENV/cfg files fixes/coding style fixes Ming Liu
2020-05-28 12:41 ` [OE-core] [PATCH V3 1/3] u-boot: support merging .cfg files for UBOOT_CONFIG Ming Liu
2020-05-29 20:09   ` Denys Dmytriyenko
2020-05-28 12:41 ` [OE-core] [PATCH V3 2/3] u-boot.inc: fix some inconsistent coding style Ming Liu
2020-05-28 12:41 ` Ming Liu [this message]
2020-05-29 20:11   ` [OE-core] [PATCH V3 3/3] u-boot: introduce UBOOT_INITIAL_ENV Denys Dmytriyenko
2020-06-01  6:48     ` Ming Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200528124129.15100-4-liu.ming50@gmail.com \
    --to=liu.ming50@gmail.com \
    --cc=denys@ti.com \
    --cc=max.krummenacher@toradex.com \
    --cc=ming.liu@toradex.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=stefan.agner@toradex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.