It’s easier to understand endianness by getting your hands on both little-endian and big-endian systems. Little-endian systems are pretty common nowadays: attu or the computer you are using to browse this page is likely to be one. Big-endian computers, though not uncommon (e.g., your game consoles or Mars rovers), require some setup. This hands-on provides instructions on emulating a big-endian system, PowerPC Linux, using qemu.
First, make sure you have qemu installed.
apt-get install qemu
yum install qemu
brew install qemu
Get a pre-built Debian Wheezy PowerPC image. If you are using attu, I have downloaded a copy and you simply need:
ln -s /cse/courses/cse333/15wi/vm/debian_wheezy_powerpc_standard.qcow2
If you are using your own computer, then download it yourself:
Create a snapshot image.
qemu-img create -f qcow2 -b debian_wheezy_powerpc_standard.qcow2 ppc.img
Now start the emulator.
Note that if you’re sshing into attu, add
-nographic to the following command.
qemu-system-ppc -hda ppc.img
Wait for a few minutes (be patient). You should see the login prompt when the system is ready.
Debian GNU/Linux 7 debian-powerpc tty1 debian-powerpc login:
The pre-built image comes with two accounts:
user (password “user”)
root (password “root”). See
If this is the first time, log in with root and install gcc.
apt-get update apt-get install gcc
You may also add “gdb”, “vim”, “emacs”, or other packages you want to install.
See lec 3: malloc & free for endianess example code.
Have fun with endianness!