February 3, 2013 by Daniel P. Clark

My Initial Raspberry Pi Raspbian Configuration

So I ordered the Raspberry Pi Version B for $35.  And boy was I surprised at how really small it is.

So first thing I did was hook it up.  But I can’t run it without an operating system so I downloaded the Raspbian OS 2012-12-16-wheezy-raspbian.zip from http://www.raspberrypi.org/downloads. Unzipped it to get 2012-12-16-wheezy-raspbian.img . And then continued to follow online instructions to install the image to a flash card with ‘sudo dd bs=4M if=/media/daniel/655F-1ECC/2012-12-16-wheezy-raspbian.img of=/dev/mmcblk0‘ .

That did everything as far as installation.  I plugged into my Raspberry Pi and booted up.  Now the first time it ran raspi-config to set some configurations.  Honestly before that while the SDcard was in my other computer I used gparted to expand the image partition from 4GB to 8GB.  But after I booted Raspbian up I found out their configuration program allows to to expand the partition to fit the SD card anyways.

Then of course I wanted to install my preferred applications.  So I installed MPG123, Mplayer, Ruby, and any additional dependencies with ‘sudo apt-get install mpg123 mplayer ruby‘.  And for Ruby I wanted my favorite gems installed Mechanize and Nokogiri.  But I got some compile error for those.  The error won’t tell you, but what you need to install first is libxslt-devel.  ‘sudo apt-get install libxslt-devel‘  Then your Ruby packages will install and build gracefully.

When I tried running my twitter feed client https://github.com/danielpclark/TwitterSeeds I realized I didn’t have the ruby executable path as it’s first line.  So I used ‘pico twitseeds.rb‘ and typed it in.  But then I ran into something interesting.  The # symbol wasn’t coming out right.  I couldn’t get is fixed through raspi-config either.  It turns out that the default image has a British keyboard layout.  So I found a youtube video http://www.youtube.com/watch?v=L1F-TxTPyiM.  Basically you just ‘sudo pico /etc/default/keyboard‘ and then change XKBLAYOUT=’gb’ to XKBLAYOUT=’us’ then reboot.  Now I was able to edit my twitter client and add ‘#!/usr/bin/ruby’ to the first line and my script runs perfectly.

Now for media.  So I hook the analog video and audio up to a HDTV (yes it has no HDMI input :-/).  And I plug in my USB memory stick and it resets.  NOTICE: Plugging in a USB drive will most likely cause a brief power drop and restart the Raspberry Pi.  After my raspberry pi is up I use ‘sudo mkdir /media/usb‘ then ‘sudo mount /dev/sda /media/usb‘.  I type ‘startx‘ and then try to play a video by opening a High Definition MP4 video file from the USB stick.  — If you want to know I’m not using a mouse so I press ALT-F2 and run lxterminal to bring up the terminal and in my USB directory I type ‘mplayer *.mp4‘.  Well, it plays the video, but it’s HORRIBLY SLOW.  And there’s no sound.  BUT WAIT!  I found the solution.

The Raspberry Pi has a GPU on it.  In case you don’t know what that means it’s like a second brain to power amazing visual graphics and not have and slow graphics.  The only thing with that is you need to use software to play the video that is “optimized” for hardware.  So there is one video player available that does that.  It’s known as OMXPlayer.  You want to get the latest build of this as well as run the latest firmware on the Raspberry Pi for it to work.  Getting the latest OMXPlayer is simple.  Goto http://omxplayer.sconde.net/ and follow their instructions.  Note anything optimized for the Raspberry Pi will have armhf in the name/file.  Armhf simple means it’s made for the ARM processor that has a Hard Float.  That is what you want.  This will not work yet, continue reading.

So it turns out that even though the distro I downloaded was the latest “image” it is NOT the latest firmware.  So you need to update it.  The easy way is with rpi-update https://github.com/Hexxeh/rpi-update .  But I was already at my girlfriends house and didn’t have a physical network to plug into and I didn’t bring my wifi USB (which I probably can’t use without a powered hub anyways. ‘I think’).  So I had to update the firmware manually.  To do the upgrade manually put the Raspberry Pi’s SD card back into your other computer.  Download rpi-firmware from https://github.com/Hexxeh/rpi-firmware (click on the ZIP button that has a cloud picture).  Now there are three folders you will be overwriting.  The instructions I found are a little general, they are right… but you need to use your brain and find the (sub)folders that match the naming scheme and layout.  Here are his instructions from https://github.com/Hexxeh/rpi-update/issues/22

To update manually:Download everything from https://github.com/Hexxeh/rpi-firmware (there’s an option to download a zip from the website). Open the  vc folder and copy the contents of ../hardfp/opt/vc/ to /opt/vc/ on your Raspberry Pi and overwrite existing files (actually you should delete everything that’s in it and put the new folder there instead but it isn’t super important).Then copy the  modules  folder to /lib/ on your Raspberry Pi and overwrite existing files (actually you should delete the existing  3.1.9+ folder but it isn’t super important).Everything else you downloaded from the repo should be in /boot/.

Credit to  SamuelDebruyn .
Once you’ve overwritten your vc folder, modules folder, and boot folder it will work BUT you have to make sure you went in and put everything where it belongs.  It’s not hard to figure out.  You just need to dig into the folders until you see it matches what you’re trying to copy.  Then use root to overwrite it (sudo cp -R from-path to-path). NOTE: The boot directory will actually be a different partition on the SDcard and not the boot folder.  “IT WILL HAVE THE SAME FILES”

Then run ‘sudo sync‘ to make sure everything is written.  Remove the SD card and place it in the Raspberry Pi.  And boot it up.  Everything’s good.  And now you can watch full 1080P HighDef video on your Raspberry Pi without any choppiness or lag.  Just continue to use OMXPlayer.

My next project is to write a system daemon to auto-mount a USB drive and shuffle play all the music on there.  This and a rechargeable battery pack with case mount for wearing on your belt.  MP3 Jukebox, cheaper then all those other MP3 players.

Please comment, share, subscribe to my RSS Feed,and follow me on twitter @6ftdan!

God bless!
– Daniel P. Clark

#1080p#HD#howto#linux#optimize#Raspberry Pi#RPI