Skip to contentSkip to conversation

Pull request for branch update-mips-support

GIT PULL New Thomas Petazzoni 2 participants 6 messages Sep 4, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

Here is a new version of the patch set that clarifies MIPS support, and especially MIPS64 support.

It has four patches:

* First patch refactors some uclibc.mk to use the existing BR2_ENDIAN config option rather than doing the same work again.

* Second patch reworks the config option for mips. It creates two separate two level architectures for MIPS and MIPS64, and then clarifies the ABI names and config options.

* Third patch (from Gustavo) remove old MIPS64 related toolchain kludge

* Fourth patch (from Gustavo) adds a defconfig to build a mips64 system for Qemu

Changes since v2:
* None, except rebasing on master.

Changes since v1:

* Addition of the first, third and fourth patches.
* Separation of top-level mips64 architectures.
* Simplification of uClibc code to find the architecture.

Best regards,

Thomas

The following changes since commit 27045cde7d18f6132ab804ed30673e3fb3961879:

gcc: default to 4.6.x (2012-09-04 13:28:03 +0200)

are available in the git repository at:

git://git.free-electrons.com/users/thomas-petazzoni/buildroot.git update-mips-support

for you to fetch changes up to 0d47f0d4b6ef8c47d226854c736b9bc87a00073a:

qemu/mips64-malta: add new sample config (2012-09-04 16:06:51 +0200)

----------------------------------------------------------------
Gustavo Zacarias (2):
mips64: remove toolchain kludge
qemu/mips64-malta: add new sample config

Thomas Petazzoni (2):
uClibc: use BR2_ENDIAN to simplify endianess selection Clarify MIPS ABIs support

 board/qemu/mips64-malta/linux-3.3.config |   78 ++++++++++++++++++++++++++++++
 board/qemu/mips64-malta/readme.txt       |    7 +++
 configs/qemu_mips64_malta_defconfig      |   24 +++++++++
 package/Makefile.in                      |    4 --
 target/Config.in.arch                    |   60 +++++++++++++----------
 toolchain/uClibc/uclibc.mk               |   24 ++-------
 6 files changed, 149 insertions(+), 48 deletions(-)
 create mode 100644 board/qemu/mips64-malta/linux-3.3.config
 create mode 100644 board/qemu/mips64-malta/readme.txt
 create mode 100644 configs/qemu_mips64_malta_defconfig

Thanks,

Signature · 1 line
Thomas Petazzoni
#1 lore raw

PATCH 1/4 uClibc: use BR2_ENDIAN to simplify endianess selection

---
 toolchain/uClibc/uclibc.mk |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
toolchain/uClibc/uclibc.mk +2 -15
index 9d0b6db..583d199 100644
@@ -41,22 +41,9 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
 		-e 's/cris.*/cris/' \
 		-e 's/xtensa.*/xtensa/' \
 ")
-# just handle the ones that can be big or little
-UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
-		-e 's/armeb/BIG/' \
-		-e 's/arm/LITTLE/' \
-		-e 's/mipsel/LITTLE/' \
-		-e 's/mips/BIG/' \
-		-e 's/sh.*eb/BIG/' \
-		-e 's/sh.*/LITTLE/' \
-		-e 's/sparc.*/BIG/' \
-")
 
-ifneq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
-ifneq ($(UCLIBC_TARGET_ENDIAN),BIG)
-UCLIBC_TARGET_ENDIAN:=
-endif
-endif
+UCLIBC_TARGET_ENDIAN:=$(call qstrip,$(BR2_ENDIAN))
+
 ifeq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
 UCLIBC_NOT_TARGET_ENDIAN:=BIG
 else
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 Clarify MIPS ABIs support

In reply to Thomas Petazzoni

Practically speaking, MIPS has three useful ABIs:

* o32 is for 32-bits CPUs, or 64-bit CPUs running only a 32-bit subset of the instruction set.
* n32 is for 64-bits CPUs only. It has 32-bits pointers and long integers.
* n64 is for 64-bits CPUs only. It has 64-bits pointers and long integers.

