-
Notifications
You must be signed in to change notification settings - Fork 247
WIP ONHOLD: Manually setup MediacenterJS on RaspberryPi with clean raspbian distro
Status: need to find a good browser running on FB!
These are the commands you need to use to build nodejs and all other dependencies on a clean Raspbian distro (http://www.raspberrypi.org/downloads) and set it up to boot in kiosk mode.
This is a fairly time consuming task as compiling takes a while on the Raspberry Pi.
This manual is based on the following sources:
http://blogs.wcode.org/2013/09/howto-boot-your-raspberry-pi-into-a-fullscreen-browser-kiosk/ and https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager and https://trac.ffmpeg.org/wiki/How%20to%20compile%20FFmpeg%20for%20Raspberry%20Pi%20(Raspbian) and http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/
Step1: Install dependencies
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install matchbox luakit x11-xserver-utils ttf-mscorefonts-installer xwit sqlite3 libnss3 git subversion texinfo python g++ make checkinstall upstart
Step2: Install NodeJS
mkdir ~/src && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v* #(remove the "v" in front of the version number in the dialog)
./configure
sudo checkinstall
Choose option: 3 (version)
Change the version to the version without the 'v'. Eg: 0.10.24 NOT v0.10.24
Step3: Download/install MediacenterJS
cd /home/pi/
git clone https://github.com/jansmolders86/mediacenterjs
cd mediacenterjs
npm install
Step4: Autostart node application on startup
add the following file /etc/init/mediacenterjs.conf
an copy the following script:
start on started mountall
stop on shutdown
respawn
respawn limit 99 5
script
export HOME="/root"
exec node /home/pi/mediacenterjs/server.js >> /var/log/node.log 2>&1
end script
post-start script
# Optionally put a script here that will notifiy you node has (re)started
# /root/bin/hoptoad.sh "node.js has started!"
end script
Step5: Set resolution
First we need to get the list of what’s supported by your monitor:
tvservice -d edid
edidparser edid
Find the mode that you want in the resulting list (for me it was “HDMI:EDID DMT mode 34) 1920x1080p @ 60 Hz
Then edit the config file:
nano /boot/config.txt
Find the section about HDMI, uncomment it and set the right group and mode from step 2. If your mode description contains “DMT”, the group should be 2, and if it contains “CEA”, it should be 1, so for me that was: First set the framebuffer up by adding this to /boot/config.txt:
# 1900x1080 at 32bit depth, DMT mode
disable_overscan=1
framebuffer_width=1900
framebuffer_height=1200
framebuffer_depth=32
framebuffer_ignore_alpha=1
hdmi_pixel_encoding=1
hdmi_group=2
hdmi_mode=34
Step6: Autostart kiosk luakit
Go to:
/etc/xdg/luakit
edit:
sudo nano window.lua
go to the function window.new and scroll down to you get to 'return w'. just above the return, type:
w.win.fullscreen = true
Then edit:
sudo nano globals.lua
Set the homepage to 'http://localhost:3000'
adjust the resolution if you want as well
Then edit /etc/xdg/lxsession/LXDE/autostart
and comment # evything in the file and add these lines:
@xset s off
@xset -dpms
@xset s noblank
@luakit`
Step7: Install FFMpeg
Building the crosstool-ng
wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.19.0.tar.bz2
tar xjf crosstool-ng-1.19.0.tar.bz2
cd crosstool-ng-1.19.0
./configure --prefix=/opt/cross
make
sudo make install
export PATH=$PATH:/opt/cross/bin
mkdir /home/pi/ctng
cd /home/pi/ctng
ct-ng menuconfig`
The menu should show up and you should set up things as instructed by the following walkthrough (checkboxes are selected using the SPACEBAR key and text fields can be edited pressing the ENTER/RETURN key on your keyboard, once you select it with your cursor keys):
* Paths and misc options
(Important) Enable "Try features marked as EXPERIMENTAL"
(Optional) Change "Prefix directory" (for example, you can put "/opt/cross/x-tools/${CT_TARGET}" there)
* Target options
(Important) Change "Target architecture" to "arm"
(Important) Leave "Endianness" set to "Little endian"
(Important) Leave "Bitness" set to "32-bit"
* Toolchain options
(Nothing to do here, the defaults are fine)
* Operating system
(Important) Change "Target OS" to "linux"
* Binary utilities
(Optional) Change "binutils version" to "2.21.1a" or whichever is the latest that isn't marked asexperimental
* C compiler
(Optional) Enable "Show Linaro versions (EXPERIMENTAL)". In the "gcc version" field, choose the "linaro-4.6-2012.04 (EXPERIMENTAL) compiler". You're free to choose a different one but this one works well. We do recommend the Linaro versions over the vanilla ones for the RPi
(Optional) Enable "C++" under the group "*** Additional supported languages: ***" if you need g++ tool also built for your RPi toolchain`
Now, exit the configuration tool, save your changes and run:
ct-ng build
This will take some time and when it finishes, you should have an ARM compiler, in the "Prefix directory" that you chose above - "/opt/cross/x-tools/${CT_TARGET}", ready to build anything for your RPi. One final step is to add that directory to your PATH:
export PATH=$PATH:/opt/cross/x-tools/arm-unknown-linux-gnueabi/bin
It also might help to export one more important environment variable CCPREFIX: export CCPREFIX="/opt/cross/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-"
Compiling libx264
cd /my/path/where/i/keep/my/source/code
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --cross-prefix=${CCPREFIX} -- prefix=/my/path/were/i/keep/built/arm/stuff --extra-cflags='-march=armv6' --extra-ldflags='-march=armv6'
make
make install
Install FFMPEG
cd /my/path/where/i/keep/my/source/code
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-cross-compile --cross-prefix=${CCPREFIX} --arch=armel --target-os=linux -- prefix=/my/path/were/i/keep/built/arm/stuff --enable-gpl --enable-libx264 --enable-nonfree --extra-cflags="- I/my/path/were/i/keep/built/arm/stuff/include" --extra-ldflags="-L/my/path/were/i/keep/built/arm/stuff/lib" --extra-libs=-ldl
make
make install