iotjs icon indicating copy to clipboard operation
iotjs copied to clipboard

MIPS Buildroot Linux Port

Open mark3072 opened this issue 7 years ago • 6 comments

Can you give any tips for how to port IOTJS to a 32bit MIPS architecture using a Linux OS supplied in a Buildroot environment? I am currently using Buildroot cs_mips-214.05.

Is this a relatively simple port or do many changes need to be made?

mark3072 avatar Nov 17 '17 00:11 mark3072

Shouldn't be hard. If you use snapshots (enabled by default) you might have some endianness issues if you cross compile iotjs (the snapshot tool might be compiled on x86 little endianness, dependin on your environment).

zherczeg avatar Nov 17 '17 07:11 zherczeg

Hi @mark3072! I've recently tried to compile the iotjs to MIPS OpenWRT router. The main points were:

  • Correctly select the toolchain, which will be used during the build. In iotjs, libtuv there are different toolchain files which could be adapted.
  • For now you should disable the snapshot function in iotjs as there is currently no support to handle the little endian snapshots on big endian systems.
  • Disable the jerry-libc option, use the build root's libc.

I don't see any blocker things currently, just some minor things. Hope this helps.

galpeter avatar Nov 17 '17 09:11 galpeter

Everything builds fine with the suggested modifications. However, I am having a problem with Buffer on my Mips Linux build.

var buff1 = new Buffer("test"); assert.equal(buff1.toString(), "test");

fails with:

uncaughtException: AssertionError: {"actual":"t","expected":"test","operator":"=="}

Is this a big/little endian issue? Do I need to dive into buffer implementation or is there something easy I am missing?

mark3072 avatar Dec 21 '17 00:12 mark3072

@mark3072 That's strange. I don't think it is related to the big/little endianness. Could you check what does the buff1.toString() returns? Also would it be possible to share your modifications in some way?

galpeter avatar Dec 21 '17 11:12 galpeter

I've tested on my openwrt build and there was no assert with the given example code. Small note: I've used an older iotjs build not the latest (~1.5 months old).

galpeter avatar Dec 21 '17 11:12 galpeter

I confirm version 1.0 is building fine on mips and other arch: https://buildd.debian.org/status/package.php?p=iotjs&suite=unstable

you can even download precompiled package from debian's testing branch.

rzr avatar Jun 26 '18 09:06 rzr