linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Handle builtin dtb files containing hyphens
@ 2018-03-07 14:06 James Hogan
  2018-03-07 20:11 ` Frank Rowand
  2018-03-08  6:56 ` [PATCH] kbuild: Handle builtin dtb files " Frank Rowand
  0 siblings, 2 replies; 9+ messages in thread
From: James Hogan @ 2018-03-07 14:06 UTC (permalink / raw)
  To: linux-kbuild, devicetree
  Cc: linux-kernel, James Hogan, Rob Herring, Frank Rowand,
	Masahiro Yamada, Michal Marek, Ralf Baechle, Florian Fainelli,
	Kevin Cernekee, linux-mips, stable

On dtb files which contain hyphens, the dt_S_dtb command to build the
dtb.S files (which allow DTB files to be built into the kernel) results
in errors like the following:

bcm3368-netgear-cvg834g.dtb.S: Assembler messages:
bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section
bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'
bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'
bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'
bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section
bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'

This is due to the hyphen being used in symbol names. Replace all
hyphens with underscores in the dt_S_dtb command to avoid this problem.

Quite a lot of dts files have hyphens, but its only a problem on MIPS
where such files can be built into the kernel. For example when
CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
used (in the latter case it admitedly shouldn't really build all the
dtb.o files, but thats a separate issue).

Fixes: 695835511f96 ("MIPS: BMIPS: rename bcm96358nb4ser to bcm6358-neufbox4-sercom")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 4.9+
---
 scripts/Makefile.lib | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5589bae34af6..a6f538b31ad6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -297,11 +297,11 @@ cmd_dt_S_dtb=						\
 	echo '\#include <asm-generic/vmlinux.lds.h>'; 	\
 	echo '.section .dtb.init.rodata,"a"';		\
 	echo '.balign STRUCT_ALIGNMENT';		\
-	echo '.global __dtb_$(*F)_begin';		\
-	echo '__dtb_$(*F)_begin:';			\
+	echo '.global __dtb_$(subst -,_,$(*F))_begin';	\
+	echo '__dtb_$(subst -,_,$(*F))_begin:';		\
 	echo '.incbin "$<" ';				\
-	echo '__dtb_$(*F)_end:';			\
-	echo '.global __dtb_$(*F)_end';			\
+	echo '__dtb_$(subst -,_,$(*F))_end:';		\
+	echo '.global __dtb_$(subst -,_,$(*F))_end';	\
 	echo '.balign STRUCT_ALIGNMENT'; 		\
 ) > $@
 
-- 
2.13.6

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-07 14:06 [PATCH] kbuild: Handle builtin dtb files containing hyphens James Hogan
@ 2018-03-07 20:11 ` Frank Rowand
  2018-03-07 20:25   ` James Hogan
  2018-03-08  6:56 ` [PATCH] kbuild: Handle builtin dtb files " Frank Rowand
  1 sibling, 1 reply; 9+ messages in thread
From: Frank Rowand @ 2018-03-07 20:11 UTC (permalink / raw)
  To: James Hogan, linux-kbuild, devicetree
  Cc: linux-kernel, Rob Herring, Masahiro Yamada, Michal Marek,
	Ralf Baechle, Florian Fainelli, Kevin Cernekee, linux-mips,
	stable

I initially misread the patch description (and imagined an entirely
different problem).


On 03/07/18 06:06, James Hogan wrote:
> On dtb files which contain hyphens, the dt_S_dtb command to build the> dtb.S files (which allow DTB files to be built into the kernel) results> in errors like the following:> > bcm3368-netgear-cvg834g.dtb.S: Assembler messages:> bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'> bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'> bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'> bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'
Please replace the following section:

> This is due to the hyphen being used in symbol names. Replace all
> hyphens 
> with underscores in the dt_S_dtb command to avoid this problem.
> 
> Quite a lot of dts files have hyphens, but its only a problem on MIPS
> where such files can be built into the kernel. For example when
> CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
> used (in the latter case it admitedly shouldn't really build all the
> dtb.o files, but thats a separate issue).

with:

   cmd_dt_S_dtb constructs the assembly source to incorporate a devicetree
   FDT (that is, the .dtb file) as binary data in the kernel image.
   This assembly source contains labels before and after the binary data.
   The label names incorporate the file name of the corresponding .dtb
   file.  Hyphens are not legal characters in labels, so transform all
   hyphens from the file name to underscores when constructing the labels.

> 
> Fixes: 695835511f96 ("MIPS: BMIPS: rename bcm96358nb4ser to bcm6358-neufbox4-sercom")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Michal Marek <michal.lkml@markovi.net>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Kevin Cernekee <cernekee@gmail.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 4.9+
> ---
>  scripts/Makefile.lib | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 5589bae34af6..a6f538b31ad6 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -297,11 +297,11 @@ cmd_dt_S_dtb=						\
>  	echo '\#include <asm-generic/vmlinux.lds.h>'; 	\
>  	echo '.section .dtb.init.rodata,"a"';		\
>  	echo '.balign STRUCT_ALIGNMENT';		\
> -	echo '.global __dtb_$(*F)_begin';		\
> -	echo '__dtb_$(*F)_begin:';			\
> +	echo '.global __dtb_$(subst -,_,$(*F))_begin';	\
> +	echo '__dtb_$(subst -,_,$(*F))_begin:';		\
>  	echo '.incbin "$<" ';				\
> -	echo '__dtb_$(*F)_end:';			\
> -	echo '.global __dtb_$(*F)_end';			\
> +	echo '__dtb_$(subst -,_,$(*F))_end:';		\
> +	echo '.global __dtb_$(subst -,_,$(*F))_end';	\
>  	echo '.balign STRUCT_ALIGNMENT'; 		\
>  ) > $@
>  
> 

Reviewed-by: Frank Rowand <frowand.list@gmail.com>

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-07 20:11 ` Frank Rowand
@ 2018-03-07 20:25   ` James Hogan
  2018-03-07 23:19     ` Frank Rowand
  0 siblings, 1 reply; 9+ messages in thread
