diff mbox series

u-boot: do not pass O=$B, if $B = $S

Message ID 9e5273afdef2797f48970927998cd5f6d5b1e63f.1720120588.git.joerg.sommer@navimatix.de
State New
Headers show
Series u-boot: do not pass O=$B, if $B = $S | expand

Commit Message

Jörg Sommer July 4, 2024, 7:18 p.m. UTC
From: Jörg Sommer <joerg.sommer@navimatix.de>

The u-boot Makefile (even v2024.07) doesn't like it, when `O=…` is the same
directory as the source directory and complains about a dirty source
directory; see below. This happens when `UBOOT_MACHINE` is set and not
`UBOOT_CONFIG`.

```
% make O=$PWD all
make[1]: Entering directory '/home/joerg/git/u-boot'
  UPD     include/generated/timestamp_autogenerated.h
  Using /home/joerg/git/u-boot as source for U-Boot
  /home/joerg/git/u-boot is not clean, please run 'make mrproper'
  in the '/home/joerg/git/u-boot' directory.
make[1]: *** [/home/joerg/git/u-boot/Makefile:1928: prepare3] Error 1
make[1]: Leaving directory '/home/joerg/git/u-boot'
make: *** [Makefile:177: sub-make] Error 2
```

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
---
 meta/recipes-bsp/u-boot/u-boot.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


Would it be possible to get this patch into kirkstone and scarthgap?

Comments

Richard Purdie July 4, 2024, 7:38 p.m. UTC | #1
On Thu, 2024-07-04 at 21:18 +0200, Jörg Sommer via
lists.openembedded.org wrote:
> From: Jörg Sommer <joerg.sommer@navimatix.de>
> 
> The u-boot Makefile (even v2024.07) doesn't like it, when `O=…` is
> the same
> directory as the source directory and complains about a dirty source
> directory; see below. This happens when `UBOOT_MACHINE` is set and
> not
> `UBOOT_CONFIG`.
> 
> ```
> % make O=$PWD all
> make[1]: Entering directory '/home/joerg/git/u-boot'
>   UPD     include/generated/timestamp_autogenerated.h
>   Using /home/joerg/git/u-boot as source for U-Boot
>   /home/joerg/git/u-boot is not clean, please run 'make mrproper'
>   in the '/home/joerg/git/u-boot' directory.
> make[1]: *** [/home/joerg/git/u-boot/Makefile:1928: prepare3] Error 1
> make[1]: Leaving directory '/home/joerg/git/u-boot'
> make: *** [Makefile:177: sub-make] Error 2
> ```
> 
> Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
> ---
>  meta/recipes-bsp/u-boot/u-boot.inc | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Can we not just always ensure B is set to somewhere different to S?

Building in S is generally a bad idea and we try to avoid that with
anything that supports it.

Cheers,

Richard
Jörg Sommer July 5, 2024, 9:41 a.m. UTC | #2
Richard Purdie schrieb am Do 04. Jul, 20:38 (GMT):
> On Thu, 2024-07-04 at 21:18 +0200, Jörg Sommer via
> lists.openembedded.org wrote:
> > From: Jörg Sommer <joerg.sommer@navimatix.de>
> > 
> > The u-boot Makefile (even v2024.07) doesn't like it, when `O=…` is
> > the same
> > directory as the source directory and complains about a dirty source
> > directory; see below. This happens when `UBOOT_MACHINE` is set and
> > not
> > `UBOOT_CONFIG`.
> > 
> > ```
> > % make O=$PWD all
> > make[1]: Entering directory '/home/joerg/git/u-boot'
> >   UPD     include/generated/timestamp_autogenerated.h
> >   Using /home/joerg/git/u-boot as source for U-Boot
> >   /home/joerg/git/u-boot is not clean, please run 'make mrproper'
> >   in the '/home/joerg/git/u-boot' directory.
> > make[1]: *** [/home/joerg/git/u-boot/Makefile:1928: prepare3] Error 1
> > make[1]: Leaving directory '/home/joerg/git/u-boot'
> > make: *** [Makefile:177: sub-make] Error 2
> > ```
> > 
> > Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
> > ---
> >  meta/recipes-bsp/u-boot/u-boot.inc | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> Can we not just always ensure B is set to somewhere different to S?
> 
> Building in S is generally a bad idea and we try to avoid that with
> anything that supports it.

I did some tests and yes, setting $B solves my build issue and does not harm
a build with UBOOT_CONFIG. But I must admit, I could only test this with
kirkstone.

Would it be possible to get this patch in kirkstone and scarthgap, too?
Richard Purdie July 5, 2024, 9:50 a.m. UTC | #3
On Fri, 2024-07-05 at 11:41 +0200, Jörg Sommer wrote:
> Richard Purdie schrieb am Do 04. Jul, 20:38 (GMT):
> > On Thu, 2024-07-04 at 21:18 +0200, Jörg Sommer via
> > lists.openembedded.org wrote:
> > > From: Jörg Sommer <joerg.sommer@navimatix.de>
> > > 
> > > The u-boot Makefile (even v2024.07) doesn't like it, when `O=…` is
> > > the same
> > > directory as the source directory and complains about a dirty source
> > > directory; see below. This happens when `UBOOT_MACHINE` is set and
> > > not
> > > `UBOOT_CONFIG`.
> > > 
> > > ```
> > > % make O=$PWD all
> > > make[1]: Entering directory '/home/joerg/git/u-boot'
> > >   UPD     include/generated/timestamp_autogenerated.h
> > >   Using /home/joerg/git/u-boot as source for U-Boot
> > >   /home/joerg/git/u-boot is not clean, please run 'make mrproper'
> > >   in the '/home/joerg/git/u-boot' directory.
> > > make[1]: *** [/home/joerg/git/u-boot/Makefile:1928: prepare3] Error 1
> > > make[1]: Leaving directory '/home/joerg/git/u-boot'
> > > make: *** [Makefile:177: sub-make] Error 2
> > > ```
> > > 
> > > Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
> > > ---
> > >  meta/recipes-bsp/u-boot/u-boot.inc | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > Can we not just always ensure B is set to somewhere different to S?
> > 
> > Building in S is generally a bad idea and we try to avoid that with
> > anything that supports it.
> 
> I did some tests and yes, setting $B solves my build issue and does not harm
> a build with UBOOT_CONFIG. But I must admit, I could only test this with
> kirkstone.
> 
> Would it be possible to get this patch in kirkstone and scarthgap, too?

A patch setting B is more likely to get merged than the one you
originally posted. To get into kirkstone/scarthgap, we need to fix
master first, then backport as appropriate. Any patch does really need
to be tested with master first too. 

Whilst not essential, it would also be nice to understand whether there
is automated tests we should have to cover any particular scenarios
which are missing.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc
index fc36c21ec2..8172551c0c 100644
--- a/meta/recipes-bsp/u-boot/u-boot.inc
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -82,11 +82,15 @@  do_compile () {
         done
         unset i
     else
-        oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
+        if [ "${S}" != "${B}" ]; then
+            O="O=${B}"
+        fi
+
+        oe_runmake -C ${S} ${O:+"$O"} ${UBOOT_MAKE_TARGET}
 
         # Generate the uboot-initial-env
         if [ -n "${UBOOT_INITIAL_ENV}" ]; then
-            oe_runmake -C ${S} O=${B} u-boot-initial-env
+            oe_runmake -C ${S} ${O:+"$O"} u-boot-initial-env
         fi
     fi