Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running on mips #1440

Closed
ghost opened this issue Apr 16, 2015 · 10 comments
Closed

running on mips #1440

ghost opened this issue Apr 16, 2015 · 10 comments
Labels
question Issues that look for answers.

Comments

@ghost
Copy link

ghost commented Apr 16, 2015

Hi all!
With the patch mentioned in #1432 I was successful in cross-compiling io.js for OpenWRT running on a AR9331 SoC big endian without FPU (carambola2):

BusyBox v1.22.1 (2015-04-16 09:09:37 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (Bleeding Edge, r44489)
 -----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -----------------------------------------------------
root@openwrt1:/# uname -a
Linux openwrt1 3.18.7 #1 Thu Apr 16 09:39:38 CEST 2015 mips GNU/Linux
root@openwrt1:/# iojs --version
v1.7.1
root@openwrt1:/# iojs ~/test.js
0.6666666666666666
root@openwrt1:/# 

Basic tests are working, now I would like to run the test suite. The system is very resource constraint though (64MB ram, 16MB flash). Any idea how to run the test suite on that system?

Many thanks for any pointer!

@mscdex mscdex added the question Issues that look for answers. label Apr 16, 2015
@silverwind
Copy link
Contributor

Is python2 available? If so, check out the repo and try

python tools/test.py --mode=release message parallel sequential -J

@jbergstroem
Copy link
Member

You probably want to omit -J since it'd waste whatever resources you have (if your processor has multiple cores). openwrt defaults to uclibc on most architectures, right?

@silverwind
Copy link
Contributor

Note: I acually copied that straight out of the makefile without researching what the options do :)

@markoly
Copy link

markoly commented Apr 16, 2015

I was going to open another issue on armv8 but seeing the title couldn't resist participating in it. I was digging through the source codes last couple of days. In my experience (I've recently worked in a project that uses this SoC on a wireless rooter), io.js is not suitable for AR9331 unless you want to burn it up, it's another story. Perhaps the project owners already know this fact. It's way too heavy for what you have.

@Fishrock123
Copy link
Contributor

io.js is not suitable for AR9331 unless you want to burn it up, it's another story. Perhaps the project owners already know this fact.

It's not an officially "supported" platform per-say, but that's about it. I don't think any of us have that much experience with mips that I know about, other than the folks working on the Tessel 2.

@silverwind
Copy link
Contributor

Forgot to add for testing: put the binary in out/Release/iojs

@ghost
Copy link
Author

ghost commented Apr 17, 2015

Hi all, many thanks for the hint's. I have to make an external root for my OpenWRT first in order get more storage. Another option I am considering is to setup a MIPS qemu environment. I'll report my progress here.

@ghost
Copy link
Author

ghost commented Apr 27, 2015

Hi all
As above comments let adumbrate the AR9331 SoC is too resource constraint. Some of the tests passed, most of them didn't. I am wondering how the tressel.io guys proceed though.
Again, thanks for your inputs!

@ghost ghost closed this as completed Apr 27, 2015
@markoly
Copy link

markoly commented May 22, 2015

As above comments let adumbrate the AR9331 SoC is too resource constraint.
I am wondering how the tressel.io guys proceed though.`

It's funny and ambitious forcing V8 JIT on AR9331 24Kc. I'm not clearly sure if they know what they are doing. SoC spec. speaks for itself.

@JohannesRudolph
Copy link

@ssuats Trying the same thing here. Unfortunately I'm getting "Illegal Instruction" when trying to run any js code with node v.4.2.1 on a carambola2.

My node binary looks fine though:

carambola@carambola-VirtualBox:~/carambola2/openwrt$ file build_dir/target-mips_34kc_uClibc-0.9.33.2/node-v4.2.1/out/Release/node 
build_dir/target-mips_34kc_uClibc-0.9.33.2/node-v4.2.1/out/Release/node: ELF 32-bit MSB  executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), not stripped

Would you be able to share your exact build commands?

Here's the OpenWrt package (&make commands) I use, correctly setting --dest-cpu=mips.

include $(TOPDIR)/rules.mk

PKG_NAME:=node
PKG_VERSION:=v4.2.1
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/nodejs/node.git
PKG_SOURCE_VERSION:=b7eff480d8fbeb0576bb98ca771fb1ad6f48e864
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz


include $(INCLUDE_DIR)/package.mk

define Package/node
  DEPENDS:=+libstdcpp +libc +libpthread +librt +uclibcxx 
  SUBMENU:=Node.js
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
  URL:=http://nodejs.org/
endef

define Package/node/description
 Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
endef

define Build/Configure
    (cd $(PKG_BUILD_DIR); \
    CC="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-gcc" \
    CXX="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    AR="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-ar" \
    RANLIB="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-ranlib" \
    LD="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    LINK="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    PATH="/usr/bin/:$(PATH)" \
    GYPFLAGS="-Dv8_use_mips_abi_hardfloat=false -Dv8_can_use_fpu_instructions=false" \
    LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
    ./configure --without-snapshot --without-npm --dest-cpu=mips --dest-os=linux --with-arm-float-abi=soft; \
    );
endef

define Build/Compile
    CC="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-gcc" \
    CXX="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    AR="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-ar" \
    RANLIB="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-ranlib" \
    LD="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    LINK="$(TOOLCHAIN_DIR)/bin/mips-openwrt-linux-g++" \
    PATH="/usr/bin/:$(PATH)" \
    GYPFLAGS="-Dv8_use_mips_abi_hardfloat=false -Dv8_can_use_fpu_instructions=false" \
    LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
    $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)"
endef

define Package/node/install
    mkdir -p $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/Release/node $(1)/usr/bin/nodejs
    $(INSTALL_BIN) ./files/node $(1)/usr/bin

    mkdir -p $(1)/usr/lib/node_modules
    $(CP) $(PKG_BUILD_DIR)/deps/npm $(1)/usr/lib/node_modules
    ln -sf /usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/bin/npm
endef

$(eval $(call BuildPackage,node))

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

6 participants