diff mbox

[1/2] m68k: enable internal toolchain

Message ID 20160319172656.GA19850@waldemar-brodkorb.de
State Awaiting Upstream
Headers show

Commit Message

Waldemar Brodkorb March 19, 2016, 5:26 p.m. UTC
This allows to build a m68k toolchain.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 arch/Config.in                               |  1 -
 arch/Config.in.m68k                          | 24 +++++++++++++++++++++++-
 package/gcc/4.8.5/890-fix-m68k-compile.patch | 15 +++++++++++++++
 package/gcc/4.9.3/890-fix-m68k-compile.patch | 15 +++++++++++++++
 package/gcc/5.3.0/890-fix-m68k-compile.patch | 15 +++++++++++++++
 5 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 package/gcc/4.8.5/890-fix-m68k-compile.patch
 create mode 100644 package/gcc/4.9.3/890-fix-m68k-compile.patch
 create mode 100644 package/gcc/5.3.0/890-fix-m68k-compile.patch

Comments

Thomas Petazzoni March 19, 2016, 6:27 p.m. UTC | #1
Waldemar,

On Sat, 19 Mar 2016 18:26:56 +0100, Waldemar Brodkorb wrote:
> This allows to build a m68k toolchain.
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

Thanks! One question below, though.

> diff --git a/arch/Config.in b/arch/Config.in
> index 401bd28..3f1453f 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -95,7 +95,6 @@ config BR2_i386
>  config BR2_m68k
>  	bool "m68k"
>  	select BR2_ARCH_HAS_MMU_MANDATORY

Are you sure all the m68k have a MMU ?

According to https://en.wikipedia.org/wiki/Motorola_68000_series, it
seems like the MMU appeared in 68030, so 68000, 68010 and 68020
probably don't have a MMU.

According to http://www.linux-m68k.org/faq/reqs.html:

  You need a Motorola 680x0 processor with a programmable memory
  management unit (PMMU). There is no way to run Linux/m68k without
  one. This reduces the list of possible processors to 68020+68851,
  68030, 68040, 68LC040, and 68060. This list of processors excludes
  the 68000, 68HC000, 68008, 68010, 68EC020, 68EC030, and 68EC040. It
  also excludes the CPU32 processors (683x0 series) and the ColdFire
  processor.

However, I believe this is not completely correct, as Linux definitely
runs on some Coldfire, as the later variants have gotten a MMU.

> -config BR2_GCC_TARGET_ARCH
> +choice
> +	prompt "Target CPU"
> +	depends on BR2_m68k
> +	default BR2_m68k_68040
> +	help
> +	  Specific CPU variant to use
> +
> +config BR2_m68k_68000
> +	bool "68000"
> +config BR2_m68k_68010
> +	bool "68010"
> +config BR2_m68k_68020
> +	bool "68020"
> +config BR2_m68k_68030
> +	bool "68030"
> +config BR2_m68k_68040
> +	bool "68040"
> +config BR2_m68k_68060
> +	bool "68060"
> +
> +endchoice
> +
> +config BR2_GCC_TARGET_CPU
>  	default "68000"		if BR2_m68k_68000
>  	default "68010"		if BR2_m68k_68010
>  	default "68020"		if BR2_m68k_68020

Maybe to get started you should simply support the 68040 which you have
tested, and leave the rest for later, once it is understood which
variant has a MMU, which variant does not?

Best regards,

Thomas
Waldemar Brodkorb March 19, 2016, 7:14 p.m. UTC | #2
Hi Thomas,
Thomas Petazzoni wrote,

> Waldemar,
> 
> On Sat, 19 Mar 2016 18:26:56 +0100, Waldemar Brodkorb wrote:
> > This allows to build a m68k toolchain.
> > 
> > Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> 
> Thanks! One question below, though.
> 
> > diff --git a/arch/Config.in b/arch/Config.in
> > index 401bd28..3f1453f 100644
> > --- a/arch/Config.in
> > +++ b/arch/Config.in
> > @@ -95,7 +95,6 @@ config BR2_i386
> >  config BR2_m68k
> >  	bool "m68k"
> >  	select BR2_ARCH_HAS_MMU_MANDATORY
> 
> Are you sure all the m68k have a MMU ?
> 
> According to https://en.wikipedia.org/wiki/Motorola_68000_series, it
> seems like the MMU appeared in 68030, so 68000, 68010 and 68020
> probably don't have a MMU.
> 
> According to http://www.linux-m68k.org/faq/reqs.html:
> 
>   You need a Motorola 680x0 processor with a programmable memory
>   management unit (PMMU). There is no way to run Linux/m68k without
>   one. This reduces the list of possible processors to 68020+68851,
>   68030, 68040, 68LC040, and 68060. This list of processors excludes
>   the 68000, 68HC000, 68008, 68010, 68EC020, 68EC030, and 68EC040. It
>   also excludes the CPU32 processors (683x0 series) and the ColdFire
>   processor.
> 
> However, I believe this is not completely correct, as Linux definitely
> runs on some Coldfire, as the later variants have gotten a MMU.