From: James Hogan @ 2018-03-07 20:25 UTC (permalink / raw)
  To: Frank Rowand
  Cc: linux-kbuild, devicetree, linux-kernel, Rob Herring,
	Masahiro Yamada, Michal Marek, Ralf Baechle, Florian Fainelli,
	Kevin Cernekee, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]

On Wed, Mar 07, 2018 at 12:11:41PM -0800, Frank Rowand wrote:
> I initially misread the patch description (and imagined an entirely
> different problem).
> 
> 
> On 03/07/18 06:06, James Hogan wrote:
> > On dtb files which contain hyphens, the dt_S_dtb command to build the> dtb.S files (which allow DTB files to be built into the kernel) results> in errors like the following:> > bcm3368-netgear-cvg834g.dtb.S: Assembler messages:> bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'> bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'> bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'> bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'
> Please replace the following section:
> 
> > This is due to the hyphen being used in symbol names. Replace all
> > hyphens 
> > with underscores in the dt_S_dtb command to avoid this problem.
> > 
> > Quite a lot of dts files have hyphens, but its only a problem on MIPS
> > where such files can be built into the kernel. For example when
> > CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
> > used (in the latter case it admitedly shouldn't really build all the
> > dtb.o files, but thats a separate issue).
> 
> with:
> 
>    cmd_dt_S_dtb constructs the assembly source to incorporate a devicetree
>    FDT (that is, the .dtb file) as binary data in the kernel image.
>    This assembly source contains labels before and after the binary data.
>    The label names incorporate the file name of the corresponding .dtb
>    file.  Hyphens are not legal characters in labels, so transform all
>    hyphens from the file name to underscores when constructing the labels.

Thanks, that is clearer.

I'll keep the paragraph about MIPS and the example configuration though,
as I think its important information to reproduce the problem, and to
justify why it wouldn't be appropriate to just rename the files (which
was my first reaction).

> Reviewed-by: Frank Rowand <frowand.list@gmail.com>

