Monday 17 September 2012

Building a Box for the Pi

Status of my Pi workings so far: 2 Raspberry Pi-B boards (Revision 1), 2 HDMI to DVI dongles, 2 1A power packs on back order, and 2 newly arrived cases – courtesy of an eBay seller in Poland – rrascase. Good service, prompt delivery, and at a nice price.

So, the next obvious step that I can do, is to put together the cases.

Step 1 - Check the Pieces
Pull all the pieces for your Pi case out, lay them on a sheet of white paper.



Step 2 – Remove the Protective Backing
Thanks to rrascase for including this extra instruction in the box. Pick a corner and with thumb or finger nail lift the corner of the protective coat. Repeat the same on the other side of each piece. Here is where the white piece of paper comes into play – if you have not removed one side of the protective coating – the piece will appear blue against the paper. Otherwise the pieces will all appear to be clear.




Step 3 – Connect the Base and Audio-Out Side
Before going any further, I have taken the step of getting my ASD wrist band out - putting the case together does require handling of the Raspberry Pi board.



Lay the pieces out.  You will notice that one of the longer side pieces has two round holes – this is the side for the composite video and audio ports. 



Connect this to one of the larger pieces, via the tongues and grooves. There is no difference between the top and bottom pieces of the case – but there is a right and wrong way that they will go. When you piece your bottom/top and long side pieces together, the top or bottom should not obstruct the tongue-catches that the shorter sides should slot onto.



Step 4 – Place the Board into Position
Simple, holding the bottom and audio side together, place the board on top of the bottom panel so that the audio and composite ports fit into their holes.



Step 5 – Connect the HDMI-out Side
Holding everything in one hand, bring the second long side into play, lining up the near-centred hole for the HDMI-out port.



Step 6 – Slot the Top Into Place
Pick up the remaining large piece, which will be the top. As you go to place its tongues in to the grooves on the longer sides, as with the bottom piece, make sure that it is not going to obstruct the placement of either short side. With my initial attempt, I did not do this, and I ended up with a top piece that was out-of-place by about two millimetres – with a gap to one of the ends, and unable to put the second end panel into place.



Step 7 – Hook the First End
Take the end piece that has the ports for the USB and NIC cut out. Align it with the ports on the board, and slip it over the top tongue-catches from the long-sides. Press the bottom firmly in, until the bottom holes click in over their tongue-catches.



Step 8 – Hook the Power End
This end might be the easiest to get wrong. Neither the SD card slot, nor the micro-USB power socket protrude from the side of the board, so it would be easy to get this piece the wrong way around. Make sure that you align the hoel for the power socket with the power socket, and then hook the piece into place over the top tongue-catches, then firmly press into place over the bottom ones.



All done!

Thursday 13 September 2012

The Light Comes On

Listening to Australian Futurist, Peter Ellyard, talk. I now see what might be an awesome application for the Raspberry Pi. A secure, inexpensive, terminal for a secure remote system to support free elections in emerging and developing democracies. Perhaps that is just the wine and food talking, but for now, it seems like it is something that is needed.

Monday 10 September 2012

Glad to See I'm Not Alone

Found a good article on makeuseof.com - appears Christian Crawley has been contemplating some of the same fundamental questions about the Pi that I have.

From a purely geek point of view, I see that there are many applications for the Raspberry Pi that I'd love to do tomorrow - like pairing it with some Arduino kit and building some robotics.  Setting up a dedicated games box or media centre for the lounge room is also appealing.

However, as a small business owner, I'm wondering if those applications are the most marketable.  Particularly as a small business owner in a region outside of a metropolitan area, I wonder if the better uses would be something along the lines of - setting up a mobile instruction lab for computing courses?  Creating a networkable/remotely contactable security or surveillance system?

Given the tyranny of distance, response times for police and or private security contractors is never going to be great.  Such tools could be useful in allowing the owner of a property to respond more quickly, or to at least capture video evidence for later use.  If paired with a weather station on a property it could allow a farmer or grazier to monitor conditions at a dam, keep close watch over livestock at vulnerable times.  Could also be used in conjunction with GPS and RFID trackers to monitor the movements of livestock or the movement of protected species of native animals.

Of course, in many of these applications and roles that I am thinking about using the Raspberry Pi for, there are already competing products.  Question is, can the Raspberry Pi out-compete the incumbent tools either in performance, portability, or price?

Tuesday 4 September 2012

Still at the Hurdle