Yes, the info is incomplete. I have another Qemu board defconfig available for coldfire
without MMU. But I wait until ARM noMMU stuff is in, as the minimal
busybox config might be interesting here, too.
And some of the later coldfire v4 have a MMU.

So m68k is really complicated and interesting ;)
 
> Maybe to get started you should simply support the 68040 which you have
> tested, and leave the rest for later, once it is understood which
> variant has a MMU, which variant does not?

Yes, that is better. I just copied the old variants without thinking
about it.

best regards
 Waldemar
diff mbox

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 401bd28..3f1453f 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -95,7 +95,6 @@  config BR2_i386
 config BR2_m68k
 	bool "m68k"
 	select BR2_ARCH_HAS_MMU_MANDATORY
-	depends on BROKEN # ice in uclibc / inet_ntoa_r
 	help
 	  Motorola 68000 family microprocessor
 	  http://en.wikipedia.org/wiki/M68k
diff --git a/arch/Config.in.m68k b/arch/Config.in.m68k
index f40f97c..0697c49 100644
--- a/arch/Config.in.m68k
+++ b/arch/Config.in.m68k
@@ -4,7 +4,29 @@  config BR2_ARCH
 config BR2_ENDIAN
 	default "BIG"
 
-config BR2_GCC_TARGET_ARCH
+choice
+	prompt "Target CPU"
+	depends on BR2_m68k
+	default BR2_m68k_68040
+	help
+	  Specific CPU variant to use
+
+config BR2_m68k_68000
+	bool "68000"
+config BR2_m68k_68010
+	bool "68010"
+config BR2_m68k_68020
+	bool "68020"
+config BR2_m68k_68030
+	bool "68030"
+config BR2_m68k_68040
+	bool "68040"
+config BR2_m68k_68060
+	bool "68060"
+
+endchoice
+
+config BR2_GCC_TARGET_CPU
 	default "68000"		if BR2_m68k_68000
 	default "68010"		if BR2_m68k_68010
 	default "68020"		if BR2_m68k_68020
diff --git a/package/gcc/4.8.5/890-fix-m68k-compile.patch b/package/gcc/4.8.5/890-fix-m68k-compile.patch
new file mode 100644
index 0000000..124e842
--- /dev/null
+++ b/package/gcc/4.8.5/890-fix-m68k-compile.patch
@@ -0,0 +1,15 @@ 
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.8.5.orig/libgcc/config/m68k/linux-atomic.c gcc-4.8.5/libgcc/config/m68k/linux-atomic.c
+--- gcc-4.8.5.orig/libgcc/config/m68k/linux-atomic.c	2013-02-04 20:06:20.000000000 +0100
++++ gcc-4.8.5/libgcc/config/m68k/linux-atomic.c	2016-03-19 00:18:12.000000000 +0100
+@@ -33,7 +33,6 @@
+    using the kernel helper defined below.  There is no support for
+    64-bit operations yet.  */
+ 
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+ 
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/package/gcc/4.9.3/890-fix-m68k-compile.patch b/package/gcc/4.9.3/890-fix-m68k-compile.patch
new file mode 100644
index 0000000..140977b
--- /dev/null
+++ b/package/gcc/4.9.3/890-fix-m68k-compile.patch
@@ -0,0 +1,15 @@ 
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c gcc-4.9.3/libgcc/config/m68k/linux-atomic.c
+--- gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c	2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/config/m68k/linux-atomic.c	2016-03-18 22:24:40.000000000 +0100
+@@ -33,7 +33,6 @@
+    using the kernel helper defined below.  There is no support for
+    64-bit operations yet.  */
+ 
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+ 
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/package/gcc/5.3.0/890-fix-m68k-compile.patch b/package/gcc/5.3.0/890-fix-m68k-compile.patch
new file mode 100644
index 0000000..6e63de0
--- /dev/null
+++ b/package/gcc/5.3.0/890-fix-m68k-compile.patch
@@ -0,0 +1,15 @@ 
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c gcc-5.3.0/libgcc/config/m68k/linux-atomic.c
+--- gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c	2015-01-05 13:33:28.000000000 +0100
++++ gcc-5.3.0/libgcc/config/m68k/linux-atomic.c	2016-03-19 09:25:07.000000000 +0100
+@@ -33,7 +33,6 @@
+    using the kernel helper defined below.  There is no support for
+    64-bit operations yet.  */
+ 
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+ 
+ #ifndef __NR_atomic_cmpxchg_32