Thanks
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-07 20:25   ` James Hogan
@ 2018-03-07 23:19     ` Frank Rowand
  2018-03-08  7:09       ` James Hogan
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Rowand @ 2018-03-07 23:19 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-kbuild, devicetree, linux-kernel, Rob Herring,
	Masahiro Yamada, Michal Marek, Ralf Baechle, Florian Fainelli,
	Kevin Cernekee, linux-mips, stable

On 03/07/18 12:25, James Hogan wrote:
> On Wed, Mar 07, 2018 at 12:11:41PM -0800, Frank Rowand wrote:
>> I initially misread the patch description (and imagined an entirely
>> different problem).
>>
>>
>> On 03/07/18 06:06, James Hogan wrote:
>>> On dtb files which contain hyphens, the dt_S_dtb command to build the> dtb.S files (which allow DTB files to be built into the kernel) results> in errors like the following:> > bcm3368-netgear-cvg834g.dtb.S: Assembler messages:> bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'> bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'> bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'> bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section> bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'
>> Please replace the following section:
>>
>>> This is due to the hyphen being used in symbol names. Replace all
>>> hyphens 
>>> with underscores in the dt_S_dtb command to avoid this problem.
>>>
>>> Quite a lot of dts files have hyphens, but its only a problem on MIPS
>>> where such files can be built into the kernel. For example when
>>> CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
>>> used (in the latter case it admitedly shouldn't really build all the
>>> dtb.o files, but thats a separate issue).
>>
>> with:
>>
>>    cmd_dt_S_dtb constructs the assembly source to incorporate a devicetree
>>    FDT (that is, the .dtb file) as binary data in the kernel image.
>>    This assembly source contains labels before and after the binary data.
>>    The label names incorporate the file name of the corresponding .dtb
>>    file.  Hyphens are not legal characters in labels, so transform all
>>    hyphens from the file name to underscores when constructing the labels.
> 
> Thanks, that is clearer.
> 
> I'll keep the paragraph about MIPS and the example configuration though,
> as I think its important information to reproduce the problem, and to
> justify why it wouldn't be appropriate to just rename the files (which
> was my first reaction).

Other than the part that says "its only a problem on MIPS".  That is
pedantically correct because no other architecture (that I am aware
of, not that I searched) currently has a devicetree source file name
with a hyphen in it, where that file is compiled into the kernel as
an asm file.  But it is potentially a problem on any architecture
to it is misleading to label it as MIPS only.


> 
>> Reviewed-by: Frank Rowand <frowand.list@gmail.com>
> 
> Thanks
> James
> 

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-07 14:06 [PATCH] kbuild: Handle builtin dtb files containing hyphens James Hogan
  2018-03-07 20:11 ` Frank Rowand
@ 2018-03-08  6:56 ` Frank Rowand
  1 sibling, 0 replies; 9+ messages in thread
From: Frank Rowand @ 2018-03-08  6:56 UTC (permalink / raw)
  To: James Hogan, linux-kbuild, devicetree
  Cc: linux-kernel, Rob Herring, Masahiro Yamada, Michal Marek,
	Ralf Baechle, Florian Fainelli, Kevin Cernekee, linux-mips,
	stable

On 03/07/18 06:06, James Hogan wrote:
> On dtb files which contain hyphens, the dt_S_dtb command to build the
> dtb.S files (which allow DTB files to be built into the kernel) results
> in errors like the following:

< snip >

Hi James,

Sorry for dribbling my comments out in so many emails.  :-)

Please change the subject line to say "dtb filenames" instead
of "dtb files".

Thanks,

Frank

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-07 23:19     ` Frank Rowand
@ 2018-03-08  7:09       ` James Hogan
  2018-03-08  8:41         ` Masahiro Yamada
  0 siblings, 1 reply; 9+ messages in thread
From: James Hogan @ 2018-03-08  7:09 UTC (permalink / raw)
  To: Frank Rowand
  Cc: linux-kbuild, devicetree, linux-kernel, Rob Herring,
	Masahiro Yamada, Michal Marek, Ralf Baechle, Florian Fainelli,
	Kevin Cernekee, linux-mips, stable

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

On Wed, Mar 07, 2018 at 03:19:11PM -0800, Frank Rowand wrote:
> On 03/07/18 12:25, James Hogan wrote:
> > On Wed, Mar 07, 2018 at 12:11:41PM -0800, Frank Rowand wrote:
> >> On 03/07/18 06:06, James Hogan wrote:
> >>> Quite a lot of dts files have hyphens, but its only a problem on MIPS
> >>> where such files can be built into the kernel. For example when
> >>> CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
> >>> used (in the latter case it admitedly shouldn't really build all the
> >>> dtb.o files, but thats a separate issue).

> > I'll keep the paragraph about MIPS and the example configuration though,
> > as I think its important information to reproduce the problem, and to
> > justify why it wouldn't be appropriate to just rename the files (which
> > was my first reaction).
> 
> Other than the part that says "its only a problem on MIPS".  That is
> pedantically correct because no other architecture (that I am aware
> of, not that I searched) currently has a devicetree source file name
> with a hyphen in it, where that file is compiled into the kernel as
> an asm file.  But it is potentially a problem on any architecture
> to it is misleading to label it as MIPS only.

Okay I'll reword to make it clearer and do a v2.

