Putting a newer version of Node.js on LinkIt Smart 7688 Duo

Today I’m going to step you through putting a newer version of Node JS on your LinkIt Smart 7688.  The default version of node available is 0.12.7 which, let’s face it, is completely outdated and essentially useless for to any serious Node.js developers.  Now there are some ongoing challenges with putting a completely up to date version of Node on the MIPS architecture. This is because there are key libraries needed to build Node JS that are not updated on MIPS yet… so since those libraries out out of date we can only get so far.

Setup your linux machine.

I use Ubuntu server 16.04.2 LTS at the time of writing this tutorial.  Get Virtual Box, download an Ubunut 16 .ISO, create a new VM, make sure your disk is around 50GB (5GB is not enough… found this out the hard way), select the ISO you downloaded, install the operating system (be sure to add SSH for convenience).

I alway use SSH for copy paste commands.  To setup you VM so you can ssh to it:

  1. Open the setting for the VM (you can do this while its running)
  2. Go to Network > Adapter 1 > Advanced > Port Forwarding
  3. Forward 127.0.0.1:2200 to 10.0.2.15:22
    • Check your ifconfig to verify your VMs IP address

SSH to it from your host with this:

ssh usename@127.0.0.1 -p 2200

Alternatively you can put the adapter in Bridge mode… then check ifconfig for the VMs IP.

Setup for the build

Following for guide here with modified instruction for things they forgot:

https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/firmware-and-bootloader/build-the-firmware-from-source-codes

and with help from the nxhack who is running this repo:

https://github.com/nxhack/openwrt-node-packages/tree/for-15.05

  1. Add the python package (if you didn’t install during Ubuntu OS install)
    sudo add-apt-repository ppa:fkrull/deadsnakes
    sudo apt-get update
  2. Install prerequisite packages to build the firmware:
    sudo apt-get install git g++ libncurses5-dev subversion libssl-dev gawk libxml-parser-perl unzip wget build-essential python2.7
  3. Download the OpenWrt CC source codes:
    git clone git://git.openwrt.org/15.05/openwrt.git
  4. Prepare the default configuration file for feeds:
    cd openwrt   
    cp feeds.conf.default feeds.conf
  5. Add the LinkIt Smart 7688 development board’s and NodeJS to the builds feed:
    sudo nano ./feeds.conf

    Add the following lines to the bottom of the file:
    src-git linkit https://github.com/MediaTek-Labs/linkit-smart-7688-feed.git
    src-git node https://github.com/nxhack/openwrt-node-packages.git;for-15.05

  6. Update the feed information for all available packages to build the firmware:
    ./scripts/feeds update
  7. Change the packages installed as default:
    wget https://gist.githubusercontent.com/nxhack/7ced4d866a59ebc72737589b49a220f8/raw/1bebfe9f6091f55a5856bc4af00da456a4995b09/mtk-linkit.patch
    patch -p1 < mtk-linkit.patch
  8. Fix build error of depend on node.js version:
    wget https://gist.githubusercontent.com/nxhack/4357d51918ba8f3cb5cc00080ad0815c/raw/e96758224ade8cb224523aedf5ea3249a6a59425/MRAA.patch
    patch -p1 < MRAA.patch
  9. Hack for wifi driver so build completes
    Copy kernel objects for support kernel 3.18.45:
    see : MediaTek-Labs/linkit-smart-7688-feed#37

    cp ./feeds/linkit/mtk-sdk-wifi/wifi_binary/mt_wifi.ko_3.18.44 ./feeds/linkit/mtk-sdk-wifi/wifi_binary/mt_wifi.ko_3.18.45
    cp ./feeds/linkit/mtk-sdk-wifi/wifi_binary/mt_wifi.ko_3.18.44_all ./feeds/linkit/mtk-sdk-wifi/wifi_binary/mt_wifi.ko_3.18.45_all
  10. Install all packages:
    ./scripts/feeds install -a
  11. Use node.js custom packages:
    rm ./package/feeds/packages/node
    rm ./package/feeds/packages/node-arduino-firmata
    rm ./package/feeds/packages/node-cylon
    rm ./package/feeds/packages/node-hid
    rm ./package/feeds/packages/node-serialport
    ./scripts/feeds install -a -p node
    
  12. Prepare the kernel configuration:
    make menuconfig
    • Select the following options:
      • Target System: Ralink RT288x/RT3xxx
      • Subtarget: MT7688 based boards
      • Target Profile: LinkIt7688
    • (Optional) GO into Languages > Node.js > Configuration (under the node package) > Select your desired version.
    • (Optional) Enable modules you want (Caution there is a 30MB limit so not all will fit)
      • (Recommended) node-npm (it is a separate module in v6)
    • Save and exit (use the default configuration file without any modification)
  13. !!!BEFORE YOU START!!!
    RUN THIS FROM YOUR VM NOT OVER SSH
    This command will take a while and if your ssh pipe breaks so will your build
    Start the compilation process:

    make

    There are several options you can use with the make command that are helpful.
    – V=99 (gives verbose output during build) or
    – V=1 (shows error, warnings, and notes “less verbose”)
    – &> output.log ( on the end – stores output in a log for later viewing)

A Few Hours Later…

  • After the build process is finished successfully, the resulted firmware file will be under “bin/ramips/openwrt-ramips-mt7688-LinkIt7688-squashfs-sysupgrade.bin”. If its’ not there check the output in your log file or on your screen.  Depending on the hardware resources of the host environment, the build process may take more than 2 hours.
  • You can use this file to update the firmware through Web UI or rename it to lks7688.img to update through a USB drive.

A big thanks to nxhack for making this build possible!

Download images for the version of Node you want:

lks7688-node-v4.img

MD5: d7f724da93a1d916bf777f80516a0f33

SHASUM: f74182c70b937909ad1cba6f97e40b5dd3891962

lks7688-node-v6.img

Includes NPM.

MD5: a17c672f87c4b8fa49a253d5534a9229

SHASUM: 8b19b20d23f1faa94c9dd084ca0271904d1dfa5e

8 thoughts on “Putting a newer version of Node.js on LinkIt Smart 7688 Duo

  1. sean says:

    IT’s possible to upgrade nodejs to v8.*?

    1. Joe says:

      I’m not sure… if I remember my research indicated that there was something preventing it but I could be wrong…

  2. Hans says:

    Thank you very much for that write up. Helped me so much!

    All the best,
    Hans

    (Theres few mistakes around steps 8. and 11.)

    1. Joe says:

      I’m sure there are some mistakes, there was a lot of back and forth out on github. I’d recommend checking it for better directions: https://github.com/nxhack/openwrt-node-packages/issues/8#issuecomment-318280825

  3. Juan Campos says:

    Will you update image? 🙂 node 8?

    1. Joe says:

      Possibly… I’d have to dig back into this. You are welcome to try as well 😀

  4. Fabio Sierra says:

    Hello, I am very grateful for the tutorial and especially for leaving the firmware images to make it easier for mortals.

    I have had only one problem so far and it is to follow this tutorial after installing the image with nodejs v6, punctually on the part of installing kmod-fs-ext4, I appreciate any help or guide that helps me solve this problem.

    https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/file-storage/mounting-the-root-fs-on-an-sd-card

    thank you very much

  5. hello,so the images files you put at the end of the page are ready to be installed on linkit?

Tell me what you REALLY think...

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>