Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#4603 closed enhancement (fixed)

Add support for mips64 mips64el (abi=n64)

Reported by: miguel.gaio@… Owned by: florian
Priority: normal Milestone:
Component: toolchain Version:
Keywords: Cc:


This patch add support for mips64 mips64el

mips abi is defined using menuconfig:

CONFIG_EXTRA_GCC_CONFIG_OPTIONS="--with-arch=mips64 --with-abi=64"
CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mips64 -march=mips64 -mabi=64 -funit-at-a-time"

  • Test was done only for ABI=n64 (uclibc, glibc, eglibc)
  • ABI=n64 required --enable-kernel="2.6.0" for glibc



Attachments (1)

mips64.patch (29.6 KB) - added by anonymous 9 years ago.

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by anonymous

comment:1 Changed 9 years ago by xxiao

please add this patch, i'm actively working on adding a 64-bit cavium 11n router to openwrt (dlink 2590) which needs 64-bit toolchain.

comment:2 Changed 9 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to assigned

comment:3 Changed 9 years ago by florian

You do not need this patch to get your cavium port working, choose the mips target name, configure your kernel to be compiled in 64-bits and to execute 32-bits code, that will work equally well.

comment:4 Changed 9 years ago by xxiao

florian, how to do the steps you mentioned correctly? i tried to add various flags/options to the toolchain and failed to get it work, until RoundSparrow give me a link to this ticket, that at least gets me going.

comment:5 Changed 9 years ago by xxiao

do you mean to change arch/mips/Makefile with the 64-bit kernel and 32bit-usercode flags?

comment:6 Changed 9 years ago by anonymous

To clarify, all you have to do in OpenWrt is define your target in say, target/linux/cavium-octeon/Makefile and put the ARCH variable to mips. That way the build system will create your toolchain which in turns is capable of producing both 64-bits and 32-bits code.

The kernel passes some additionnal CFLAGS to the toolchain when selecting a 64-bits kernel in the kernel configuration file, but this does not interfere with the userland compilation. So in the end, you have compiled a 64-bits kernel and 32-bits userland. As long as your kernel can execute 32-bits code this is not much of a problem.

Now, when talking with Miguel, he explained me that he has quite some space on its target, therefore he does not really care about 32-bits executables. 64-bits executables are bigger than 32-bits so depending on your setup, you might want to have a 64-bits kernel only.

Could you contact me by mail so that we can coordinate the cavium octeon port ? Thanks.

comment:7 Changed 9 years ago by florian

Previous comment was from me ;)

comment:8 Changed 9 years ago by kaloz

I'll work on this target soon, too. 64bit userland hardly makes sense, given it increases the need of other resources as well, not only space. Sot this can be an option, but shouldn't be the default.

comment:9 Changed 9 years ago by xxiao

I put mips64 to target/linux/cavium-octen/Makefile and used Miguel's patch, still could not complete the kernel compilation. When I set ARCH=mips i did not get a 64-bit gcc for kernel, are you saying to use a 32-bit gcc with 64-bit flag to compile the kernel, instead of using a 64-bit gcc to do that? Cavium said it may work but they use 64-bit gcc directly.

On the rootfs, I agree the 32-bit should be the way to go. I hacked Dlink's (dap 2590) kernel and use it with a unmodified ar71xx rootfs.squashfs, and it booted up, though the rootfs runs painfully slow.

I'm using gcc-4.3.3, binutils 2.19.1, uclibc 0.9.30. Again Cavium said those versions should work though you will need gcc4.4.4 to get full cavium support(mips64r2 ISA). Put this aside, Dlink has, which gave troubles to 4.3.3 due to some asm code, I really don't want to go back to port their known-good gcc4.1.1 to openwrt and am still trying 4.3.3 on kernel.

Again, if you meant to use gcc-32bit to compile 64-bit kernel, will the flag -mabi=n64 suffice?

comment:10 Changed 9 years ago by florian

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with [15249].

comment:11 Changed 8 years ago by ricardo@…

Hi, I set the following menuconfig to build the trunk code (revision 18354)

CONFIG_EXTRA_GCC_CONFIG_OPTIONS="--with-arch=mips64 --with-abi=64" 
CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mips64 -march=mips64 -mabi=64 -funit-at-a-time" 

When I use ramdisk kernel image, boot will fail when executing init, output as the following:

Failed to execute /init
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

I'm using gcc 4.4.1, eglibc-2.10.1 on octeon evaluation board.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.