QEMU に Armadillo-800 EVA を追加してみた
アットマークテクノさんの新しいArmadilloである Armadillo-800 EVAのエミュレーションを QEMU に追加してみました。
但し、扱えるデバイスはシリアルとタイマのみで Linux カーネルが起動する程度となっています。
また、動作確認した環境は、Debian 6.0、Ubuntu 11.10 です。
ビルド
QEMU の他、ゲストである Linux カーネルと Buildroot を使用したユーザランドの全てをビルドします。
準備
以降のビルド手順に必要なパッケージをホスト環境に導入します。
(Ubuntu 11.10 システムインストール直後の場合) # apt-get install g++ bison flex gettext glib2.0-dev u-boot-tools
また、必要に応じて作業ディレクトリを作成します
% mkdir ~/work % export WORKDIR=~/work
buildroot
% cd $WORKDIR % wget http://buildroot.uclibc.org/downloads/buildroot-2012.05.tar.bz2 % tar xf buildroot-2012.05.tar.bz2 % cd buildroot-2012.05 % cat > configs/armadillo800eva_defconfig << EOF BR2_arm=y BR2_cortex_a9=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM2009Q3=y BR2_TARGET_GENERIC_GETTY_PORT="ttySC1" BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_CPIO_GZIP=y EOF % make armadillo800eva_defconfig % make
Linux カーネル
% cd $WORKDIR % git clone https://github.com/myokota/linux-a800eva-defconfig-for-qemu.git % wget http://armadillo.atmark-techno.com/files/downloads/kernel-source/linux-2.6.35-at/linux-2.6.35-a800eva-at2.tar.gz % tar xf linux-2.6.35-a800eva-at2.tar.gz % cd linux-2.6.35-a800eva-at2 % cp $WORKDIR/linux-a800eva-defconfig-for-qemu/armadillo800eva_qemu_defconfig arch/arm/configs
ビルドの前に、以下の修正を加えます。
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmo index a570b40..a2c0d95 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -128,6 +128,7 @@ static struct platform_device __maybe_unused usb_func_device .resource = usb_resources, }; +#ifdef CONFIG_MMC static void sdhi0_set_pwr(struct platform_device *pdev, int state) { gpio_set_value(GPIO_PORT107, state); @@ -304,6 +305,7 @@ static struct platform_device sh_mmcif_device = { .num_resources = ARRAY_SIZE(sh_mmcif_resources), .resource = sh_mmcif_resources, }; +#endif /* CONFIG_MMC */ static struct sh_fsi_dma sh_fsi2_dma = { .dma_porta_tx = { @@ -1044,9 +1046,11 @@ static struct platform_device gpio_led = { static struct platform_device *rma1evb_devices[] __initdata = { ð_device, +#ifdef CONFIG_MMC &sh_mmcif_device, &sdhi0_device, &sdhi1_device, +#endif //&usb_func_device, &ohci_device, &ehci_device,
ビルドを行います。
% export ARCH=arm % export CROSS_COMPILE=$WORKDIR/buildroot-2012.05/output/host/usr/bin/arm-none-linux-gnueabi- % make armadillo800eva_qemu_defconfig % make uImage
QEMU
% cd $WORKDIR % git clone https://github.com/myokota/qemu-a800eva.git % cd qemu-a800eva % ./configure --target-list=arm-softmmu % make
実行
以下で QEMU を起動します。
% $WORKDIR/qemu-a800eva/arm-softmmu/qemu-system-arm \ -M a800eva \ -kernel $WORKDIR/linux-2.6.35-a800eva-at2/arch/arm/boot/uImage \ -initrd $WORKDIR/buildroot-2012.05/output/images/rootfs.cpio.gz \ -append "console=ttySC1" \ -nographic \ -serial telnet:0.0.0.0:1200,server
すると、
QEMU waiting for connection on: telnet:0.0.0.0:1200,server
というメッセージが表示されるので、別の端末から、
% telnet localhost 1200
とします。すると、Linux カーネルが起動を開始するので、ログインプロンプトが表示されれば、root にてログイン(パスワードなし)が可能です。