Thanks
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] kbuild: Handle builtin dtb files containing hyphens
  2018-03-08  7:09       ` James Hogan
@ 2018-03-08  8:41         ` Masahiro Yamada
  2018-03-08 11:02           ` [PATCH v2] kbuild: Handle builtin dtb file names " James Hogan
  0 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2018-03-08  8:41 UTC (permalink / raw)
  To: James Hogan
  Cc: Frank Rowand, Linux Kbuild mailing list, devicetree,
	Linux Kernel Mailing List, Rob Herring, Michal Marek,
	Ralf Baechle, Florian Fainelli, Kevin Cernekee, Linux-MIPS,
	stable

2018-03-08 16:09 GMT+09:00 James Hogan <jhogan@kernel.org>:
> On Wed, Mar 07, 2018 at 03:19:11PM -0800, Frank Rowand wrote:
>> On 03/07/18 12:25, James Hogan wrote:
>> > On Wed, Mar 07, 2018 at 12:11:41PM -0800, Frank Rowand wrote:
>> >> On 03/07/18 06:06, James Hogan wrote:
>> >>> Quite a lot of dts files have hyphens, but its only a problem on MIPS
>> >>> where such files can be built into the kernel. For example when
>> >>> CONFIG_DT_NETGEAR_CVG834G=y, or on BMIPS kernels when the dtbs target is
>> >>> used (in the latter case it admitedly shouldn't really build all the
>> >>> dtb.o files, but thats a separate issue).
>
>> > I'll keep the paragraph about MIPS and the example configuration though,
>> > as I think its important information to reproduce the problem, and to
>> > justify why it wouldn't be appropriate to just rename the files (which
>> > was my first reaction).
>>
>> Other than the part that says "its only a problem on MIPS".  That is
>> pedantically correct because no other architecture (that I am aware
>> of, not that I searched) currently has a devicetree source file name
>> with a hyphen in it, where that file is compiled into the kernel as
>> an asm file.  But it is potentially a problem on any architecture
>> to it is misleading to label it as MIPS only.
>
> Okay I'll reword to make it clearer and do a v2.
>
> Thanks
> James


The code looks good.
If you send v2, I can shortly apply it to the fixes branch.

If possible, I want to send a PR this weekend.



-- 
Best Regards
Masahiro Yamada

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

* [PATCH v2] kbuild: Handle builtin dtb file names containing hyphens
  2018-03-08  8:41         ` Masahiro Yamada
@ 2018-03-08 11:02           ` James Hogan
  2018-03-08 16:25             ` Masahiro Yamada
  0 siblings, 1 reply; 9+ messages in thread
From: James Hogan @ 2018-03-08 11:02 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kernel, James Hogan, Rob Herring, Michal Marek,
	Ralf Baechle, Florian Fainelli, Kevin Cernekee, devicetree,
	linux-kbuild, linux-mips, stable

cmd_dt_S_dtb constructs the assembly source to incorporate a devicetree
FDT (that is, the .dtb file) as binary data in the kernel image. This
assembly source contains labels before and after the binary data. The
label names incorporate the file name of the corresponding .dtb file.
Hyphens are not legal characters in labels, so .dtb files built into the
kernel with hyphens in the file name result in errors like the
following:

bcm3368-netgear-cvg834g.dtb.S: Assembler messages:
bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section
bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'
bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'
bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'
bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section
bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'

Fix this by updating cmd_dt_S_dtb to transform all hyphens from the file
name to underscores when constructing the labels.

As of v4.16-rc2, 1139 .dts files across ARM64, ARM, MIPS and PowerPC
contain hyphens in their names, but the issue only currently manifests
on Broadcom MIPS platforms, as that is the only place where such files
are built into the kernel. For example when CONFIG_DT_NETGEAR_CVG834G=y,
or on BMIPS kernels when the dtbs target is used (in the latter case it
admittedly shouldn't really build all the dtb.o files, but thats a
separate issue).

Fixes: 695835511f96 ("MIPS: BMIPS: rename bcm96358nb4ser to bcm6358-neufbox4-sercom")
Signed-off-by: James Hogan <jhogan@kernel.org>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 4.9+
---
Changes in v2:
 - Rewrite commit message (thanks Frank for some improved wording).
 - Add Franks' reviewed-by.
---
 scripts/Makefile.lib | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5589bae34af6..a6f538b31ad6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -297,11 +297,11 @@ cmd_dt_S_dtb=						\
 	echo '\#include <asm-generic/vmlinux.lds.h>'; 	\
 	echo '.section .dtb.init.rodata,"a"';		\
 	echo '.balign STRUCT_ALIGNMENT';		\
