I wanted big-endian emulation on my little-endian Intel machine to test a program for byte order related issues. QEMU PowerPC emulator seemed like a good solution. I have documented the steps to set it up below.
1) Installed QEMU.
nifty:~# aptitude update && aptitude install qemu
2) Downloaded Mac-on-Linux from http://sourceforge.net/projects/mac-on-linux/files/ and copied the 'video.x' file in the download to '/usr/share/qemu'. This was necessary to prevent qemu-system-ppc from complaining about it.
nifty:~# tar -xjf mol-0.9.72.1.tar.bz2
nifty:~# cp mol-0.9.72.1/mollib/drivers/video.x /usr/share/qemu
3) Downloaded Debian for PowerPC and installed it on a QEMU hard disk image.
susam@nifty:~/qemu$ wget --no-verbose http://cdimage.debian.org/debian-cd/5.0.4/powerpc/iso-cd/debian-504-powerpc-CD-1.iso
2010-06-19 02:55:06 URL:http://caesar.acc.umu.se/debian-cd/5.0.4/powerpc/iso-cd/debian-504-powerpc-CD-1.iso[675569664/675569664] -> "debian-504-powerpc-CD-1.iso" [1]
susam@nifty:~/qemu$ qemu-img create powerpc.img 2G
Formatting 'powerpc.img', fmt=raw size=2147483648
susam@nifty:~/qemu$ qemu-system-ppc -hda powerpc.img -cdrom debian-504-powerpc-CD-1.iso -boot d -m 512
4) Booted the QEMU PowerPC emulator with the hard disk image.
susam@nifty:~/qemu$ qemu-system-ppc -hda powerpc.img -m 512
5) Verified that I was really on a big endian system by writing a simple C program.
susam@lilliput:~$ cat endian.c
#include <stdio.h>
int main()
{
int n = 0x1;
printf(*((char *) &n) ? "little-endian\n" : "big-endian\n");
return 0;
}
susam@lilliput:~$ gcc endian.c && ./a.out
big-endian
susam@lilliput:~$
In case you missed the pun, Lilliputians were originally big-endians.