Skip to content

Instantly share code, notes, and snippets.

@reid
Created September 11, 2011 01:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reid/1209059 to your computer and use it in GitHub Desktop.
Save reid/1209059 to your computer and use it in GitHub Desktop.

Node.js Installation for Chumby

If you have an Insignia Infocast 8 (Chumby Silvermoon), this will get you up and running with Node.js.

Get shell access

  1. On the device, tap the Insignia logo for the about dialog.
  2. Tap the pi icon on the top right of the about dialog.
  3. Tap the SSHD button in the "Do you believe in the users?" dialog.
  4. You can now ssh root@chumby -- the IP address is on the dialog.

Install a toolchain

So easy. Just type make and agree to the download.

From now on, we will be working in /mnt/storage.

Turn off the control panel

Flash sure does soak up a lot of memory.

stop_control_panel

Install Python

Python is needed to compile Node.js.

cd /mnt/storage
mkdir python
cd python
wget http://files.chumby.com/languages/python/python2.6-chumby.tgz
tar xzf python2.6-chumby.tgz
mount -oremount,rw /
ln -s /mnt/storage/python/bin/python /usr/bin/python
ln -s /mnt/storage/python/lib/python2.6 /usr/lib/python2.6
mount -oremount,ro /

Install Node.js

Enable swap

GCC takes up a ton of memory while building V8. I recommend stopping non-essential services (see above) and enabling swap.

This will create and use a 256M swapfile:

dd if=/dev/zero of=/mnt/storage/swap bs=1M count=256
mkswap /mnt/storage/swap
swapon /mnt/storage/swap

More information: http://wiki.chumby.com/index.php/Chumby_One_tips_and_tricks

Download and Extract

cd /mnt/storage
mkdir node
wget http://nodejs.org/dist/node-v0.4.11.tar.gz
tar xzf node-v0.4.11.tar.gz
cd node-v0.4.11

Hack some wscript

The Silvermoon toolchain defines inotify and epoll headers, but these features are not enabled in the running kernel.

Additionally, a bad check for sync_file_range causes it to be used; however, it does not work.

  1. In deps/libeio/wscript, remove the check_cc call for HAVE_SYNC_FILE_RANGE.
  2. In deps/libev/wscript, remove the check_cc calls for inotify and epoll.

Build

If you are using a Chumby One or 3.5 inch Infocast, adjust the march setting using the next section.

The compile will take quite a long time, mostly on V8.

./configure --without-ssl --without-snapshot
CCFLAGS="-fno-tree-sink -march=armv5te" CXXFLAGS="-march=armv5te" make
mount -oremount,rw /
make install
mount -oremount,ro /

Aside: Finding the march setting for non-Silvermoon

Run gcc -v, you will see output similar to:

Using built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with: /home/user/oe/tmp/work/armv5te-angstrom-linux-gnueabi/ <snip>

The arch to use is after /tmp/work/ and before the dash.

More information about the bad GCC default: http://fastr.github.com/articles/Node.js-on-OpenEmbedded.html

Help

Internal compiler error

If you encounter an error like this while compiling:

/mnt/storage/node/node-v0.4.11/deps/v8/src/arm/assembler-arm-inl.h: In member function 'v8::internal::MaybeObject* v8::internal::CallStubCompiler::CompileCallConstant(v8::internal::Object*, v8::internal::JSObject*, v8::internal::JSFunction*, v8::internal::String*, v8::internal::CheckType)':/mnt/storage/node/node-v0.4.11/deps/v8/src/arm/assembler-arm-inl.h:259: internal compiler error: in simplify_subreg, at simplify-rtx.c:4922

This appears to be a transient error. Try running the build again.

Pure virtual method called

After a successful compile, you may see this output when running a Node program or the REPL:

pure virtual method called
terminate method called without an active exception
Aborted

This is caused by a GCC bug in GCC 4.3.x. You must specify the CCFLAG -fno-tree-sink while compiling to fix.

More information: nodejs/node-v0.x-archive#883

Internal error: Killed

If you encounter this error while compiling:

g++: Internal error: Killed (program cc1plus)

Your system might be out of memory during compilation. Make sure swap is enabled. See above.

For information: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34882

Thumb inter-working

If you encounter this error while compiling:

deps/v8/src/arm/macro-assembler-arm.cc:59:3: error: #error "For thumb inter-working we require an architecture which supports blx"

Your compiler may be using the wrong arch setting. Make sure you passed the arch in CCFLAGS, see above.

See: http://code.google.com/p/v8/issues/detail?id=836

mksnapshot fails

Set the --no-snapshot option when you ./configure Node.js.

Building with V8 snapshot enabled

This does not work. To try anyway:

Edit the mksnapshot line to look like this, grep for Snapshot to find it.

vi deps/v8/src/SConscript

env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions --noenable_armv7 --noenable_vfp3')

You are adding the two disable flags. Now make again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment