All of lore.kernel.org
 help / color / mirror / Atom feed
* firmware: fix build of external firmware
@ 2014-08-07  7:58 Jan Beulich
  2014-08-08 13:20 ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2014-08-07  7:58 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild

It looks like commit 5180d5f483 ("firmware: Simplify directory
creation") uncovered a latent bug: The cmd_fwbin make macro, which is
being called without any arguments, referenced argument 2, which I
suppose previously just happened to be set to the right value (from an
enclosing macro invocation - some make versions don't always properly
clear unused macro arguments on nested macro invocations). In 3.16 with
such make versions it now points into the source tree instead,
resulting in build failure when building outside the source tree. And
obviously on make versions properly clearing unused arguments it would
have resolved to empty.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -159,7 +159,7 @@ quiet_cmd_fwbin = MK_FW   $@
 		  echo "    .section .rodata"				>>$@;\
 		  echo "    .p2align $${ASM_ALIGN}"			>>$@;\
 		  echo "_fw_$${FWSTR}_bin:"				>>$@;\
-		  echo "    .incbin \"$(2)\""				>>$@;\
+		  echo "    .incbin \"$(obj)/$$FWNAME\""		>>$@;\
 		  echo "_fw_end:"					>>$@;\
 		  echo "   .section .rodata.str,\"aMS\",$${PROGBITS},1"	>>$@;\
 		  echo "    .p2align $${ASM_ALIGN}"			>>$@;\




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

* Re: firmware: fix build of external firmware
  2014-08-07  7:58 firmware: fix build of external firmware Jan Beulich
@ 2014-08-08 13:20 ` Michal Marek
  2014-08-08 13:29   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2014-08-08 13:20 UTC (permalink / raw)
  To: Jan Beulich; +Cc: linux-kbuild

On 2014-08-07 09:58, Jan Beulich wrote:
> It looks like commit 5180d5f483 ("firmware: Simplify directory
> creation") uncovered a latent bug: The cmd_fwbin make macro, which is
> being called without any arguments, referenced argument 2, which I
> suppose previously just happened to be set to the right value (from an
> enclosing macro invocation - some make versions don't always properly
> clear unused macro arguments on nested macro invocations). In 3.16 with
> such make versions it now points into the source tree instead,
> resulting in build failure when building outside the source tree. And
> obviously on make versions properly clearing unused arguments it would
> have resolved to empty.

With which make version are you seeing the error?

Thanks,
Michal

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

* Re: firmware: fix build of external firmware
  2014-08-08 13:20 ` Michal Marek
@ 2014-08-08 13:29   ` Jan Beulich
  2014-08-13 14:55     ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2014-08-08 13:29 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild

>>> On 08.08.14 at 15:20, <mmarek@suse.cz> wrote:
> On 2014-08-07 09:58, Jan Beulich wrote:
>> It looks like commit 5180d5f483 ("firmware: Simplify directory
>> creation") uncovered a latent bug: The cmd_fwbin make macro, which is
>> being called without any arguments, referenced argument 2, which I
>> suppose previously just happened to be set to the right value (from an
>> enclosing macro invocation - some make versions don't always properly
>> clear unused macro arguments on nested macro invocations). In 3.16 with
>> such make versions it now points into the source tree instead,
>> resulting in build failure when building outside the source tree. And
>> obviously on make versions properly clearing unused arguments it would
>> have resolved to empty.
> 
> With which make version are you seeing the error?

3.80 and 3.81, albeit with the latter I can't construct a simple
repro Makefile to demonstrate the problem (hence the mentioning
of "make versions" _and_ "don't always").

Jan


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

* Re: firmware: fix build of external firmware
  2014-08-08 13:29   ` Jan Beulich
@ 2014-08-13 14:55     ` Michal Marek
  2014-08-22 14:52       ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2014-08-13 14:55 UTC (permalink / raw)
  To: Jan Beulich; +Cc: linux-kbuild

On 2014-08-08 15:29, Jan Beulich wrote:
>>>> On 08.08.14 at 15:20, <mmarek@suse.cz> wrote:
>> On 2014-08-07 09:58, Jan Beulich wrote:
>>> It looks like commit 5180d5f483 ("firmware: Simplify directory
>>> creation") uncovered a latent bug: The cmd_fwbin make macro, which is
>>> being called without any arguments, referenced argument 2, which I
>>> suppose previously just happened to be set to the right value (from an
>>> enclosing macro invocation - some make versions don't always properly
>>> clear unused macro arguments on nested macro invocations). In 3.16 with
>>> such make versions it now points into the source tree instead,
>>> resulting in build failure when building outside the source tree. And
>>> obviously on make versions properly clearing unused arguments it would
>>> have resolved to empty.
>>
>> With which make version are you seeing the error?
> 
> 3.80 and 3.81, albeit with the latter I can't construct a simple
> repro Makefile to demonstrate the problem (hence the mentioning
> of "make versions" _and_ "don't always").

It actually fails for me with the patch and works without:

$ mkdir ~/fw
$ echo 'hello world' >~/fw/test.bin
$ grep FIRMWARE .config
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE="test.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/home/mmarek/fw"
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_GOOGLE_FIRMWARE is not set
$ make
...
  MK_FW   firmware/test.bin.gen.S
  AS      firmware/test.bin.gen.o
firmware/test.bin.gen.S: Assembler messages:
firmware/test.bin.gen.S:5: Error: file not found: firmware/test.bin
make[1]: *** [firmware/test.bin.gen.o] Error 1
make: *** [firmware] Error 2
$ make --version
GNU Make 3.81
...

What are the exact step to reproduce the bug you are seeing?

Thanks,
Michal

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

* Re: firmware: fix build of external firmware
  2014-08-13 14:55     ` Michal Marek
@ 2014-08-22 14:52       ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2014-08-22 14:52 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild

>>> On 13.08.14 at 16:55, <mmarek@suse.cz> wrote:
> On 2014-08-08 15:29, Jan Beulich wrote:
>>>>> On 08.08.14 at 15:20, <mmarek@suse.cz> wrote:
>>> On 2014-08-07 09:58, Jan Beulich wrote:
>>>> It looks like commit 5180d5f483 ("firmware: Simplify directory
>>>> creation") uncovered a latent bug: The cmd_fwbin make macro, which is
>>>> being called without any arguments, referenced argument 2, which I
>>>> suppose previously just happened to be set to the right value (from an
>>>> enclosing macro invocation - some make versions don't always properly
>>>> clear unused macro arguments on nested macro invocations). In 3.16 with
>>>> such make versions it now points into the source tree instead,
>>>> resulting in build failure when building outside the source tree. And
>>>> obviously on make versions properly clearing unused arguments it would
>>>> have resolved to empty.
>>>
>>> With which make version are you seeing the error?
>> 
>> 3.80 and 3.81, albeit with the latter I can't construct a simple
>> repro Makefile to demonstrate the problem (hence the mentioning
>> of "make versions" _and_ "don't always").
> 
> It actually fails for me with the patch and works without:
> 
> $ mkdir ~/fw
> $ echo 'hello world' >~/fw/test.bin
> $ grep FIRMWARE .config
> CONFIG_PREVENT_FIRMWARE_BUILD=y
> CONFIG_FIRMWARE_IN_KERNEL=y
> CONFIG_EXTRA_FIRMWARE="test.bin"
> CONFIG_EXTRA_FIRMWARE_DIR="/home/mmarek/fw"
> # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
> # CONFIG_FIRMWARE_EDID is not set
> CONFIG_FIRMWARE_MEMMAP=y
> # CONFIG_GOOGLE_FIRMWARE is not set
> $ make
> ...
>   MK_FW   firmware/test.bin.gen.S
>   AS      firmware/test.bin.gen.o
> firmware/test.bin.gen.S: Assembler messages:
> firmware/test.bin.gen.S:5: Error: file not found: firmware/test.bin
> make[1]: *** [firmware/test.bin.gen.o] Error 1
> make: *** [firmware] Error 2
> $ make --version
> GNU Make 3.81
> ...
> 
> What are the exact step to reproduce the bug you are seeing?

Okay, I see now where the $(2) comes from and that this is the
correct thing to use. The problem got introduced in a completely
different place: $(objtree) all of the sudden is just . rather than
$(CURDIR) (your commit 7e1c04779e), and I have

# CONFIG_FIRMWARE_IN_KERNEL is not set
CONFIG_EXTRA_FIRMWARE="tigon/tg3_tso.bin"
CONFIG_EXTRA_FIRMWARE_DIR="${objtree}/firmware"

in an attempt to avoid all kinds of other firmware to be put into
the kernel too. The logic at the top of firmware/Makefile now
wrongly tries to locate the file in the source tree rather than the
object one (and note the final conversion being there just to get
rid of the $(objtree) prefix, which seems pretty pointless with
that change of yours).

Jan


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

end of thread, other threads:[~2014-08-22 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  7:58 firmware: fix build of external firmware Jan Beulich
2014-08-08 13:20 ` Michal Marek
2014-08-08 13:29   ` Jan Beulich
2014-08-13 14:55     ` Michal Marek
2014-08-22 14:52       ` Jan Beulich

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.