Skip to main content

z2buntu Compiling Environment

The z2buntu rootfs contains working compiling tools, but the Zipit doesn't really have the processing power to compile programs in a reasonable amount of time. This is a good use for QEMU. QEMU can run the z2buntu rootfs as a virtual machine faster than the Zipit can run natively. I run Ubuntu Linux on my home desktop so this guide needs to be tweaked for whatever OS you run.

First you need a rootfs. you can download my z2buntu rootfs or create your own using this guide (make sure to use the jaunty distro). If you use the z2buntu rootfs, I would recommend increasing the size of the partition so that you have enough room to install the required packages and source codes you'll be compiling. To do this, write the image to an SD card (change the img filename and the device to suit your needs):

sudo dd if=/path/to/your-rootfs-filename.img of=/dev/YOURDEVICE

Using gparted, increase the partition size to your liking. Then, create a new image file:

sudo dd if=/dev/YOURDEVICE of=/path/to/your-new-z2buntu-qemu.img

You will need to install qemu to run the virtual machine. For Ubuntu it's as easy as
sudo apt-get install qemu-kvm qemu-kvm-extras

The last thing you need to get is a kernel for the emulator. Ubuntu provides a kernel at http://ports.ubuntu.com/dists/jaunty/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.28-11-versatile.

Now it's time to start the emulator. Here's a minimal command line startup with 256M RAM and networking:
qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.28-11-versatile -m 256 -hda z2buntu-qemu.img -append "root=/dev/sda1 rw" -net nic,vlan=0 -net user,vlan=0

For networking in the VM to work everytime at startup, edit /etc/network/interfaces and add:
auto eth0
iface eth0 inet dhcp

Now on to the fun stuff. You can install ssh and apache into the image, then setup port redirection. This allows you to forward, let say, port 2222 on your host computer to port 22 inside the VM. If you ssh to port 2222 on your host computer, it redirects you into the VM. I also redirect host port 8080 to 80 inside the VM allowing me to download directly. Redirection works by adding this to your qemu command line:
-redir tcp:2222::22 -redir tcp:8080::80

So, I can now ssh into my Zipit emulator from anywhere in the world, compile a program, compress it/create a deb, and put it up for download all inside the VM. Pretty amazing.

how to connect using ssh

hi,

i've setup the environment and the VM works, but i cannot connect with ssh.

when i run 'ssh -p 2222 localhost' i get something like 'connection refused by host'.

hat means i get a connection but the VM doesn't allow it.

what command du you use?

gimmebottles

SSH Port

I neglected to mention that you should change the port in the virtual machine to use 2222 by editing /etc/ssh/sshd_config. Also, if you're running a firewall on the host or are trying to connect from outside a firewall, open/forward port 2222 on/to the host machine.

ok, i've done what you said

ok, i've done what you said but now i get this:

'ssh_exchange_identification: Connection closed by remote host'

do i have to type any password or something like this?

gimmebottles

SSH User

When you login to the VM you need to change your username. In your previous comment your ssh line looked like this:
ssh -p 2222 localhost

Try this instead:
ssh -p 2222 user@localhost
Replace 'user' with whatever username you use (the default in z2buntu is "user" with the password "ubuntu").

If that doesn't work, check out this post which has some other things to try: http://www.linuxquestions.org/questions/linux-networking-3/cant-ssh-to-r...

kernel

Any chance your post your kernel source for 2.6.35-rc3 or the patch's maybe the .config? Is sound working on your build? Doesn't appear to be any modules for it, but alsamixer shows it. Just can't access /dev/audio or /dev/dsp.

RE: kernel

You can download my config file here. I believe the latest source can be had here. Sound works for me, but I haven't done much with it. I installed cmus, mpg123, quake which all work.I have not tested headphone or mic jack. I must have built the drivers into the kernel and not as modules.

Alternate compilers

I don't know if space is an issue or if it would make a difference but I ran across a Tiny C Compiler (http://bellard.org/tcc/) that if it is truly as tiny as it claims might be a reasonable addition to a Zipit userland. Wasn't sure if you just had GCC loaded on the flash card or not.
Alex.

What works better is just

What works better is just extract the image, but bash-static in /bin and qemu-arm-static in /usr/bin and do chroot into extracted fs, much better performance then full emulator.

sudo apt-get install qemu-arm-static
sudo apt-get install bash-static
sudo cp `which qemu-arm-static` /path/to/fs/bin
sudo cp `which bash-static` /path/to/fs/usr/bin
sudo chroot /path/to/fs