Skip to contentSkip to conversation

m68k: enable internal toolchain

PATCH Superseded Waldemar Brodkorb 2 participants 3 messages Mar 19, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 m68k: enable internal toolchain

This allows to build a m68k toolchain.

---
 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
arch/Config.in +0 -1
index 401bd28..3f1453f 100644
@@ -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
arch/Config.in.m68k +23 -1
index f40f97c..0697c49 100644
@@ -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
package/gcc/4.8.5/890-fix-m68k-compile.patch new file +15 -0
new file mode 100644
index 0000000..124e842
@@ -0,0 +1,15 @@
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+
+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
package/gcc/4.9.3/890-fix-m68k-compile.patch new file +15 -0
new file mode 100644
index 0000000..140977b
@@ -0,0 +1,15 @@
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+
+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
package/gcc/5.3.0/890-fix-m68k-compile.patch new file +15 -0
new file mode 100644
index 0000000..6e63de0
@@ -0,0 +1,15 @@
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+
+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
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 m68k: enable internal toolchain

Waldemar,

Quoted 3 lines · Waldemar Brodkorb

This allows to build a m68k toolchain.

Thanks! One question below, though.

arch/Config.in config BR2_i386 · line 97

Quoted 8 lines
arch/Config.in +0 -0
index 401bd28..3f1453f 100644
@@ -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.

Quoted 17 lines
arch/Config.in +16 -1
-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

arch/Config.in config BR2_i386

Quoted 10 lines
arch/Config.in +7 -0
+	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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/2 m68k: enable internal toolchain

Hi Thomas,
Thomas Petazzoni wrote,

Quoted 34 lines

Waldemar,

Quoted 3 lines · Waldemar Brodkorb

This allows to build a m68k toolchain.

Thanks! One question below, though.

arch/Config.in config BR2_i386 · line 97

Quoted 8 lines
arch/Config.in +0 -0
index 401bd28..3f1453f 100644
@@ -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.

Quoted 2 lines

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 ;)

Quoted 3 lines

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