Additional Raspberry Pi VM Information
I was informed yesterday that there seems to be a problem following my VM setup instructions when using Ubuntu 11.10. I spent about 5 hours and 3 Ubuntu 11.10 installs checking this and it certainly seems to be the case that without an awful lot of fiddiling and complications that are just not worth the bother. So for the time being the recommended guest os's for building your own VM are Ubuntu 10.04LTS, Fedora16 or Debian (I haven't built the VM on Debian for a long time so i'm not sure exactly which version to recommend but I can't imagine that Debian will be much of a problem with any recent versions. If anyone has a problem with Debian please let me know.)
Once again if you are using my instructions to build the Raspberry Pi development VM (or a VM for any development using Scratchbox2 and/or qemu) i'd recommend (in no particular order) currently using
- Ubuntu 10.04LTS
- Fedora
- Debian
Now a tip when porting x86 code to ARM using gcc. If you get a lot of warnings when trying to build software originally written in C for x86 for ARM especially things like "comparison is always true/false due to limited range of data type" the chances are that you aree being bitten by the fact that x86 compilers usually default to signed chars if not specified by the variable declaration while ARM compilers usually default to unsigned chars. If you are using gcc (which you are if you are using my VM or your own installation of Scratchbox2 then the fix is to use the
-fsigned-char
gcc option. e.g.
gcc hello.c -o hello -fsigned-char
Another thing that might prove useful when you have access to the real Raspberry Pi hardware and the standardized distro is that by default the codesourcery toolchain included in the VM by default builds for generic ARMv5. On the whole this really shouldn't matter as ARMv6 can run ARMv5 instructions but there maybe times when you are doing something that needs to use an ARMv6 specific instruction or you are including assembler in the C code or something else where a generic ARM version binary just won't cut it. In that case using the gcc option
-mcpu=arm1176jzf-s
which specifies that gcc emits the correct instructions for the specific ARM core that the Raspberry Pi uses might be helpful.
e.g.
gcc -mcpu=arm1176jzf-s hello.c -o hello
Setting up a VM for Raspberry Pi development using Virtualbox, Scratchbox2 & qemu (Part 2)
If you decided to use a Debian or Ubuntu based distro then when you booted the Raspberry Pi Development VM that you just created you will have probably noticed an error message flash on the screen saying
piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr
and you'll want to fix that before doing anything else. The Fedora16 VM doesn't produce this error so Fedora users can skip straight to the guest addition installation instructions. I wrote a short post about this error last year but to save you having to go there to read that post the fix [Credit for that fix goes to http://finster.co.uk & Karl Foley] is:
- Start a terminal
- sudo vi /etc/modprobe.d/blacklist.conf
- Add the line blacklist i2c_piix4 to the end of the file and save
- sudo update-initramfs -u -k all
- sudo reboot
Setting up a VM for Raspberry Pi development using Virtualbox, Scratchbox2 & qemu (Part 1)
Last week I released version 0.2 of the Raspberry Pi development VM and I thought that I could safely call it a day because in a few weeks the Raspberry Pi hardware will be available and therefore we will no longer need the VM for software development. So yesterday I announced on this blog and the Raspberry Pi forums that I had decided to EOL the VM and would no longer be updating it as I didn't see the need and i'm not going to have the time to maintain it for the next few months as it takes about 12 to 14 hours to create, configure and upload, 8 to 10 hours of that is uploading using all my upstream bandwidth which is no longer feasible for me to do again until after June.
However, almost immediately after posting that I started to receive tweets and PM's asking me not to stop working on the VM or to at least write detailed instructions on how to create your own VM for Raspberry Pi (or other ARM based devices) from scratch. Yesterday I also finally managed to get SDL programs working correctly, not that I had actually tried that hard previously as the majority of software I was personally interested in building and porting to the Raspberry Pi are text based and at most use ncurses. So although I really won't have time to work on upgrading, tweaking and maintaining the VM personally I have decided that it should continue to live in the form of detailed instructions on how to create your own Raspberry Pi development VM, which is almost mostly transferable to other ARM based devices as well, it's actually pretty much transferable to any device that qemu will emulate but that is beyond the scope of this how-to.
Virtualbox and upgrade bios or force_addr error
I've been using Virtualbox for several years now and one thing that always annoyed me when using a ubuntu or debian based guest OS was the
piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr
error when booting. It didn't annoy me enough to actually do anything about it as it didn't seem to cause any problems when running the guest OS but it was there whenever i rebooted the VM. However as I am now making a few VM's for other people I wanted to squash any bugs and uglyness when using one of my VM's and this morning while looking to fix another annoyance I stumbled across Karl Foley's blog which had a solution for the upgrade bios boot error. It's a quick and simple solution and i'm not sure why I didn't think of it myself but I was probably wasn't motivated enough to actually bother or actually thinking about it properly.
The relevant blog post is http://cs.thefoleyhouse.co.uk/blogs/karl/archive/2011/02/19/ubuntu-boot-error-in-virtualbox-piix4-smbus-0000-00-07-0-smbus-base-address-uninitialized-upgrade-bios-or-use-force-addr-0xaddr.aspx
Virtualbox VM for RaspberryPi development
[update: this vm is obsolete. please use the one in the follow post http://russelldavis.org/2012/01/20/new-raspberry-pi-development-vm-v0-2/ ] I am currently in the process of uploading a have uploaded created virtual machine running debian with lxde in which I have installed and configured scratchbox2, qemu and the codesourcery toolchain so that it is possible to build software for the RaspberryPi (although noone actually has one other than the lucky few developers that have access to a alphaboard).
The vm file will be is available from about (it's about 1.3GB so is about 7 hours from completing the upload)  11pm 10/09/11 (uk date format) at http://russelldavis.org/RaspberryPi/RaspberryPi.zip and as a torrent (created by #raspberrypi user obarthelemy)
http://thepiratebay.org/torrent/6667294
http://www.demonoid.me/files/details/2726361/
Although this virtual machine is meant to be used for developing for the RaspberryPi it should be usable for any ARM based device especially if you have a rootfs from the device that you can use to seed the scratchbox2 environment (see http://russelldavis.org/2010/10/20/setting-up-scratchbox2-to-build-software-for-zubuntu/ &Â http://russelldavis.org/2010/11/03/mounting-a-raw-disk-image/ &Â http://russelldavis.org/2011/09/07/setting-up-scratchbox2-from-scratch-for-the-raspberry-pi/ ).
I did forget a couple of important things in the included README. I have installed apache2 and symbolic linked $HOME/raspberrypi-development/build into /var/www and you should build everything in (or under) the $HOME/raspberrypi-development/build directory.