Showing posts with label archlinux. Show all posts
Showing posts with label archlinux. Show all posts

Friday, August 17, 2012

Installing node.js on the Raspberry Pi Archlinux

My Raspberry Pi arrived a few weeks ago and I had some problems with getting node.js to build on it. This post is specifically about building node.js from source on Archlinux.

All activity and commands in this tutorial are run on the Raspberry Pi, either via SSH or physical keyboard. It is possible to cross-compile on your laptop/desktop for ARM, but I preferred not to in this case.

Prerequisites

Have the base-devel group installed, you should have a working gcc and friends, along with openssl and zlib. Also install python2-virtualenv and git-core.

Get the source

I usually stay on node bleeding edge so:

$ git clone git://github.com/joyent/node

Use Python2

Since Archlinux uses python3 by default, the configure and build scripts screw up. You can edit the individual files, but I find it easier to just use virtualenv, which will setup the shell environment to use python2 and its libraries.

$ virtualenv2 env
$ source env/bin/activate

Here env is the name of the directory virtualenv will use to store scripts. You can use some other name. Sourcing the activate script will set up the environment so that python will actually be python2.

Patch the source

Geoff Flarity has created a patch to tweak the build parameters a bit. You can either follow the instructions to apply the patch, or just comment the 12 vfp3:on... lines yourself, which is what I did. Also set the environment variables to build for ARM as in the README.

