Re: building image for Realtek RTS3916N mips SoC using vendor provided prebuilt external uClibc toolchain

davis roman <davis.roman84@...>

On Wed, Dec 29, 2021 at 7:40 PM Davis Roman <davis.roman84@...> wrote:

On Wed, Dec 29, 2021 at 6:15 PM Davis Roman <davis.roman84@...> wrote:

On Wed, Dec 29, 2021 at 5:30 PM Khem Raj <raj.khem@...> wrote:

On Wed, Dec 29, 2021 at 2:20 PM Davis Roman <davis.roman84@...> wrote:

On Wed, Dec 29, 2021 at 2:21 PM Anders Montonen <Anders.Montonen@...> wrote:


On 29 Dec 2021, at 9:53, davis roman <davis.roman84@...> wrote:

I generated an internal mips toolchain built against musl and I tried
to compile u-boot but unfortunately, I'm getting "opcode not
supported" error messages.
If instead I use the realtek provided prebuilt toolchain then u-boot
compiles successfully.

I'm thinking that Realtek's toolchain has patches specific to their
SoC that have not been pushed upstream. Could this be the reason I'm
unable to compile uboot?
I’m guessing that your U-Boot config doesn’t set the correct MIPS architecture revision. The compiler error shows that you’re trying to assemble a MIPS32r1 instruction, but the compiler is targeting the original MIPS1 architecture. The Realtek toolchain may have set the default architecture to match the SoC, but the fix is to update the config to match the hardware.
You're right. I didn't realize the RX5281 core on the RTS3916N only
supports mips1 or mips16 (

I happened to have a mips sourcery toolchain installed on my machine
so I pointed that to u-boot without modifying anything else and it was
able to compile u-boot successfully. Woot!

I suppose the next step would be to generate a mips1 yocto toolchain
however according to the available tune values it appears only mips32
or mips64 is available

Any suggestions on how to generate a mips1 yocto toolchain or if
that's even supported?

Yes it’s supported although it’s not default for qemumips so the simple trick you can do is change the DEFAULTTUNE setting in the qemumips.conf away from mips32r2
Sorry Khem, I'm not quite following you. I tried the following patch
( thinking perhaps this is what you
meant however my build configuration still shows the tune set to

What am I missing?
Nevermind, I scraped the last patch, recreated my BUILD_DIR, set
MACHINE = "qemumips" and added DEFAULTTUNE = "mips" in my local.conf.
Now the build configuration correct and
I'm now waiting for the toolchain to finish so I can attempt to build
realtek's u-boot.
Unfortunately, I still get the original u-boot error
( even after creating a toolchain using

Later I re-read what Anders Montonen had mentioned regarding the arch
needs to be set in the u-boot source itself (since the yocto toolchain
does not contain the same defaults as the realtek toolchain) so I
decided to tweak arch/mips/Makefile to set the arch to mips32 ( it
should be backwards compatible with mips1)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index efe7e44..0c0f0c2 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -29,6 +29,7 @@ arch-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,-mips32r6
arch-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,-mips64
arch-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,-mips64r2
arch-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,-mips64r6
+arch-$(CONFIG_CPU_TAROKO) += -march=mips32 -Wa,-mips32

# Allow extra optimization for specific CPUs/SoCs
tune-$(CONFIG_MIPS_TUNE_4KC) += -mtune=4kc

With this patch, my build was able to get a little farther
( however I got the following linker

mipsel-poky-linux-ld.bfd: u-boot: error: PHDR segment not covered by
LOAD segment
Makefile:1214: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1

Any idea what this could be about? or thoughts in general?

I'm not sure if the gcc dumpspecs for each toolchain would be useful
but here they are just in case.
yocto toolchain - ( not able to compile
realtek u-boot)
realtek toolchain - ( able to compile
realtek u-boot)
code sourcery mips 2016.05 - ( able to
compile realtek u-boot)

Anders Montonen

Join to automatically receive all group messages.