Skip to contentSkip to conversation

u-boot.inc: WORKDIR -> UNPACKDIR transition

PATCH Superseded Leon Anavi 3 participants 5 messages Jun 23, 2024 – Jun 27, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Leon Anavi

author
#0 lore raw

PATCH 1/1 u-boot.inc: WORKDIR -> UNPACKDIR transition

Replace references of WORKDIR with UNPACKDIR for U-Boot script and variable UBOOT_ENV_BINARY, for example for boot.scr.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +3 -3
index 45d700fbdd..9a91a0e3d8 100644
@@ -92,7 +92,7 @@ do_compile () {
 
     if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
     then
-        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
+        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${UNPACKDIR}/${UBOOT_ENV_BINARY}
     fi
 }
 
@@ -188,7 +188,7 @@ do_install () {
 
     if [ -n "${UBOOT_ENV}" ]
     then
-        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
+        install -m 644 ${UNPACKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
         ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
     fi
 
@@ -324,7 +324,7 @@ do_deploy () {
 
     if [ -n "${UBOOT_ENV}" ]
     then
-        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
+        install -m 644 ${UNPACKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
         ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
         ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
     fi
Signature · 1 line
2.39.2
#1 lore raw
Quoted 13 lines · Leon Anavi via lists.openembedded.org

Replace references of WORKDIR with UNPACKDIR for U-Boot script and variable UBOOT_ENV_BINARY, for example for boot.scr.

---
 meta/recipes-bsp/u-boot/u-boot.inc | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
index 45d700fbdd..9a91a0e3d8 100644
@@ -92,7 +92,7 @@ do_compile () {
Quoted 7 lines


     if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
     then
-        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY} +        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${UNPACKDIR}/${UBOOT_ENV_BINARY} fi
 }

If that command is writing a file, the written file should remain in WORKDIR, not UNPACKDIR. I suspect the SRC should probably therefore be changed but not the BINARY?

Quoted 11 lines

meta/recipes-bsp/u-boot/u-boot.inc +0 -0
@@ -188,7 +188,7 @@ do_install () {


     if [ -n "${UBOOT_ENV}" ]
     then
-        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} +        install -m 644 ${UNPACKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
     fi

meta/recipes-bsp/u-boot/u-boot.inc +0 -0
@@ -324,7 +324,7 @@ do_deploy () {
Quoted 8 lines


     if [ -n "${UBOOT_ENV}" ]
     then
-        install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} +        install -m 644 ${UNPACKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
         ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
     fi

Which would then make these unneeded?

Cheers,

Richard

#2 lore raw

Hi Richard,

Quoted 15 lines · Richard Purdie via lists.openembedded.org
Quoted 14 lines · Leon Anavi via lists.openembedded.org

Replace references of WORKDIR with UNPACKDIR for U-Boot script and variable UBOOT_ENV_BINARY, for example for boot.scr.

---
  meta/recipes-bsp/u-boot/u-boot.inc | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
index 45d700fbdd..9a91a0e3d8 100644
@@ -92,7 +92,7 @@ do_compile () {
 
Quoted 11 lines

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

Quoted 6 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
      if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
      then
-        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
+        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${UNPACKDIR}/${UBOOT_ENV_BINARY}
      fi
  }

If that command is writing a file, the written file should remain in WORKDIR, not UNPACKDIR. I suspect the SRC should probably therefore be changed but not the BINARY?

WORKDIR still isn't cleaned between builds of a recipe I assume? While migrating to UNPACKDIR gets rid of patches that were once in SRC_URI but aren't anymore (or other files for that matter), using WORKDIR as a temporary directory between tasks is going to be an issue depending on how the other tasks are going to behave. If the logic using the file is the same as the logic for creating the file then it shouldn't be an issue. But if the logic using the file is just checking whether the file exists, then using WORKDIR is an issue since it won't be cleaned between builds of the same recipe.

Maybe we should go for ${B} instead?

Cheers,
Quentin

#3 lore raw
Quoted 30 lines · Quentin Schulz

Hi Richard,

Quoted 18 lines · Richard Purdie via lists.openembedded.org
Quoted 17 lines · Leon Anavi via lists.openembedded.org

Replace references of WORKDIR with UNPACKDIR for U-Boot script and variable UBOOT_ENV_BINARY, for example for boot.scr.

---
  meta/recipes-bsp/u-boot/u-boot.inc | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
index 45d700fbdd..9a91a0e3d8 100644
@@ -92,7 +92,7 @@ do_compile () {


      if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
      then
-        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}

Quoted 8 lines
Quoted 3 lines

+        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${UNPACKDIR}/${UBOOT_ENV_BINARY} fi
  }

If that command is writing a file, the written file should remain in WORKDIR, not UNPACKDIR. I suspect the SRC should probably therefore be changed but not the BINARY?

Quoted 9 lines

WORKDIR still isn't cleaned between builds of a recipe I assume? While migrating to UNPACKDIR gets rid of patches that were once in SRC_URI but aren't anymore (or other files for that matter), using WORKDIR as a temporary directory between tasks is going to be an issue depending on how the other tasks are going to behave. If the logic using the file is the same as the logic for creating the file then it shouldn't be an issue. But if the logic using the file is just checking whether the file exists, then using WORKDIR is an issue since it won't be cleaned between builds of the same recipe.

Correct.

Quoted 1 line

Maybe we should go for ${B} instead?

${B} would probably be an improvement, yes.

Cheers,

Richard

author
#4 lore raw

Hi Richard, Quentin,

Quoted 38 lines · Richard Purdie
Quoted 28 lines · Quentin Schulz

Hi Richard,

Quoted 15 lines · Richard Purdie via lists.openembedded.org
Quoted 14 lines · Leon Anavi via lists.openembedded.org

Replace references of WORKDIR with UNPACKDIR for U-Boot script and variable UBOOT_ENV_BINARY, for example for boot.scr.

---
   meta/recipes-bsp/u-boot/u-boot.inc | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +0 -0
index 45d700fbdd..9a91a0e3d8 100644
@@ -92,7 +92,7 @@ do_compile () {
 
Quoted 10 lines

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

Quoted 6 lines
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
       if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
       then
-        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
+        ${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${UNPACKDIR}/${UBOOT_ENV_BINARY}
       fi
   }

If that command is writing a file, the written file should remain in WORKDIR, not UNPACKDIR. I suspect the SRC should probably therefore be changed but not the BINARY?

Quoted 9 lines

WORKDIR still isn't cleaned between builds of a recipe I assume? While migrating to UNPACKDIR gets rid of patches that were once in SRC_URI but aren't anymore (or other files for that matter), using WORKDIR as a temporary directory between tasks is going to be an issue depending on how the other tasks are going to behave. If the logic using the file is the same as the logic for creating the file then it shouldn't be an issue. But if the logic using the file is just checking whether the file exists, then using WORKDIR is an issue since it won't be cleaned between builds of the same recipe.

Quoted 4 lines

Correct.

Quoted 1 line

Maybe we should go for ${B} instead?

${B} would probably be an improvement, yes.

Thank you for the valuable feedback. Following your suggestions I modified the patch to use B for UBOOT_ENV_BINARY. I sent v2 of the patch a few minutes ago. Best regards, Leon

Quoted 6 lines

Cheers,

Richard