export GYP_DEFINES="armv7=0"
export CCFLAGS='-march=armv6'
export CXXFLAGS='-march=armv6'`

NOTE: All commands should be run in the same shell that has the virtualenv environment and the above variables set.

Use system zlib and openssl

Attempting to compile the included openssl failed on my Archlinux setup with some ARM assembly errors. Using the installed libs will also reduce the compilation time. So

$ ./configure --shared-openssl\
--shared-openssl-includes=/usr/include/openssl\
--shared-openssl-libpath=/usr/lib\
--shared-zlib\
--shared-zlib-includes=/usr/include\
--shared-zlib-libpath=/usr/lib

Build

$ make
$ su -c 'make install'

The build will take some time (30 minutes to an hour), so be patient. Once it is done you will have a fully working node runtime on your Raspberry Pi. Use it to power your home automation control server or whatever else. I use it to experiment with my DHT implementation.

The use of node.js to write low-level systems services or networking code over traditional languages like C/C++ is very interesting, because it provides a safer, garbage-collected runtime, with efficient I/O and a less verbose language. Inexpensive devices like the Raspberry Pi allow experimenting with multiple devices or peer-to-peer configurations rather than being bound to only localhost testing for those on a tight budget. So get a Pi and have fun.

Monday, October 27, 2008

Installing Arch linux on the HP DV6910TX

This is a record of my attempt to put Arch (2008.06 Core Dump) on the HP DV6910TX.
Here is my system configuration
  • Intel Core 2 Duo T5750 @ 2.00GHz
  • Ram : 3GB
  • Nvidia GeForce 8400M GS with 256Mb dedicated memory
  • 320Gb harddisk

Partitioning



Here was my original partitioning scheme:
  • C: 308Gb
  • D: (Recovery) ~10Gb
Make sure you create your HP Recovery Discs first!

Since the arch install CD doesn't have ntfsprogs ( it has the packages, but not as part of the setup boot ), I booted from dreamlinux (you can use any liveCD) and used ntfsresize to shrink the C: (/dev/sda1) to 35Gb.

Then I used gparted to create a proper partition layout. Here is how it goes
  • /dev/sda1 - ntfs - 35Gb (C:)
  • /dev/sda2 - ntfs - 10Gb (D:)
  • /dev/sda3 - swap - 4Gb ( to hibernate, you need atleast as much swap as your RAM )
  • /dev/sda4 - extended
  • --- /dev/sda5 - ext3 - 20Gb (/)
  • --- /dev/sda6 - ext3 - 50Gb (/home)
  • --- /dev/sda7 - ntfs - 180Gb (/shared)
After committing these changes I began the installation.

The rest of the settings were normal Arch installation procedures, which can be found elsewhere.

Hardware



Display


The dv6910tx has an nVidia 8400M GS with 256Mb of dedicated memory. Installing the nvidia drivers ( pacman -S nvidia nvidia-utils ) and running nvidia-xconfig generated the required xorg.conf, and the card worked perfectly.

Touchpad


Installing the synaptics package and merging the required changes into xorg.conf ensured that the touchpad worked too, including scroll areas and locking.

CD/DVD drive


Works perfectly without any configuration.

Ethernet


Arch correctly used the r8169 driver

Wifi


Arch was able to identify the card, but there is no hotspot here to test the connection.

Card reader


The 6910 has a 5-in-1 reader from Ricoh. But I could test only for SD cards.

Firewire


Detected fine,, but no device to test.

Power management


Installing Guidance (pacman -S guidance-power-manager) will allow you to quickly view battery performance and perform suspend or hibernate ( I'm using pm-utils ).
To enable different power modes ( governors ), install cpufreq and follow the Arch Wiki Page on CPUfreq.

A special entry has to be made to mount/unmount NTFS partitions. Put the following in /etc/pm/sleep.d/66ntfs:


#!/bin/bash

MOUNTS="/windows/C /shared"

function 66ntfsmount() {
for i in $MOUNTS
do
mount $i
done
}

function 66ntfsumount() {
for i in $MOUNTS
do
umount $i
done
}

case $1 in
hibernate)
66ntfsumount
;;
suspend)
66ntfsumount
;;

thaw)
66ntfsmount
;;
resume)
66ntfsmount
;;
*)
echo "BAD!"
;;
esac



Now make it executable ( chmod +x /etc/pm/sleep.d/66ntfs ).

Webcam


Not tested yet.

NTFS partitions


I installed ntfsprogs and used the fuse.ntfs system to mount ntfs in userspace as read and write. Here are the additions to /etc/fstab


UUID=... /windows/D fuse.ntfs defaults 0 0
UUID=... /windows/C fuse.ntfs defaults 0 0
UUID=... /shared fuse.ntfs defaults 0 0

NOTE: The arch shutdown scripts kill the fuse ntfs system rather than unmounting the drives. To fix this issue edit /etc/rc.local.shutdown and insert the following:



. /etc/rc.conf
. /etc/rc.d/functions

# Unmount NTFS partitions
stat_busy "Unmounting NTFS partitions"
umount /shared
umount /windows/C
umount /windows/D
stat_done

Bluetooth


Device detected. I could scan for my cell phone, but I've yet to figure out how to exchange files.

Hotkeys


If you use KDE4, go to System Settings -> Regional and Language -> Keyboard Layout. Enable keyboard layouts and change the keyboard model to Hewlett-Packard Pavilion ZT11xx. All the keys EXCEPT Quickplay and DVD work after that. The mute key does not turn red, but it does work. Of course it is your job to actually configure application shortcuts to use the keys.

Remote


The volume keys respond. Other keys should be configured to work with the respective applications using application specific settings.

Sunday, August 17, 2008

Nikhil meet Archlinux and KDE4



I've been home (Mumbai) this weekend and have been hacking away for the last two days to get Arch running on my external HDD, since I can't stand Mandriva anymore. The cool thing about Arch and Pacman is their flexibility. Following this guide I was able to install Arch from within my internal hdd arch, and have all the latest packages (including KDE 4.1).

There was only one problem which wasn't mentioned. External HDDs require usb support in the initrd which is not done in Arch by default. So before rebooting just edit /etc/mkinitcpio.conf and add "usb" to the line HOOKS="base udev …". Then remake the initrd using "mkinitcpio -g /boot/kernel26.img".

I must say I'm pretty impressed with KDE 4.1. There are still a few rough edges like the khotkeys keyboard shortcuts not working and some KWin effects not exactly doing anything. But overall a great effort.