<?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>vm-kernel &#187; kernel</title>
	<atom:link href="http://vm-kernel.org/blog/category/kernel/feed/" rel="self" type="application/rss+xml" />
	<link>http://vm-kernel.org/blog</link>
	<description>All about emulation and virtualization</description>
	<lastBuildDate>Sat, 17 Apr 2010 03:51:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gdium linux kernel support status</title>
		<link>http://vm-kernel.org/blog/2010/04/16/gdium-linux-kernel-support-status/</link>
		<comments>http://vm-kernel.org/blog/2010/04/16/gdium-linux-kernel-support-status/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 13:20:42 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[kernel]]></category>
		<category><![CDATA[loongson]]></category>
		<category><![CDATA[gdium]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/?p=227</guid>
		<description><![CDATA[After several days working, the 2.6.34-rc2 kernel is working on gdium expect sound. Of course most of the codes are from mandriva and Philippe's work.
I will make some code clean and make the sound work in the next few days. It seems the sm501 sound driver needs a hardcoded 8051 firmware to work. Damn it. [...]]]></description>
			<content:encoded><![CDATA[<p>After several days working, the 2.6.34-rc2 kernel is working on gdium expect sound. Of course most of the codes are from mandriva and Philippe's work.</p>
<p>I will make some code clean and make the sound work in the next few days. It seems the sm501 sound driver needs a hardcoded 8051 firmware to work. Damn it. After these works are done, I will send the patches to<a href="http://groups.google.com/group/loongson-dev"> loongson-dev</a> maillist and merge it to <a href="http://dev.lemote.com/code/linux-loongson-community">linux-loongson-community</a> and linux-mips mainline at last.</p>
<p>I am keeping moving....... Please wait.</p>
<p>ps: The linux kernel for gdium repository is <a href="http://repo.or.cz/w/linux-2.6/linux-mips/linux-gdium.git">here</a>.</p>
<blockquote><p>kill-bill:~# uname -a<br />
Linux kill-bill 2.6.34-rc2 #24 PREEMPT Fri Apr 16 21:01:51 CST 2010 mips64 GNU/Linux<br />
kill-bill:~# cat /proc/cpuinfo<br />
system type             : dexxon-gdium-2f-10inches<br />
processor               : 0<br />
cpu model               : ICT Loongson-2 V0.3  FPU V0.1<br />
BogoMIPS                : 598.01<br />
wait instruction        : no<br />
microsecond timers      : yes<br />
tlb_entries             : 64<br />
extra interrupt vector  : no<br />
hardware watchpoint     : yes, count: 0, address/irw mask: []<br />
ASEs implemented        :<br />
shadow register sets    : 1<br />
core                    : 0<br />
VCED exceptions         : not available<br />
VCEI exceptions         : not available
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2010/04/16/gdium-linux-kernel-support-status/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>what&#039;s the difference between these two definitions</title>
		<link>http://vm-kernel.org/blog/2009/04/23/whats-the-difference-between-these-two-definitions/</link>
		<comments>http://vm-kernel.org/blog/2009/04/23/whats-the-difference-between-these-two-definitions/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 01:39:03 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2009/04/23/whats-the-difference-between-these-two-definitions/</guid>
		<description><![CDATA[I write this article because some guys are talking about it in CLF. The question is: what is the difference between the two following definitions:
A. const char temp[]=&#34;abc&#34;;
B. const char *temp=&#34;abc&#34;;

You may have your own answer already. But wait a moment, let me write some test cases first and you can see whether your answer [...]]]></description>
			<content:encoded><![CDATA[<p>I write this article because some guys are talking about it in <a href="http://www.linuxforum.net/forum/showflat.php?Cat=&amp;Board=embedded&amp;Number=717266&amp;page=0&amp;view=collapsed&amp;sb=5&amp;o=0&amp;fpart=">CLF</a>. The question is: what is the difference between the two following definitions:</p>
<blockquote><p>A. const char temp[]=&quot;abc&quot;;</p>
<p>B. const char *temp=&quot;abc&quot;;</p>
</blockquote>
<p>You may have your own answer already. But wait a moment, let me write some test cases first and you can see whether your answer is right or not. <img src='http://vm-kernel.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(1) Test case 1</p>
<blockquote><p>const char temp[]=&quot;abc&quot;;      <br />int main()       <br />{       <br />temp[0]='c';       <br />printf(&quot;temp %s \n&quot;,temp);       <br />}       <br />debian:~# gcc -o test test.c       <br />test.c: In function `main':       <br />test.c:8: error: assignment of read-only location `temp[0]'</p>
</blockquote>
<p>(2) Test case 2</p>
<blockquote><p>const char temp[]=&quot;abc&quot;;      <br />char temp1[]=&quot;def&quot;;       <br />int main()       <br />{       <br />temp = temp1;       <br />printf(&quot;temp %s \n&quot;,temp);       <br />}       <br />debian:~# gcc -o test test.c       <br />test.c: In function `main':       <br />test.c:8: error: assignment of read-only variable `temp'</p>
</blockquote>
<p>(3) Test case 3</p>
<blockquote><p>const char* temp=&quot;abc&quot;;      <br />char temp1[]=&quot;def&quot;;       <br />int main()       <br />{       <br />temp = temp1;       <br />printf(&quot;temp %s \n&quot;,temp);       <br />}       <br />debian:~# gcc -o test test.c       <br />debian:~# ./test       <br />temp def</p>
</blockquote>
<p>(4) Test case 4</p>
<blockquote><p>const char* temp=&quot;abc&quot;;      <br />int main()       <br />{       <br />temp[0] = 'd';       <br />printf(&quot;temp %s \n&quot;,temp);       <br />}       <br />debian:~# gcc -o test test.c       <br />test.c: In function `main':       <br />test.c:8: error: assignment of read-only location `*temp'</p>
</blockquote>
<p>So the definition A means both temp and array is const and you can not change it. Definition B means temp points to a const string, which you can not change its content. But you can change temp itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2009/04/23/whats-the-difference-between-these-two-definitions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#039;s bring virtualization into MIPS&#039;s world</title>
		<link>http://vm-kernel.org/blog/2009/02/25/lets-bring-virtulization-into-mipss-world/</link>
		<comments>http://vm-kernel.org/blog/2009/02/25/lets-bring-virtulization-into-mipss-world/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 07:35:19 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[ARM/MIPS]]></category>
		<category><![CDATA[JZ]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[jz-hacking]]></category>
		<category><![CDATA[Links:Virtualization]]></category>
		<category><![CDATA[loongson]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2009/02/25/lets-bring-virtulization-into-mipss-world/</guid>
		<description><![CDATA[I have spent about 1 month in making linux run on onda vx747 and it works now. Although it is a achievement, it's not the end of project jz-hacking.
These days I am always thinking about bringing virtualization into MIPS's world. You know, xen has been ported into ARM by Samsung and kvm into PPC by [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">I have spent about 1 month in making <a href="http://vm-kernel.org/blog/2009/02/24/linux-on-onda-vx747/">linux run on onda vx747</a> and it works now. Although it is a achievement, it's not the end of project jz-hacking.</p>
<p align="justify">These days I am always thinking about bringing virtualization into MIPS's world. You know, <a href="http://www.youtube.com/watch?v=ylEy-WT3JF4">xen has been ported into ARM</a> by Samsung and <a href="http://kvm.qumranet.com/kvmwiki/KvmForum2008?action=AttachFile&amp;do=get&amp;target=kdf2008_10.pdf">kvm into PPC by IBM</a>. X86, not even to say,  has the most complete support of virtualization in hardware and software. But to MIPS, there is nothing. Neither there is no virtualization support in MIPS's world nor anyone wants to do this(at least I have NOT heard of that).</p>
<p align="justify">I think you may ask who needs virtualization or why we need virtualization in MIPS's world. Well, that's a good question which is not easy to answer. Let's divide MIPS's world into two parts: high performance computing and embedded devices. For the first part, the advantage of virtualization is obvious, for example, making better resource utilization.To the embedded world, let's use mobile phone as an example, using virtualization can make your device more secure by isolating the critical part, communicating protocol for example, from feature rich os(linux for example). Because of isolation, the virus on linux can not control your system's critical part.</p>
<p align="justify">Loongson has done great job in developing 2E and 2F, but that's not enough. I find that loongson has put many effort into x86 binary translation acceleration in last few years. That's a good point to get more market share. But we need to consider one thing first, if one customer wants to buy a MIPS translated x86 cpu, why does not he buy a x86 cpu directly? I think there is one area which loongson should put even more effort into. That is virtualization!</p>
<p align="justify">Virtualization can be achieved by hardware and/or software, with the better performance if hardware supports this feature. To the software virtualization, we already have xen/kvm/lguest and OKL4(it seems to focus on embedded world). Xen is a paravirtualization solution while kvm is a full virtualization solution. The most obvious difference between paravirtualization and full virtualization is prarvirtualization needs to modify the guest operation system while full virtualization needn't. Of course you can do this in full virtualization to achieve better performance.</p>
<p align="justify">According to MIPS, I think there should be a solution of virtualization. Either kvm or xen is ok. The important part is that we need to have one. That's what I was planned todo even in one year ago when I was busy developing virtualmips. I spent some days on porting <a href="http://lguest.ozlabs.org/">lguest</a> to jz4740 in last July. But at last I gave up. Now I want to do it again. I plan to port lguest to jz4740 and  loongson 2f first. With the help of this experience, I can gain some knowledge about virtualization on MIPS platform. And then kvm is planned to be ported to loongson 2f. Image that one day we can run five linux operating systems on loongson 2f at the same time, is it cool?</p>
<p align="justify">If you are interested in virtualization, let's work together to make this happen. Do not leave MIPS alone while other boys all have virtualization to play with. <img src='http://vm-kernel.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2009/02/25/lets-bring-virtulization-into-mipss-world/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Problems I meet when porting linux to onda vx747</title>
		<link>http://vm-kernel.org/blog/2009/02/24/problems-i-meet-when-porting-linux-to-onda-vx747/</link>
		<comments>http://vm-kernel.org/blog/2009/02/24/problems-i-meet-when-porting-linux-to-onda-vx747/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 06:20:25 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[JZ]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[frame buffer console]]></category>
		<category><![CDATA[jz4740]]></category>
		<category><![CDATA[qtopia]]></category>
		<category><![CDATA[vx747]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2009/02/24/problems-i-met-when-porting-linux-to-onda-vx747/</guid>
		<description><![CDATA[1. About jz4740 DMA
JZ4740 has 2 groups of DMA, 4 channels in each group. The default prority is channel 0 has the highest priority and channel 7 has the loweset priority.
Channel 0 is used for SLCD and channel 2/3 are used for MMC TX/RX. Because the SLCD DMA is busy transmitting data from frame buffer [...]]]></description>
			<content:encoded><![CDATA[<p>1. About jz4740 DMA</p>
<p>JZ4740 has 2 groups of DMA, 4 channels in each group. The default prority is channel 0 has the highest priority and channel 7 has the loweset priority.</p>
<p>Channel 0 is used for SLCD and channel 2/3 are used for MMC TX/RX. Because the SLCD DMA is busy transmitting data from frame buffer to LCD controller, so that MMC DMA is in hunger and the root filesystem can not be loaded from micro sd card.</p>
<p>In SLCD driver, set the DMA priority to round bin.</p>
<p>2. Issues about qtopia</p>
<p>(1)QWSServerSocket: could not bind to file /tmp/qtembedded-unknown/QtEmbedded-0</p>
<p>Error: File exists</p>
<p>Failed to bind to /tmp/qtembedded-unknown/QtEmbedded-0</p>
<p>Add networking support in linux kernel.</p>
<p>Networking support-&gt;Networking options-&gt;Unix domain sockets</p>
<p>(2)QServerSocket: failed to bind or listen to the socket<br />
Failed to bind to port 4243<br />
QServerSocket: failed to bind or listen to the socket<br />
Failed to bind to port 4242</p>
<p>According to <a title="http://osdir.com/ml/handhelds.opie/2002-10/msg00253.html" href="http://osdir.com/ml/handhelds.opie/2002-10/msg00253.html">http://osdir.com/ml/handhelds.opie/2002-10/msg00253.html</a>,</p>
<blockquote><p>Opie is binding to the ports 4242(ftp) and 4243(qcopbridge) this is needed for<br />
syncing.. Opie got terminated and restarted somehow and did not properly<br />
release the sockets..<br />
I guess this is a kernel security feature.</p></blockquote>
<p>That's because Opie can not bind to port 4242 and 4243. After enabling TCP/IP support in linux kernel, this problem is solved.</p>
<p>Networking support-&gt;Networking options-&gt;TCP/IP networking</p>
<p>(3)Unable to open /usr/share/zoneinfo/zone.tab</p>
<p>That's because zoneinfo directory is missed. Copy it from my debian and it works.</p>
<p>3. Issues about framebuffer console</p>
<p>When I pass console=fb0 to linux kernel, the framebuffer does not appear on LCD. I am sure the LCD driver is working because the qtopia can run successfully. And I have enabled framebuffer console support in linux kernel.</p>
<p>Pass console=tty0 to linux kernel can solve this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2009/02/24/problems-i-meet-when-porting-linux-to-onda-vx747/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux on onda vx747(updated)</title>
		<link>http://vm-kernel.org/blog/2009/02/24/linux-on-onda-vx747/</link>
		<comments>http://vm-kernel.org/blog/2009/02/24/linux-on-onda-vx747/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 04:13:19 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[JZ]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[jz4740]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[onda]]></category>
		<category><![CDATA[qtopia]]></category>
		<category><![CDATA[vx747]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2009/02/24/linux-on-onda-vx747/</guid>
		<description><![CDATA[Before reading this article, please please visit the following website and help this little girl. She is the daughter of panjet, the core member of this project. Without him, this project can not even happen. 
http://yifanfund.com (English)
在阅读这篇文章前, 我恳请您花一点时间来帮助panjet的女儿怡帆. Panjet是这个项目的核心成员.如果没有他的参与,这个项目不可能成功地port linux到vx747上面. 赠人玫瑰,手留余香.  您的爱心一定能让小怡帆度过目前的困难.
http://help-yifan.org (中文)

Hi guys, a good news for you who are interested in running linux [...]]]></description>
			<content:encoded><![CDATA[<p align="justify"><strong>Before reading this article, please please visit the following website and help this little girl. She is the daughter of panjet, the core member of this project. Without him, this project can not even happen. </strong></p>
<p align="justify"><a href="http://yifanfund.com/">http://yifanfund.com</a> (English)</p>
<p align="justify"><strong>在阅读这篇文章前, 我恳请您花一点时间来帮助panjet的女儿怡帆. Panjet是这个项目的核心成员.如果没有他的参与,这个项目不可能成功地port linux到vx747上面. 赠人玫瑰,手留余香.  您的爱心一定能让小怡帆度过目前的困难.</strong></p>
<p align="justify"><a href="http://help-yifan.org/">http://help-yifan.org</a> (中文)</p>
<p align="justify"><img class="alignnone" title="Yifan" src="http://yifanfund.com/images/header/header.jpg" alt="" width="790" height="308" /></p>
<p align="justify">Hi guys, a good news for you who are interested in running linux on jz4740 based devices. First I would link to say it is not a very easy work although ingenic has released the linux source code. Secondly I would like to say thanks to many people who helped me a lot, vxworks,panjet,esoul of <a href="http://www.linuxforum.net/forum/postlist.php?Cat=&amp;Board=embedded&amp;page=0&amp;view=collapsed&amp;sb=5&amp;o=0">linuxforum</a> and Maurus Cuelenaere, the great rockbox guy.</p>
<p align="justify">Hey do not be so boring to say these useless words. Tell me how do you do that. Ok. Please be patient.</p>
<p align="justify">Currently linux can run on onda vx747 without writting any things to your nand flash. What you need is just a micro sd card  bigger than 128M bytes where you put linux kernel and root filesystem. Of course, if you want to replace the original firmware and write u-boot into nand flash, I can tell you how to do it. Even after writing u-boot into your nand flash you can still reinstall the original firmware. So please do not worry about your devices.  It won't be damaged.</p>
<p align="justify">1. Download the following files from jz_hacking.</p>
<p align="justify">(1)<a href="http://jz-hacking.googlecode.com/files/jz_tools_20090224.tar.bz2">jz_tools_20090224.tar.bz2</a>: It contains a tool called usbtool which uploads your program into jz4740's internal sram directly.</p>
<p align="justify">md5:1520851babe97da15651f9bef2c1ac5f</p>
<p align="justify">(2)<a href="http://jz-hacking.googlecode.com/files/jz_hacking_20090224.tar.bz2">jz_hacking_20090224.tar.bz2</a>: It contains u-boot image, jz_xloader and linux image.</p>
<p align="justify">md5:ac755b694f6e38224560a9051f1392e7</p>
<p align="justify">(3)<a href="http://jz-hacking.googlecode.com/files/root26.tar.bz2">root26.tar.bz2</a>: root file system of linux 2.6 kernel with qtopia</p>
<p align="justify">md5:738f6dfc648d36229a799d1d608655d1</p>
<p align="justify">Some guy says that this bz2 file is corrupted. I have tried downloading it using firefox in window and the file downloaded is corrupted!. But when I use other download tool it is ok. So if you can not unpack this package, you can try downloading it using other download tool. Wget in linux works well.</p>
<p align="justify">2. Make usbtool</p>
<p align="justify">Decompress the jz_tools_20090224.tar.bz2 and build the usbtool. It can be compiled in linux or minigw on windows. Please first read the README file in 'jz_tools_20090224/usb_tools'.</p>
<p align="justify">In linux, libusb-dev needs to be installed first. In windows, install MingW32 and LibUSB-Win32 and edit "Makefile" to make sure "WIN_DRIVERS_LIBUSB_DIR" is set correctly.</p>
<p align="justify">Type 'make linux' in linux platform and 'make win' on windows to build usbtool. After that copy jz_xloader.bin and u-boot-boot-linux.bin and u-boot-program-nand.bin from jz_hacking_20090224 into this directory.</p>
<p align="justify">3. Prepare your micro sd card</p>
<p align="justify">First you need to format sd card into <span style="text-decoration: line-through;">two </span>three partitions, one is fat and the other is ext2 and the third partition is swap. You do not know how to do it? Do not worry. <a href="http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat">This wiki page</a> on beagle board tells you how to do it.  Please  to format your first partition to FAT16 format, not FAT32 referred on the wiki page. That mean you have to use 'mkfs.vfat -F 16' to format the first partition. Use mkswap command in linux to format the third partition into swap space. In xp, you can use partition magic to do this job.</p>
<p align="justify">Download the following files:</p>
<ul>
<li><a style="white-space: nowrap;" href="http://jz-hacking.googlecode.com/files/uImage-vx747-20090303">uImage-vx747-20090303</a> :this is the linux kernel with sound support</li>
<li><a style="white-space: nowrap;" href="http://jz-hacking.googlecode.com/files/rcS-vx747-20090303">rcS-vx747-20090303</a> :This is the init script for vx747.</li>
<li><a style="white-space: nowrap;" href="http://jz-hacking.googlecode.com/files/rcS-vx747-20090303"></a><a style="white-space: nowrap;" href="http://jz-hacking.googlecode.com/files/pointercal-vx747-20090302">pointercal-vx747-20090302</a> :This is the touch screen calibration data  for vx747.</li>
</ul>
<p align="justify">After you finish formatting your micro sd card, rename uImage-vx747-20090303 to uImage and copy it to your fat partition. Copy u-boot-nand.bin from jz_hacking_20090224 to your fat pattition. Do <strong>NOT</strong> copy uImage in jz_hacking_20090224 to your fat partition. It is the old linux kernel image. Now we have uImage-vx747-20090303 and we do not need it anymore. Copy all the files in root26 into the ext2 partition. Rename rcS-vx747-20090303 to rcS and copy it to directory 'ext/init.d/rcS' of the ext2 partition of your SD card. Rename pointercal-vx747-20090302 to pointercal and copy it to the directory 'ext/pointercal'.</p>
<p align="justify">4. Boot linux</p>
<p align="justify">Ok, it is time to boot linux. Insert the sd card into onda vx747. Press the reset button and hold the M button at the same time to enter usb boot mode. Run the usbtool using the following commands.</p>
<blockquote>
<p align="justify"><span style="background-color: #ffffff;">./usbtool 1 jz_xloader.bin 0x80000000</span></p>
<p align="justify"><span style="background-color: #ffffff;">./usbtool 1 u-boot-boot-linux.bin 0x80100000<br />
</span></p></blockquote>
<p align="justify">If that does not work in your system(some guy says it does that work on ubuntu), you can try the following commands:</p>
<blockquote>
<p align="justify"><span style="background-color: #ffffff;">sudo ./usbtool 12<br />
</span></p></blockquote>
<p align="justify">Then you can see the u-boot logo. It will load uImage from micro sd card into SDRAM automatically and then boot from SDRAM. After that, linux logo will appear on LCD with framebuffer console output. At last, qtopia is running and you can play with it.</p>
<p align="justify">5. Programing u-boot into nand flash(optional)</p>
<p align="justify">If you decide to replace the original firmware and write u-boot into nand flash, you can use u-boot-program-nand.bin to do that.</p>
<blockquote>
<p align="justify"><span style="background-color: #ffffff;">./usbtool 1 jz_xloader.bin 0x80000000</span></p>
<p><span style="background-color: #ffffff;">./usbtool 1 u-boot-program-nand.bin 0x80100000</span></p></blockquote>
<p align="justify">Also 'sudo ./usbtool 13' can work.</p>
<p align="justify">It will write u-boot into nand flash and reboot onda vx747 automatically.</p>
<p align="justify">If you want to restore the original firmware, <a href="http://www.rockbox.org/twiki/bin/view/Main/OndaVX747#Official_flash_recovery">this information may help you</a>.</p>
<p align="justify">I only test the linux kernel and u-boot on my 4G bytes onda vx747 with 16M SDRAM. Some guy says that there is another model of vx747 with 32M SDRAM, I have not tried on that device. If you have any suggestion, please wirte to me(yajin AT vm-kernel.org). Spams are not welcome. <img src='http://vm-kernel.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p align="justify">Current Issue:</p>
<ul>
<li><span style="text-decoration: line-through;">Touch screen is not accurate </span>(solved)</li>
<li><span style="text-decoration: line-through;">Sound is not working </span>(solved)</li>
<li><span style="text-decoration: line-through;">time and date setting </span>(solved)<span style="text-decoration: line-through;"><br />
</span></li>
<li>nand driver of u-boot is not working on 8G vx747 (not yet. I do not have the 8G version of vx747)</li>
</ul>
<p>Please be patient. I will solve these problems.</p>
<p align="justify">Also any donation of jz4740/4750 based device is appreciated.</p>
<p align="justify">For anyone interested, the source code of u-boot and linux-kernel is available here.</p>
<p align="justify">http://code.google.com/p/jz-hacking/wiki/Index?tm=6#source_code</p>
<p align="justify"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/jbMxSP7_jqY&amp;hl=zh_CN&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/jbMxSP7_jqY&amp;hl=zh_CN&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2009/02/24/linux-on-onda-vx747/feed/</wfw:commentRss>
		<slash:comments>133</slash:comments>
		</item>
		<item>
		<title>low level debug of linux omap</title>
		<link>http://vm-kernel.org/blog/2008/12/12/low-level-debug-of-linux-omap/</link>
		<comments>http://vm-kernel.org/blog/2008/12/12/low-level-debug-of-linux-omap/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 05:02:28 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[OMAP]]></category>
		<category><![CDATA[emulation]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[low level debug]]></category>
		<category><![CDATA[printascii]]></category>
		<category><![CDATA[qemu-omap3]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2008/12/12/low-level-debug-of-linux-omap/</guid>
		<description><![CDATA[Working on qmeu-omap3. A starange problem. If I use the kernel image downloaded from http://beagleboard.googlecode.com/files/uImage_OTG, some kernel boot informations can be displayed in uart3. But when I use the kernel source from linux omap git and build it by myself, there are NO linux kernel boot informations at all.
Linux kernel uses printk to output informations [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">Working on qmeu-omap3. A starange problem. If I use the kernel image downloaded from <a title="http://beagleboard.googlecode.com/files/uImage_OTG" href="http://beagleboard.googlecode.com/files/uImage_OTG">http://beagleboard.googlecode.com/files/uImage_OTG</a>, some kernel boot informations can be displayed in uart3. But when I use the kernel source from <a href="http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=summary" target="_blank">linux omap git</a> and build it by myself, there are NO linux kernel boot informations at all.</p>
<p align="justify">Linux kernel uses printk to output informations to console and the console struct is initialized in function console_init(). So why the linux can be displayed before function console_init()?</p>
<p align="justify">The answer is that there is another way to output informations to console. That is low level debug. It uses printascii to print informations. The following is the code in vprintk.</p>
<pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #e9e9e9">
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">556 #ifdef  CONFIG_DEBUG_LL
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">557         printascii(printk_buf);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">558 #endif</pre>
</pre>
<p>So if we want to output debug information as early as possible, define CONFIG_DEBUG_LL first. </p>
<p>The default configuration of beagle board in <a title="http://www.beagleboard.org/uploads/2.6_kernel_revb-v2.tar.gz" href="http://www.beagleboard.org/uploads/2.6_kernel_revb-v2.tar.gz">http://www.beagleboard.org/uploads/2.6_kernel_revb-v2.tar.gz</a> defines this macro while the source code from&#160; <a href="http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=summary" target="_blank">linux omap git</a> does not define this macro.</p>
<p>Function printascii is defined in include/asm-arm/arch-omap/debug-macro.S.</p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2008/12/12/low-level-debug-of-linux-omap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>抢占式调度和休眠</title>
		<link>http://vm-kernel.org/blog/2008/10/29/%e6%8a%a2%e5%8d%a0%e5%bc%8f%e8%b0%83%e5%ba%a6%e5%92%8c%e4%bc%91%e7%9c%a0/</link>
		<comments>http://vm-kernel.org/blog/2008/10/29/%e6%8a%a2%e5%8d%a0%e5%bc%8f%e8%b0%83%e5%ba%a6%e5%92%8c%e4%bc%91%e7%9c%a0/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 03:47:14 +0000</pubDate>
		<dc:creator>yajin</dc:creator>
				<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://vm-kernel.org/blog/2008/10/29/%e6%8a%a2%e5%8d%a0%e5%bc%8f%e8%b0%83%e5%ba%a6%e5%92%8c%e4%bc%91%e7%9c%a0/</guid>
		<description><![CDATA[在LDD3上有一个例子，代码如下：

1: /* Wait for space for writing; caller must hold device semaphore. On
2:  * error the semaphore will be released before returning. */
3: static int scull_getwritespace(struct scull_pipe *dev, struct file *filp)
4: {
5:
6:         while (spacefree(dev) == 0)

7:         { /* [...]]]></description>
			<content:encoded><![CDATA[<p>在LDD3上有一个例子，代码如下：</p>
<pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #e9e9e9">
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">1: <span style="color: #008000">/* Wait for space for writing; caller must hold device semaphore. On</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">2:  * error the semaphore will be released before returning. */</span></pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">3: <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> scull_getwritespace(<span style="color: #0000ff">struct</span> scull_pipe *dev, <span style="color: #0000ff">struct</span> file *filp)</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">4: {</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">5:</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">6:         <span style="color: #0000ff">while</span> (spacefree(dev) == 0)
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">7:         { <span style="color: #008000">/* full */</span>
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">8:                 DEFINE_WAIT(wait);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">9:
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">10:                 up(&amp;dev-&gt;sem);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">11:                 <span style="color: #0000ff">if</span> (filp-&gt;f_flags &amp; O_NONBLOCK)
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">12:                         <span style="color: #0000ff">return</span> -EAGAIN;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">13:
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">14:                 PDEBUG(&quot;<span style="color: #8b0000">\&quot;%s\&quot; writing: going to sleep\n</span>&quot;,current-&gt;comm);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">15:                 prepare_to_wait(&amp;dev-&gt;outq, &amp;wait, TASK_INTERRUPTIBLE);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">16:                 <span style="color: #0000ff">if</span> (spacefree(dev) == 0)
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">17:                         schedule();
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">18:                 finish_wait(&amp;dev-&gt;outq, &amp;wait);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">19:                 <span style="color: #0000ff">if</span> (signal_pending(current))
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">20:                 <span style="color: #008000">/* signal: tell the fs layer to handle it */</span>
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">21:                         <span style="color: #0000ff">return</span> -ERESTARTSYS;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">22:                 <span style="color: #0000ff">if</span> (down_interruptible(&amp;dev-&gt;sem))
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">23:                         <span style="color: #0000ff">return</span> -ERESTARTSYS;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">24:         }
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">25:         <span style="color: #0000ff">return</span> 0;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">26:
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">27: }
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">28:
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9"></pre>
</pre>
<p>上面代码见LDD3 Page 159。 </p>
<p>在书上面，解释了为什么需要Line 16的判断语句。因为在prepare_to_wait后，并没有真正让出CPU，只是改变了进程的状态。而这个时候，可能缓冲区又已经可用了(行10和 15之间read函数释放了缓冲区)，那么我就不需要调用schedule让出处理器资源而休眠了。试想，如果不判断而调用schedule，而这个时候 read函数已经唤醒过了，那么谁来唤醒我呢？ </p>
<p>可是仍然有一个疑问，因为2.6内核是可抢占的。那么调用假设prepare_to_wait和if判断之间也就是行15和16之间，发生了内核抢占，调度了另外的进程来运行。并且在行10和15之间，read 函数已经释放了缓冲区。那么由于不可能有进程来唤醒我，我就一直在休眠了！！！！！ </p>
<p>实际上，这里就涉及到内核抢占的问题。在内核抢占的时候，schedule并不是被直接调用的，而是通过 preempt_schedule,preempt_schedule_irq和__cond_resched间接调用的，这三个例程都会在调用 schedule之前给当前的抢占计数加上PREEMPT_ACTIVE：</p>
<pre>
<pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #e9e9e9">
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">1: add_preempt_count(PREEMPT_ACTIVE);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">2: ...
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">3: schedule();
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">4: ...
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">5: sub_preempt_count(PREEMPT_ACTIVE);</pre>
</pre>
</pre>
<p>而schedule函数内部会检查PREEMPT_ACITVE位是否被设置，只有当此位没有被设置的时候才会将不是TASK_RUNNING状态的进程移除运行队列：</p>
<pre>
<pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #e9e9e9">
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">1:  <span style="color: #0000ff">if</span> (prev-&gt;state &amp;&amp; !(preempt_count() &amp; PREEMPT_ACTIVE)) {
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">2:         switch_count = &amp;prev-&gt;nvcsw;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">3:         <span style="color: #0000ff">if</span> (unlikely((prev-&gt;state &amp; TASK_INTERRUPTIBLE) &amp;&amp;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">4:                 unlikely(signal_pending(prev))))
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">5:             prev-&gt;state = TASK_RUNNING;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">6:         <span style="color: #0000ff">else</span> {
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">7:             <span style="color: #0000ff">if</span> (prev-&gt;state == TASK_UNINTERRUPTIBLE)
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">8:                 rq-&gt;nr_uninterruptible++;
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">9:             deactivate_task(prev, rq);
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">10:         }
</pre>
<pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; background-color: #e9e9e9">11:     }</pre>
</pre>
</pre>
<p>因此，被抢占的进程始终会回到被抢占的点继续执行，无论它被抢占的时候状态为何。这样即使在行15和16之间发生抢占，该进程仍然在运行队列，下次仍然有机会被投入运行（被投入运行的条件不仅仅是被唤醒了，因为其在运行队列中）。因此，仍然会去执行下面的判断语句。在这篇<a href="http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-10/2391.html">邮件</a>中也有相关的说明： </p>
<blockquote>
<p>See the PREEMPT_ACTIVE logic. </p>
<p>If a task is preempted it is marked PREEMPT_ACTIVE and it skips the<br />
    <br />runqueue removal logic in schedule(). So even if it is !TASK_RUNNING it </p>
<p>will run again. </p>
<p>You can see this in schedule() and preempt_schedule(), both in<br />
    <br />kernel/sched.c. </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Robert Love </p>
</blockquote>
<p>[参考] </p>
<p>1.<a href="http://blog.chinaunix.net/u/5251/showart_450988.html">http://blog.chinaunix.net/u/5251/showart_450988.html</a> </p>
<p>2.<a href="http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-10/2391.html">http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-10/2391.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vm-kernel.org/blog/2008/10/29/%e6%8a%a2%e5%8d%a0%e5%bc%8f%e8%b0%83%e5%ba%a6%e5%92%8c%e4%bc%91%e7%9c%a0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
