Does node.js not include packages in opkg yet?
-
Yea, that is kinda old I just started looking at the IOT.js package, and it looks promising, but in early stages it would appear. They looks to be trying to support GPIO directly too. IOT.js might work better in a memory constrained device.
-
I'm currently trying to get OpenWRT from allseenalliance built from the master branch, which is currently similar to chaos_calmer openwrt build as per the latest deployed firmware (they did it for alljoyn on the ar71xx family of chips). Once that is done, I'm going to try and cross-compile node.js from source as per https://github.com/netbeast/docs/wiki/Cross-Compile-Nodejs-for-OpenWrt
I'm now beginning to think that the former is failing due to onerous firewalls and network rules preventing me from downloading source tarballs However, once that is resolved, I should be able to make some progress on seeing if node.js is even possible to be cross-compiled, much less usable on the omega.
This also is ignoring that someone has seemingly been successful getting this compiled at: https://github.com/nneves/openwrt_mips_ar9331_nodejs
-
hmmmm:
file out/Release/node
out/Release/node: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), not strippedSeems I did something nominally right? . . .
-
@Theodore-Borromeo We have followed that guide to get nodejs compiled. However, the compiled binary had no problem showing its version, but when you get to run any command, it will crash. New versions of nodejs won't even compile...
-
@Boken-Lin I think that mine will crash, as I think it was built with a dependency on musl c lib, which I'll have to get on the device as well. Not to mention that I need v8 too. I was just surprised that I got something to spit out. This is, as well, ignoring whatever complications I may have introduced to the process by taking from allseenalliance for their work on openWRT for Atheros chipsets. . .
I understand that this may not work. It is just nice to make some progress. Did Onion Omega come preloaded with tools to on device to aid in debugging? Alternatively, is there any way to make public the source and feeds you all used to get chaos_calmer built? That would probably be the easiest way for the community to aid in getting a workable solution, no?
-
just found your post at: https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment
I'll probably have to redo from there and figure out a way to incorporate some of what was done at: https://github.com/nneves/openwrt_mips_ar9331_nodejs
into a docker container.
-
@Theodore-Borromeo Dock is actually a great idea. We should probably make a docker image for the community to download so that everyone can create a build environment very quickly.
-
@Boken-Lin I can do that for you. Can you forward me the links necessary to setup an environment and the debian /ubuntu version you all depend on? From there, I can put something together. For reference of what I did know, please take a look at: https://github.com/borromeotlhs/docker-onion-omega
I'll be automating setting OpenWRT variables and .configs for OpenWRT later. Those should be automatically prepared for insertion into the docker container so that 'make' can just run while building the docker container (thus giving the built and completed toolchain straight off with no fuss). This will then also allow you all to normalize the 'distro' and include via a prefilled .config, those packages that you think should be allowed for optional install/build by folks who have enough savvy to build the packages themselves.
-
@Theodore-Borromeo This is what we use to set up our compile environment: https://github.com/OnionIoT/OpenWRT-Packages/wiki/Setting-Up-the-Cross-Compile-Environment
We usually use the latest Ubuntu version.
Let me know if you need any other information to get this started.
-
@Boken-Lin I am erroring out on the line:
cd openwrtevernote:///view/1434696247/s567/edc62026-49b6-4a74-a2aa-a5b6d4b2d90b/edc62026-49b6-4a74-a2aa-a5b6d4b2d90b/what is that? I have never seen this format. Are you sure that this is an artifact that resolves for you all on a windows system with evernote installed? I think it'd be best to host fork of openwrt + whatever changes you have in whatever that link resolves to. If I can get that point resolved, I have found a way to eliminate all other hand configurable items by usings 'scripts/diffconfig' to create a .config file that will just roll into the docker build env source tree once I check it in.
-
@Theodore-Borromeo OOPS... We copy and pasted it from Evernote, and they must have their proprietary protocol to keep track of hyperlinks within notes. Fixed now
-
@Boken-Lin How is this: https://github.com/borromeotlhs/docker-onion-omega/commit/b4c98eab76e6f3d02704da39da890991e8fba1f4
I can't get 'make' to work due to my firewall issues, and I do still need to:
- parameterize the number of cores to make
- Set the ENV variables to point to the OpenWRT toolchain ahead of the make succeeding (for node.js, at least)
Though I would love for someone to instantiate this and run 'make' to test that the image builds through.
-
OK,
Built from source using instructions from:
https://github.com/nneves/openwrt_mips_ar9331_nodejshttps://drive.google.com/open?id=0ByWngkuitN_ZQ3RKUmRIZXNtRE9pd0d5X1FuQUZ4TTZ1cE40
libv8 so
https://drive.google.com/open?id=0ByWngkuitN_ZR0dHUnpLRXNvdjhCV2l1TUVqN2ZYV2F2UG00
node (v0.10.5)
-
@Theodore-Borromeo, @Boken-Lin - When you guys get this sorted out, do you mind pinging me with install details?
-
Assuming you have serial console access or have terminal access from the wifi console, and that your onion omega is connected to the same wifi network. PLEASE NOTE: working node.js is NOT built from openwrt toolchain provided by onion corp., and I am still working on getting that 'container-ized', so that is still TBD.
1.) Download the two files from google drive I linked to, get them over to a mounted usb drive on the onion (i format to ext4). Run:
ln -s /path/to/usb/libv8.so /usr/lib/libv8.so2.) and then go to:
cd /path/to/usb/3.) and run:
./node --versionThat's about it
OR
pull borromeotlh/docker-onion-omega-nodejs from dockerhub, then:
docker cp over 'node' and 'libv8.so' from /node/nodejs_deploy to your host machine
scp over those two libs onto a usb drive (ext4 formatted is what I used, but ymmv) mounted to on the omega
make a symlink for /usr/lib/libv8.so that points to libv8.so you just scp-ed over
go to usb drive and run './node --version'
-
-
Have quickly re-implemented my Python GPIO helper in JavaScript, if anyone wants to give it a go? Wont be able to test for another 12 hours (supposed to be working!).
EDIT: Code now here https://community.onion.io/topic/46/simple-node-js-wrapper-and-demo
-
@Dan-L. I would, but I got the micro dock and haven't had time to:
1.) wire up the omega to a breadboard
2.) breadboard -> micro dock so that I can get serial access
3.) and wire up omega pin outs from breadboard to leds/buttonsIt's is probably why I've been tinkering around with just getting software to work
I think I should probably guy the other docks, though I am awaiting the camera kit as I've been wanting to see if I can't create a forward facing camera for my car (rear facing cams are great, but I still can't tell where my hood is in relation to the other guy's bumper!) I test drove the new Tesla Model S, and their 360 sonar ranging was SWEET! Not to mention auto-pilot <digressing>
-
@Dan-L. Also, your use of 'this' is mangled for javascript. I'm trying to fix it now. You also meant to write:
GPIOHelper.prototype.setPinDirection = function(pin, dir, callback) {
if(dir !== 'out' && dir !== 'in') {
throw new Error("Invalid pin direction, use 'in' or 'out'.");
}
fs.writeFile(this.pinDirectionPath.replace('$', pin), dir, callback);
};GPIOHelper.prototype.setPinDirectionSync = function(pin, dir) {
if(dir !== 'out' && dir !== 'in') {
throw new Error("Invalid pin direction, use 'in' or 'out'.");
}
fs.writeFileSync(this.pinDirectionPath.replace('$', pin), dir);
};I'll have to ensure that:
fs.writeFileSync(this.pinValuePath.replace('$', pin), String(value));resolves to the this.pinValuePath you've defined in the GPIOHelper function. ES7, with proper class support, will hopefully make this moot As of right now I get the error:
/mnt/sda1/scripts/js/gpiotest/GPIOHelper.js:53
fs.writeFileSync(this.pinDirectionPath.replace('$', pin), dir);
^
TypeError: Cannot call method 'replace' of undefined
-
@Theodore-Borromeo Correction to last post:
'this' usage is fine, but we can't 'see' :
this.pinDirectionPath
this.pinValuePathfrom outside the function definition. I've tried returning them at the end of the GPIOHelper() function, though that is still returning undefined. I think this wrapper may need a little bit of work, and I'm tinkering away with it now. However, I am only moderately skilled at javascript. . .