Good News:  The HDMI to DVI adapters arrived.  Still waiting on the power supplies.

Tried the virtualisation of the Pi again - but with mixed results.  I managed to get 2 steps further before hitting problems.  I'll outline what I did this time to get that far:

I cleaned out my working directory.  Then from the root ran 'sudo chmod -R 777 /qworking/' to give full permissions on the working directory. Also run 'sudo apt-get install libsdl-dev' and 'sudo apt-get install patch', prior to commencing.

Get QEMU: Download at the command prompt from wget http://wiki.qemu.org/download/qemu-1.2.0-rc2.tar.bz2 into the working directory.

Unpack QEMU:  Use 'tar -xvf qemu-1.2.0-rc2.tar.bz2'

Configure and Install QEMU: 'cd qemu-1.2.0-rc2', then run './configure –target-list=arm-softmmu,arm-linux-user'.  Next run 'make', then 'sudo make install'.  QEMU should now be installed

Download and Set-up Wheezy: Make a folder for Wheezy - run 'mkdir /qworking/wheezy/' then 'cd /qworking/wheezy/'.  Next from RaspberryPi.org download the 'Wheezy' image.  Then 'unzip 2012-08-16-wheezy-raspbian.zip'.

Find the rootfs in the Image: Run 'file 2012-08-16-wheezy-raspbian.img'.  Got the following as output - we want the startsector and number of sectors values from partition 2:

> 2012-08-16-wheezy-raspbian.img: x86 boot sector; partition 1: ID=0xc, starthead 130, startsector 8192, 114688 sectors; partition 2: ID=0x83, starthead 165, startsector 122880, 3665920 sectors, code offset 0xb8

'cd..' then, 'dd if=wheezy/2012-08-16-wheezy-rasbian.img of=rootfs_debian_rpi.ext4 skip=122880 count=3665920'

Set-up the Kernel - 1: 'mkdir /qworking/kernel/', then, 'cd kernel/'.

Set-up the Kernel - 2: Get the Sourcery Lite version from http://bit.ly/IHvEMv then, 'tar -xvf arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2' to unpack it.

Set-up the Kernel - 3: Download the Kernel - 'wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.9.tar.bz2'

Set-up the Kernel - 4: Patch the Kernel - Grab the patch from 'wget http://thoronir.net/raspi-dev/linux-arm.patch'.  Then run 'patch -p1 -d linux-3.1.9/ < linux-arm.patch'.  Resulting output should indicate a couple of files were patched.
Configure the Kernel - 1: 'cd /qworking/kernel/linux-3.1.9/', then run the following commands; 'make ARCH=arm versatile defconfig', and when that is successful, 'make ARCH=arm menuconfig'.  This should bring you to the BIOS-like setup screen for the kernel configuration.

Configure the Kernel - 2: Select General Setup > Cross compiler tool prefix.  If you have downloaded the correct version of Sorcery Lite, you should be able to use the value '/qworking/kernel/arm-2011.03/bin/arm-none-eabi-'.  A good way to confirm is to check if the '/qworking/kernel/arm-2011.03/bin/' path is a valid one on your machine.

Configure the Kernel - 3:  Set the following values (all paths are relative to the root menu):
System Type > Support ARM V6 Processor - Activate
System Type > ARM errata: Invalidation of the Instruction Cache operation can fail - Activate
Kernel Features > Use ARM EABI to compile the Kernel - Activate
Bus Support > PCI Support - Activate
Device Drivers > SCSI Device Support > SCSI Device Support - Activate
Device Drivers > SCSI Device Support > SCSI CDROM Support - Activate
Device Drivers > SCSI Device Support > SCSI low-level drivers - Activate
Device Drivers > SCSI Device Support > SCSI low-level drivers > SYM53C8XX Version 2 SCSI Support - Activate
Device Drivers > Generic Driver Options > Maintain a devtmpfs filesystem to mount at /dev - Activate
Device Drivers > Generic Driver Options > Automount devtmpfs at /dev after the kernel mounted the root - Activate
File Systems > The Extended 4(ext4) filesystem - Activate
File Systems > Pseudo filesystems > Virtual memory file system support (former shm fs) - Activate
Device Drivers > Input device support > Event Interface - Activate
Exit and Save Changes

Compile the Kernel:  Run 'make ARCH=arm'.

Use the Kernel Image: Move back to the working directory, 'cd /qworking/', and copy in the kernel image, renaming it at the same time: 'cp kernel/linux-3.1.9/arch/arm/boot/zImage zImage_3.1.9'.