See http://www.linux-mips.org/wiki/MIPS_ABI_History and
http://www.linux-mips.org/wiki/WhatsWrongWithO32N32N64 for more details.

So, this commit reworks the Buildroot MIPS support by:

* Add separate mips64/mips64el top-level architectures.

* Renaming the n32 ABI option to BR2_MIPS_NABI32, for consistency with BR2_MIPS_OABI32.

* Renaming the n64 ABI option to BR2_MIPS_NABI64, for consistency with BR2_MIPS_OABI32.

* Make the n32 and n64 ABI selections select the BR2_ARCH_IS_64, since those ABIs are valid on 64-bits CPUs only.

* Removing the o64 ABI, which is practicaly never used.

* Removing the "none" ABI, which really doesn't make sense.

* Introduce the mips64 and mips64el architecture names when a 64-bits MIPS ABI is choosen. This will fix build issue like
http://autobuild.buildroot.org/results/9b8c5ea86c953a89e85e7b67e9221de41773f652/build-end.log
where gmp was confused by the fact of having a 32 bits architecture (detected by the mips- architecture part of the tuple) but 64 bits integer size when compiling.

* Adjust the uclibc.mk logic to support the new mips64/mips64el architecture names, and take into account the renaming of the ABI options.

This has been build tested by generating Buildroot toolchains and compiling a few packages for MIPS o32, MIPS n32 and MIPS n64.

This work is originally based on prior work done by Gustavo Zacarias.

---
 package/Makefile.in        |    2 +-
 target/Config.in.arch      |   60 ++++++++++++++++++++++++++------------------
 toolchain/uClibc/uclibc.mk |    7 +++---
 3 files changed, 39 insertions(+), 30 deletions(-)
package/Makefile.in +1 -1
index 6fad224..21b8634 100644
@@ -87,7 +87,7 @@ endif
 
 TARGET_CFLAGS=$(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 
-ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_ABI64)),yy)
+ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_NABI64)),yy)
 TARGET_CFLAGS+=-fno-pic -mno-abicalls
 endif
 
target/Config.in.arch +35 -25

132 lines not on this page · raw message

toolchain/uClibc/uclibc.mk +3 -4
index 583d199..534550a 100644
@@ -37,7 +37,6 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
 		-e 's/v850.*/v850/g' \
 		-e 's/sh[234].*/sh/' \
 		-e 's/mips.*/mips/' \
-		-e 's/mipsel.*/mips/' \
 		-e 's/cris.*/cris/' \
 		-e 's/xtensa.*/xtensa/' \
 ")
@@ -142,13 +141,13 @@ ifeq ($(UCLIBC_TARGET_ARCH),mips)
 	 /bin/echo "# CONFIG_MIPS_ISA_MIPS32R2 is not set"; \
 	 /bin/echo "# CONFIG_MIPS_ISA_MIPS64 is not set"; \
 	) >> $(UCLIBC_DIR)/.oldconfig
