<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; QEMU</title>
	<atom:link href="https://lakm.us/logit/tag/qemu/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Hello World with JamVM Embedded JVM on Ubuntu ARM</title>
		<link>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/</link>
		<comments>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 09:53:19 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[QEMU]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=380</guid>
		<description><![CDATA[While waiting for my BeagleBoard xM shipment, I was considering Java as one of the possible application platforms. Anyhow, the keyword &#8220;embedded Java ARM&#8221; landed me to the tiny JamVm. This JVM is said to be working with ARM Cortex A8 which can be emulated under QEMU running Ubuntu ARM. The fact that there had [...]]]></description>
				<content:encoded><![CDATA[<p>While waiting for my <a href="http://beagleboard.org/hardware-xM" title="http://beagleboard.org/hardware-xM" target="_blank">BeagleBoard xM</a> shipment, I was considering Java as one of the possible application platforms. Anyhow, the keyword &#8220;embedded Java ARM&#8221; landed me to the tiny <a href="http://jamvm.sourceforge.net/" title="http://jamvm.sourceforge.net/" target="_blank">JamVm</a>. This JVM is said to be working with <a href="http://en.wikipedia.org/wiki/ARM_Cortex-A8" title="http://en.wikipedia.org/wiki/ARM_Cortex-A8" target="_blank">ARM Cortex A8</a> which can be emulated under <a href="./2011/11/ubuntu-on-qemu-processor-emulator/" title="Ubuntu on QEMU Processor Emulator" target="_blank">QEMU running Ubuntu ARM</a>. The fact that there had been already a Karmic image that work with QEMU would shorten the time.</p>
<p>A &#8220;Hello World&#8221; class to test the JVM will be:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> HelloWorldJamVM <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hello world&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>saved as <code>HelloWorldJamVM.java</code>. However, executing a &#8220;Hello World&#8221; requires longer steps than writing that class.</p>
<p>In order for the JamVM 1.5.4 to run on Ubuntu, we need (1) <code>build-essential</code> (certainly so) and (2) <a href="http://gcc.gnu.org/java/ " title="The GNU Compiler for Java" target="_blank">GCJ</a> with dependency of (3) <code>zlib1g-dev</code>. It&#8217;s all available in the Karmic ARM repo. Another thing that we need is <a href="http://www.gnu.org/software/classpath/classpath.html" title="GNU Classpath" target="_blank">GNU Classpath 0.98</a>.</p>
<p>Following the instruction, as <code>root</code> we can then <code>configure, make, make install, make install-strip</code> sources under <code>jamvm-1.5.4</code> directory. Continue them with the <code>classpath-0.98</code> sources by configuring as follow</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--disable-gtk-peer</span> <span style="color: #660033;">--disable-gconf-peer</span> <span style="color: #660033;">--disable-plugin</span> <span style="color: #660033;">--disable-Werror</span></pre></div></div>

<p>and then <code>make install</code> as usual. The whole compiling will run slow for sure as QEMU emulates ARM far from nearing native processor performance in my case.</p>
<p>We can compile the above &#8220;Hello World&#8221; using GCJ with the command <code>javac</code>, which is actually linked to <code>/usr/bin/gcj-wrapper-4.4</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">javac HelloWorldJamVM.java</pre></div></div>

<p>A <code>HelloWorldJamVM.class</code> bytecode file will appear and we can run this with JamVM</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>jamvm<span style="color: #000000; font-weight: bold;">/</span>bin 
<span style="color: #7a0874; font-weight: bold;">export</span> PATH
jamvm HelloWorldJamVM</pre></div></div>

<div class="wp-caption alignleft" style="width: 510px"><img alt="qemu-ubuntu-arm-cortex-a8-running-jamvm-embedded-jvm.jpg" src="../../../../images/qemu-ubuntu-arm-cortex-a8-running-jamvm-embedded-jvm.jpg" title="QEMU with Ubuntu ARM Cortex A8 running JamVM embedded JVM" width="450" height="261" /><p class="wp-caption-text">QEMU with Ubuntu ARM Cortex A8 running JamVM embedded JVM</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu ARM on QEMU Processor Emulator</title>
		<link>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/</link>
		<comments>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 04:14:55 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[Lucid]]></category>
		<category><![CDATA[OMAP3]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[rootfs]]></category>
		<category><![CDATA[RootStock]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=300</guid>
		<description><![CDATA[There are times when you need to try things on virtualized environment before hand e.g. 1) checking application functionality or 2) actual device shipment is still on its long way. Those were also my cases with ARM Linux. Unlike virtualization in production environment however, putting software to emulate CPU architecture will slow down the guest [...]]]></description>
				<content:encoded><![CDATA[<p>There are times when you need to try things on virtualized environment before hand e.g. 1) checking application functionality or 2) actual device shipment is still on its long way. Those were also my cases with ARM Linux. Unlike virtualization in production environment however, putting software to emulate CPU architecture will slow down the guest machine a lot.</p>
<p>Ready-to-use image for from the old Ubuntu 9.10 Karmic is avalaible as suggested in <a href="https://wiki.ubuntu.com/ARM/RootfsFromScratch">RootStock Wiki</a> .</p>
<p>To run Ubuntu 10,04 Lucid you can create similar <code>.img</code> filled by RootStock generated root file system as described in <a href="../2011/10/running-ubuntu-on-devkit8500d-natty-kernel-and-lucid-rootfs/">this post</a> generating <code>lucid-arm.img</code>. Boot image is obtained from <a href="http://ports.ubuntu.com/dists/lucid/main/installer-armel/current/images/versatile/netboot/vmlinuz">Lucid port page</a>, of which I saved with the name <code>vmlinuz-lucid-current-ports</code> which is actually linux kernel 2.6.32-21. Running QEMU is then:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">qemu-system-arm <span style="color: #660033;">-M</span> versatilepb <span style="color: #660033;">-cpu</span> cortex-a8 \
  <span style="color: #660033;">-kernel</span> vmlinuz-lucid-current-ports \
  <span style="color: #660033;">-hda</span> lucid-arm.img <span style="color: #660033;">-m</span> <span style="color: #000000;">256</span> <span style="color: #660033;">-append</span> <span style="color: #ff0000;">&quot;root=/dev/sda mem=256M devtmpfs.mount=0 rw&quot;</span></pre></div></div>

<p>However, adding <code>-redir tcp:3232::22</code> isn&#8217;t directly working (although <code>telnet</code> is showing both directions are functional). This redirection is working with the Karmic image which gives instant <code>ssh</code> on my host laptop as in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> localhost <span style="color: #660033;">-oPort</span>=<span style="color: #000000;">3232</span> <span style="color: #660033;">-l</span> ubuntu</pre></div></div>

<p>Note: successful QEMU machine image probably won&#8217;t boot successfully with the real board. I can&#8217;t use kernel 2.6.38-10 for Lucid rootfs on QEMU, but successfully boot that on DevKit8500D board.</p>
<div class="wp-caption aligncenter" style="width: 510px"><img alt="qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" src="../../../../images/qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" title="qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" class="aligncenter" width="480" height="435" /><p class="wp-caption-text">QEMU console of Ubuntu 10.04 VM</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