All worked well to this point.  Then I've attempted the first boot of the image in QEMU, with the command: 'qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -hda rootfs_debian_rpi.ext4 -kernel zImage_3.1.9 -append "root=/dev/sda" -serial stdio -redir tcp:2222::22'.

At the command prompt the following was in the output:
oss: Failed to open /dev/dsp
oss: Reason: No such file or directory

In the QEMU window:
VFS: Cannot open root device “sda” or unknown-block(2,0)
Please append a correct “root=” boot option

Not sure whats going on.  Search through several forums, nothing helpful.  Checked - and yes sda is a mount point on my machine.  Possibly I need a dedicated partition on my local drive in which to get this running?  The machine I am on is using grub to boot load either Ubuntu 11.10 or Kubuntu 12.04.  So, I think I'll start by re-building the machine with some spare partitions, and only one OS.

Monday 3 September 2012

Charging Forward and Into the Next Hurdle

Today I started upon trying to virtualise a Raspberry Pi system.

Why would I do that?  Let us recap on where my adventures have lead so far.  I have purchased 2 Raspberry Pi B boards from Element14, plus the necessary HDMI-DVI adapters and power supplies.  Today, the boards arrived.  Woohoo!  Alas the other components are on back-order.  Today I also found a supplier in Poland selling boxes for the boards on eBay - so I bought 2 boxes at just under $26 AUD including postage.  I also have a spare wireless keyboard and mouse with USB dongle ready to go, and the other day I procured 4 x 8GB Class 10 SD memory cards.  Interesting note is that today I found our local supplier - Think Technology - can supply the 8GB Class 10 cards for $15 AUD - awesome.  Note that these are blank SD cards - not cards with a pre-install of Raspbian.

So, whilst I am still in-progress for setting up to develop with the Raspberry Pis, I am not ready yet - hence why I want to create virtual instances - so I can start practicing sooner.

So, this afternoon I started to apply the instructions from Rob Zwetsloot's article, "Virtualise Raspberry Pi" in Issue 14 of Linux User & Developer.  The article and the instructions within are well written and easy to follow.  The problem, as I've found with a number of Linux publishings is that with the speed that the Open Source community runs through change, the changes naturally obfuscate the value of the instructions.  So far, I have not quite hit success.

I'll paraphrase Rob Zwetsloot's instructions to detail where I got to, and where things went differently.  Please note that for the working directory that Rob refers to in his instructions, I created:

'mkdir /qworking/'

The machine I ran this on is a Kubuntu 12.04, 64b installation.

I also ran most of the instructions with 'sudo' at the beginning, to allow for the fact that I did not have full permissions on the working directory.

  1. Download QEMU.  Easy.  At the time of the article, it appears that QEMU 1.0 was the stable version.  QEMU is now up to 1.2, so a small change.
  2. Prepare to compile.  Again, easy.  Went pretty much as per instructions.
  3. Compile QEMU.  Again a smooth operation.
  4. Debian Preparation.  As Rob notes, at the time of his article, the official release of Debian was debian6-19-04-2012, and it was available on the Raspberry Pi website.  Unfortunately on the day of this post, the only download options that I had was for Raspbian "wheezy", Soft-float Debian "wheezy", Arch Linux ARM or QtonPi.  All of these images are pre-rolled for the SD card, where as Rob's article takes more of a Roll your own approach.  Having never compiled a kernel before, I wanted to take Rob's approach. I searched the Debian site for a link to the release Rob mentioned - but could not find it.  So, I decided to try it with the Raspbian "wheezy" image.
  5. Find the rootfs.  This step while differing from that which Rob described, was easy.  I unpacked the wheezy image, the ran 'file 2012-08-16-wheezy-raspbian/2012-08-16-wheezy-raspbian.img', and got the second partition's details.  All good.
  6. Extract the rootfs.  Again, this step went smoothly when adjusted for the difference in the image name.
  7. Starting with the Kernel. Ran 'mkdir /qworking/kernel', no problems.  Attempted to download Soucery Lite from the link Rob gave - 'http://bit.ly/lHvEMv' - or at least I read that to be the link at the time.  That link failed.  But as I write this blog, I've decided to try 'http://bit.ly/IHvEMv' (Upper case 'i' in front of the H - not lower case 'L') - and that works.  At the time I was confused and searched around.  I found the site for Sourcery Tools at Mentor Graphics.  From there I found the closest download that I could to what Rob had specified - Sourcery CodeBench Lite 2012.03-56 for ARM EABI - IA32 GNU/Linux TAR package.
  8. Grab the Kernel.  Downloaded the Linux 3.1.9 kernel - no issues.
  9. Patch up the Kernel.  Downloaded the patch OK.  Went to apply it as per the instructions - found that my Kubuntu was missing the patch directive.  Easily fixed with 'sudo apt-get install patch'.  Then the patching processed worked.
  10. Kernel Configure.  Again, worked as per the instructions
  11. Kernel Settings - part 1.  Here I gave the following path for the toolchain, as per Rob's instructions, '/qworking/kernel/arm-2011.03/bin/arm-none-eabi-'.
  12. Kernel Settings - part 2
  13. Kernel Settings - part 3
  14. Kernel Settings - part 4.  All these steps worked fine - really they are the one step as there is no confirming output in between.
  15. Compile the Kernel.  Doing the last of the kernel settings and then the initial compile.  During the make step, 'sudo make ARCH=arm', I've hit an error 127, as the toolchain was not found.
  16. Using the Kernel.  In this step, Rob describes using the zImage.  Can't find it.  I guess since step 15 failed, there is no zImage.