-ifeq ($(BR2_MIPS_OABI),y)
+ifeq ($(BR2_MIPS_OABI32),y)
 	$(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
-ifeq ($(BR2_MIPS_ABI32),y)
+ifeq ($(BR2_MIPS_NABI32),y)
 	$(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
-ifeq ($(BR2_MIPS_ABI64),y)
+ifeq ($(BR2_MIPS_NABI64),y)
 	$(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
 ifeq ($(BR2_mips_1),y)
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 mips64: remove toolchain kludge

In reply to Thomas Petazzoni

From: Gustavo Zacarias <[email protected]>

-mno-abicalls is an old kludge for some (probably) old issue. Remove it since it's actually harmful, static busybox doesn't build with it for a modern-ish toolchain (defaults as of this commit, uClibc 0.9.33.2 + gcc 4.5.4).

---
 package/Makefile.in |    4 ----
 1 file changed, 4 deletions(-)
package/Makefile.in +0 -4
index 21b8634..340e387 100644
@@ -87,10 +87,6 @@ endif
 
 TARGET_CFLAGS=$(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 
-ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_NABI64)),yy)
-TARGET_CFLAGS+=-fno-pic -mno-abicalls
-endif
-
 ifeq ($(BR2_LARGEFILE),y)
 TARGET_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 endif
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 qemu/mips64-malta: add new sample config

In reply to Thomas Petazzoni

From: Gustavo Zacarias <[email protected]>

---
 board/qemu/mips64-malta/linux-3.3.config |   78 ++++++++++++++++++++++++++++++
 board/qemu/mips64-malta/readme.txt       |    7 +++
 configs/qemu_mips64_malta_defconfig      |   24 +++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 board/qemu/mips64-malta/linux-3.3.config
 create mode 100644 board/qemu/mips64-malta/readme.txt
 create mode 100644 configs/qemu_mips64_malta_defconfig
board/qemu/mips64-malta/linux-3.3.config new file +78 -0
new file mode 100644
index 0000000..6e7f7ee
@@ -0,0 +1,78 @@
+CONFIG_MIPS_MALTA=y
+CONFIG_CPU_MIPS64_R1=y
+CONFIG_64BIT=y
+CONFIG_64BIT_PHYS_ADDR=y
+CONFIG_MIPS_MT_SMP=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_HZ_100=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_SYSVIPC=y
+CONFIG_LOG_BUF_SHIFT=15
+CONFIG_SYSFS_DEPRECATED_V2=y
+CONFIG_RELAY=y
+CONFIG_NAMESPACES=y
+CONFIG_UTS_NS=y
+CONFIG_IPC_NS=y
+CONFIG_PID_NS=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_SLAB=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_PCI=y
+CONFIG_PM=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_MISC_DEVICES is not set
+CONFIG_IDE=y
+CONFIG_BLK_DEV_IDECD=y
+CONFIG_IDE_GENERIC=y
+CONFIG_BLK_DEV_GENERIC=y
+CONFIG_BLK_DEV_PIIX=y
+CONFIG_NETDEVICES=y
+CONFIG_NET_ETHERNET=y
+CONFIG_NET_PCI=y
+CONFIG_PCNET32=y
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO_I8042 is not set
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_MFD_SUPPORT is not set
+CONFIG_FB=y
+CONFIG_FB_CIRRUS=y
+# CONFIG_VGA_CONSOLE is not set
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+CONFIG_QUOTA=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_ROOT_NFS=y
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
board/qemu/mips64-malta/readme.txt new file +7 -0
new file mode 100644
index 0000000..5087b01
@@ -0,0 +1,7 @@
+Run the emulation with:
+
+ qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -hda output/images/rootfs.ext2 -append "root=/dev/hda"
+
+The login prompt will appear in the terminal that started Qemu. The
+graphical window is the framebuffer. No keyboard support has been
+enabled.
configs/qemu_mips64_malta_defconfig new file +24 -0
new file mode 100644
index 0000000..5653c88
@@ -0,0 +1,24 @@
+# Architecture
+BR2_mips=y
+BR2_mips_64=y
+BR2_MIPS_NABI64=y
+
+# Toolchain
+# uClibc dynamic loader seems broken for mips64
+BR2_PREFER_STATIC_LIB=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.3.8"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/mips64-malta/linux-3.3.config"
+BR2_LINUX_KERNEL_VMLINUX=y
+
+# Serial port config
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Hello,
Thomas> Here is a new version of the patch set that clarifies MIPS support, Thomas> and especially MIPS64 support.

Thomas> It has four patches:

Thomas> * First patch refactors some uclibc.mk to use the existing BR2_ENDIAN
Thomas> config option rather than doing the same work again.

Thomas> * Second patch reworks the config option for mips. It creates two
Thomas> separate two level architectures for MIPS and MIPS64, and then
Thomas> clarifies the ABI names and config options.

Thomas> * Third patch (from Gustavo) remove old MIPS64 related toolchain
Thomas> kludge

Thomas> * Fourth patch (from Gustavo) adds a defconfig to build a mips64
Thomas> system for Qemu

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard