tag:blogger.com,1999:blog-64871052025963907832024-03-13T19:11:44.564+01:00Hardware & Software Useful bitsUnknownnoreply@blogger.comBlogger38125tag:blogger.com,1999:blog-6487105202596390783.post-84447660067820474912015-03-05T00:42:00.002+01:002015-06-21T12:04:55.499+02:00Stream movies to Android devices<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
After battling for some time with how to best <b>stream movie content through Ethernet and Wifi</b> <b>from a media server</b> (the <a href="http://hwswbits.blogspot.com/2015/03/getting-linux-on-minix-neo-z64.html" target="_blank">Minix Neo Z64 running Linux</a> in this case) where my USB hard disks are plugged, <b>to Android devices</b> connected to my TVs, I've found that the very best method for <u><b>smooth streaming is to serve the files with a web server</b></u>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
That way, <b>on any Android in the house (phone, tablet, TV box, MiniPC</b>,
or even an x86 PC) I can use a <b>Web Browser</b> to connect to the Z64 (with
its static IP), then navigate my movie folder and <b>click on the link of
the movie</b> I want to watch.</div>
<div style="text-align: justify;">
Android will prompt with what movie player (I use MX Player, and BSPlayer when MX has trouble)<b> and playing will start</b>, without installing any other app at all!</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I have even been able to have <b>XBMC</b> (now Kodi) on an <b>Android device to read and manage this web-served movie collection</b> just by adding it as an http server (however very long filenames are cut, making it harder for XBMC to link it to the Internet movie database).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For the <b>basics of a NAS on Linux</b>, you can <a href="http://hwswbits.blogspot.com/2013/10/diy-nas-with-rk3188-device-radxa-rock.html" target="_blank">read this article</a>, which was for my original setup with the RK3188.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
To serve the files just install on the Minix Neo Z64 a <b>nice light web server, such as nginx.</b> Then it's just a matter of editing the file <b>/etc/nginx/sites-enabled/default</b> to add a section for your file-web-server, like this:</div>
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">server {<br /> charset utf-8;<br /> <br /> root /mnt;<br /> index index.html index.htm;<br /><br /> server_name 192.168.1.4;<br /><br /> location / {<br /> root /mnt/;<br /> try_files $uri $uri/ /index.html;<br /> autoindex on;<br /> autoindex_exact_size off;<br /> autoindex_localtime off;<br /> }<br />} </span></blockquote>
<br />
<div style="text-align: justify;">
You'll just have to <b>change the IP</b> for the static one of your Z64, <b>and the two lines</b> that start with <b>"root"</b> which should point to the root folder that you want to share (subfolders will be shared too).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The <b>"charset"</b> line is very important for all of us with <b>accented languages</b>. The <b>"autoindex"</b> lines do the magic of creating a <b>link for each file</b> in a folder.</div>
<div style="text-align: justify;">
<br />
It is also a good idea to edit /etc/nginx/nginx.conf and set keepalive_timeout and send_timeout both to a large number of seconds, like:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">keepalive_timeout 1200;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">send_timeout 1200; </span></blockquote>
<br />
That way you can pause a movie for 10 minutes and still be able to resume (or else, after a X minutes pause, upon resume the Android movie player will stop after soem seconds and you'll have to open the file again).</div>
<div style="text-align: justify;">
<br />
Then,
on any device on your local network enter the Z64's IP on a web browser
and you'll see the files and folders under /mnt in your Z64.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I usually install also the openssh-server so I can ssh into the Z64 from my PC, instead of connecting it to a TV.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>BONUS:</b></u> Add a script to init that executes one line like this for every hard disk (substitute the sd_) connected to the media server:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo hdparm -S 200 -B 100 -K 1 /dev/sd_</span></blockquote>
<div style="text-align: justify;">
This invaluable piece of advice <b>makes sure that the hard drivers spin off when not used</b>
for some time ("-S 200" for 16 minutes). This will enhance by orders of
magnitude the life of your precious hard disks, and will reduce your
energy bill.</div>
<br />Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6487105202596390783.post-44796899017121102802015-03-05T00:37:00.000+01:002015-03-05T00:37:05.609+01:00Getting Linux on the Minix Neo Z64<div style="text-align: justify;">
I have recently received the latest <a href="http://www.minix.com.hk/Products/MINIX-NEO-Z64-WIN-PC.html" target="_blank">Minix Neo Z64</a>, courtesy of Minix. This TV Box is equipped with an Intel x86 processor, an Atom 3735F, which is not so far off a low-end PC desktop but at just 2.2W making it fanless. You can check its respectable specs at <a href="http://ark.intel.com/compare/80274" target="_blank">this Intel page</a>, and even compare it against other Intel CPUs.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-UKxLW8NZuEY/VPdXPRPnSGI/AAAAAAAABtE/PHC42iK4bZU/s1600/2015030415413853.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-UKxLW8NZuEY/VPdXPRPnSGI/AAAAAAAABtE/PHC42iK4bZU/s1600/2015030415413853.jpg" height="306" width="320" /></a></div>
<br />
<br />
<div style="text-align: justify;">
The Z64 is <b>smaller than previous Minix TV boxes</b>, which is nice. As always, a <b>good quality power adapter</b>, HDMI cable, and remote are bundled in the box. The Wifi antenna design is non-detachable, and this time I have been <b>unable to find a way to open the box</b> in order to take the customary PCB photo. Sorry about that :-(</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Apart from that, you get <b>32 GB fast eMMC flash</b> (instead of the usual slower NAND flash chip), 2 GB DDR3 <b>RAM</b> at <b>1333 MHz</b>, two (ouch) USB 2.0 ports, Ethernet 10/100 (ouch), Wifi and Bluetooth.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I find several big reasons to <b>prefer this TV box over ARM ones</b>:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
- the <b>x86</b> architecture is completely <b>PC SW compatible</b> (think Adobe <b>Flash</b>)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
- <b>Intel</b> has a solid background on <b>Open Source</b>, like its <b>Linux GPU drivers</b> (2D/3D) which are top of the line. You even have <b>3D support on the HDMI</b> interface (see 5.4.1.3 at the <a href="https://www-ssl.intel.com/content/www/us/en/processors/atom/atom-z36xxx-z37xxx-datasheet-vol-1.html" target="_blank">CPU datasheet here</a>).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
- For <b>HW accelerated video decoding</b> you have a VPU supporting 1080p60 decoding for H-264, WMV9, and MPEG-2 (see 1.4 on Type 3 SoC at the <a href="https://www-ssl.intel.com/content/www/us/en/processors/atom/atom-z36xxx-z37xxx-datasheet-vol-1.html" target="_blank">CPU datasheet here</a>).</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
- And one important thing: the USB controller. Usually <b>ARM CPUs</b> have DesignWare's <b>USB controller, which has nasty and buggy firmware/driver</b>, leading to lots of problems with USB devices (webcams, external hard disks, 10/100 USB Ethernet and Wifi dongles). However, here we have a good and <u><b>robust Intel USB controller</b></u>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The last reason alone has made me jump into <b>switching my NAS home media server</b> (which has several USB hard disks) <b>to this Minix Neo Z64 with Linux</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This tiny Intel CPU even has <b>virtualization features</b> (VT-x), you could even install Xen on this (or even <b><a href="https://wiki.qubes-os.org/wiki/SimpleIntro" target="_blank">Qubes-OS</a></b>, if you are serious about <b>secure computing</b>).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So... sorry <b>Windows 8.1</b>, you <b>look nice</b> and you run <b>fast</b>, but Linux and I...</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Hence, find here <b>instructions to get into</b> the <b>Minix Neo Z64 whatever distribution of Linux</b> you prefer. I don't like creating distros when you can <b>very easily</b> install a standard one.</div>
<br />
<br />
<br />
<h3>
Live Linux USB</h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
First of all get a <b>USB pendrive</b> that can be erased, so we can <b>start Linux</b> on the Z64<b> to make a backup of Windows</b>, before removing it.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I've developed a liking for <b>Xubuntu</b> (XFCE based) after Canonical decided to outsmart all of us by inventing their hateable GUI, and then Gnome followed suit with its 3.0 version.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can use <b>any version of Ubuntu</b>, they'll work the very same way as described here. Just head to the corresponding <b>official Ubuntu page and download the x86_64</b> version (also called <b>amd64</b>) of the distro.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I wish I could tell you that's it, but truth is somebody messed up somewhere and all Intel Atom boxes/MiniPCs I know happen to have a <b>32 bits UEFI BIOS</b>, which <b>complicates booting a 64 bits OS</b>, so there is <b>one extra step</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This consists of <b>adding a 32 bits bootloader to the 64 bits one in the Ubuntu distro</b> so it can boot, that's it. You can either <b>download</b> the <b>bootia32.efi</b> bootloader from <a href="https://github.com/jfwells/linux-asus-t100ta/raw/master/boot/bootia32.efi" target="_blank">this link</a> or you can follow the instructions (from the same place) to <b><a href="https://github.com/jfwells/linux-asus-t100ta/tree/master/boot" target="_blank">build it yourself</a></b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Now, about <b>creating a LiveUSB for UEFI</b> systems and modifying it... people around are resorting to using a tool called Rufus that requires you to use Windows... ugly.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, <b>there is a simple way (<a href="https://github.com/lopaka/instructions/blob/master/ubuntu-14.10-install-asus-x205ta.md" target="_blank">thanks lopaka</a>) to do everything from your usual Linux PC</b> (the lines preceded with "#" are just my comments, disregard them): </div>
<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">#first erase the USB pendrive</span><br />
<span style="font-family: "Courier New",Courier,monospace;">sgdisk --zap-all /dev/sd_</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#create a new GPT partition for booting on UEFI systems<br />sgdisk --new=1:0:0 --typecode=1:ef00 /dev/sd_</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#create a FAT32 partition, as expected by the UEFI BIOS</span><br />
<span style="font-family: "Courier New",Courier,monospace;">mkfs.vfat -F32 /dev/sd_1</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br />#create a temporary folder</span><br />
<span style="font-family: "Courier New",Courier,monospace;">mkdir image</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#mount the FAT32 partition (only root can mount)<br />sudo mount -t vfat /dev/sd_1 image/</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#uncompress Ubuntu onto the mounted USB<br />sudo 7z x xubuntu-14.10-desktop-amd64.iso -oimage/</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#add the 32 bits bootloader (see blog above)<br />sudo cp bootia32.efi image/EFI/BOOT/</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#finish any pending writes<br />sudo sync</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#unmount the USB<br />sudo umount image</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#remove the temporary folder </span><br />
<span style="font-family: "Courier New",Courier,monospace;">rmdir image</span></blockquote>
<br />
<div style="text-align: justify;">
Please note that <b>ALL references to the USB disk above are in the form "sd_" or "sd_1"</b>, this is because you can delete your hard disk if you just copy paste this code, so don't!!! You <b>first</b> have to<b> find if your USB pendrive is at sdb, sdc, sdd, sde</b>, or whatever sd*.</div>
<div style="text-align: justify;">
<b>Easy way is</b>, without the USB drive inserted, type in a terminal:</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">ls /dev/sd*</span></blockquote>
</div>
<div style="text-align: justify;">
And then again, after inserting the USB. The new sd_ (without trailing number) is your pendrive.<b> Use that letter instead of the "_" above.</b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
BIOS settings</h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In order to <b>boot the Live USB</b>, connect a keyboard to the Minix and as soon as you press the power button, start pressing several times the <b>"Del" key to enter BIOS setup</b> (if screen remains black after 10s, then you'll need a PC monitor instead of a TV to see it).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
BTW, the sensible way to forcefully <b>power off the box</b>, if there is nothing on screen, is to keep pressed the <b>power button</b> for a bit more than <b>5 seconds</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On the <b>BIOS screen</b>, go to "Advanced", then "CPU Configuration" and on the "<b>Execute Disable Bit</b>" hit Enter and select <b>Disabled</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
By the way, just in case you dig through the BIOS options, you may see one named "<b>ISP PCI Device Selection</b>", just <b>ignore it</b>. I say this because it mentions that it
should be another value for Linux, but never mind that, leave it at Windows.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, there is a <b>very important change</b> to be done, find the <b>"Quiet
boot"</b> item. It <b>must be disabled</b> since there seems to be something missing in the
GFX initialization that the BIOS is doing but Linux is missing. Maybe the logo that appears (when Quiet boot is enabled) instead
of the usual BIOS text is pushing the GPU into an incompatible video
mode, and it prevents booting Linux (black screen).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Head to the last menu page (the one on <b>Boot options</b>) and select the option to <b>Save Settings</b> (without reset or exit, just save).</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Finally, if the above instructions for the USB preparation were followed, you should see the <b>pendrive's name</b> or brand listed in the "<b>Boot Override</b>" choices at the bottom, select it and <b>hit Enter to boot</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On the grub2 menu that should appear select "<b>Try Ubuntu before installing</b>".</div>
<div style="text-align: justify;">
If you get a black screen or Windows, then you may be missing the bootia32.efi file, re-do the instructions above on USB preparation.</div>
<br />
<br />
<h3>
Backup Windows 8.1</h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Since <b>Minix bundles a fully licensed Windows 8.1</b> with Bing (as opposed to many other TV boxes that come with a 30 days trial version), it is a good idea to <b>back it up</b> to avoid losing the licensed OS, in case we wanted to switch back to it anytime.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This part of the instructions is based on this <a href="http://www.cnx-software.com/2015/02/13/how-to-install-ubuntu-15-04-on-mele-pcg03-intel-mini-pc/" target="_blank">CNX-Software's page</a>, the news site for hacking with embedded devices; though there are additional things to make Linux work on the Z64.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
We will install "pv" as a convenience, to monitor the copy's progress, since the backup takes several minutes to complete.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Just open a terminal and <b>cd into the folder of another USB pendrive</b> (the <b>Live USB is read only</b> so nothing survives reboot) to execute these commands:</div>
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install pv</span><br />
<span style="font-family: "Courier New",Courier,monospace;">sudo dd if=/dev/mmcblk0 bs=16M | pv | gzip -9 > Z64_Win81.gz</span></blockquote>
<br />
<div style="text-align: justify;">
Most of the 32 GB flash is empty, so<b> gzip'ing it produces a much smaller file</b> (mine was some <b>4 GB, instead of 32 GB</b>)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>To restore Windows</b> 8.1 from the backup you should follow this section up to the "pv" install, and then do:</div>
<div style="text-align: justify;">
<br /></div>
<blockquote class="tr_bq">
<div style="text-align: justify;">
<span style="font-family: "Courier New",Courier,monospace;">gzip -dc Z64_Win81.gz | pv | sudo dd of=/dev/mmcblk0 bs=16M</span></div>
</blockquote>
<div style="text-align: justify;">
<br /></div>
<br />
<h3>
Installing Linux in Flash</h3>
<br /><div style="text-align: justify;">
Finally! Click on the <b>icon to Install Ubuntu</b> and start the setup as usual.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
When asked about the <b>partitioning</b> select the do "<b>Something else</b>" choice and you'll be presented with the current partitioning of the internal eMMC flash that contains Windows 8.1.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
We are going to wipe Windows. But you have to <b>leave the first two partitions untouched,</b> they are mmcblk0p1 and mmcblk0p2. Together they
amount to less than 240MB and are <b>needed to boot EFI</b> (at least p1, the FAT32 one).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, you can perfectly <b>remove the "Win" and "Images" partitions</b>, which together are around <b>30 GB of space</b>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I used all but 2 GB for an <b>ext4 partition</b> to be mounted at "/" where Linux will reside, and the remaining 2 GB for <b>swap partition</b> (the ancient recommendation is to match your RAM size in swap).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Even if this is a Flash, <b>it's ok to have a swap partition,</b> it should be <b>seldom used</b>, only when you start filling up the RAM, but a <b>home server</b> should be ok even without it.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On the <b>booloader device</b> dropdown at the bottom of the new window, select <b>"/dev/mmcblk0"</b> not other, just that one (or update-grub2 later may update the wrong place and you'll end up with two "ubuntu" entries on the UEFI BIOS).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>Once installation is finished</b> (this is based on <a href="https://docs.google.com/document/d/1Cp8PHEmNrlDufVoDpeEqNEdGWJi_cZ_Mo6VC7QDeN8s/edit" target="_blank">Linuxium's great work here</a>), you'll need to <b>boot once more with the Live USB</b>, but when presented with its grub2 menu, press 'c' to go to its console and enter these three lines:</div>
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">linux (hd1,gpt3)/boot/vmlinuz-3.16.0-31-generic root=/dev/mmcblk0p3</span></blockquote>
<blockquote>
<span style="font-family: "Courier New",Courier,monospace;">initrd (hd1,gpt3)/boot/initrd-3.16.0-31-generic</span> </blockquote>
<blockquote>
<span style="font-family: "Courier New",Courier,monospace;">boot</span></blockquote>
<br />
<br />
<br />
<br />
<br />
<br />
<div style="text-align: justify;">
If you used a different Linux distro, the version numbers may be different. You can <b>use grub's auto-completion,</b> with the Tab key, to <b>help you find</b> your vmlinuz and initrd files for you.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The Ubuntu that you have installed on the internal eMMC flash will boot up, connect to the <b>Internet with an Ethernet</b> cable (there is <b>no wireless</b> out of the box) and enter these commands on a terminal:</div>
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install grub-efi-ia32 grub-efi-ia32-bin</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo cp /boot/efi/EFI/ubuntu/grubia32.efi /boot/efi/EFI/ubuntu/grubx64.efi</span> </blockquote>
<blockquote>
<span style="font-family: "Courier New",Courier,monospace;">sudo update-grub2
</span></blockquote>
<br />
<br />
<div style="text-align: justify;">
Now you can <b>power off, remove the pendrive, and boot again</b>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<b>You should then boot to your Linux. </b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you see a Windows bluish screen stating that there is something wrong, then you'll have to <b>enter the BIOS</b> once more and change the <b>Boot priority #1 to "ubuntu"</b>.<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3>
Limitations</h3>
<div style="text-align: justify;">
<br /> Please note <b>Wifi (Realtek RGN RTL8723BS) is not working</b> out of the box, but <a href="http://www.cnx-software.com/2015/02/13/how-to-install-ubuntu-15-04-on-mele-pcg03-intel-mini-pc/" target="_blank">CNX-Software's page</a> provides info on compiling its drivers from source.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Also the <b>sound (Realtek ALC5642) is not working</b>, there is one person around that says to have fixed it by using Chromium's Intel firmware (<a href="http://ubuntuforums.org/showthread.php?t=2254631" target="_blank">see this page</a>) but I've tried it and, even though a new output appeared in the audio mixer, nothing sounded and the "dmesg" log was full of errors related to audio.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you google around for ALC5642 and Linux there seems to be a good place to look for the driver (see <a href="https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1259099" target="_blank">this page</a>) whenever it appears.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
That's it. Enjoy!</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com21tag:blogger.com,1999:blog-6487105202596390783.post-18861578500731965762014-06-10T16:38:00.001+02:002014-06-10T16:38:11.171+02:00Minix Neo X8H HW tinkering first impressionsI just got my hands on a <b>Minix Neo X8-H</b> TV Box, along with an <b>M1 airmouse</b>, courtesy of Minix, with the aim of porting Linux to it (<b>Amlogic Quad-Core</b> processor this time).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-edzDTaMTHxY/U5cGC7S-AKI/AAAAAAAABog/rax0njgHNlk/s1600/20140526183918754.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-edzDTaMTHxY/U5cGC7S-AKI/AAAAAAAABog/rax0njgHNlk/s1600/20140526183918754.jpg" height="400" width="370" /></a></div>
<br />
<h3>
First impressions</h3>
<br />
I won't bother you with the specs, which you can review at <a href="http://www.minix.com.hk/Products/MINIX-NEO-X8-H.html" target="_blank">Minix' X8-H product page</a>. However, from a subjective point of view I can say <b>Android 4.4 Kitkat feels pretty fast</b> and stable and, despite the youth of this processor, I haven't run into any problems while using it.<br />
<br />
However nobody should be surprised here, since <b>Minix was the one that <a href="http://minixforums.com/threads/official-minix-4-4-2.4348/#post-39322" target="_blank">honestly repudiated</a></b><a href="http://minixforums.com/threads/official-minix-4-4-2.4348/#post-39322" target="_blank"> releasing</a> for its devices <b>the embarrassingly fake "Android Kitkat Betas"</b> that plagged chinese <b>Rockchip</b> sticks at the beginning of this year.<br />
<br />
<br />
<a href="http://1.bp.blogspot.com/-wNI08D7muGw/U5cI7qMDpCI/AAAAAAAABos/toFvFBukzpg/s1600/MINIX-Neo-X8-and-Neo-X8s-3.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://1.bp.blogspot.com/-wNI08D7muGw/U5cI7qMDpCI/AAAAAAAABos/toFvFBukzpg/s1600/MINIX-Neo-X8-and-Neo-X8s-3.jpg" height="200" width="167" /></a>One thing that I found immature though was the <b>H/W video decoding</b>, since using MX Player I was absolutely<b> unable to avoid seeing the subtitles in MKV movies</b>, no matter how many forced/unforced subtitles checkmarks I removed. This does not happen when using a Rockchip TV box, so a newer Amlogic firmware should have to fix this.<br />
<br />
<br />
The <b>M1 airmouse is small</b>, looks <b>slick</b>, and has an <b>accurate</b> response, I really like it.<br />
<br />
However, when I removed the USB receiver from the X8-H, I found myself with the plastic cap in one hand and the electronic PCB still connected to the USB port... so better <b>handle it with care</b>.<br />
<br />
<br />
<br />
<br />
<h3>
The serial console</h3>
<br />
That said and, after fellow <b>developer <a href="http://www.omegamoon.com/blog/" target="_blank">Omegamoon</a> dared open it first and find the UART</b> pins, I went about to do the same since, as you may already know, the UART (or serial console) is necessary for first tinkering with ROMs/Linux, due to being the <b>place where all debug output is dumped to</b>, way <b>before you get anything on screen</b>. And, of course, no kernel compilation works the first time, at least not for me :P<br />
<br />
Apart from that, and until flash reading/writing through USB from a PC Linux is provided with tools by Amlogic, the <b>best way to flash and reflash this device is to use the "u-boot" bootloader</b>, through the serial console. U-boot is what runs after power-on but just before any kernel, Android or Linux, is loaded. In fact, <b>u-boot is in charge of loading the kernel</b>.<br />
<br />
Hitting Enter on the serial console while the X8-H boots is enough to get a u-boot prompt instead of booting to Android.<br />
<br />
<br />
<br />
<h3>
PCB inside Neo X8-H</h3>
<br />
Just as its <a href="http://hwswbits.blogspot.com/2014/01/hacking-into-minix-neo-x7.html" target="_blank">smaller brother, the Neo X7</a>, the internals of this device boasts quality. And you may say: Why?<br />
<br />
Well, let me recount a few items that you will NOT find on other cheap TV boxes that usually suffer from reboots in the middle of your favorite movie:<br />
<br />
- The <b>processor</b> has a <b>large heatsink of quality metal</b> on it (instead of crappy tapes)<br />
- The <b>memory</b> has that <b>large heatsink</b> also over it. What? The memory also has a heatsink!<br />
- The <b>large heatsink has another heatsink on top</b> of it! What? Yes, attached to the top of the box!<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-hDhDxMalcGA/U5cNueZZFKI/AAAAAAAABo4/ugi8wAhvDvg/s1600/Minix_X8H_PCB.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-hDhDxMalcGA/U5cNueZZFKI/AAAAAAAABo4/ugi8wAhvDvg/s1600/Minix_X8H_PCB.jpg" height="588" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Minix Neo X8-H PCB</td></tr>
</tbody></table>
<br />
Not enough?<br />
- There is an <b>embedded battery</b> to keep the <b>RTC</b> time while powered off<br />
- Count the number of <b>capacitors</b>, coarsely that's a <b>major plus for stability</b>.<br />
- They even soldered <b>pins for the UART</b> serial console!! (bottom left)<br />
<br />
Yes, the UART pins are right there for us tinkerers:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-Lnqjv5G6Gu0/U5cOsa30LRI/AAAAAAAABpE/QD9KUdqrdoY/s1600/Minix_X8H_PCB_UART.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-Lnqjv5G6Gu0/U5cOsa30LRI/AAAAAAAABpE/QD9KUdqrdoY/s1600/Minix_X8H_PCB_UART.jpg" height="256" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">UART RX/TX pins plus power pins</td></tr>
</tbody></table>
<br />
<br />
So, with just a 3 pin [low-profile] connector broken in two, I was able to get them out:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-c4YoQDGAopc/U5cPrqX_aeI/AAAAAAAABpY/_WAfPaSq70o/s1600/Minix_X8H_PCB_UART2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-c4YoQDGAopc/U5cPrqX_aeI/AAAAAAAABpY/_WAfPaSq70o/s1600/Minix_X8H_PCB_UART2.jpg" height="279" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Black for Ground, Red for X8H's TX, Blue for RX.</td></tr>
</tbody></table>
<br />
With a rather ugly cutout at the back of the box (upssss):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-6RSWP9AHowQ/U5cPrn9Z-SI/AAAAAAAABpU/S23o1sS9O-8/s1600/Minix_X8H_PCB_UART3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://1.bp.blogspot.com/-6RSWP9AHowQ/U5cPrn9Z-SI/AAAAAAAABpU/S23o1sS9O-8/s1600/Minix_X8H_PCB_UART3.jpg" height="320" width="269" /></a></div>
<br />
<br />
<br />
And, finally, connecting it to my PC through a Serial2USB board, the <b>full boot log</b> was available, including <b>access to the u-boot console</b> (<a href="http://pastebin.com/ZPeWTzBx" target="_blank">boot log here</a>).<br />
<br />
<br />
<br />
<br />
<h3>
Quick tests</h3>
<br />
The <b>u-boot version</b> is reported as this bizarrerie: U-boot-00001-g473771c-dirty<br />
As far as I know it should be the year followed by the version within that year, so I guess <b>somebody must have changed it</b>, obscuring the source code it's based on.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-pF0nNG6sITo/U5cUSqvnXhI/AAAAAAAABpk/r5SfriGNTm4/s1600/20140610_X8H_uboot_log.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="http://2.bp.blogspot.com/-pF0nNG6sITo/U5cUSqvnXhI/AAAAAAAABpk/r5SfriGNTm4/s1600/20140610_X8H_uboot_log.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">u-boot log on Minix Neo X8-H</td></tr>
</tbody></table>
<br />
Once booted, Android reports <b>kernel version 3.10.33</b>, which is the latest one <a href="openlinux.amlogic.com:8000/download/ARM/" target="_blank">openly provided by Amlogic</a>, and which, after some comparisons I believe is <a href="http://releases.linaro.org/14.03/components/kernel/linux-linaro-stable-lsk/" target="_blank"><b>based on Linaro Stable Kernel tree</b></a> for Android, which currently has the same version.<br />
<br />
<b>Unfortunately</b>, I have found a few of the same device-specific <b>kernel source modifications</b> by Amlogic people, so typical of Rockchip kernels. That is <b>ugly, prevents mainlining</b> (using the official kernel and easily updating it), and is really badly looked upon.<br />
<br />
<br />
On the<b> bright side, this kernel is</b> very modern and, magnificently, it is <b>device-tree based</b>.<br />
<br />
What's that you say? Well, a <a href="http://xillybus.com/tutorials/device-tree-zynq-1" target="_blank">device-tree file</a> would allow you to <b>use the very same kernel</b> (no recompiling ever!) <b>among all devices</b> using, at least, the same Amlogic processor.<br />
You just need to flash a different device-tree file! It's like an <b>index telling the kernel what does the box in question have</b> inside and where to find it.<br />
<br />
<b>Previously, on the dark ages that Rockchip</b> sent us to, every vendor wildly modified the kernel source with its own, often buggy, little specifics, which caused an explosion of RK kernels everywhere, a chaos where you used a <b>different kernel for each device</b> and went crazy to keep them all up to date.<br />
<br />
<br />
<br />
I have done some quick tests like <b>extracting the device-tree</b> file. Here you can see the <a href="http://pastebin.com/yJbwxg4H" target="_blank">device-tree of Minix Neo X8-H</a>, which you can compare to the one <a href="http://www.cnx-software.com/2014/05/12/how-to-extract-a-device-tree-file-from-android-firmware-files/" target="_blank">posted by CNX-Software</a> for the <a href="http://pastebin.com/mDY2ejpk" target="_blank">Tronsmart Vega S89 device-tree</a>, it's interesting!<br />
<br />
<br />
Another thing I've done is test the <b>capabilities of u-boot</b>, like being a client for a <b>TFTP</b> server on my PC, where I plan to place my kernel compilations, to <b>download and flash to the Neo X8-H</b>, like in this example:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-BU0E-6MmF-E/U5cUSr6H9HI/AAAAAAAABpo/wjIpmUm93rw/s1600/20140610_X8H_uboot_tftp_test.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-BU0E-6MmF-E/U5cUSr6H9HI/AAAAAAAABpo/wjIpmUm93rw/s1600/20140610_X8H_uboot_tftp_test.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">u-boot getting new file for the X8-H from a TFTP server</td></tr>
</tbody></table>
<br />
I have been told that Minix may soon be releasing the source code its TV box is using, which is again one of the nice things we can expect from <a href="http://hwswbits.blogspot.com/2014/01/hacking-into-minix-neo-x7.html" target="_blank">Minix, who has already released it before</a>.<br />
<br />
Once that is done I'll go on to recompiling and trying to <b>get Linux into this beast</b>! Stay tuned for the instructions!<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Unknownnoreply@blogger.com14tag:blogger.com,1999:blog-6487105202596390783.post-8146174950438622442014-01-03T10:50:00.003+01:002014-01-03T11:10:44.484+01:00Hacking into the Minix Neo X7<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="" style="clear: both; text-align: justify;">
<br /></div>
<div class="" style="clear: both; text-align: justify;">
Recently, just in time for the holiday season, I have been testing and developing with a <b>Minix Neo X7</b> and its very handy <b>A2 airmouse</b>.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img border="0" height="320" src="http://1.bp.blogspot.com/-8goZDpqfisg/UsBXRkflcQI/AAAAAAAABlE/H28WRGra2t0/s320/VIANDTV-X7-216A_00001.jpg" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Minix NEO X7 TV box with RK3188 Quad-Core CPU and 2GB RAM<u><br /></u></td></tr>
</tbody></table>
<div style="text-align: center;">
</div>
<br />
<br />
This TV box is remarkable to me on the <b>outside</b> for the <b>quality of its finishes</b>, that do make it sturdy and good looking. On the <b>inside</b> there are some probably <b>good choices on the design</b>, namely:<br />
<br />
- A <b>quality Audio CODEC</b> (RT5616 that afaik is a Realtek ALC5616) instead of the usual cheap RK1000 shipped on most TV boxes.<br />
<br />
- A <b>well suited on-board Ethernet</b> MAC (Realtek RTL8152) as opposed to using the internal MAC of the RK3188, as is done by most other TV boxes, which are riddled with bugs (to list a just few of RK MAC's problems: quirks when connecting Ethernet directly to a PC, stops working on TV-box Linux restart, CPU shut-down upon serving heavy files over SAMBA, ...).</div>
<div class="" style="clear: both; text-align: justify;">
<br />
- An <b>on-board battery for the RTC</b> chip (real-time clock HYM8563 to keep the time even without network), which may be interesting for embedded projects with a Linux OS.</div>
<div class="" style="clear: both; text-align: justify;">
<br />
<br />
Also, as a less precisely statement, though <b>based on my electronics background</b>, just by looking at the X7 PCB one can find many <b>more capacitors than on most other devices</b>. This is maybe one of the most important good points of this box, since having those capacitors <b>means much more stability</b>, so that it is far less likely for it to hang/reboot while doing heavy duty stuff.<br />
<br />
Next time your Android stick/tablet/phone reboots, hangs, or throws you out of an app, think that more than half the times this is due to trimmed down capacitor count, while the rest of the times it's just buggy SW.<br />
<br />
<br />
<br /></div>
<div class="" style="clear: both; text-align: justify;">
<br />
<a href="http://4.bp.blogspot.com/-fL5QcaWAt1E/UsZ3UA7oR5I/AAAAAAAABlU/CzoLL-yxcGs/s1600/MINIX+Developer+Challenge+-+LOGO.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://4.bp.blogspot.com/-fL5QcaWAt1E/UsZ3UA7oR5I/AAAAAAAABlU/CzoLL-yxcGs/s200/MINIX+Developer+Challenge+-+LOGO.png" width="200" /></a>Apart from that, <b>Minix</b> has already <b>released twice their kernel sources</b>:<br />
<br />
- In September 2013, to well known developer phjanderson (<a href="https://github.com/phjanderson/Kernel-3188-X7" target="_blank">here</a>)<br />
<br />
- And then again in December 2013, for the <a href="http://minixforums.com/threads/minix-developer-challenge.3361/" target="_blank">MINIX Developer Challenge</a>, which by the way may be of interest to Android hackers and artists, since they offer <b>well rewarded prizes for the best UI</b> (up until Feb. 9, 2014).<br />
<br />
<br />
<br />
<br />
<br />
The practice of <b>respecting the GPL license</b> is something we, as an <b>open source community, value most</b> and certainly distinguishes one vendor from another.<br />
<br />
Think that, even for Android, <b>having kernel sources means an "explosion" of ROMs</b>, developers, and, generally, features such as safer overclocking, updates, fixes (i.e. Vsync screen fix), etc, without the irksome binary patching.<br />
<br />
However, if I could make <b>a wish, that would be the schematics</b> of this TV box, so we can know which CPU pins are connected to which pins of the many ICs on the board, so as to give an even better support for all its components.<br />
Please note that plain schematics are like the blueprint on hotel room doors, they don't disclose how the hotel was built, just how the rooms are set up.<br />
<br />
<br />
<h3>
Hacking the machine</h3>
<br />
1) First things first, you may want to <b>backup your recovery partition</b> (no need to backup the others, unless you have your data on it, since MINIX offers the latest stock ROMs on their site). For that we do the following:<br />
- Coonect the X7 to the power outlet (but don't press the power button yet) <br />
- Connect the X7 to the PC through its USB OTG MicroUSB connector<br />
- Carefully insert a clip into the "Recovery" pin hole (near the HDMI connector) until a pushbutton clicks, and keep it pushed.<br />
- Press the X7's Power button<br />
<br />
Then, upon doing a "lsusb" on the PC you'll see the <b>X7 in bootloader mode</b>, listed as a nameless USB device.<br />
<br />
You can check the partition table (as a list formatted like: partition_size@partition_offset(partition_name)) by issuing this command:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo ./rkflashtool r 0 1 | head -n 11</span></blockquote>
<br />
The <b>partition parameters</b> is what follows after mtdparts. On my X7's revision this looks like:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x00008000@0x00004000(kernel),0x00008000@0x00012000(boot),0x00010000@0x00020000(recovery),0x00020000@0x00030000(backup),0x00040000@0x00050000(cache),0x00800000@0x00090000(userdata),0x00002000@0x00890000(kpanic),0x00130000@0x00892000(system),-@0x009c5000(user)</span></blockquote>
<br />
So <b>backing up recovery</b> partition becomes (swapping size <=> offset):<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo ./rkflashtool r 0x20000 0x10000 > NEO_X7_recovery.img</span></blockquote>
<br />
<br />
2) Second step would be to <b>root Android</b>, so you can reboot to recovery (i.e. Linux) anytime. <b>Rooting the X7</b> is done <a href="http://hwswbits.blogspot.com/2013/09/root-rockchip-stickstablets-from-linux.html" target="_blank">as described in this post</a>.<br />
<br />
<br />
<br />
3) Now you want to compile your kernel with the options (.config) you prefer, just remember to use the <b>latest kernel source</b>, at the last line of the <a href="http://minixforums.com/threads/minix-developer-challenge.3361/" target="_blank">MINIX Developer Challenge announcement</a>.<br />
<br />
As a base for any hacking, the <b>stock Neo X7 config</b> is: /arch/arm/configs/box_3188_r2_defconfig<br />
<br />
To compile your own kernel you can follow this post: <a href="http://hwswbits.blogspot.com/2013/03/compiling-picuntu-kernel-ubuntu-linux.html" target="_blank">Generic Linux Kernel building for RK devices</a>.<br />
<br />
<br />
<br />
4) Last step is <b>flashing</b> your shiny <b>new kernel to the recovery</b> partition of the X7. This is done with the following two commands:<br />
<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo ./rkflashtool w 0x20000 0x10000 < recovery.img</span><br />
<span style="font-family: "Courier New",Courier,monospace;">sudo ./rkflashtool b</span></blockquote>
<br />
<br />
5) In order to <b>boot to Linux</b>, you just need to insert an SD card with your Linux RFS (<a href="http://hwswbits.blogspot.com/2013/11/your-own-official-linux-distro-in-sd.html" target="_blank">you can create your own RFS as described here</a>) and then, you can either use this <a href="https://play.google.com/store/apps/details?id=com.autorunlinux.android" target="_blank">excellent "Autorun Linux" app</a>, or install "Android Terminal Emulator" get inside it, type "su" and then "reboot recovery" every time.<br />
<br />
That's it, happy hacking!<br />
<br />
<br />
<br />
<br />
<h3>
Regarding Android 4.4 KitKat</h3>
<br />
Yesterday <a href="https://www.facebook.com/minixtech" target="_blank">Minix issued a brief message</a> regarding the recently announced, supposed, Android 4.4 support on some RK3188 devices from other vendors [that do not release their kernel sources].<br />
<br />
Since I have been myself, along with other well known developers in the RK Linux community, doing work on upgrading the RK kernel to newer versions (3.0.36+ is tremendously outdated), I can confirm Minix' point of view, that the <b>supposed 4.4 support by those other vendors is indeed FAKE</b>.<br />
<br />
The leaked 4.4-supporting kernel is the same old 3.0.36+ kernel with just some drivers in different structures/places and the bare minimum to trick Android 4.4 into believing it is running a newer kernel.<br />
Naturally this is a recipe for <b>bad outcomes, instability and developer support dispersion</b>.<br />
<br />
It kinda feels like those MicroSD cards that are labelled 8 GB but are internally just 4 GB...<br />
<br />
So, I really look forward to the official release of a real Android 4.4 and its kernel sources. Until then I think we are better off with a nice theme in our current and more stable Android Jelly Bean.<br />
<br />
<br /></div>
<br />Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-6487105202596390783.post-32299396251172533162013-12-01T14:46:00.001+01:002013-12-01T22:56:10.736+01:00OpenSUSE for Rockchip ARM devices<br />
<br />
Going on with the earlier post on creating <a href="http://hwswbits.blogspot.com/2013/11/your-own-official-linux-distro-in-sd.html" target="_blank">your own MicroSD with the Linux RFS </a>of your preference, here is the howto for installing OpenSUSE using the usual kernel and modules+firmware.<br />
Just in case, <b>whatever your stick/box</b>, you can use these very generic 3.0.36+ <b>kernels</b> for <a href="http://hwswbits.blogspot.com/2013/05/unofficial-new-3036-kernel-for-picuntu.html" target="_blank">RK3066</a> or <a href="http://hwswbits.blogspot.com/2013/10/booting-linux-on-radxa-rock.html" target="_blank">RK3188</a> (only missing internal Wifi).<br />
<br />
In my case I used the excellent <a href="http://radxa.com/specification/" target="_blank">Radxa Rock board</a>, equipped with a quad-core RK3188, for the tests and found no problem booting it:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="http://2.bp.blogspot.com/-QigF2YKrxnw/Ups05mDYTkI/AAAAAAAABkU/-thyIs0yrfg/s1600/Screenshot+-+011213+-+12:33:42.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="http://2.bp.blogspot.com/-QigF2YKrxnw/Ups05mDYTkI/AAAAAAAABkU/-thyIs0yrfg/s400/Screenshot+-+011213+-+12:33:42.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">OpenSUSE on Rockchip RK3188 (Radxa Rock board)</td></tr>
</tbody></table>
<br />
<div>
</div>
<br />
<br />
Of course, this has been made possible by <a href="http://en.opensuse.org/Portal:ARM" target="_blank">OpenSUSE team's commitment to the ARM architecture</a>, since they are one of the few that have put all the necessary efforts to have their distribution compiled for ARM CPUs.<br />
<br />
OpenSUSE's official wiki has one page dedicated to installing on a RK3066 device (MK808 [1]), though it is outdated since, among other things, it uses the old 3.0.8 kernel. However the guide was useful and I wanted to update it here.<br />
<br />
<br />
Now the procedure, with the same captions as in the original post (<a href="http://hwswbits.blogspot.com/2013/11/your-own-official-linux-distro-in-sd.html" target="_blank">for Linaro Ubuntu</a>), for comparison:<br />
<br />
<br />
<br />
<b><u>Getting an up-to-date official distribution, for ARM</u></b><br />
<br />
You can check the latest ARM distribution at OpenSUSE by heading to this url:<br />
<a href="http://download.opensuse.org/ports/armv7hl/distribution/openSUSE-current/images/">http://download.opensuse.org/ports/armv7hl/distribution/openSUSE-current/images/</a><br />
<br />
and downloading the "rootfs" suffixed .tbz file, which at the time of writing (Dec 2013) is this one:<br />
<a href="http://download.opensuse.org/ports/armv7hl/distribution/openSUSE-current/images/openSUSE-12.3-ARM-XFCE-rootfs.armv7l-1.12.1-Build49.1.tbz">http://download.opensuse.org/ports/armv7hl/distribution/openSUSE-current/images/openSUSE-12.3-ARM-XFCE-rootfs.armv7l-1.12.1-Build49.1.tbz</a><br />
<br />
<br />
<br />
<br />
<b><u>Getting the RFS into the MicroSD card (or flash)</u></b><br />
<div>
<br />
Exactly the very same procedure as in <a href="http://hwswbits.blogspot.com/2013/11/your-own-official-linux-distro-in-sd.html" target="_blank">original post</a>, except that steps 4 and 6 are NOT to be done, and step 3 becomes:<br />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 15px; line-height: 20px;">3) Extract the downloaded ARM RFS in it:</span><br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">tar xjfv /home/username/Downloads/openSUSE-12.3-ARM-XFCE-rootfs.armv7l-1.12.1-Build49.1.tbz </span></blockquote>
<br />
<br />
And <b>this last step is necessary</b> (or else the root file system is mounted as read-only, preventing correct boot), open the /mnt/whatever_folder/etc/fstab in your linuxroot and add the following first line:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">/dev/root / ext4 defaults,noatime 0 0</span></blockquote>
<br />
<br />
<br />
<u><b>Getting a desktop environment</b></u><br />
<br />
You already have it. However I've found a problem: upon opening the "Install/Remove Software" you will likely stumble upon this fatal error:<br />
<br />
<blockquote class="tr_bq">
"UI Syntax error. Couldn't load plug-in gtk-pkg. Check the logfile"</blockquote>
Solution is simple [2], open a terminal and type:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">su -c "zypper in libyui-gtk-pkg4"</span></blockquote>
You'll be asked the root's password and the missing package installed, so now you can open the Install Software app.<br />
<br />
<br />
Enjoy!<br />
<br />
<br />
<br />
<br />
References:<br />
[1] http://en.opensuse.org/HCL:MK808<br />
[2] http://forums.opensuse.org/english/get-technical-help-here/applications/487505-opensuse-samsung-arm-chromebook-almost-works.html#post2561668<br />
<br /></div>
Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-6487105202596390783.post-27716239189513462242013-11-27T07:18:00.001+01:002013-12-01T22:57:11.944+01:00Your own official Linux distro in a SD card (for ARM)Currently for us, owners of ARM devices of the Rockchip family (though <b>this post applies to any ARM CPU</b>), when wanting to <b>boot Linux</b> we have to do two things:<br />
<br />
1) <b>Flash</b> a Linux <b>kernel</b>, usually to recovery, in order to be able to boot to Linux<br />
2) Copy a <b>Linux Root File System</b> (RFS) <b>into a MicroSD</b> card for the OS to boot from<br />
<br />
This post is about Step 2.<br />
<br />
<br />
<br />
<h3>
Why can't we use official distributions?</h3>
<br />
Basically because <b>most distros are [easily] available for x86 CPUs</b> (x86, amd64, ...), <b>not ARM CPUs</b> (armel, armhf). And then, when you find it compiled for ARM, there are some little extras to be done, like copying your kernel's modules into it, and throwing it all into a MicroSD card.<br />
<br />
<b>Hence, we are currently forced to choose among static RFS</b> that fellow developers have made available and can update only on their free time, which isn't much. These are:<br />
<br />
- Picuntu, from Alok Sinha<br />
- Ubuntu 12.10 RFS, from linuxium <br />
- Home.io, from JustinTime4Tea<br />
<br />
<br />
<b>These RFS are all just the Ubuntu distribution, sometimes with a different name</b> (Xubuntu in the case of Picuntu, Ubuntu in the case of Home.io), though they usually include extras like:<br />
<br />
- The modules (drivers) for many devices (needed for many, but not all, USB gadgets)<br />
- The <a href="http://hwswbits.blogspot.com/2013/04/flash-on-picuntu-linux-arm.html" target="_blank">Flash video ARM support solution I posted here</a><br />
<br />
However let's face it, <b>you are forced to use Ubuntu</b>, and then <b>you depend on the maintainer's free time to grab the latest version</b> of Ubuntu, add the above extras and publish it so you can use it.<br />
<br />
<br />
<br />
<h3>
Your own Linux distribution's RFS</h3>
<br />
Here <b>I am going to show how to create your own RFS</b> by grabbing whatever version of Ubuntu (and with few changes any other distro, like Arch Linux, <a href="http://hwswbits.blogspot.com/2013/12/opensuse-for-rockchip-arm-devices.html" target="_blank">OpenSUSE</a>, CentOS, just click on the link to be taken to the specific distro's instructions), and create a RFS <b>to use on a MicroSD card to boot Linux</b> your ARM stick/box. <b>Or to flash</b> the same RFS into your device's <b>Nand Flash chip and avoid the SD card</b> altogether.<br />
<br />
<br />
<br />
<br />
<u><b>Getting an up-to-date official distribution, for ARM</b></u><br />
<br />
The first thing is <b>getting the Linux distribution</b> (all the programs that make up your booted up Linux: from the "ls" commandline, to the GNOME desktop and the LibreOffice suite) <b>already compiled for ARM devices</b>, instead of the usual x86 for PCs.<br />
<br />
This is not difficult since, actually, <b>Linaro is doing just that</b>!<br />
If you want a <b>desktop environment</b> (XFCE, Gnome, KDE, etc.) <b>you have two options</b>:<br />
<br />
<b>Option 1) Easy way</b>: (Older version but everything done) Head over to:<br />
<blockquote class="tr_bq">
<a href="http://www.linaro.org/downloads/">http://www.linaro.org/downloads/</a></blockquote>
Look for "Ubuntu Desktop" in the "Developers and Community Builds" section and click on any of the boards that support it on the right (Origen, Panda, etc. doesn't matter). At the time of writing (Nov 2013) this will redirect you to this page:<br />
<blockquote class="tr_bq">
<a href="http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop">http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop</a></blockquote>
So the <b>latest version with the desktop already installed is Ubuntu 12.11</b>, you'll have to install this one in your SD and upgrade to the latest version after booting. <b>Download</b> the biggest .tar.gz file, in my case <b>473 MB</b> of:<br />
<blockquote class="tr_bq">
<a href="http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20121124-560.tar.gz">http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20121124-560.tar.gz</a></blockquote>
<b>Option 2) Manual way</b> (Newer version, but starts with a commandline Linux): You<b> can get the cutting edge latest version</b> of Ubuntu, it will be small and fast but you'll have to type a few more commands, after booting it, in order to install a desktop. Go here:<br />
<blockquote class="tr_bq">
<a href="http://releases.linaro.org/">http://releases.linaro.org/</a></blockquote>
And click in the folder link of the latest version number ("13.11" for me). A new page appears where you have to select "ubuntu", in the next page select the link that ends in "-images" (prefix depends on Ubuntu's version name, in this case it's "raring-images"), and finally <b>select the version link</b> that you want (<b>nano / developer / server</b>) to <b>get its .tar.gz file</b>.<br />
<br />
<b>All three are the same Linux but each one with different sets of packages already installed</b>. They are:<br />
<br />
- <b>nano (around 50 MB)</b> gives you a command-line with very very few things (not even a vi/vim/nano editor!), with this version you'll need a network connection (care for /etc/network/interfaces and such) soon enough, to start cranking "apt-get install" for all the little apps.<br />
<br />
- <b>developer (around 140 MB)</b> a usable command-line with most things you'll need to comfortably start working and changing whatever configuration. However, IMHO, it includes many packages for software development, while lacking some others more typical of a generic user system.<br />
<br />
- <b>server (around 130 MB)</b> a usable command-line <b>with all you need for a quick setup of a desktop environment resembling a PC with Ubuntu</b>. Even if you are a developer you can later install all the packages you need. <b>This is the one I recommend.</b><br />
<br />
N.B.: Compare the *.packages files to get a glimpse for yourself of what's inside each version.<br />
<br />
So, following the recommendation we would <a href="http://releases.linaro.org/13.11/ubuntu/raring-images/server/linaro-raring-server-20131124-562.tar.gz" target="_blank">download this file for the latest Ubuntu 13.11</a> (Nov 2013, or else go into the page above and get yourself the latest and very best.<br />
<br />
<br />
<br />
<br />
<u><b>Getting the RFS into the MicroSD card (or flash)</b></u><br />
<br />
First of all <b>introduce the MicroSD</b> card into your PC <b>to partition it</b> in the way that the kernel expects it (<b>please don't use partition utilities</b>, they won't do it!).<br />
<br />
Let's say that the MicroSD appears at the folder "/mnt/whatever_folder", then type the following command to know the device name:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">df -h | grep whatever_folder</span></blockquote>
You should see a line somewhat like this:<br />
<blockquote class="tr_bq">
/dev/sdg1 7,3G 612M 6,4G 9% /mnt/whatever_folder</blockquote>
Now that we know the MicroSD is in "/dev/sdg" (remove the number!!) unmount the MicroSD:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo umount /mnt/whatever_folder</span></blockquote>
And <b>the most important step to avoid later problems</b>: partition & format in this one step:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">mkfs.ext4 -F -L linuxroot /dev/sdg</span></blockquote>
Which <b>labels it "linuxroot" and at "/dev/mmcblk0", where the kernel expects it</b> (CMDLINE), instead of where a partition tool would place it (at "/dev/mmcblk0p1").<br />
<br />
<blockquote class="tr_bq">
SIDE-NOTE <u>ONLY FOR USING INTERNAL FLASH INSTEAD OF A MICROSD</u>:<br />
If you want your RFS to be in your device's Flash chip, and 1) have flashed the right parms, 2) have a kernel with the right CMDLINE for those parms, 3) the kernel has an initramfs.cpio with rknand...ko, then the you have to format it with this command: "mkfs.ext4 /dev/mtdblock0" (mtdblock number is that of your [big] partition).</blockquote>
<br />
It may take a couple minutes and when finished <b>you should mount it</b> and start following these steps:<br />
<br />
1) Become root (necessary to keep file permissions in the RFS!)<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sudo su -</span></blockquote>
2) Go to the folder where the SD card (or flash) is mounted:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">cd /mnt/whatever_folder</span></blockquote>
3) Extract the downloaded ARM RFS in it:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">tar xvfz /home/username/Downloads/linaro-raring-server-20131124-562.tar.gz</span> </blockquote>
4) Since the Linaro .tar.gz contains the RFS inside a folder named "binary", we
have to move its contents to the real root of the SD card and then remove the, now empty, "binary" folder:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">mv binary/* .<br />rmdir binary </span></blockquote>
5) <b>If you are</b> doing this process <b>on a PC</b>, you have to uncompress the modules+firmware file (that came with the kernel you flashed into your stick) into the "/mnt/whatever_folder/lib/" folder.<br />
<br />
<br />
Or, <b>if you are on an ARM stick</b>, you can just <b>copy your own modules (drivers) and firmware</b> to the new RFS so you have everything from the beginning:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">mkdir ./lib/modules</span><br />
<span style="font-family: "Courier New",Courier,monospace;">cp -R /lib/modules/* ./lib/modules</span><br />
<span style="font-family: "Courier New",Courier,monospace;">cp -R /lib/firmware/* ./lib/firmware</span></blockquote>
And it won't hurt to copy the <b>library for playing Adobe Flash videos</b> (think YouTube) in ARM (and all the Flash ads and websites, of course):<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">cp /usr/lib/libpepflashplayer.so ./usr/lib/</span></blockquote>
If you didn't have it, follow <a href="http://hwswbits.blogspot.com/2013/04/flash-on-picuntu-linux-arm.html" target="_blank">this quick post</a>.<br />
<br />
<br />
6) You may also want to "touch" certain files to make sure networking works out of the box. For example, if you have an Ethernet connection in your ARM device, then modify the /mnt/whatever_folder/etc/network/interfaces file to add these lines:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">auto eth0</span><br />
<span style="font-family: "Courier New",Courier,monospace;">iface eth0 inet dhcp </span></blockquote>
7) It's always a good idea to end operations with this command (to <b>finish all write operations</b>):<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">sync</span></blockquote>
<br />
<b>You can unmount that MicroSD, because it's ready to boot</b>. If you installed the desktop version the easy way, that's it.<br />
However, if you installed a trimmed commandline version the manual way, you should continue reading the following section.<br />
<br />
<br />
<br />
<h3>
Getting a desktop environment</h3>
<br />
Once you <b>boot your device with the created MicroSD card</b>, your first task is to <b>check the network connection</b>. For example type:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">apt-get update</span></blockquote>
If the <b>software repositories start updating</b>, you're good to go. If there is no connectivity: Internet is full of Q&A about networking in Linux :)<br />
<br />
Now, with Internet on, in order to<b> install a desktop environment</b>, in my case XFCE (the one used in Xubuntu), I would just type this:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">apt-get install xubuntu-desktop</span></blockquote>
And when asked, say Yes to downloading >400 MB of packages that will use up >1 GB of space when installed, but will land me on the <b>very latest desktop environment for an ARM PC</b>, whatever your CPU (Rockchip, Allwinner, Samsung, ...).<br />
<br />
<br />
<br />
<br />
Sorry if it took too long to explain something that is actually simple, but everybody is welcome!<br />
The more users discover that <b><a href="http://hwswbits.blogspot.com/2013/10/booting-linux-on-radxa-rock.html" target="_blank">a tiny and cheap stick/TV-box</a> is actually a full-fledged low to mid-end PC</b> (without the noise, size, <a href="http://hwswbits.blogspot.com/2013/03/rk3066-measy-u2c-stick-power-consumption.html" target="_blank">and the Watts!</a>), the better for all!<br />
<br />
<br />Unknownnoreply@blogger.com34tag:blogger.com,1999:blog-6487105202596390783.post-32516621345256523532013-11-19T19:24:00.004+01:002013-11-19T19:41:39.854+01:00Linux on UG008 TV Box (RK3066)I was looking for the <b>cheapest</b> Rockchip device with <b>external Wifi antenna and/or Ethernet connection</b>, just to find both capabilities in the <b>UG008</b> TV Box, a RK3066 (dual core) device at <a href="http://www.geekbuying.com/item/UG008-Google-TV-Box-RK3066-1G-4G-HDMI-AV-output-314507.html" target="_blank">just <b>55 USD</b> (shipping included).</a><br />
<br />
After purchasing it and a quick delivery of 2 weeks to Europe, I set out to test it, since I worried it may be lagging behind the newer 4 core experience with the RK3188 CPUs.<br />
<br />
The TV box surprised me being very small, at 7.5cm x 7.5cm and <b>looking really slick and solid</b>. I was glad to see <b>Android feels zippy</b>.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-F6qat4wnIVc/UouniHxUgNI/AAAAAAAABkA/E5qZf2jQbmg/s1600/UG008.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://4.bp.blogspot.com/-F6qat4wnIVc/UouniHxUgNI/AAAAAAAABkA/E5qZf2jQbmg/s320/UG008.jpg" width="295" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Small and cheap UG008 TV Box (wifi antenna is also just 7 cm)</td></tr>
</tbody></table>
<br />
<br />
So, hacking started:<br />
<br />
1) <b>Backup internal flash</b>: The recovery button is at a tiny hole in one side, near the front. The only quirk here is that you insert a clip there and <b>stay pressing the recovery button</b>, plug the MicroUSB from the PC to the TV box and then: you <b>also have to press a couple of seconds the power button</b>, before you can release the recovery.<br />
<br />
A red light appears around the MicroUSB slot, and on your [Linux] PC you can type "lsusb" and find a nameless device (for my PC's buses/devices, it is: "Bus 002 Device 004: ID 2207:300a "), the 2207:300a ID is what matters, that is our UG008.<br />
<br />
First's first, the "partition table", extracted with:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r 0 1 | head -n 11</span></blockquote>
looks like:<br />
<blockquote class="tr_bq">
CMDLINE: console=ttyFIQ0 androidboot.console=ttyFIQ0 init=/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x00006000@0x00004000(kernel),0x00006000@0x0000A000(boot),0x00008000@0x00010000(recovery),0x00120000@0x00018000(backup),0x00040000@0x00138000(cache),0x00300000@0x00178000(userdata),0x00002000@0x00478000(kpanic),0x00120000@0x0047A000(system),-@0x0059A000(user)</blockquote>
We go one by one backing them up into our PC (you can safely leave out some, like user, cache, kpanic), just remember for the rkflashtool command you have to swap the hex numbers above.<br />
<br />
For example to backup recovery (to flash our Linux kernel on it), which is listed above as "0x00008000@0x00010000(recovery)", you'd do:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r 0x10000 0x8000 > UG008_recovery.img</span></blockquote>
<br />
2) <b>Rooting UG008</b>: Once we are done with that, we should root the device (even if just for the sake of being able to dual boot Android or Linux), the <a href="http://hwswbits.blogspot.com/2013/09/root-rockchip-stickstablets-from-linux.html" target="_blank">rooting procedure is fairly standard and described here</a>. If you only want Linux on the box, you don't need to root it, keep reading,<br />
<br />
<br />
3) <b>Flash Linux kernel</b>: You have two options depending on what you want:<br />
<br />
a) <b>Dual Boot Android/Linux</b>: This is the usual way, you want to flash the recovery partition. I've found this box to be a close relative of the Measy U2C, for which I published several <a href="http://hwswbits.blogspot.com/2013/05/unofficial-new-3036-kernel-for-picuntu.html" target="_blank">recovery kernels that are compatible with UG008</a>, you'd be missing Wifi (RK901) and Ethernet. Flashing being just:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool w 0x10000 0x8000 < recovery.img</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool b</span> </blockquote>
<br />
If you're into working your way around, it should be easy to add the connectivity. Wifi with RK901 has been supported in Linux sticks for some time already (though I never bothered to check myself, being used to wired LAN), and Ethernet should require only to enable this .config options before building your kernel: CONFIG_NET_ETHERNET and CONFIG_RK29_VMAC.<br />
<br />
<a href="http://hwswbits.blogspot.com/2013/03/compiling-picuntu-kernel-ubuntu-linux.html" target="_blank">Generic Linux Kernel building for RK devices is described here</a>. Just remember this is a RK3066 device, so don't compile it for RK3188! The audio codec is the <a href="http://hwswbits.blogspot.com/2013/04/rockchip-rk1000-s.html" target="_blank">well known RK1000</a>.<br />
<br />
Now, in order to boot to Linux from Android you can use this <a href="https://play.google.com/store/apps/details?id=com.autorunlinux.android" target="_blank">excellent "Autorun Linux" app</a>, or install "Android Terminal Emulator" get inside type "su" and then "reboot recovery" every time.<br />
<br />
<br />
b) <b>Only Linux (remove Android)</b>: Very legitimate. Using the <a href="http://hwswbits.blogspot.com/2013/05/unofficial-new-3036-kernel-for-picuntu.html" target="_blank">same recovery kernel as above</a>, the flashing procedure is <a href="http://hwswbits.blogspot.com/2013/10/booting-to-linux-instead-of-android.html" target="_blank">all explained here</a> (but follow the instructions for flashing "boot" partition, instead of "kernel" partition, since you are using a recovery kernel). The boot writing (after you back up that partition!!) can be done with this command:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool w 0xA000 0x6000 < recovery.img</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool b</span> </blockquote>
<br />
<u>Note:</u> I haven't tested the "Only Linux" approach on my UG008, though it should work, or else you can always flash again your backed up stock partition and be back where you started.<br />
<br />
<br />
<br />
4) <b>Booting Linux</b>: Insert your usual MicroSD card with Linux root file system (rfs) and you're good to go.<br />
<br />
<br />
Any questions, and polite criticism is welcome in the comments below. I hope this post helps!<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-6487105202596390783.post-38550938926920288112013-10-23T03:34:00.002+02:002013-10-25T18:09:18.978+02:00DIY NAS with a RK3188 device (Radxa Rock)I currently have a <b>full-blown Linux PC noisy tower serving 3 SATA hard disks</b> full of multimedia as a home server... that is some <b>80 Watts of power consumption, plus the noise</b>, for just a few hours of use per week.<br />
<br />
There must be a <b>better solution for my home network file-sharing</b> (also called NAS) needs!<br />
<br />
So, come the <b>Radxa Rock board</b>, equipped with a <b>Quad Core</b> ARM CPU, the Rockchip <b>RK3188</b>, and <b>2 GB RAM</b>, quite a beast actually (I'm currently blogging from it, and use it for almost all my PC needs).<br />
<br />
And here is <b>today's proof-of-concept RK3188 NAS</b> happily <b>serving files</b> from my desk:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-1my6w29CB1k/UmcTclHh-kI/AAAAAAAABi8/pgPYu0ssPH0/s1600/NAS_radxa.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="265" src="http://1.bp.blogspot.com/-1my6w29CB1k/UmcTclHh-kI/AAAAAAAABi8/pgPYu0ssPH0/s400/NAS_radxa.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">1st rev.: RK3188 functioning as NAS home fileserver (using Radxa Rock board)</td></tr>
</tbody></table>
<b>UPDATE:</b><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-23r8FD-sO18/UmqQgC0GdSI/AAAAAAAABjw/kmpnYCwGthg/s1600/S1360021v.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="318" src="http://3.bp.blogspot.com/-23r8FD-sO18/UmqQgC0GdSI/AAAAAAAABjw/kmpnYCwGthg/s400/S1360021v.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">2nd rev.: Radxa Rock as a 3 hard disks NAS (11W idle, 33W with 2 disks streaming)</td></tr>
</tbody></table>
<br />
Now, if you want to bear with me on the <b>technical side</b>... I've been doing the <b>math about data bandwidths</b> for some time already and taken into account the <b>Rockchip</b> datasheet briefs to guess the <b>best I/Os</b> for the task:<br />
<br />
<br />
<h3>
<b>Hard disk interface:</b></h3>
<br />
Let's face it, Rockchip SoCs don't have SATA ports, and other <b>ARM SoC have at most one SATA port</b>, afaik, and that still means an <b>external power for the SATA device is necessary</b>. That is <u>not a solution for NAS</u>, unless you can fit everything in <u>just one hard disk</u>.<br />
<br />
So let's get over it and find the second best solution: <b>USB 2.0 ports are the highest bandwidth inputs</b> (to connect the hard disks). The Radxa Rock board has:<br />
<br />
- Two full sized USB 2.0 ports, and a third one in the pins of the expansion connector. All these ports are sharing, through an integrated hub, one single USB bus coming from the RK3188.<br />
- One Micro <b>USB 2.0 OTG port that is directly wired to the RK3188</b>.<br />
<br />
Ideally USB 2.0 would mean up to 480 Mbps raw throughput so, to get the best, we don't want to share it with other devices. Hence, we will be plugging our hard disk/s to the USB OTG port.<br />
<br />
Thankfully the market is full of external hard disk enclosures that do a very good job at converting <b>SATA to USB</b>. And let's see what that means:<br />
<br />
- SATA is currently doing 3 Gbps<br />
- USB 2.0 is "just" 480 Mbps, here is a bottleneck, certainly, but is it?<br />
<br />
<br />
<b><u>Why USB 2.0 is fine instead of SATA</u></b><br />
<br />
Does this sound like a let down? Really? Let's do the math:<br />
<br />
Are you going to be streaming 1080p content over Wifi? That really leaves you with <300 Mbps, and most probably <150 Mbps, if you can maintain that incredible wireless speed.<br />
<br />
But, let's see <b>what 150 Mbps really means</b> in today's high compression world:<br />
<br />
150 Mbps / 8 bits per byte = ~19 MB/s and let's say your content is a 1h30m long movie...<br />
19 MB/second * 90 minutes * 60 seconds/minute = <b>100 GB movie!</b><br />
<br />
Is your movie larger than that? Then this solution is clearly not for you. For the rest of the world, let's go on:<br />
<br />
You may rightly object: movies have well and bad compressed parts, fast action may mean a bandwidth spike!<br />
<br />
Well, you are right, and that's why multimedia players use a <b>technique called buffering!</b> This mostly <b>rids us of the problem</b>.<br />
<br />
So once we accept that it's OK to stream things at Megabit speeds, we may stop worrying about using SATA hard disks over USB.<br />
<br />
<b><u><br /></u></b>
<br />
<h3>
<b>Network interface:</b></h3>
<br class="Apple-interchange-newline" />
As I/O, the <b>Radxa Rock</b> board has an <b>integrated Fast Ethernet</b>, that is connected directly to the RK3188 (through the usual RMII PHY interface). This means 100 Mbps so... people with movies of >66 GB may stop reading now. ;-)<br />
<br />
For the sake of <b>this proof-of-concept, we will be using this 100 Mbps Ethernet</b> port, although a better solution would be to have a Gigabit Ethernet adapter attached to a full sized USB 2.0 port, which would give us up to 480 Mbps of actual bandwidth.<br />
<br />
<b>Do not share the USB OTG port with the hard disk/s!</b> The RK3188 (and the RK3066) has two physical USB 2.0 buses: the OTG and the "full sized", so use both as much as possible, instead of cramming all devices onto just one's bandwidth.<br />
<div>
<br /></div>
<div>
<br />
<br />
<br /></div>
<h3>
File-sharing Speed Testing:</h3>
<div>
<br /></div>
I am using a bare <a href="http://hwswbits.blogspot.com/2013/10/booting-linux-on-radxa-rock.html" target="_blank">Xubuntu Linux on the Radxa board</a> so it is possible to connect to the SATA hard disk through FTPS out of the box.<br />
<br />
The <b>SATA II hard disk</b> is in a external <b>USB 2.0 enclosure</b> and has a <b>1.5 TB NTFS partition</b> and we will be using a <b>FTPS server (slower than FTP)</b>. Not the best case for speed, but will let us see how well it can do on this not ideal setup.<br />
<br />
So, first of all, let's test how fast the RK3188 itself can read files from it, by running this command on the connected [but unmounted] drive:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo hdparm -t /dev/sda<br />/dev/sda:<br /> Timing buffered disk reads: 90 MB in 3.03 seconds = 29.74 MB/sec</span></blockquote>
The repeated <b>tests result always around and very close to 30 MB/second</b>. That is some 240 Mbps, or 50% the theoretical maximum USB 2.0 speed.<br />
Who is to blame? I fear in this case it's <b>my old USB2SATA's fault</b>, since doing the <b>same speed test on an i7 top of the line PC yields some 33 MB/s</b>.<br />
<br />
Good, more of a worst case then, so let's do real life tests with actual <b>multimedia files on the SATA disk served over Fast Ethernet by the</b> Radxa Rock <b>RK3188</b> board:<br />
<br />
<b>Streaming an 11 GB action movie (1080p) requires an average of 2 MB/s</b> and is perfectly watchable on the remote PC, as if it were a local file.<br />
<div>
<br /></div>
<b>Transferring a large file</b> over Ethernet to another PC <b>maintains a speed of 6.7 MB/s</b>, that is a bit over 50 Mbps.<br />
<br />
I've also tested <b>transferring a file from the MicroSD</b> card where Xubuntu runs, just to do a <b>test without USB</b> and SATA, the result is a <b>constant speed of 7.2 MB/s.</b><br />
<b><br /></b>
For the sake of completeness, I too have tried <b>this same raw transfer</b> (FTPS from MicroSD) <b>using a Gigabit Ethernet to USB</b> 2.0 adapter, the result is a <b>constant speed of 8 MB/s</b>.<br />
Better and more than enough for our purposes, but still below my expectations. Next thing will be to test with an FTP server, without the FTPS encryption burden!<br />
<br />
Further details about these tests: the "intermediary" is a Gigabit switch that has been thoroughly tested at 1 Gbps speeds.<br />
<br />
So it seems the <b>RK3188 is perfectly able</b> to cope with the task, even using a <b>heavy encrypted FTPS</b> <b>server</b>.<br />
<br />
<br />
<br />
<h3>
Conclusions for a faster NAS file-sharing solution</h3>
<br />
1) Use a <b>Gigabit Ethernet</b> to USB 2.0 adapter (and from a reliable source or you'll find yourself with a ridiculous USB 1.1 device able of <11 Mbps) and connect it to the full size USB port on your Rockchip board/stick.<br />
<br />
2) Set up a simple<b> FTP server</b> for file-sharing, that makes sure your RK3188 can concentrate on reading the hard-disks through USB and the network protocols, instead of the heavyweight encryption for the FTPS. Even if you go wireless, Wifi already encrypts everything on the air!<br />
<br />
3) Use Linux-friendly <b>EXT4 partitions</b>. NTFS is not bad, but will require more CPU to read/write (you'll see a process called "mount.ntfs" often). FAT what?<br />
<br />
4) If you want to have a <b>4-disk NAS</b> or even an 8-disks NAS, no problem! Just know you should still <b>plug them all</b>, through a USB hub, to the <b>same USB port</b>.<br />
<br />
5) And the final tip to make a nice NAS solution:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo hdparm -B 50 /dev/sda</span></blockquote>
This wonderful <b>command</b> at NAS startup will take care of <b>turning-off your hard disks when they are unused</b>, saving power and <b>hard-disk life</b>, while keeping a <b>100% silent</b> environment!<br />
<br />
<br />
<b>UPDATE:</b> If the drive answers with:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">HDIO_DRIVE_CMD failed: Input/output error<br /> APM_level<span class="Apple-tab-span" style="white-space: pre;"> </span>= not supported</span></blockquote>
<div>
Then try this similar command:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo hdparm -S 20 -K 1 /dev/sda</span></blockquote>
<div>
<br /></div>
<div>
(substitute /dev/sda in these commands with your actual /dev/sdX device)</div>
<br />
<br />
Next step: a quad hard-disk NAS solution based on Rockchip ARMs for all my file serving needs!<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com17tag:blogger.com,1999:blog-6487105202596390783.post-4402670515517498312013-10-16T04:30:00.002+02:002013-10-16T04:30:45.380+02:00Radxa Rock communicating with I2C devicesSince I'm a hardware tinkerer at heart, and <b>my background is more on electronics</b> than on software, the <b>Radxa Rock board</b> had a deeper interest for me.<br />
<br />
This board has a <b>lot of potential for all kind of low level electronics</b>, thanks to its two expansion headers:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-8Bog4zEY8YI/Ul3ynInRAiI/AAAAAAAABic/X4h45fw72hA/s1600/Radxa_Exp_Headers.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="245" src="http://3.bp.blogspot.com/-8Bog4zEY8YI/Ul3ynInRAiI/AAAAAAAABic/X4h45fw72hA/s640/Radxa_Exp_Headers.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Expansion Headers from Radxa Rock schematics</td></tr>
</tbody></table>
<br />
<br />
<br />
As you can see there are <b>two UARTs</b> (number 3 is shared with some GPS pins), <b>one I2C bus</b>, <b>two SPI buses</b> (SPI1 on J8 is shared with GPS pins), a full <b>24 bits LCD</b> display output (!!), <b>one USB port</b> (HOST_D*2), one audio Line In (LINE_L/R), as well as several other <b>GPIO</b> I/Os.<br />
<br />
<br />
<br />
I then set out to test my latest <a href="http://hwswbits.blogspot.com/2013/10/booting-linux-on-radxa-rock.html" target="_blank">kernel for booting Linux on the Radxa Rock</a> to access one of the, for me, most interesting low level hardware buses: I2C.<br />
<br />
This one is heavily used for low bandwidth (control/status, sensor data readings, EEPROMs, etc...) communications inter integrated circuits (I I C... I2C ;). This bus consists of just two lines: SCL (master clock) and SDA (bi-directional data), which makes it extremely handy.<br />
<br />
And for this test, a handy old friend of mine: the BMP085 pressure sensor (featured on <a href="http://hwswbits.blogspot.com/2012/09/eoc-bit-in-bosch-bmp085-i2c-registers.html" target="_blank">this blog's first post</a>) inside a little PCB with an<b> accelerometer chip, gyroscope chip, magnetometer compass chip, and our pressure and temperature sensor chip, the BMP085</b>.<br />
<br />
This is all called a 10-DOF or <b>Ten Degrees of Freedom sensor board</b>, since it allows for precise movement/position detection through "sensor fusion" (though I really dislike using nerdy "magic words").<br />
<br />
So first's first, I <b>wired the 10-DOF board to the Radxa's left expansion header</b> (J8) in the following manner:<br />
- PCB's VCC (5V) wired to J8 exp. header's pin 40 (DC5V)<br />
- PCB's GND wired to J8 exp. header's pin 39 (GND)<br />
- PCB's SDA wired to pin 32 (I2C0_SDA)<br />
- PCB's SCL wired to pin 31 (I2C0_SCL)<br />
<br />
<br />
The result looks like this:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-MlZh2jDavKc/Ul3ylwbWxfI/AAAAAAAABiU/pYZAdXxRMRo/s1600/Radxa_I2C_BMP085.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="http://1.bp.blogspot.com/-MlZh2jDavKc/Ul3ylwbWxfI/AAAAAAAABiU/pYZAdXxRMRo/s400/Radxa_I2C_BMP085.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Radxa Rock board bus I2C #0 connected to a 10 degrees-of-freedom sensor board</td></tr>
</tbody></table>
<br />
<br />
So, what to do to start communicating with the board? Well, since my kernel already has all the needed things built-in, you just have to follow these steps (shamelessly taken from <a href="http://www.instructables.com/id/Raspberry-Pi-I2C-Python/step4/Install-Necessary-Packages/" target="_blank">this guide</a>):<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">#install i2c-tools (user space) for talking to I2C buses/devices<br />sudo apt-get install i2c-tools<br />#insmod the I2C-dev module to allow user space access to I2C<br />sudo modprobe i2c-dev<br />#probe I2C bus 0, the one at expansion header J8<br />sudo i2cdetect -y 0</span></blockquote>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
The result of this last command is the possibly detected I2C devices on bus 0 (remember the 10-DOF board has 4 devices sharing the same bus). In our case we do know the <b>I2C address of the BMP085 (0x77)</b>, so we can talk to it directly.<br />
<br />
Since I know the calibration parameters of my device (see AC* at first screenshot in <a href="http://hwswbits.blogspot.com/2012/09/eoc-bit-in-bosch-bmp085-i2c-registers.html" target="_blank">this post</a>) and their addresses, I can just compare to see if this is random data, or actually the BMP085 chip, being talked to from Linux running on the RK3188 of the Radxa Rock board:<br />
<br />
Calibration parameter AC1, which for my 10-DOF board has a 2 byte value of 6746 (0x1A5A) is located at I2C registers 0xAA (MSB) and 0xAB (LSB), by reading the sensor's datasheet.<br />
<br />
Let's dump the contents of the device at that address (the BMP085) to confirm we are talking to it:<br />
<br /><blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">#dump non-interactively (-y) contents of selected device (0x77)<br />#on given I2C bus (0) in byte read mode (b)<br />sudo i2cdump -y 0 0x77 b</span></blockquote>
<br />
Not really illustrating, but the result is:<br />
<span style="font-family: Courier New, Courier, monospace;"> 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef</span><br />
<span style="font-family: Courier New, Courier, monospace;">00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">80: a5 94 52 49 a4 27 77 a6 1e 26 1a 5a fb dd c7 bc ??RI?'w??&?Z????</span><br />
<span style="font-family: Courier New, Courier, monospace;">90: 7c 9e 60 2c 59 11 15 7a 00 37 80 00 d4 bd 09 80 |?`,Y??z.7?.????</span><br />
<span style="font-family: Courier New, Courier, monospace;">a0: a5 94 52 49 a4 27 77 a6 1e 26 1a 5a fb dd c7 bc ??RI?'w??&?Z????</span><br />
<span style="font-family: Courier New, Courier, monospace;">b0: 7c 9e 60 2c 59 11 15 7a 00 37 80 00 d4 bd 09 80 |?`,Y??z.7?.????</span><br />
<span style="font-family: Courier New, Courier, monospace;">c0: 00 00 bc 33 00 00 00 00 00 00 00 10 00 00 00 03 ..?3.......?...?</span><br />
<span style="font-family: Courier New, Courier, monospace;">d0: 55 01 06 00 00 00 00 00 00 00 00 00 00 00 00 00 U??.............</span><br />
<span style="font-family: Courier New, Courier, monospace;">e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................</span><br />
<span style="font-family: Courier New, Courier, monospace;">f0: 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 ......?.........</span><br />
<br />
<br />
And sure enough! you can find the values (1a and 5a) of this little example at the expected register addresses (0xAA and 0xAB).<br />
<br />
RK3188 is communicating with the 10-DOF board through one I2C bus at the expansion header!<br />
<br />
<h3 style="text-align: center;">
Radxa Rock meets the world of electronics!</h3>
<br />
<br />
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-6487105202596390783.post-2316568228016529762013-10-12T15:52:00.003+02:002013-10-15T00:35:55.846+02:00Doubts over Rockchip FB Vsync fixAlmost every owner of a RK3188 stick has noticed video problems, like stuttering or a lost frame every now and then, no matter its being a local file or just a small avi.<br />
<br />
Some time ago phjanderson (from Freaktab forum) found a solution to this:<br />
<a href="http://www.freaktab.com/showthread.php?5939-Fixing-RK3188-video-playback/page2&p=81489#post81489">http://www.freaktab.com/showthread.php?5939-Fixing-RK3188-video-playback/page2&p=81489#post81489</a><br />
<br />
It basically eliminated a blocking condition on a function on rk_fb.c, which also happened to apparently solve the stutter problem. This was called phjanderson's Vsync fix and lots of ROMs have added this patch since.<br />
<br />
I then set out to test it on Linux along with my framebuffer fix (see <a href="https://github.com/Galland/3188-SRC-AP6210/commit/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0">https://github.com/Galland/3188-SRC-AP6210/commit/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0</a> ) just to find that after a random amount of minutes after boot, there appeared a <b>new thread called "fb-vsync" that utilized 100% of one of the 4 cores</b> on the RK3188, regardless of the system being idle or never even opening a video.<br />
<br />
<b>To me, this is unacceptable since it forces the CPU to run at higher frequencies all the time, as well as consume lots more of power and a 25% performance penalty hit.</b><br />
<br />
I initially thought it had something to do with Linux' screen usage or even with my framebuffer fix. However it did happen without the framebuffer fix, so I just let it out of my kernels.<br />
<br />
However, I recently read on a forum ( <a href="http://www.rikomagic.co.uk/forum/viewtopic.php?p=15682&sid=e872d9b5e003da9082af7976a28fa50c#p15682">http://www.rikomagic.co.uk/forum/viewtopic.php?p=15682&sid=e872d9b5e003da9082af7976a28fa50c#p15682</a> ) that Android people are seeing also the 25% CPU usage constant (1 core out of 4) due to this thread.<br />
<br />
So I heavily suspect this patch is great for fixing the Vsync video stutter problems, but at the cost of losing 25% of the CPU performance, consuming more power all the time (+heat!), and thus reducing the component's life.<br />
<br />
If you happen to have flashed a rooted ROM with Vsync fix and have an Android monitor installed (able to track system threads), please write a comment sharing if you've been able to see the thread in action.<br />
<br />
<br />
UPDATE:<br />
<br />
I'll try to explain a bit the code related to this problem.<br />
Most of it is located in rk_fb.c where:<br />
1) upon registering fb0 (the main framebuffer) a <a href="https://github.com/Galland/3188-SRC-AP6210/blob/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0/kernel_ruikemei/drivers/video/rockchip/rk_fb.c#L1475" target="_blank">thread called "fb-vsync" is created</a>.<br />
2) This thread executes the function "<a href="https://github.com/Galland/3188-SRC-AP6210/blob/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0/kernel_ruikemei/drivers/video/rockchip/rk_fb.c#L769" target="_blank">rk_fb_wait_for_vsync_thread</a>"<br />
3) This function is an "infinite" loop that emits a <a href="https://github.com/Galland/3188-SRC-AP6210/blob/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0/kernel_ruikemei/drivers/video/rockchip/rk_fb.c#L784" target="_blank">"vsync" notification</a> to user-space apps subscribed to it, whenever a Vsync happens, meanwhile it waits idle.<br />
<br />
How does it wait for a Vsync?<br />
Through the use of "<a href="https://www.kernel.org/doc/htmldocs/device-drivers/API-wait-event-interruptible.html" target="_blank">wait_event_interruptible</a>" with arguments:<br />
- waitqueue: this is the event queue we're hanging on: dev_drv->vsync_info.wait<br />
- condition:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">!ktime_equal(timestamp, dev_drv->vsync_info.timestamp) && dev_drv->vsync_info.active</span></blockquote>
<br />
The 2nd part of the condition (dev_drv->vsync_info.active) should always be met since it is set to 1 <a href="https://github.com/Galland/3188-SRC-AP6210/blob/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0/kernel_ruikemei/drivers/video/rockchip/rk_fb.c#L1484" target="_blank">just after creating this thread</a>.<br />
What about the 1st part? It compares:<br />
a) variable "timestamp": which is constant!! and set to the value of "dev_drv->vsync_info.timestamp" as it was just before calling "wait_event_interruptible".<br />
b) dev_drv->vsync_info.timestamp as it IS any time the waitqueue is awaken<br />
<br />
Naturally this condition is meant to become true (and exit the wait event to send the "vsync" notification) at the next Vsync.<br />
<br />
Why? Because "dev_drv->vsync_info.timestamp" is updated by the <a href="https://github.com/Galland/3188-SRC-AP6210/blob/a3ddf7e46c4426e6cc67e09d7eee2a14baeea1f0/kernel_ruikemei/drivers/video/rockchip/lcdc/rk3188_lcdc.c#L1360" target="_blank">lcdc interrupt service routine</a>, which at the same time wakes up our "wait_event_interruptible" above!<br />
<br />
Then the !ktime_equal compares the "timestamp" variable that holds the PREVIOUSLY set vsync_info.timestamp (before the wait_event is triggered) with the CURRENT, just updated, vsync_info.timestamp.<br />
Hence the condition may indeed become true.<br />
<br />
<br />
<b>What did phjanderson's fix do?</b> It just made this wait event to always have a true condition, hence the "while" loop is constantly executing (no wait) and notifying a "vsync".<br />
<br />
<b>How does it interact with Galland's framebuffer fix?</b> Note that in the lcdc isr, the fb fix excludes the wake_up_... call, so what it does is make the wait event above to never be woken up. Kind of the opposite to phjanderson's.<br />
<br />
The union of both fixes is... unfortunate too :) so I just left out phjanderson's fix, since the isr changes are needed for the overall fb fix.<br />
<br />
<br />Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-6487105202596390783.post-27864574683925964902013-10-07T17:29:00.001+02:002013-10-07T17:29:41.884+02:00Bitbanging Radxa Rock gpiosThis post assumes you're using the latest Linux kernel from <a href="http://hwswbits.blogspot.com/2013/10/booting-linux-on-radxa-rock.html" target="_blank">here</a> on your Radxa Rock RK3188 board.<br />
<br />
As you may already know, by looking at the openly available <a href="http://dl.radxa.com/rock/docs/hw/RADXA_ROCK_schematic_20130903.pdf" target="_blank">Radxa Rock schematics</a>, this board has many GPIOs accessible through two expansion headers (along with other buses like LCD, SPI, I2C, etc.) as well as three user LEDs.<br />
<br />
In this brief post I'll explain how to access any of these GPIOs to read/write its value. I've chosen one of the user LEDs to easily see the results of our actions.<br />
<br />
<br />
By checking the schematics, it is easy to see there is a Red LED connected to GPIO0_B7 (gpio 175), an active low Green LED at GPIO0_B4 (gpio 172), and another active low Yellow LED at GPIO0_B6 (gpio 174).<br />
<br />
<blockquote class="tr_bq">
<i>How do I know the gpio number from the pin name?</i> Relatively easy, look for your pin name <a href="https://github.com/Galland/Linux3188/blob/master/arch/arm/mach-rk30/include/mach/gpio.h" target="_blank">here</a>, and calculate the gpio number by taking into account that GPIO_BASE = 160 and NUM_GROUP = 32.</blockquote>
<br />
<br />
In this example we will toggle the Green LED on and off by following these commands in a Terminal within Linux in your Radxa (or through ssh to the board):<br />
<br /><blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">#become root<br />su root<br />#tell Linux we want to have access to gpio pin 172<br />echo 172 > /sys/class/gpio/export<br />#set it as an output pin (though we will be able to readback its value)<br />echo "out" > /sys/class/gpio/gpio172/direction<br />#set its value to 1 (turn off led)<br />echo 1 > /sys/class/gpio/gpio172/value<br />#set its value to 0 (turn on led)<br />echo 0 > /sys/class/gpio/gpio172/value<br />#in any case read the pin value<br />cat /sys/class/gpio/gpio172/value</span></blockquote>
<br />
Now, I'll be figuring out how to communicate with SPI and I2C devices hooked to the RR's expansion headers.<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-6487105202596390783.post-32435535249832015192013-10-06T23:12:00.000+02:002013-10-15T01:03:45.287+02:00Booting Linux on Radxa Rock<br />
For anybody interested, here is a <u>preliminary</u> working kernel for the Radxa Rock board.<br />
<br />
UPDATE (2013/10/11): IR and Audio I/O working, updated links to new flash images<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-p2efSrm5xrU/UlHNOyZX_EI/AAAAAAAABh8/pyhDS_7qeKk/s1600/rr.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="360" src="http://1.bp.blogspot.com/-p2efSrm5xrU/UlHNOyZX_EI/AAAAAAAABh8/pyhDS_7qeKk/s640/rr.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Xubuntu Linux on Radxa Rock RK3188 board</td></tr>
</tbody></table>
<br />
<br />
This is WORK IN PROGRESS, so few things are supported, even though it's already almost as usable as any stick. This is the current state of affairs (<a href="https://github.com/Galland/Linux3188/commits/master" target="_blank">check commits</a> for updated info):<br />
<br />
What works?<br />
- Integrated Ethernet 10/100<br />
- USB 2<br />
- HDMI<br />
- Flash<br />
- MicroSD<br />
- RK1000-S sound (integrated mic, audio out jack)<br />
- IR (point a remote at it and press a button while monitoring cat /proc/interrupts ;)<br />
<br />
What doesn't work yet?<br />
- Wifi+BT<br />
<br />
Not tested?<br />
- Expansion headers<br />
- SPDIF Audio Out / Exp.header Line In<br />
- RTC<br />
<br />
<br />
I've based development on <a href="https://github.com/Galland/Linux3188" target="_blank">this repository</a>. To compile it for yourself, you'll have to clone it and use the arch/arm/configs/rk3188_Radxa_Rock_Linux_galland_defconfig file as your .config (<b>UPDATE: </b>the initramfs file necessary for this defconfig, with rknand support, is initramfs-3.0.36+.cpio from <a href="https://github.com/Galland/rk30_linux_initramfs" target="_blank">here</a>).<br />
<br />
<br />
OR, if you have the board and want to go ahead with the flashing (supposing you already have an Ubuntu Linux in a MicroSD card inserted in the Radxa board), you have two options:<br />
<br />
A) <b>Boot to Linux only</b>: Flash "kernel" partition with <a href="https://www.dropbox.com/s/c5tq5rqnwojblp3/RadxaRock_Linux_kernel_WARNING_READ_BLOG.7z" target="_blank">this file</a>, so you boot directly to Linux (warning: it won't boot to Android unless you revert this step). Follow these steps:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">//backup the Android "kernel" to be able to revert this<br />sudo ./rkflashtool r 0x4000 0x5000 > radxa_stock_kernel.img<br />//flash the downloaded Linux kernel instead<br />sudo ./rkflashtool w 0x4000 0x5000 < kernel.img<br />//safely reboot (into Linux)<br />sudo ./rkflashtool b</span></blockquote>
<br />
Now the Radxa board will <b>boot directly into Linux</b>.<br />
In order to recover Android booting you'd have to reflash the stock kernel you've backed up.<br />
<br />
<br />
B) <b>Usual way</b>: flash the Linux kernel (decompressing <a href="https://www.dropbox.com/s/kfg414lh7knwh5c/RadxaRock_Linux_recovery.7z" target="_blank">this different file</a>) into the recovery partition to be able to <b>dual boot Android/Linux</b>:<br />
<div>
<div>
<br /></div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">//flash the downloaded and uncompressed recovery.img<br />sudo ./rkflashtool w 0x10000 0x10000 < recovery.img<br />//safely reboot (into Android)<br />sudo ./rkflashtool b</span></blockquote>
</div>
<div>
<br />
Now to get into Linux you have to boot into Android and have again two options:</div>
<div>
<br /></div>
<div>
- Enable Debug Mode, connect OTG USB port to PC, go to Settings->USB->Connect to PC, and then in the PC issue an "adb shell reboot recovery"</div>
<div>
<br /></div>
<div>
- Or, install an Android Terminal emulator (beware there is no Google Play in the RR!) get into it and, with root, issue a: reboot recovery</div>
<div>
<br /></div>
<div>
<br />
<br />
<br />
Since booting back to recovery partition tends to be cumbersome and since I only care about Linux, I have <b>flashed kernel partition and always just boot to Linux</b>!<br />
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
PS: Just in case you don't have the latest modules and firmware, get <a href="https://www.dropbox.com/s/dcobxtyadxk0hsp/RR_mod%2Bfw.7z" target="_blank">these ones</a> into the root (not "root" folder!) of your MicroSD Linux (I insert the uSD card in the PC, open a file explorer as root and copy them at uSD's root).</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com10tag:blogger.com,1999:blog-6487105202596390783.post-33801904497281149252013-10-06T22:24:00.002+02:002013-10-28T04:20:51.252+01:00Booting to Linux instead of Android (flashing kernel partition) for RK<br />
<h3>
1) Get the software</h3>
You'll first need to fetch the Linux RK flashing tool (ignore the git name, the tool is valid for RK2*, RK30, RK31 devices), and the Linux rkcrc tool (for pre-/post-fixing a kernel image with the right RK values):<br />
<blockquote class="tr_bq">
<br />
<span style="font-family: Courier New, Courier, monospace;">git clone https://github.com/Galland/rkflashtool_rk3066 rkflashtool<br />cd rkflashtool<br />make<br />cd..<br /><br />git clone https://github.com/Galland/rk-tools.git<br />cd rk-tools<br />make rkcrc<br />cd ..</span></blockquote>
<br />
<h3>
2) Prepare your own kernel</h3>
<br />
After compiling your kernel, you have to convert/sign the zImage output file with this command:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">./rk-tools/rkcrc -k Linux3188/arch/arm/boot/zImage kernel.img</span></blockquote>
<br />
Substitute "Linux3188" with the folder name where your kernel sources are.<br />
<br />
<br />
<h3>
3) Getting device into Recovery mode</h3>
<br />
This is most usually done by keeping pressed a pushbutton while plugging the USB OTG connector to your PC and then releasing it after a >2 seconds. If upon typing Linux command "lsusb" on the PC we see a nameless device (with ID 2207:...), that's our RK device in recovery mode.<br />
<u><br /></u>
<u>Warning:</u> some devices (like the Radxa Rock) have a 2 minutes timeout for the recovery mode after which it will power off, the timeout restarts upon any flash reading/writing.<br />
<br />
<br />
<br />
<h3>
4) Know your partitions</h3>
<br />
Before any flashing operation, we must be sure of at what offset and what size does the partition of interest have. To do it, while in recovery mode, issue the following command in your PC:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r 0x0 0x1 | head -n 11</span></blockquote>
<br />
That will result in several lines of parameter information from your stick. We are interested in the last text paragraph, from "mtdparts" to the end.<br />
<br />
For example, in my MK908 (check yours, since there are several versions), it is:<br />
<blockquote class="tr_bq">
mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x00006000@0x00004000(kernel),0x00008000@0x0000A000(boot),0x00010000@0x00012000(recovery),0x00020000@0x00022000(backup),0x00040000@0x00042000(cache),0x00400000@0x00082000(userdata),0x00002000@0x00482000(kpanic),0x00100000@0x00484000(system),-@0x00584000(user)</blockquote>
These are the partitions' parameters, where each partition is described as:<br />
<blockquote class="tr_bq">
partition_size@partition_offset(partition_name)</blockquote>
So the "kernel" partition in my MK908 is at offset 0x4000 and has a size of 0x6000 (= 24,576 sectors of 512 bytes each = 12,582,912 bytes).<br />
<div>
<br />
<u><b>Warning:</b></u> If your partition of interest has an offset that is not multiple of 4MB, you MUST follow the "misaligned" instructions below, using your device's offsets.<br />
<br />
<br />
<div>
Always remember that the flashing tool requires the numbers in <b>reversed position</b> compared to what appears in the mtdparts above, that is: first the offset, then the size, like:</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r (offset) (size)</span></blockquote>
</div>
<br />
<br />
<br />
<h3>
5) Backup stock partitions!</h3>
<br />
I <b>strongly recommend</b> to read and store in your PC at least the boot, kernel, and recovery stock partitions of your devices, before you start tinkering with it!<br />
<br />
This is very easily done with these commands (substitute the offsets and sizes with the ones from your mtdparts):<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"><br class="Apple-interchange-newline" />sudo ./rkflashtool r 0x4000 0x6000 > stock_kernel.img</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r 0xA000 0x8000 > stock_boot.img</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool r 0x12000 0x10000 > stock_recovery.img</span></blockquote>
<br />
<br />
<h3>
6) Flash your new kernel</h3>
<br />
Since my kernel partition's offset (0x4000 = 16384 => *512B = 8 MB) is a multiple of 4MB, flashing it becomes as easy as:<br />
<div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool w 0x4000 0x6000 < kernel.img</span></blockquote>
</div>
<div>
<br /></div>
<div>
<br />
<u>NOTE:</u> If for some unknown reason you wanted to flash a kernel into boot partition, you should flash the same one that is used to flash recovery.</div>
<div>
<blockquote class="tr_bq">
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
</blockquote>
</div>
</div>
In order to ensure flashing is done correctly, always reboot the stick after flashing with the following command:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool b</span></blockquote>
<br />
<div style="text-align: center;">
<b>Now your device will always boot to your kernel!</b></div>
<br />
If it is a Linux kernel, then RK will directly boot to it, ignoring Android (until you revert these changes, by flashing back the stock kernel image)<br />
<br />
<br />
<h3>
</h3>
<h3>
</h3>
<div>
<br /></div>
<h3>
Misaligned partitions (offset not at 4 MB boundary)</h3>
<br />
If the partition you want to write/flash starts at an offset not multiple of 4 MB then you will find that the first <4 MB that you write are wrong when/if you read them back.<br />
<br />
An example of this can be found in Radxa Rock's boot partition, which starts at offset 0x9000 and has a size of 0x7000. If naively flashing boot with the command:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool w 0x9000 0x7000 < boot.img</span></blockquote>
That is: flash boot.img from 0x9000 up to, but not including, 0x10000 (= 0x9000 + 0x7000). If we proceed to read back the just written data, in order to verify it:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ./rkflashtool r 0x9000 0x7000 > boot_readback.img</span></blockquote>
<br />
The result will be:<br />
- Wrong, apparently random, data from 0x9000 up to, but not including, 0xA000 (note this is the first 4 MB boundary within boot partition)<br />
- Good data from 0xA000 up to, but not including, 0x10000, that is: just what we've written, as expected.<br />
<br />
This will cause the RK device to ignore the bad boot partition and jump on to recovery partition.<br />
<br />
As far as I know, this problem arises when writing images, not when reading. It happens for Linux rkflashtool as well as for Windows RKAndroidTool.exe.<br />
<br />
<br />
<br />
<h3>
Workaround to flash misaligned partitions</h3>
<br />
The workaround I've found is to flash the previous partition (kernel) at the same time than boot partition. Why? Because kernel partition's offset is aligned to a 4 MB boundary, so there is no problem flashing it. Hence the operation would be:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">//read stock kernel (padded to the full size of the partition)<br />sudo ./rkflashtool r 0x4000 0x5000 > radxa_stock_kernel.img<br />//concatenate the kernel partition with your own boot partition<br />cat radxa_stock_kernel.img my_own_boot_partition.img > kernelboot.img<br />//flash both partitions at the same time (0x5000+0x7000=0xC000)<br />sudo ./rkflashtool w 0x4000 0xC000 < kernelboot.img</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">//optionally read back to verify flashing operation<br />sudo ./rkflashtool r 0x4000 0xC000 > kernelboot_readback.img<br />//compare what we wanted to write, to what has been written<br />cmp -b kernelboot.img kernelboot_readback.img</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">//always safely reboot the RK device after flashing<br />sudo ./rkflashtool b</span></blockquote>
<div>
<div>
<br />
<br />
<br /></div>
</div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-6487105202596390783.post-43014867493527261182013-10-04T18:28:00.002+02:002013-10-04T18:28:24.358+02:00Radxa Rock board Linux development starts!So, finally the Radxa Rock board (early developer sample) arrived.<br />
<br />
First of all a <b>big thanks to Tom Cubie and his team</b> at <a href="http://radxa.com/specification/" target="_blank">Radxa</a> for kindly donating it to further Linux development!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-G5ddeq6192s/Uk7bxmjQPvI/AAAAAAAABho/lQWlkhZhrho/s1600/ant2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://4.bp.blogspot.com/-G5ddeq6192s/Uk7bxmjQPvI/AAAAAAAABho/lQWlkhZhrho/s400/ant2.JPG" width="400" /></a></div>
<br />
<br />
<h3>
Overview</h3>
<br />
This tiny board looks fantastic, first and foremost because it has <b>EXPANSION HEADERS</b>, apart from this varied assortment of ports and peripherals:<br />
<br />
- CPU RK3188 quad-core @ 1.6 GHz<br />
- 2 GB DDR3 RAM<br />
- 8 GB Flash<br />
- Wifi + BT<br />
- 10/100 Eth<br />
- Audio I/O + integrated microphone + SPDIF Out<br />
- IR RX<br />
- 2 full size USB ports<br />
- 1 OTG USB port<br />
- Power connector (doesn't take up a USB port)<br />
<br />
Very nice specs but, to me, what makes this board unique is the expansion headers (along with <a href="http://dl.radxa.com/rock/docs/hw/RADXA_ROCK_schematic_20130903.pdf" target="_blank">openly available schematics</a>!) where you can directly plug and access devices through I2C, SPI, UART, ... there is even an LCD output as well as another USB port at those pins!<br />
<br />
<br />
<h3>
First boot</h3>
<br />
After screwing in the protective top/bottom methacrylate plastics you will need a power adapter and an HDMI cable (normal size connector, not mini/micro) to attach it to a display and be ready to boot.<br />
<br />
When you power the board for the first time it boots into Android, scaled 720p and in English, version 4.2.2 with kernel 3.0.36+ based on RK3188 R-BOX Android 4.2.2 SDK v1.0.0-130514.<br />
However, beware, there is <b><u>no Google Play</u></b>, so you're on your own to install apps.<br />
<br />
<br />
<h3>
Hack it!</h3>
<br />
If you want to tinker with it, nothing easier, turn it off, unplug power and then: <u>while keeping pressed</u> the Recovery push-button nearby the USB ports, plug the OTG USB port to your PC.<br />
<br />
A board red LED will light immediately, give it 2 seconds (or it'll boot Android) and, then, you can release the pushbutton and go to your PC.<br />
<br />
I'm supposing you're on Linux, so if you go to a Terminal and write "lsusb" you'll see a new nameless device with ID: 2207:310b which corresponds to a RK3188 SoC awaiting flashing instructions.<br />
<br />
<br />
<b><u>IMPORTANT TIMEOUT:</u></b><i> This recovery mode for flashing <b>powers off after 2 minutes</b> from last flash operation or from being plugged in (if you do no operations). So it will issue a "power off" command through the serial console and just disappear from "lsusb" output. You'll have to re-plug it again to access it.</i><br />
<br />
Then, through the usual Windows RK-provided tool or with the Linux rkflashtool that you can download and compile with ease from: <a href="https://github.com/Galland/rkflashtool_rk3066">https://github.com/Galland/rkflashtool_rk3066</a> (I know, worst name ever, it does handle RK29* and RK31* too).<br />
<br />
So download and compile the Linux USB flashing tool:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">git clone https://github.com/Galland/rkflashtool_rk3066 rkflashtool<br />cd rkflashtool<br />sudo apt-get install libusb-1.0-0-dev<br />gcc -o rkflashtool rkflashtool.c -lusb-1.0 -O2 -W -Wall -s</span></blockquote>
<br />
<br />
Ask the Radxa board about its partition sizes and offsets:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool r 0x0 0x1 | head -n 11</span></blockquote>
<br />
the result should be:<br />
<br />
<blockquote class="tr_bq">
FIRMWARE_VER:4.1.1<br />MACHINE_MODEL:rk31sdk<br />MACHINE_ID:007<br />MANUFACTURER:RK31SDK<br />MAGIC: 0x5041524B<br />ATAG: 0x60000800<br />MACHINE: 3066<br />CHECK_MASK: 0x80<br />KERNEL_IMG: 0x60408000<br />#RECOVER_KEY: 1,1,0,20,0<br />CMDLINE:console=ttyFIQ0 androidboot.console=ttyFIQ0 init=/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x00005000@0x00004000(kernel),0x00007000@0x00009000(boot),0x00010000@0x00010000(recovery),0x00020000@0x00020000(backup),0x00040000@0x00040000(cache),0x00200000@0x00080000(userdata),0x00002000@0x00280000(kpanic),0x00100000@0x00282000(system),-@0x00382000(user)</blockquote>
<div>
<br /></div>
<div>
What does this tell us?</div>
<div>
<br /></div>
<div>
Well, for us Linux developers, used to sharing sticks' space with Android (unless you decide to wipe it and make your Linux take over the flash...) we are bound to flashing our kernels into the "recovery" partition so that we can dual boot Android or Linux by having the latter's filesystem in a MicroSD (also called uSD) card.</div>
<div>
<br /></div>
<div>
And then, from above parameters, where each partition is described as:</div>
<div>
partition_size@partition_offset(partition_name)</div>
<div>
we infer that our "recovery" partition is at 0x10000 and has a size of 0x10000</div>
<div>
Please remember that the flashing tool requires these numbers in reversed position (first the offset, then the size), like sudo ./rkflashtool r (offset) (size)</div>
<br />
<br />
Hence, once you have downloaded/compiled your Linux kernel and have a Ubuntu rfs (root file system) in your uSD, you can go ahead and flash your Linux kernel with these simple commands:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo ./rkflashtool w 0x10000 0x10000 < my_kernel_recovery.img<br />sudo ./rkflashtool b</span></blockquote>
<br />
The "b" command safely reboots the RK device when the flash is written.<br />
<br />
I'll initially be using my most up to date kernel for booting Linux, so you may see some activity there:<br />
<a href="https://github.com/Galland/Linux3188">https://github.com/Galland/Linux3188</a><br />
<br />
Have fun hacking!<br />
<br />
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6487105202596390783.post-37990204738439431032013-09-16T22:57:00.003+02:002013-09-16T22:57:40.513+02:00DWC USB interrupt spam in Rockchip SoCsSome time ago, when looking for answers to some USB 1.1 problems on the RK chips, like:<br />
- USB 1.1 to Ethernet dongle not working<br />
- Repeated or missing key presses<br />
I stumbled upon some <a href="http://lists.infradead.org/pipermail/linux-rpi-kernel/2012-June/000063.html" target="_blank">Raspberry Pi forums</a> complaining about the same things.<br />
<br />
This is logical since both the Rasp. Pi SoC and the RK3066/3188 are using the same USB HW IP cores (from DesignWare, that is DWC).<br />
<br />
One of the problems they were reporting was an excessive number of interrupts per second coming from the USB while the system was idle (I've confirmed it, even with just a USB 1.1 keyboard attached).<br />
<br />
One way to check this is with the console command:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">vmstat 1</span></blockquote>
Looking below label "in" will tell you how many interrupts are there per second. In my case, Linux3188 kernel ( <a href="http://github.com/Galland/Linux3188">http://github.com/Galland/Linux3188</a> ) on a RK3188 Cozyswan S400 (kindly donated by <a href="http://kskelectrics.com/" target="_blank">KSK Electrics</a>) the result is some 10600 interrupts per second.<br />
<br />
And a way to see who is interrupting is simply to type:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">cat /proc/interrupts</span></blockquote>
In my case, the "dwc_otg_hcd:usb1, dwc_otg_pcd" is the root cause for some more than 8000 interrupts per second, just as it <a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=7866" target="_blank">happens to RPi guys</a>.<br />
<br />
The problem seems to stem from the DWC driver, as explained <a href="http://lists.infradead.org/pipermail/linux-rpi-kernel/2012-June/000039.html" target="_blank">here</a>:<br />
<blockquote class="tr_bq">
"the Synopsys driver relies on the start of frame interrupt for scheduling transfers if "descriptor DMA" is not implemented (which it isn't, on BCM2835). 8000 is one interrupt per microframe."</blockquote>
and propose the use of a FIQ (ARM fast interrupt handler) for USB IRQs to discard USB microframes that contain no data. More <a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?t=39175" target="_blank">info here...</a><br />
<br />
And the FIQ enabled code lies in this repo (see commits starting in April 2013 by Gordon Hollingworth): <a href="https://github.com/ghollingworth/linux/commits/rpi-3.6.y">https://github.com/ghollingworth/linux/commits/rpi-3.6.y</a><br />
<br />
<br />Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6487105202596390783.post-42691783502558818702013-09-16T17:55:00.000+02:002013-09-16T17:55:25.480+02:00Testing real screen resolution on RK Linux<h3>
Problem:</h3>
<br />
You think you have a 1080p screen resolution but when you draw a non-aliased one pixel width line and move the window around, it doesn't look one solid line anymore.<br />
<br />
You're not on 1080p, but likely on a scaled 720p (even if Linux reports 1080p).<br />
<br />
<br />
<h3>
Test:</h3>
<br />
On a console type:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">cat /sys/devices/platform/rk-fb/graphics/fb0/disp_info</span></blockquote>
<br />
for a working 1080p setup, the result should be something like:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">win0:enabled<br />xvir:960<br />xact:1920<br />yact:1080<br />xdsp:1920<br />ydsp:1080<br />x_st:192<br />y_st:41<br />x_scale:1.0<br />y_scale:1.0<br />format:RGB565<br />win1:disabled<br />xvir:0<br />xdsp:320<br />ydsp:240<br />x_st:10<br />y_st:10<br />format:ARGB888</span></blockquote>
<br />
That is xact and yact (the virtual resolution seen by Linux) must be the same as xdsp and ydsp (the real resolution been sent to the screen), or else you have a scaled output (x_scale and y_scale not 1.0).<br />
<br />
<h3>
Solution:</h3>
<br />
If this is the case and you find that xdsp=1280 and ydsp=720, whereas you expected a 1080p display, the solution is in this commit:<br />
<a href="https://github.com/Galland/3188-SRC-AP6210/commit/130c1ad6bb47f3b2401b6156f205dcb5882255c7">https://github.com/Galland/3188-SRC-AP6210/commit/130c1ad6bb47f3b2401b6156f205dcb5882255c7</a><br />
<br />
<br />
BTW, notice the 16 bits color: RGB565<br />
I couldn't tell the difference with normal desktop usage, but it means half the memory operations (32 bits ARGB888 <-> 16 bits RGB565).Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6487105202596390783.post-84493730657294281182013-09-11T22:52:00.000+02:002014-05-27T14:25:09.736+02:00Root Rockchip sticks/tablets from LinuxSince with every new device it becomes a nightmare (at least for me, that I seldom use Windows) to find the right Windows drivers for ADB access... I noticed that the rooting procedure (<a href="http://forum.xda-developers.com/showthread.php?t=1526487" target="_blank">TPSparky Vondroid</a>) relies only on the adb command and... that is readily accessible from Linux.<br />
<br />
Hence this little guide came up as I put together the necessary little bits and has been tested with a RK3066 based tablet (RK3188 devices should also be rootable with this method, confirmed with Minix Neo X7).<br />
<br />
<br />
<h3>
1st Set up Linux ADB access to the device</h3>
<div>
<br /></div>
<div>
This step is entirely done from the Linux PC (Ubuntu in this case) where the RK device is connected (through the USB). </div>
<div>
<br /></div>
<div>
Please note that if your RK device has several USB ports, there will be only one that can be connected to the PC, usually marked as OTG or Slave.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
1) Download the lightweight adb tools:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install android-tools-adb</span></blockquote>
<div>
or, if you don't have Ubuntu, proceed to download and install the whole Android SDK :S</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
2) Open/create the following text file to let your standard user connect to the RK device:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo gedit /etc/udev/rules.d/51-android.rules</span></blockquote>
<div>
and then add a new line with the following text:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"</span></blockquote>
<div>
Of course make sure that your Linux user is part of group "plugdev" with the following terminal command:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">groups user</span></blockquote>
<div>
<br /></div>
<div>
3) Force a reload of the USB access rules to get the latest one on:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">sudo udevadm control --reload-rules</span></blockquote>
<div>
<br /></div>
<div>
4) Add RK devices USB Vendor ID to what adb may expect for your currently logged user:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">echo "0x2207" >> ~/.android/adb_usb.ini</span></blockquote>
<div>
<br /></div>
<div>
<br /></div>
<div>
<h3>
2nd Set up the RK device for ADB access</h3>
<div>
<br /></div>
<div>
Unplug the RK device from the USB and go to its Settings page to follow this steps:</div>
</div>
<div>
<div>
<br /></div>
<div>
1) Go to Settings->Storage and click at the top right on the three dots</div>
<div>
<br /></div>
<div>
2) Select USB computer connection in the dropdown</div>
<div>
<br /></div>
<div>
3) Select "Mass Storage" check box and go back to Settings</div>
<div>
<br /></div>
<div>
4) Browse down in Settings and select Security</div>
<div>
<br /></div>
<div>
5) In Security Settings, select "Unknown sources"</div>
<div>
<br /></div>
<div>
6) Back in Settings, select Developer Options</div>
<div>
<br /></div>
<div>
7) In Developer Options, select "USB debugging"</div>
<div>
<br /></div>
<div>
8) Close settings, and any other open apps.</div>
<div>
<br /></div>
<div>
9) Using a known good USB cable, connect the RK device to the PC, you'll get "Connecting to USB" in the notifications area in Android, and a USB icon in the notification area. You Do Not want to select "Connect to Pc to Transfer Files", in the notification menu, just plug in the cable and let it be.</div>
</div>
<div>
<br /></div>
<div>
PS: If you don't get a connection you may have to go back into Settings and select USB, then click on "Connect to PC".</div>
<div>
<br /></div>
<div>
<h3>
3rd Rooting the RK device from Linux</h3>
<div>
<div>
<br /></div>
<div>
The following steps are just a COPY of those in "TPSparkyRoot.bat" with a minor fix for correct SuperSU installation.</div>
<div>
<br /></div>
<div>
These are to be done on the Linux PC:</div>
<div>
<br /></div>
<div>
1) <a href="https://www.dropbox.com/s/ttfhtqhv7gfxrhi/TPSarky-VonDroid-Root.rar" target="_blank">Download the package</a> with the needed su, SuperSU, busybox, and RootExplorer binaries</div>
<div>
<br /></div>
<div>
2) Extract the package into a folder, open a terminal and cd into that folder</div>
<div>
<br /></div>
<div>
3) Create a new text file (i.e. "gedit script.sh") and copy the following contents:</div>
</div>
</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "*---* VonDroid.com RK device Root Tool based on work by sunnydavid *---*"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- Plug in your device, make sure debugging is enabled in Developer Options"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- This script will now copy files over to your RK device"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell mv /data/local/tmp /data/local/tmp.bak</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell ln -s /data /data/local/tmp</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb reboot</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- Reboot 1/3 - Press Enter once the device has rebooted</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: 'Courier New', Courier, monospace;">(if USB debugging doesn't appear in the Android bar you may have to click Settings->USB->Connect to PC)"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> read -p "or CTRL-C to exit"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell rm /data/local.prop > nul</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell "echo \"ro.kernel.qemu=1\" > /data/local.prop"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb reboot</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- Reboot 2/3 - Press Enter once the device has rebooted (if USB debugging doesn't appear in the Android bar you may have to click Settings->USB->Connect to PC)"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> read -p "or CTRL-C to exit"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell id</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- If the ID shows as 0(root) then continue, otherwise CTRL+C to cancel and start over"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> read -p "CTRL-C to exit"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb remount</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb push su /system/bin/su</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chown root.shell /system/bin/su</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chmod 6755 /system/bin/su</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb push busybox /system/bin/busybox</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chown root.shell /system/bin/busybox</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chmod 0755 /system/bin/busybox</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- Installing SuperSU"</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb push SuperSU.apk /system/app/SuperSU.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chown root.root /system/app/SuperSU.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chmod 0644 /system/app/SuperSU.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb push RootExplorer.apk /system/app/RootExplorer.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chown root.root /system/app/RootExplorer.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell chmod 0644 /system/app/RootExplorer.apk</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "Completing Root ..."</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell rm /data/local.prop</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell rm /data/local/tmp</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb shell mv /data/local/tmp.bak /data/local/tmp</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> adb reboot</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> echo "--- Reboot 3/3 - Your RK device should now be rooted!"</span></div>
</div>
<div>
<br /></div>
<div>
<div>
<br /></div>
<div>
4) Make the script executable with: </div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">chmod +x script.sh</span></blockquote>
<div>
<br />
<br />
<div>
5) Restart the adb server by typing:</div>
<blockquote class="tr_bq">
<span style="background-color: white; font-size: 13px; line-height: 19.1875px;"><span style="font-family: Courier New, Courier, monospace;">adb kill-server; adb start-server</span></span></blockquote>
<div>
6) And now when typing the following terminal command:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">adb devices</span></blockquote>
<div>
you should see the connected device listed (my tablet for example is named 12345678...)</div>
<br />
<br /></div>
<div>
7) Execute the previously created script ( ./script.sh ) and follow the steps to the letter, including patiently waiting for the potential several-minutes-long pauses</div>
</div>
<div>
<br />
<b>PS: After every reboot you MUST check that in the Android status bar the "USB Debugging" message appears (so that there is adb connection with the PC), or else you'll have to go back into Settings and select USB, then click on "Connect to PC". Only then you can hit Enter in the script to let it go on.</b><br />
<br /></div>
<div>
<br /></div>
<div>
That's it, your device should be rooted, all from within Linux!</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>DISCLAIMER</b>: I've followed this instructions to root my own devices without any trouble. The rooting procedure itself is simply the very widely used TPSparky method. However I take no responsibility for any mishappenings that may arise from your trying it on your devices. That is entirely yours.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<u>References:</u></div>
<div>
http://forum.xda-developers.com/showthread.php?t=1526487</div>
<div>
http://linux-rockchip.info/mw/index.php?title=ADB_shell_with_RK3066</div>
<div>
http://forum.xda-developers.com/showthread.php?t=2127573</div>
<div>
<br /></div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-6487105202596390783.post-20852748132191333062013-07-12T00:00:00.000+02:002013-07-12T02:14:38.387+02:00Serial console mod for RK3188 stick Cozyswan S400<div style="text-align: left;">
<b>First of all, I would like to thank <a href="http://kskelectrics.com/" target="_blank">KSK Electrics</a> for kindly donating this S400 stick (and a MK908) to support the Linux kernel porting on RK3188 devices.</b></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
A serial console for the <b>Cozyswan S400</b> was needed in order to debug the boot problems encountered with the RK3188 kernel source "freed" by Andy from Rikomagic.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Also, since this kernel removed support for the framebuffer console (the text you [should] see on screen at boot, or in text Linux, before installing any XFCE/Gnome/...), the serial console is the only way to see what's happening when there is something wrong.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Fortunately I was able to <a href="https://github.com/Galland/Linux3188/commit/361c2a3c0e54a44154c46a277fc7c811ff029cde" target="_blank">successfully backport</a> the framebuffer console so that now text is back on screen for Linux!</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In any case here is the mod to get the serial console pins, thanks to Alok Sinha, who found those pads to be the serial output. They looked to me so much like an IR tx/rx connector that I would have tested every other pad before trying those! :)</div>
<div style="text-align: left;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-yRdL6yF20ZI/Ud8n6Cn191I/AAAAAAAABc0/7MKojCET6Ic/s1600/IMAG0909v.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="226" src="http://1.bp.blogspot.com/-yRdL6yF20ZI/Ud8n6Cn191I/AAAAAAAABc0/7MKojCET6Ic/s400/IMAG0909v.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Left to Right: The R (RX) pad for receiving keystrokes, the T (TX) pad for sending to your<br />
<a href="https://www.sparkfun.com/products/9873" target="_blank">Serial2USB</a> module the text, and the required G (Ground) </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Actually only TX and Gnd are needed to receive the boot text, so I usually solder just those two.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-7QqGq6tiDiA/Ud8oMlSa45I/AAAAAAAABdE/gU7qPbwKisI/s1600/IMAG0912v.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="171" src="http://1.bp.blogspot.com/-7QqGq6tiDiA/Ud8oMlSa45I/AAAAAAAABdE/gU7qPbwKisI/s400/IMAG0912v.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The pads are small, with a tiny bit of solder on the iron tip and<br />
another tiny bit on the cable, you should get good results</td></tr>
</tbody></table>
<br />
<div>
Omegamoon, who did the <a href="http://www.omegamoon.com/blog/static.php?page=mk808_serial_console" target="_blank">MK808</a> (RK3066) and <a href="http://www.omegamoon.com/blog/static.php?page=mk908_serial_console" target="_blank">MK908</a> (RK3188) sticks' serial console mods, recommends this nice <a href="https://www.sparkfun.com/products/9873" target="_blank">Serial2USB module</a>.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-g9vsVB18O1Y/Ud8n8ZE8xaI/AAAAAAAABc8/4PEQdZRMS6E/s1600/IMAG0914v.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="198" src="http://2.bp.blogspot.com/-g9vsVB18O1Y/Ud8n8ZE8xaI/AAAAAAAABc8/4PEQdZRMS6E/s400/IMAG0914v.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The three clams, as I call them</td></tr>
</tbody></table>
<br />
You can <a href="http://hwswbits.blogspot.com/2013/06/measy-u2c-hw-serial-console-pins.html" target="_blank">find here the Serial mod instructions</a> for the Measy U2C RK3066 stick.<br />
<br />
I hope it helps!<br />
<div style="text-align: left;">
<br /></div>
</div>
Unknownnoreply@blogger.com10tag:blogger.com,1999:blog-6487105202596390783.post-81844044894722197622013-06-18T17:10:00.001+02:002013-06-18T17:14:02.460+02:00Full RK3066 Technical Reference Manual found!Thanks to <a href="http://omegamoon.com/blog/" target="_blank">Omegamoon</a>, who found it, here is the full RK3066 Technical Reference Manual, 1142 pages and 26MB of completely necessary data for opensource development on this platform.<br />
<br />
<a href="https://www.dropbox.com/s/80ubbvgou4g3bmk/Rockchip%20RK30xx%20TRM%20V2.0.pdf">https://www.dropbox.com/s/80ubbvgou4g3bmk/Rockchip%20RK30xx%20TRM%20V2.0.pdf</a><br />
<br />
It is the same file found in chinese <a href="http://iask.sina.com.cn/u/2240153254/ish" target="_blank">websites</a> and named as "Rockchip RK30xx TRM V2.0.pdf"<br />
<br />
And here is the full folder shared with more RK29 and RK30 documents:<br />
<br />
<a href="https://www.dropbox.com/sh/pycam3nl5bahwjt/WkfqGz6BVp">https://www.dropbox.com/sh/pycam3nl5bahwjt/WkfqGz6BVp</a><br />
<br />
Enjoy!Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-6487105202596390783.post-13506115786083510852013-06-17T13:19:00.000+02:002013-06-17T13:19:37.869+02:00Measy U2C HW serial console pinsA hardware serial console is a little module soldered to at least two pin pads of a CPU (in this case the RK3066 of the Measy U2C stick) in order to transmit to a PC the stick's boot log sequence happening long before the screen turns on.<br />
<br />
Naturally, if a kernel (<a href="https://github.com/Galland/rockchip-rk3188-generic" target="_blank">like the latest one</a>) refuses to boot and does not even get to turn on the screen, the only way to debug the reason is to use the serial console.<br />
<br />
With the indications and the useful <a href="http://www.omegamoon.com/blog/index.php?entry=entry130113-161359" target="_blank">blogpost</a> (for MK808) of fellow developer <a href="http://github.com/omegamoon" target="_blank">Omegamoon</a>, I set out to find the two pins necessary to watch in my PC the boot sequence, that is:<br />
<br />
- TXD: the pin where the CPU outputs the console text<br />
- Ground: the necessary reference for the electrical levels in TXD<br />
<br />
These had to be connected to the RXD and GND pins, respectively, of a <a href="https://www.sparkfun.com/products/9873" target="_blank">hardware serial-to-USB module</a>, that is then plugged to a PC's USB port. If anybody wonders about the CPU's RXD pin, it is not necessary unless you want to send commands to the stick once it's booted.<br />
<br />
In the PC I myself use Ubuntu's CuteCom console app, connecting to serial port /dev/ttyUSB0 at 115200 bauds 8 bits data, 1 bit stop, no parity, and no handshake.<br />
<br />
<br />
The way in which I found the RK3066's TXD pin was by trial and error. But since I saw there were small circular pads around the same area where Omegamoon had found his stick's TXD/RXD, I supposed mine should be close.<br />
<br />
Hence, I first soldered the ground cable to the micro USB port on top of the RK3066 CPU and started very carefully making the serial-to-USB module's RXD pin's cable touch the different pads while powering on the stick, until I found the one that was transmitting data: TXD and proceeded to solder the cable and make the smallest possible hole in the Measy U2C's enclosure to get the two cables out of it while closed.<br />
<br />
For reference, these are the places where the cables to the serial-to-USB are soldered<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-lLNVHT3IrTU/Ub7wIdkaQeI/AAAAAAAABas/qWzNCyz-pdE/s1600/MeasyU2C_serial.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="256" src="http://4.bp.blogspot.com/-lLNVHT3IrTU/Ub7wIdkaQeI/AAAAAAAABas/qWzNCyz-pdE/s640/MeasyU2C_serial.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">TXD pad of RK3066 (to RXD on serial-to-USB) and GROUND on the Micro USB connector</td></tr>
</tbody></table>
<br />
The TXD pad looks tiny but with a bit of care and a little bit of solder tin on the cable tip and the solder tip, you'll get good results.<br />
<br />
<br />Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-6487105202596390783.post-61777489829039774232013-06-15T03:49:00.000+02:002013-06-15T03:49:50.978+02:00Linux on RK3188 work in progressPlease note this is not a blog post, it's a my personal pastebin where I can put in writing to myself and other fellow developers the small things I find in the <a href="https://github.com/Galland/Linux3188" target="_blank">latest 3.0.36 kernel</a> that supports rk3188 devices.<br />
<br />
<br />
<br />
<h3>
MALI and CONFIG_SYNC ( sync_fence_cancel_async )</h3>
Talking about <a href="https://github.com/Galland/rockchip-rk3188-generic" target="_blank">Omegamoon's codebase</a> (but with backported drivers folder from <a href="https://github.com/Galland/rk3x_kernel_3.0.36/tree/master/drivers" target="_blank">my previous one</a>)<br />
<br />
Once MALI is configured in as:<br />
<br />
<blockquote class="tr_bq">
CONFIG_DRM=m<br />CONFIG_DRM_MALI=m<br /># CONFIG_ION is not set<br />CONFIG_MALI=y<br />CONFIG_MALI400=m<br /># CONFIG_MALI400_DEBUG is not set<br /># CONFIG_MALI400_PROFILING is not set<br />CONFIG_MALI400_UMP=y<br />CONFIG_UMP=m<br /># CONFIG_UMP_DEBUG is not set</blockquote>
<br />
And /include/drm/drm.h is backported to rk3x's version, that is, the first:<br />
#if defined(__linux__)<br />
becomes:<br />
#if defined(__KERNEL__) || defined(__linux__)<br />
<br />
Then compiling throws this new error:<br />
drivers/gpu/mali/mali/common/mali_kernel_core.c:1084:4: error: implicit declaration of function 'sync_fence_cancel_async'<br />
<br />
That function is called because now CONFIG_SYNC is forced by PLAT_RK and should be implemented in <span style="white-space: pre-wrap;">/drivers/base/sync.c (see </span>http://lists.linaro.org/pipermail/linaro-mm-sig/2012-June/002050.html) but it's missing.<br />
Hence, since MALI has worked without CONFIG_SYNC and a quick grep of the codebase shows it's the only driver talking about CONFIG_SYNC, my fix for this is removing the dependence with PLAT_RK by going to /arch/arm/Kconfig<br />
and in the config for PLAT_RK commenting the following lines:<br />
<br />
#<span class="Apple-tab-span" style="white-space: pre;"> </span>select SYNC<br />
#<span class="Apple-tab-span" style="white-space: pre;"> </span>select SW_SYNC<br />
#<span class="Apple-tab-span" style="white-space: pre;"> </span>select SW_SYNC_USER<br />
<div>
<br /></div>
<br />
and then in the .config removing:<br />
<br />
CONFIG_SYNC=y<br />
CONFIG_SW_SYNC=y<br />
CONFIG_SW_SYNC_USER=y<br />
<br />
<br />
Also had to add this line at the top of /drivers/video/rockchip/rk_fb.c due to missing references to 'GET_UMP_SECURE_ID_BUF2':<br />
<br />
#include "mali_def.h"<br />
<br />
<br />Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-6487105202596390783.post-33714169544711749222013-06-10T20:21:00.001+02:002013-06-10T20:21:02.701+02:00Disassembling .uu filesQuick post to not forget this procedure :)<br />
<br />
Let's say we have a .uu file that is a "uu-encoded" (a kind of hex encoding of a binary file) compiled object file, for example:<br />
<a href="https://github.com/Galland/rk3x_kernel_3.0.36/blob/master/arch/arm/mach-rk30/ddr.uu">https://github.com/Galland/rk3x_kernel_3.0.36/blob/master/arch/arm/mach-rk30/ddr.uu</a><br />
<br />
In order to peek into its internals we would have to download it and:<br />
<br />
1) Decode the file:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;"> uudecode rk3x_kernel_3.0.36/arch/arm/mach-rk30/ddr.uu -o ddr.o</span></blockquote>
<br />
2) Disassemble it with the specific ARM toolchain:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">toolchains/android-toolchain-eabi/arm-eabi/bin/objdump -d ddr.o > disassembled-ddr.asm</span></blockquote>
<br />
The latest version (4.8) of the Linaro ARM toolchain can be downloaded from this place (thanks Omegamoon):<br />
<div style="text-align: center;">
<a href="https://android-build.linaro.org/builds/~linaro-android/toolchain-4.8-bzr/">https://android-build.linaro.org/builds/~linaro-android/toolchain-4.8-bzr/</a></div>
<br />
The result is at dissasembled-ddr.asm and, for the above ddr.uu, can be seen <a href="https://www.dropbox.com/s/je2sa7il43fd2lo/disassembled-ddr.asm">here</a>.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6487105202596390783.post-27606497020145302692013-05-24T17:10:00.004+02:002013-12-01T14:18:50.448+01:00New 3.0.36+ kernel for Linux on RK3066 devicesThe kernel you can find on Picuntu releases is 3.0.8-alok+, but a few weeks ago I <b>found a 3.0.36 kernel for RK</b> devices in github, which was <b>released by <a href="http://www.bqreaders.com/" target="_blank">Spanish tablet maker bq</a></b> (support them if you can by buying their devices).<br />
<br />
I soon set out to <b>compile it for use with Linux</b>, with some help from fellow developer <a href="http://www.omegamoon.com/" target="_blank">Omegamoon</a>, who is also doing a great work on <a href="http://www.omegamoon.com/blog/index.php?entry=entry130521-172521" target="_blank">OpenELEC XBMC Linux</a> for RK devices.<br />
<br />
Then, after adding some of the kernel fixes I've published in previous blogposts (to me the most important is the one that <a href="http://hwswbits.blogspot.com/2013/03/bugfix-for-wrong-monitor-resolution-in.html" target="_blank">fixes support for 1080p monitors</a>) as well as <b>adding</b> <b>Mali 3D HW acceleration</b> support (thanks Olegk0 <a href="http://hwswbits.blogspot.com/2013/04/3d-hw-acceleration-on-picuntu-linux.html" target="_blank">for your great work</a>!) I tested this <b>kernel and it's more stable than the previous</b>.<br />
<br />
I've also noticed that an <b>issue with USB has disappeared</b> (on kernel 3.0.8 I experienced USB dis-/re-connects very often, which disabled USB devices for several seconds).<br />
<br />
Please note that I am so in love with the <a href="http://hwswbits.blogspot.com/2013/03/rk3066-measy-u2c-stick-power-consumption.html" target="_blank">extreme low power</a> nature of these devices and their <b>noiselessness</b> that I am using <b>my Measy U2C as a "PC stick"</b> and work with it as much as I can (using the excellent lightweight XFCE windows manager), since you can install <b>all the SW in the Ubuntu Software Center</b> plus any other programs can be compiled straight away for ARM from within Picuntu itself (no need for cross-compilers).<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-yELBHyY3raU/UZ-t1egoI-I/AAAAAAAABaY/Hnl1R7RYkUE/s1600/Picuntu_3.0.36.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="http://4.bp.blogspot.com/-yELBHyY3raU/UZ-t1egoI-I/AAAAAAAABaY/Hnl1R7RYkUE/s320/Picuntu_3.0.36.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Xubuntu on kernel 3.0.36+ running with Mali 3D on my RK3066 stick</td></tr>
</tbody></table>
<br />
All my code changes and fixes are publicly available in my github repositories (<a href="https://github.com/Galland/rk3x_kernel_3.0.36" target="_blank">in this case here</a>) but, since many people are not too comfortable <a href="http://hwswbits.blogspot.com/2013/03/compiling-picuntu-kernel-ubuntu-linux.html" target="_blank">compiling the kernel</a> from sources, I've decided to <b>release a generic 3.0.36+ image and modules+firmware</b> so you can enjoy too this new level of stability and performance with your <b>Linux</b>.<br />
<br />
You can find the <b>1080p</b> <b>kernel 3.0.36+ for RK3066</b> <b>recovery image</b> <a href="https://www.dropbox.com/s/y80dv5qt123gusb/recovery.img.7z" target="_blank">here</a> (compressed with .7z)<br />
and the <b>720p</b> <b>kernel 3.0.36+</b> <b>for RK3066 </b><b>recovery image</b> <a href="https://www.dropbox.com/s/oeyazcsagvmgtzj/recovery720p.img.7z" target="_blank">here</a> (compressed with .7z)<br />
And the <b>modules+firmware</b> <a href="https://www.dropbox.com/s/dyyl7nvuw62hcdd/mod%2Bfw.7z" target="_blank">here</a> (also .7z to be decompressed in the root folder of your Picuntu MicroSD).<br />
<br />
<br />
My <b>recommendation</b> is to <b>also install the following enhancements</b> to your MicroSD filesystem:<br />
- <a href="http://hwswbits.blogspot.com/2013/04/flash-on-picuntu-linux-arm.html" target="_blank">Flash support for Chromium web browser</a><br />
- <a href="http://hwswbits.blogspot.com/2013/04/3d-hw-acceleration-on-picuntu-linux.html" target="_blank">Mali 3D HW XF86 drivers</a> (the above kernel includes the necessary Mali modules, but to enable them you also need these steps, except the last step of kernel compilation!)<br />
- If you are going to use your stick as a PC, I strongly recommend adding a swap file to avoid "deadlocking" your Linux due to lack of RAM, <a href="http://hwswbits.blogspot.com.es/2013/03/picuntu-xfce-problems-fixes.html" target="_blank">look for "swap" here</a><br />
<br />
<br />
BTW, I've enabled <b>RK903 Wifi driver</b> on the kernel configuration. However, I don't own a stick with the RK903, so <b>I can't test</b> if it works. In any case don't expect Wifi chips that didn't work with previous kernel to work with this one, since nothing has changed there, afaik.<br />
<br />
If you find any troubles, I usually answer questions on <a href="http://miniand.com/forums/forums/picuntu-linux" target="_blank">Miniand's Linux forum</a>, so don't hesitate to post your issues there :)<br />
<br />
<br />
<br />Unknownnoreply@blogger.com98tag:blogger.com,1999:blog-6487105202596390783.post-90684963610303843792013-04-18T13:58:00.005+02:002013-04-20T11:05:12.081+02:00Compiling the Mali HW accelerated driver (xf86-video-fbdev for RK3066)<br />
Expert Linux developer olegk0 has made a framebuffer driver for the RK30 HDMI with Mali acceleration (rk30fb_drv.so). You can just download and <a href="http://hwswbits.blogspot.com/2013/04/3d-hw-acceleration-on-picuntu-linux.html" target="_blank">use his .so to have 3D</a> acceleration, or you can follow these instructions to compile it yourself and help debug it.<br />
<br />
Among other things, like 2D/3D, it allows playing <b>fullscreen videos with far less CPU usage</b>, leaving the processor just for what your app requires to decode the videos. With "app" I mean Parole, VLC or, my strong recommendation, the excellent commandline utility: mplayer (which immediately takes advantage of the HW acceleration).<br />
<br />
The downside is that it still has some bugs, like turning everything in the screen black (except the played video). Just move the mouse or a window around and everything gets redrawn again.<br />
Another bug is that the video output becomes mangled when the video window touches the left or right sides of the screen.<br />
<br />
In any case I love to be able to watch movies/videos on this stick with Linux, so what I do is open a terminal and type:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">mplayer whatever-video.avi</span></blockquote>
And screen turns black except the video, I move the mouse a bit around (which causes the black parts to be redrawn) to find the corners of the mplayer video window and make it big enough to cover most of the screen, just without touching either left or right sides of the screen.<br />
<br />
<br />
In any case, if you would like to give us a helping hand debugging the XVideo implementation (my suspect is ./xf86-video-fbdev/src/video.c) just follow these steps to tinker with the code and compile the driver to see the changes:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">git clone git://github.com/olegk0/xf86-video-fbdev.git<br />sudo apt-get install xserver-xorg-dev</span></blockquote>
<div>
<br /></div>
<div>
We must then fix a dangling symlinked folder at "./xf86-video-fbdev/src/ump" pointing to "../../../../../r3p1/ump/include/ump"</div>
<div>
<br /></div>
<div>
So go to <a href="http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-gpus-ump-user-space-drivers-source-code-2/">http://malideveloper.arm.com/develop-for-mali/drivers/open-source-mali-gpus-ump-user-space-drivers-source-code-2/</a> and download the same revision (r3p1, until we get a first working driver; then we can try with a newer version), that is: Linux Kernel Device Driver r3p1-01rel1</div>
<div>
At the time of writing this is located at: <a href="http://malideveloper.arm.com/downloads/DX910-SW-99006-r3p1-01rel1.tgz">http://malideveloper.arm.com/downloads/DX910-SW-99006-r3p1-01rel1.tgz</a></div>
<div>
<br /></div>
<div>
Copy or symlink the uncompressed folder "./DX910-SW-99006-r3p1-01rel1/driver/src/ump/include/ump" to "./xf86-video-fbdev/src/ump"</div>
<div>
<br /></div>
<div>
And now just do:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">./configure --prefix=/usr<br />make<br />sudo make install</span></blockquote>
<div>
There is a lot of debug information printed on /var/log/syslog every time you play a video with mplayer, which should help in the debugging.</div>
Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-6487105202596390783.post-41898919564497949182013-04-16T07:19:00.001+02:002013-05-30T15:13:52.269+02:003D HW acceleration on Picuntu Linux (Mali400)<br />
<br />
I have ported olegk0's kernel (<a href="https://github.com/olegk0/rk3066-kernel">https://github.com/olegk0/rk3066-kernel</a>) updates and Mali driver to Picuntu on my Picuntu kernel branch (<a href="https://github.com/Galland/picuntu-3.0.8-alok" style="text-decoration: line-through;">https://github.com/Galland/picuntu-3.0.8-alok</a> <a href="https://github.com/Galland/rk3x_kernel_3.0.36">https://github.com/Galland/rk3x_kernel_3.0.36</a>).<br />
<br />
I'm testing and it seems very stable. <strike><b>glxgears</b> reports now <b>85fps 3D</b>, whereas before I was getting 5fps (3D in software), if I remember well.</strike> (glxgears is OpenGL, not OpenGL-ES, which is the HW accelerated one by Mali! thanks to Jean-Luc Aufranc for pointing it out) glmark2-es2 reports a glmark2 score of 80, and es2gears reports some 150fps.<br />
<br />
Please note that <b>Mali is the GPU</b> on the RK3066, responsible for 2D/3D acceleration, <b>not for HW video en/decoding</b>! That's done by the VPU core, which is still unsupported.<br />
<br />
Please note that, afaik, all of <b>this is work done by olegk0</b> (see [1]) and I have just checked it does work on our Picuntu, so <b>all cheers go to him</b>, thanks for the great work, olegk0!<br />
<br />
If you would like to test this too, grab my github kernel and follow the instructions on [1] or these Picuntu-targeted instructions here:<br />
<br />
1) Get <a href="https://docs.google.com/folder/d/0B6QRwjacGTzCX0UyOXNGSU5iMGc/edit?docId=0B6QRwjacGTzCZnlsMmQ0ekFkU1U">xorg.conf</a> and place it on your Picuntu MicroSD's folder <b>/etc/X11/</b><br />
<br />
2) Get <a href="https://docs.google.com/folder/d/0B6QRwjacGTzCZEhrOThPZERFUVU/edit">rk30fb_drv.so</a> (or <a href="http://hwswbits.blogspot.com/2013/04/compiling-mali-hw-accelerated-driver.html" target="_blank">compile it yourself</a>) and place it on your Picuntu MicroSD's folder <b>/usr/lib/xorg/modules/drivers/</b><br />
<br />
3) Modify <b>/etc/rc.local</b> by commenting (precede with #) existing lines that use "fbset" and adding the following new lines:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">fbset -rgba 8/16,8/8,8/0,8/24 -a</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">chmod 666 /dev/mali /dev/ump</span></blockquote>
<br />
4) Modify <b>/etc/modules</b> to add the following lines:<br />
<span style="font-family: Courier New, Courier, monospace;">rk29-ipp<br />ump</span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;">disp_ump</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">mali</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">drm</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">mali_drm</span><br />
<br />
5) Get the <a href="http://dn.odroid.com/MALI400_R3P2/20130222/mali_packages.tar.gz">mali package</a>, uncompress and install this file: <b>mali400_2.1-13_armhf.deb</b><br />
<br />
6) Run the following commands:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo mv /usr/lib/arm-linux-gnueabihf/mesa-egl/ /usr/lib/arm-linux-gnueabihf/.mesa-egl/ </span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libEGL.so</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libEGL.so.1.4</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libGLESv1_CM.so</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libGLESv1_CM.so.1.1</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libGLESv2.so</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/lib/libMali.so </span><span style="font-family: 'Courier New', Courier, monospace;">/usr/lib/</span><span style="font-family: 'Courier New', Courier, monospace;">libGLESv2.so.2.0</span></div>
<br />
<br />
<br />
Then if you enter: <span style="font-family: Courier New, Courier, monospace;">ll /usr/lib | grep libMali</span><br /><br />The output should look something like this:<br /><span style="font-family: Courier New, Courier, monospace;">lrwxrwxrwx 1 root root 19 abr 16 17:58 libEGL.so -> /usr/lib/libMali.so<br />lrwxrwxrwx 1 root root 10 feb 22 02:06 libEGL.so.1.4 -> libMali.so<br />lrwxrwxrwx 1 root root 19 abr 16 17:58 libGLESv1_CM.so -> /usr/lib/libMali.so<br />lrwxrwxrwx 1 root root 10 feb 22 02:06 libGLESv1_CM.so.1.1 -> libMali.so<br />lrwxrwxrwx 1 root root 19 abr 16 17:58 libGLESv2.so -> /usr/lib/libMali.so<br />lrwxrwxrwx 1 root root 10 feb 22 02:06 libGLESv2.so.2.0 -> libMali.so<br />-rw-r--r-- 1 root root 731492 feb 22 02:06 libMali.so</span><br /><br />
<br />
<br />
<br />
<b>LAST STEP : ONLY IF YOU ARE NOT USING <a href="http://hwswbits.blogspot.com/2013/05/unofficial-new-3036-kernel-for-picuntu.html">KERNEL 3.0.36+</a></b><br />
Get <a href="https://github.com/Galland/rk3x_kernel_3.0.36">my github kernel code</a> (3.0.36+) and <a href="http://hwswbits.blogspot.com/2013/03/compiling-picuntu-kernel-ubuntu-linux.html" target="_blank">compile it</a><strike>, just make sure that you do this too:</strike><br />
<br />
<strike>- I'm using the Measy U2C stick, which has DDR3 1333 9-9-9 capable memory, but this may not be your case and may cause your system to not boot. So just before compiling ("make -j 4") do "<b>make menuconfig</b>" and get inside "System Type" and there set "DDR Memory Type" to "DDR3 (Type default)" and "DDR SDRAM frequence (in MHz)" [sic] to "333".</strike><br />
<br />
- Also please note that my kernel is set to Maximum CPU frequency of 1.6 GHz (instead of 1.2 GHz in stock Picuntu), so use at your own risk!!!!! <strike>For added safety you can make your CPU run cooler by setting (in above menuconfig) into "CPU Power Management" --> "CPU Frequency scaling" --> "Default CPUfreq governor" to <a href="http://wiki.rootzwiki.com/CPU_Governors">"conservative" or "powersave"</a>, so it will rarely go to high frequencies (but it'll be slower). My CPU does fine with 1.6 GHz without any heatsink, and usually runs at 60-70 ÂșC, with 80+ spikes :S however voltage scaling is known to work on my stick (not on others I fear).</strike> I fixed this in current github kernel, so CPU automatically scales down frequency when temperature rises.<br />
<br />
<strike>- You may also want to check on "Device Drivers" -> "Network device support" -> "Wireless LAN" that your Wifi chip/stick is selected there, for its driver to be compiled. My kernel is, currently, more up to date than others, and as you will see, there is a driver for the RK903 Wifi. However, since I don't own a stick that has it, I haven't been able to test. Please let me know if it works for you :)</strike><br />
<br />
- After compiling, you have to do "<b>make modules</b>" too, this is very important!<br />
<br />
- Then do "<b>make modules_install</b>" and go to your PC's /lib/modules to grab the full <strike>"3.0.8+alok"</strike> "3.0.36+" folder and copy it to your Picuntu MicroSD's /lib/modules folder (or just do all this on your Picuntu Linux!!:), then boot up your Picuntu stick and type in a terminal "<b>depmod -a</b>" so it will parse the new modules and <b>restart </b>Picuntu.<br />
<br />
- After doing that you can flash the recovery partition with the compiled kernel<br />
<br />
This could sound complicated but kernel tinkering is actually pretty straightforward and works! :) Hope it helps and check your temperature with: <b>cat /sys/module/tsadc/parameters/temp*</b><br />
<br />
<b>END OF LAST STEP (only for non 3.0.36+)</b><br />
<br />
<br />
<br />
<h3>
<b>Testing 3D acceleration:</b></h3>
Run as a normal user: <span style="font-family: Courier New, Courier, monospace;">es2gears </span><br />
It should report >120 fps (I usually get from 120 to 170 fps) with a CPU usage of around 30% for Xorg and just <15% for es2gears.<br />
If that's not the case then double-check above steps and if it still doesn't work, you can, for example, post your questions at <a href="http://miniand.com/forums/forums/picuntu-linux">Miniand's Picuntu forum</a>, where I try to be of help.<br />
<br />
<br />
<br />
<b>Disclaimer: Use at your own risk!!</b><br />
<br />
If you run into an "Illegal instruction" error or a sudden reboot... your stick needs a heatsink... I spent the whole glmark2-es2 test blowing air to mine!<br />
This is due to my overclocking the GPU from 266 MHz to its limit of 400 MHz, <u>I've undone this</u> in the github kernel too :)<br />
<br />
<b><u><br /></u></b>
<u><strike><b>MK808 note:</b> If you have a MK808 you may want to compile olegk0's kernel instead of mine, because MK808 uses a different "LCDC video port" for HDMI output (1 instead of 0), which requires some minor code changes. However my kernel is more up to date (less bugs, less power consumption, etc.) than his, so I must recommend it for other sticks.</strike></u><br />
<br />
<br />
<br />
<u>Reference</u><br />
http://www.slatedroid.com/topic/55626-my-version-of-the-linux-kernel-for-mk808/<br />
http://linux-sunxi.org/Binary_drivers<br />
https://www.miniand.com/forums/forums/picuntu-linux/topics/new-kernel-3-0-36-for-picuntu-linux-on-rk3066-released</div>
Unknownnoreply@blogger.com8