So where to go now?  I suspect one of two things.  From step 4, perhaps the "wheezy" image requires a different toolchain to be specified in step 11.  Or, I need to use the correct version of Sourcery Lite (arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2) in step 7.

In my next post, I hope to be able to give some guidance on what has worked for me.

Sunday 2 September 2012

Good Things Come in Small Packages

Just received my Raspberry Pis this morning.  Thank you Element14.  They're even smaller that I imagined.  This is so cool!.

Unfortunately, the power supplies and HDMI-> DVI video converters are on back order, so I won't be plugging them in immediately.  Fortunately I can still get into it so to speak.  Issue 14 of Linux User & Developer has an article "Virtualise Raspberry Pi" by Rob Zwetsloot.  I think I'll be trying that out.

Setting up to Blog

When you are happily blogging away about your favourite band, or soccer team, you can pretty much say what you want.  Criticise Beckham until the cows come home, or praise Black Sabbath for their seminal works.

As a professional, publishing your own work, for the benefit of your industry, there are times where you do need to consult with others first.  Particularly where intellectual property rights are concerned.

Many of you may notice that the logo for this blog is in some ways similar to that of the Raspberry Pi Foundation.  It however has several standout differences.  Even then I did not assume that I could roll ahead and use it.  I did contact the good people at Raspberry Pi Foundation and consult with them first to seek their agreement that my logo was different enough from theirs, and that I was able to use it.

Passion, Creativity and Opportunity

I have a passion for conceptualising systems, I have a yearning to be creative, and Raspberry Pi is my opportunity!

Welcome to my new blog, which I am dedicating to my adventures in the world of Raspberry Pi.

For the last four months I've been reading articles about these new fan-dangled Raspberry Pi devices.  Wow! At first, they looked cool.  I wanted one.  Then a work colleague revealed that he had ordered some, but was waiting due to supply issues.  As the weeks went by I saw more articles, and I could feel this great potential around the devices.  As a professional software engineer, I was in awe of what this device would do the PC and the IT world in general.  I had to have one.  I had to make it mine!

The possibilities for this device are phenomenal.  You could see it fitting into the hands of a surgeon in your local A&E (that's the ER for anyone in the US).  It has educational possibilities.  You might see one in the hands of a farmer or grazier.  You might even end up seeing them strapped to the forearms of troops on the battlefield.

But humanity has already developed many devices that fit into these areas.  For example, one idea I had was for a touch-screen unit that could be used for exhibitions and displays in galleries and museums - then my wife alerted me to the fact that many institutions are already using mobile-phone sized units.  So here-in is my first and foremost challenge for this project - I can either aim to 'remake the wheel', in which case I need to make it better than it has ever been made before - or, I can try to find that leap ahead and create something that hasn't been done before.  There will be plenty of other challenges, but this will be the keystone.

Obviously, this is not a challenge that I am immediately going to overcome.  Part of determining what will come will be the journey of learning this new device and its capabilities.  So my project has a direction, but no definite destination.  Hence the name of this blog refers to the laid-back approach to life of a Rastafarian.

So, with this in mind, last Wednesday I lodged my order with the good people at Element14 for 2 Raspberry Pis.  I can't wait to get hold of them!