diff mbox series

[1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware

Message ID 20200324161539.7538-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/3] net: wan: wanxl: use $(CC68K) instead of $(AS68K) for rebuilding firmware | expand

Commit Message

Masahiro Yamada March 24, 2020, 4:15 p.m. UTC
As far as I understood from the Kconfig help text, this build rule is
used to rebuild the driver firmware, which runs on the QUICC, m68k-based
Motorola 68360.

The firmware source, wanxlfw.S, is currently compiled by the combo of
$(CPP) and $(AS68K). This is not what we usually do for compiling *.S
files. In fact, this is the only user of $(AS) in the kernel build.

Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
Instead of combining $(CPP) and (AS) from different tool sets, using
single $(CC68K) seems simpler, and saner.

After this commit, the firmware rebuild will require cc68k instead of
as68k. I do not know how many people care about this, though.

I do not have cc68k/ld68k in hand, but I was able to build it by using
the kernel.org m68k toolchain. [1]

[1] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/9.2.0/x86_64-gcc-9.2.0-nolibc-m68k-linux.tar.xz

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/net/wan/Kconfig  | 2 +-
 drivers/net/wan/Makefile | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven March 24, 2020, 5:46 p.m. UTC | #1
Hi Yamada-san,

On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> As far as I understood from the Kconfig help text, this build rule is
> used to rebuild the driver firmware, which runs on the QUICC, m68k-based
> Motorola 68360.
>
> The firmware source, wanxlfw.S, is currently compiled by the combo of
> $(CPP) and $(AS68K). This is not what we usually do for compiling *.S
> files. In fact, this is the only user of $(AS) in the kernel build.
>
> Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
> PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
> Instead of combining $(CPP) and (AS) from different tool sets, using
> single $(CC68K) seems simpler, and saner.
>
> After this commit, the firmware rebuild will require cc68k instead of
> as68k. I do not know how many people care about this, though.
>
> I do not have cc68k/ld68k in hand, but I was able to build it by using
> the kernel.org m68k toolchain. [1]

Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like
provided by Debian/Ubuntu, too?

Gr{oetje,eeting}s,

                        Geert
Masahiro Yamada March 25, 2020, 3:49 a.m. UTC | #2
On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Yamada-san,
>
> On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > As far as I understood from the Kconfig help text, this build rule is
> > used to rebuild the driver firmware, which runs on the QUICC, m68k-based
> > Motorola 68360.
> >
> > The firmware source, wanxlfw.S, is currently compiled by the combo of
> > $(CPP) and $(AS68K). This is not what we usually do for compiling *.S
> > files. In fact, this is the only user of $(AS) in the kernel build.
> >
> > Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
> > PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
> > Instead of combining $(CPP) and (AS) from different tool sets, using
> > single $(CC68K) seems simpler, and saner.
> >
> > After this commit, the firmware rebuild will require cc68k instead of
> > as68k. I do not know how many people care about this, though.
> >
> > I do not have cc68k/ld68k in hand, but I was able to build it by using
> > the kernel.org m68k toolchain. [1]
>
> Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like
> provided by Debian/Ubuntu, too?
>

Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu'
It successfully compiled this firmware.

In my understanding, the difference is that
the kernel.org ones lack libc,
so cannot link userspace programs.

They do not make much difference for this case.
Geert Uytterhoeven March 25, 2020, 7:52 a.m. UTC | #3
Hi Yamada-san,

On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > As far as I understood from the Kconfig help text, this build rule is
> > > used to rebuild the driver firmware, which runs on the QUICC, m68k-based
> > > Motorola 68360.
> > >
> > > The firmware source, wanxlfw.S, is currently compiled by the combo of
> > > $(CPP) and $(AS68K). This is not what we usually do for compiling *.S
> > > files. In fact, this is the only user of $(AS) in the kernel build.
> > >
> > > Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
> > > PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
> > > Instead of combining $(CPP) and (AS) from different tool sets, using
> > > single $(CC68K) seems simpler, and saner.
> > >
> > > After this commit, the firmware rebuild will require cc68k instead of
> > > as68k. I do not know how many people care about this, though.
> > >
> > > I do not have cc68k/ld68k in hand, but I was able to build it by using
> > > the kernel.org m68k toolchain. [1]
> >
> > Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like
> > provided by Debian/Ubuntu, too?
> >
>
> Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu'
> It successfully compiled this firmware.

Thanks for checking!

> In my understanding, the difference is that
> the kernel.org ones lack libc,
> so cannot link userspace programs.
>
> They do not make much difference for this case.

Indeed.

So perhaps it makes sense to replace cc68k and ld68k in the Makefile by
m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold
of on a modern system?

What do you think?
Thanks!

Gr{oetje,eeting}s,

                        Geert
Masahiro Yamada March 25, 2020, 9:05 a.m. UTC | #4
Hi Geert,