-	echo '.global __dtb_$(*F)_begin';		\
-	echo '__dtb_$(*F)_begin:';			\
+	echo '.global __dtb_$(subst -,_,$(*F))_begin';	\
+	echo '__dtb_$(subst -,_,$(*F))_begin:';		\
 	echo '.incbin "$<" ';				\
-	echo '__dtb_$(*F)_end:';			\
-	echo '.global __dtb_$(*F)_end';			\
+	echo '__dtb_$(subst -,_,$(*F))_end:';		\
+	echo '.global __dtb_$(subst -,_,$(*F))_end';	\
 	echo '.balign STRUCT_ALIGNMENT'; 		\
 ) > $@
 
-- 
2.13.6

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

* Re: [PATCH v2] kbuild: Handle builtin dtb file names containing hyphens
  2018-03-08 11:02           ` [PATCH v2] kbuild: Handle builtin dtb file names " James Hogan
@ 2018-03-08 16:25             ` Masahiro Yamada
  0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2018-03-08 16:25 UTC (permalink / raw)
  To: James Hogan
  Cc: Linux Kernel Mailing List, Rob Herring, Michal Marek,
	Ralf Baechle, Florian Fainelli, Kevin Cernekee, devicetree,
	Linux Kbuild mailing list, Linux-MIPS, stable

2018-03-08 20:02 GMT+09:00 James Hogan <jhogan@kernel.org>:
> cmd_dt_S_dtb constructs the assembly source to incorporate a devicetree
> FDT (that is, the .dtb file) as binary data in the kernel image. This
> assembly source contains labels before and after the binary data. The
> label names incorporate the file name of the corresponding .dtb file.
> Hyphens are not legal characters in labels, so .dtb files built into the
> kernel with hyphens in the file name result in errors like the
> following:
>
> bcm3368-netgear-cvg834g.dtb.S: Assembler messages:
> bcm3368-netgear-cvg834g.dtb.S:5: Error: : no such section
> bcm3368-netgear-cvg834g.dtb.S:5: Error: junk at end of line, first unrecognized character is `-'
> bcm3368-netgear-cvg834g.dtb.S:6: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_begin:'
> bcm3368-netgear-cvg834g.dtb.S:8: Error: unrecognized opcode `__dtb_bcm3368-netgear-cvg834g_end:'
> bcm3368-netgear-cvg834g.dtb.S:9: Error: : no such section
> bcm3368-netgear-cvg834g.dtb.S:9: Error: junk at end of line, first unrecognized character is `-'
>
> Fix this by updating cmd_dt_S_dtb to transform all hyphens from the file
> name to underscores when constructing the labels.
>
> As of v4.16-rc2, 1139 .dts files across ARM64, ARM, MIPS and PowerPC
> contain hyphens in their names, but the issue only currently manifests
> on Broadcom MIPS platforms, as that is the only place where such files
> are built into the kernel. For example when CONFIG_DT_NETGEAR_CVG834G=y,
> or on BMIPS kernels when the dtbs target is used (in the latter case it
> admittedly shouldn't really build all the dtb.o files, but thats a
> separate issue).
>
> Fixes: 695835511f96 ("MIPS: BMIPS: rename bcm96358nb4ser to bcm6358-neufbox4-sercom")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Reviewed-by: Frank Rowand <frowand.list@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Michal Marek <michal.lkml@markovi.net>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Kevin Cernekee <cernekee@gmail.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 4.9+
> ---
> Changes in v2:
>  - Rewrite commit message (thanks Frank for some improved wording).
>  - Add Franks' reviewed-by.

Applied to linux-kbuild/fixes.  Thanks!

-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2018-03-08 16:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 14:06 [PATCH] kbuild: Handle builtin dtb files containing hyphens James Hogan
2018-03-07 20:11 ` Frank Rowand
2018-03-07 20:25   ` James Hogan
2018-03-07 23:19     ` Frank Rowand
2018-03-08  7:09       ` James Hogan
2018-03-08  8:41         ` Masahiro Yamada
2018-03-08 11:02           ` [PATCH v2] kbuild: Handle builtin dtb file names " James Hogan
2018-03-08 16:25             ` Masahiro Yamada
2018-03-08  6:56 ` [PATCH] kbuild: Handle builtin dtb files " Frank Rowand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).