BuildingEnvironment

Version 13, last updated by kawasaki at over 16 years

This page explains how to build up environment to develop QEMU SH4 System Emulation. These works are done 2008 March, on Ubuntu Edgy.

QEMU

Get qemu-sh source code and build it. First, get qemu subversion newest head. % svn co svn://svn.savannah.nongnu.org/qemu/trunk % ls trunk Second, get qemu-sh patches. % git clone git://git.kernel.org/pub/scm/virt/qemu/lethal/qemu-sh.git % ls qemu-sh Following operations are explained in qemu-sh/README. % cd trunk % QUILT_PATCHES=../qemu-sh quilt push -a Build qemu. % ./configure --target-list=sh4-softmmu % make % ./sh4-softmmu/qemu-system-sh4

I recommend to specify --target-list option to reduce build time.

Linux Kernel and Userland

For quick start, you can get built kernel and configuration.

Build Linux Kernel for SH according to LinuxSH Wiki.

First of all, obtain the toolchain fro SH4.

    % mkdir /opt/gnush4
    % cd /opt/gnush4
    % wget http://userweb.kernel.org/~lethal/toolchains/gnush4_linux_v0702_rc-1-1.i386.tar.gz
    % tar zxvf gnush4_linux_v0702_rc-1-1.i386.tar.gz

Then obtain kernel source. I followed git-howto. Git-clone takes a long time.

    % git-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6
    % cd linux-2.6
    % git pull git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 

Configure and build kernel. R2D+ is the appropriate target hardware emulated by QEMU.

    % make ARCH=sh rts7751r2dplus_defconfig
    % make ARCH=sh CROSS_COMPILE=/opt/gnush4/usr/share/gnush4_linux_v0702_rc-1/bin/sh4-linux- menuconfig
    % make ARCH=sh CROSS_COMPILE=/opt/gnush4/usr/share/gnush4_linux_v0702_rc-1/bin/sh4-linux- zImage

Userland disk image is available from one of following two.

   http://jlime.com/downloads/development/qemu/disk_small.img
   http://aleksoft.net/sh/disk_small.img

Get it.

   % wget http://jlime.com/downloads/development/qemu/disk_small.img

How to invoke QEMU

The command I use is like this.

     % ./qemu/sh4-softmmu/qemu-system-sh4 -M r2d -serial vc -serial stdio -m 1024M -kernel ./linux-2.6/arch/sh/boot/zImage -usb -usbdevice keyboard -hda disk_small.img

The vc serial console shows QEMU monitor, which is easy to quit QEMU cleanly with 'q' command. The '-m' option seems necessary to avoid memory shortage for initramfs. The '-usb' and '-usbdevice keyboard' options provides key input feature.

Then the kernel stats booting and graphics console will appear. The system is not so stable. Sometimes segmentation fault occurs.

Recent Versions

Choose two versions to compare, or click the link to view it.

Clear All

History Key

  • New Content
  • Removed content