On Wed, Mar 25, 2020 at 4:53 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Yamada-san,
>
> On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > As far as I understood from the Kconfig help text, this build rule is
> > > > used to rebuild the driver firmware, which runs on the QUICC, m68k-based
> > > > Motorola 68360.
> > > >
> > > > The firmware source, wanxlfw.S, is currently compiled by the combo of
> > > > $(CPP) and $(AS68K). This is not what we usually do for compiling *.S
> > > > files. In fact, this is the only user of $(AS) in the kernel build.
> > > >
> > > > Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
> > > > PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
> > > > Instead of combining $(CPP) and (AS) from different tool sets, using
> > > > single $(CC68K) seems simpler, and saner.
> > > >
> > > > After this commit, the firmware rebuild will require cc68k instead of
> > > > as68k. I do not know how many people care about this, though.
> > > >
> > > > I do not have cc68k/ld68k in hand, but I was able to build it by using
> > > > the kernel.org m68k toolchain. [1]
> > >
> > > Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like
> > > provided by Debian/Ubuntu, too?
> > >
> >
> > Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu'
> > It successfully compiled this firmware.
>
> Thanks for checking!
>
> > In my understanding, the difference is that
> > the kernel.org ones lack libc,
> > so cannot link userspace programs.
> >
> > They do not make much difference for this case.
>
> Indeed.
>
> So perhaps it makes sense to replace cc68k and ld68k in the Makefile by
> m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold
> of on a modern system?
>
> What do you think?
> Thanks!
>


If desired, I can do like this:


ifeq ($(ARCH),m68k)
  CC_M68K = $(CC)
  LD_M68K = $(LD)
else
  CC_M68K = $(CROSS_COMPILE_M68K)gcc
  LD_M68K = $(CROSS_COMPILE_M68K)ld
endif
Geert Uytterhoeven March 25, 2020, 9:12 a.m. UTC | #5
Hi Yamada-san,

On Wed, Mar 25, 2020 at 10:06 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> On Wed, Mar 25, 2020 at 4:53 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Wed, Mar 25, 2020 at 4:50 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > On Wed, Mar 25, 2020 at 2:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > On Tue, Mar 24, 2020 at 5:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > > As far as I understood from the Kconfig help text, this build rule is
> > > > > used to rebuild the driver firmware, which runs on the QUICC, m68k-based
> > > > > Motorola 68360.
> > > > >
> > > > > The firmware source, wanxlfw.S, is currently compiled by the combo of
> > > > > $(CPP) and $(AS68K). This is not what we usually do for compiling *.S
> > > > > files. In fact, this is the only user of $(AS) in the kernel build.
> > > > >
> > > > > Moreover, $(CPP) is not likely to be a m68k tool because wanxl.c is a
> > > > > PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
> > > > > Instead of combining $(CPP) and (AS) from different tool sets, using
> > > > > single $(CC68K) seems simpler, and saner.
> > > > >
> > > > > After this commit, the firmware rebuild will require cc68k instead of
> > > > > as68k. I do not know how many people care about this, though.
> > > > >
> > > > > I do not have cc68k/ld68k in hand, but I was able to build it by using
> > > > > the kernel.org m68k toolchain. [1]
> > > >
> > > > Would this work with a "standard" m68k-linux-gnu-gcc toolchain, like
> > > > provided by Debian/Ubuntu, too?
> > > >
> > >
> > > Yes, I did 'sudo apt install gcc-8-m68k-linux-gnu'
> > > It successfully compiled this firmware.
> >
> > Thanks for checking!
> >
> > > In my understanding, the difference is that
> > > the kernel.org ones lack libc,
> > > so cannot link userspace programs.
> > >
> > > They do not make much difference for this case.
> >
> > Indeed.
> >
> > So perhaps it makes sense to replace cc68k and ld68k in the Makefile by
> > m68k-linux-gnu-gcc and m68k-linux-gnu-ld, as these are easier to get hold
> > of on a modern system?
>
> If desired, I can do like this:
>
> ifeq ($(ARCH),m68k)
>   CC_M68K = $(CC)
>   LD_M68K = $(LD)
> else
>   CC_M68K = $(CROSS_COMPILE_M68K)gcc
>   LD_M68K = $(CROSS_COMPILE_M68K)ld
> endif

Thanks, that looks good to me.

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index 4530840e15ef..0f35ad097744 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -200,7 +200,7 @@  config WANXL_BUILD_FIRMWARE
 	depends on WANXL && !PREVENT_FIRMWARE_BUILD
 	help
 	  Allows you to rebuild firmware run by the QUICC processor.
-	  It requires as68k, ld68k and hexdump programs.
+	  It requires cc68k, ld68k and hexdump programs.
 
 	  You should never need this option, say N.
 
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index 701f5d2fe3b6..d21a99711070 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -40,16 +40,16 @@  $(obj)/wanxl.o:	$(obj)/wanxlfw.inc
 
 ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
 ifeq ($(ARCH),m68k)
-  AS68K = $(AS)
+  CC68K = $(CC)
   LD68K = $(LD)
 else
-  AS68K = as68k
+  CC68K = cc68k
   LD68K = ld68k
 endif
 
 quiet_cmd_build_wanxlfw = BLD FW  $@
       cmd_build_wanxlfw = \
-	$(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
+	$(CC68K) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \
 	$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
 	hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
 	rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o