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.