mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number
@ 2023-05-26  7:08 Johannes Zink
  2023-05-26  7:50 ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Zink @ 2023-05-26  7:08 UTC (permalink / raw)
  To: barebox; +Cc: patchwork-jzi, kernel, =ahmad, afa, Johannes Zink

As Ahmad pointed out in [1], compilation failed if the prepare make
target was not called before compiling the imx-usb-loader, which caused
the generated file not to exist when building for the sandbox target and
broke the build.

As the included utsrelease file only contains a UTS_RELEASE macro
generated from the KERNELVERSION make variable: use the variable
directly and pass it via HOSTCFLAGS as a define. Leave the remaining
code untouched to still support compiling the imx-usb-loader from an
external makefile which does not define the UTS_RELEASE macro.

while at it: also propagate the version number to the target imx-usb-loader.

Fixes: c1b50061f4b3 ("imx-usb-loader: add commandline option for
displaying version number")

[1] 20230525181320.2277320-1-ahmad@a3f.at

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
 scripts/imx/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
index b3be3886d8eb..dca6be2fe1f4 100644
--- a/scripts/imx/Makefile
+++ b/scripts/imx/Makefile
@@ -3,10 +3,10 @@
 hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
 hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
 
-HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
+HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
 HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
 
-imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
+imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
 imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
 
 HOSTCFLAGS_imx.o = -I$(srctree)/include/mach
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number
  2023-05-26  7:08 [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number Johannes Zink
@ 2023-05-26  7:50 ` Ahmad Fatoum
  2023-05-26  8:19   ` Johannes Zink
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-05-26  7:50 UTC (permalink / raw)
  To: Johannes Zink, barebox; +Cc: patchwork-jzi, kernel, ahmad, afa

On 26.05.23 09:08, Johannes Zink wrote:
> As Ahmad pointed out in [1], compilation failed if the prepare make
> target was not called before compiling the imx-usb-loader, which caused
> the generated file not to exist when building for the sandbox target and
> broke the build.

This needs to be v2 as patch is in master.

> 
> As the included utsrelease file only contains a UTS_RELEASE macro
> generated from the KERNELVERSION make variable: use the variable
> directly and pass it via HOSTCFLAGS as a define.

I think you lose dependency tracking this way. If you update e.g. EXTRAVERSION
(like umpf does) and imx-usb-loader was already built, it won't be rebuilt
to report the new version.

> Leave the remaining
> code untouched to still support compiling the imx-usb-loader from an
> external makefile which does not define the UTS_RELEASE macro.
> 
> while at it: also propagate the version number to the target imx-usb-loader.

Good catch.

> 
> Fixes: c1b50061f4b3 ("imx-usb-loader: add commandline option for
> displaying version number")
> 
> [1] 20230525181320.2277320-1-ahmad@a3f.at

You can like it via lore.barebox.org to make lookup easier.

> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
>  scripts/imx/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
> index b3be3886d8eb..dca6be2fe1f4 100644
> --- a/scripts/imx/Makefile
> +++ b/scripts/imx/Makefile
> @@ -3,10 +3,10 @@
>  hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
>  hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
>  
> -HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
> +HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>  HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
>  
> -imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
> +imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>  imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
>  
>  HOSTCFLAGS_imx.o = -I$(srctree)/include/mach

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number
  2023-05-26  7:50 ` Ahmad Fatoum
@ 2023-05-26  8:19   ` Johannes Zink
  2023-05-26  8:23     ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Zink @ 2023-05-26  8:19 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox; +Cc: patchwork-jzi, kernel, ahmad, afa

Hi Ahmad,

On 5/26/23 09:50, Ahmad Fatoum wrote:
> On 26.05.23 09:08, Johannes Zink wrote:
>> As Ahmad pointed out in [1], compilation failed if the prepare make
>> target was not called before compiling the imx-usb-loader, which caused
>> the generated file not to exist when building for the sandbox target and
>> broke the build.
> 
> This needs to be v2 as patch is in master.

I see. I will send a v2 then, including some more fixes.

> 
>>
>> As the included utsrelease file only contains a UTS_RELEASE macro
>> generated from the KERNELVERSION make variable: use the variable
>> directly and pass it via HOSTCFLAGS as a define.
> 
> I think you lose dependency tracking this way. If you update e.g. EXTRAVERSION
> (like umpf does) and imx-usb-loader was already built, it won't be rebuilt
> to report the new version.

ack, good catch. Will send a new version fixing this, the data is 
available anyway, so let's use it. Do you prefer handing all substrings 
down to the C file piece-by-piece or should I assemble the entire 
version string in the makefile and hand it down as one piece?

> 
>> Leave the remaining
>> code untouched to still support compiling the imx-usb-loader from an
>> external makefile which does not define the UTS_RELEASE macro.
>>
>> while at it: also propagate the version number to the target imx-usb-loader.
> 
> Good catch.
> 
>>
>> Fixes: c1b50061f4b3 ("imx-usb-loader: add commandline option for
>> displaying version number")
>>
>> [1] 20230525181320.2277320-1-ahmad@a3f.at
> 
> You can like it via lore.barebox.org to make lookup easier.

Ack, will fix this in v2.

Johannes

> 
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>>   scripts/imx/Makefile | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
>> index b3be3886d8eb..dca6be2fe1f4 100644
>> --- a/scripts/imx/Makefile
>> +++ b/scripts/imx/Makefile
>> @@ -3,10 +3,10 @@
>>   hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
>>   hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
>>   
>> -HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
>> +HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>>   HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
>>   
>> -imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
>> +imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>>   imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
>>   
>>   HOSTCFLAGS_imx.o = -I$(srctree)/include/mach
> 

-- 
Pengutronix e.K.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number
  2023-05-26  8:19   ` Johannes Zink
@ 2023-05-26  8:23     ` Ahmad Fatoum
  0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-05-26  8:23 UTC (permalink / raw)
  To: Johannes Zink, barebox; +Cc: patchwork-jzi, kernel, ahmad, afa

On 26.05.23 10:19, Johannes Zink wrote:
> Hi Ahmad,
> 
> On 5/26/23 09:50, Ahmad Fatoum wrote:
>> On 26.05.23 09:08, Johannes Zink wrote:
>>> As Ahmad pointed out in [1], compilation failed if the prepare make
>>> target was not called before compiling the imx-usb-loader, which caused
>>> the generated file not to exist when building for the sandbox target and
>>> broke the build.
>>
>> This needs to be v2 as patch is in master.
> 
> I see. I will send a v2 then, including some more fixes.
> 
>>
>>>
>>> As the included utsrelease file only contains a UTS_RELEASE macro
>>> generated from the KERNELVERSION make variable: use the variable
>>> directly and pass it via HOSTCFLAGS as a define.
>>
>> I think you lose dependency tracking this way. If you update e.g. EXTRAVERSION
>> (like umpf does) and imx-usb-loader was already built, it won't be rebuilt
>> to report the new version.
> 
> ack, good catch. Will send a new version fixing this, the data is available anyway, so let's use it. Do you prefer handing all substrings down to the C file piece-by-piece or should I assemble the entire version string in the makefile and hand it down as one piece?

One piece is ok. My main concern is the dependency tracking.



> 
>>
>>> Leave the remaining
>>> code untouched to still support compiling the imx-usb-loader from an
>>> external makefile which does not define the UTS_RELEASE macro.
>>>
>>> while at it: also propagate the version number to the target imx-usb-loader.
>>
>> Good catch.
>>
>>>
>>> Fixes: c1b50061f4b3 ("imx-usb-loader: add commandline option for
>>> displaying version number")
>>>
>>> [1] 20230525181320.2277320-1-ahmad@a3f.at
>>
>> You can like it via lore.barebox.org to make lookup easier.
> 
> Ack, will fix this in v2.
> 
> Johannes
> 
>>
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>>   scripts/imx/Makefile | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
>>> index b3be3886d8eb..dca6be2fe1f4 100644
>>> --- a/scripts/imx/Makefile
>>> +++ b/scripts/imx/Makefile
>>> @@ -3,10 +3,10 @@
>>>   hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)    += imx-image
>>>   hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)    += imx-usb-loader
>>>   -HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
>>> +HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>>>   HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
>>>   -imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0`
>>> +imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -DUTS_RELEASE='"$(KERNELVERSION)"'
>>>   imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
>>>     HOSTCFLAGS_imx.o = -I$(srctree)/include/mach
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-26  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:08 [PATCH] fixup! imx-usb-loader: add commandline option for displaying version number Johannes Zink
2023-05-26  7:50 ` Ahmad Fatoum
2023-05-26  8:19   ` Johannes Zink
2023-05-26  8:23     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox