{"id":1426,"date":"2012-03-14T15:05:11","date_gmt":"2012-03-14T15:05:11","guid":{"rendered":"http:\/\/www.chalk-elec.com\/?p=1426"},"modified":"2017-02-23T09:41:37","modified_gmt":"2017-02-23T09:41:37","slug":"how-to-compile-android-ics-with-touchscreen-support","status":"publish","type":"post","link":"https:\/\/www.chalk-elec.com\/?p=1426","title":{"rendered":"How to compile Android ICS with touchscreen support"},"content":{"rendered":"<div class=\"bluebox\"><h6>This post was created with valuable help of Zhi Yong Woo and Benjamin Tissoires<\/h6><\/div><div class=\"line\"><\/div>\n<p>OK, lets make our own Android ICS tablet based on PandaBoard and our 10&#8243; LCD bundle. We will use Linaro 12.01 build.<\/p>\n<p><iframe loading=\"lazy\" title=\"Android ICS (Linaro) running on PandaBoard with LCD and capacitive touchscreen\" width=\"630\" height=\"354\" src=\"https:\/\/www.youtube.com\/embed\/BWZXKImuJ4U?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h5>Prerequisites<\/h5>\n<p>We will need Ubuntu 11.04 x64 as a host machine. I tried different others hosts including 10.04LTS and 11.10, but only 11.04 x64 gave me working result. You can install your machine in VirtualBox &#8211; that&#8217;s exactly what I did. Just turn on Intel virtualization (VT-x) option in BIOS an enable it in VirtualBox. Also, you will need around 40 Gbytes of free disk space.<\/p>\n<h5>Install required packages<\/h5>\n<pre>\r\nsudo apt-get install git-core gnupg flex bison gperf build-essential \\\r\n        zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \\\r\n        x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \\\r\n        libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \\\r\n        libxml2-utils xsltproc libncurses5-dev libreadline6-dev \\\r\n        gcc-arm-linux-gnueabi uboot-mkimage\r\n<\/pre>\n<h5>Install Java JDK<\/h5>\n<p>Oracle forced to remove Java JDK from standard Ubuntu repository recently. Therefore, we will use small trick to install JDK. <\/p>\n<pre>\r\nwget https:\/\/raw.github.com\/flexiondotorg\/oab-java6\/master\/oab-java6.sh -O oab-java6.sh\r\nchmod +x oab-java6.sh\r\nsudo .\/oab-java6.sh\r\nsudo apt-get install sun-java6-jdk\r\n<\/pre>\n<h5>Install Linaro image tools<\/h5>\n<pre>\r\nsudo add-apt-repository ppa:linaro-maintainers\/tools \r\nsudo apt-get update \r\nsudo apt-get install linaro-image-tools\r\n<\/pre>\n<h5>Install Repo tool<\/h5>\n<pre>\r\ncurl https:\/\/dl-ssl.google.com\/dl\/googlesource\/git-repo\/repo > ~\/bin\/repo\r\nexport PATH=$HOME\/bin:$PATH\r\nchmod a+x ~\/bin\/repo\r\n<\/pre>\n<h5>Download Android source code (Linaro 12.01)<\/h5>\n<pre>\r\nexport MANIFEST_REPO=git:\/\/android.git.linaro.org\/platform\/manifest.git \r\nexport MANIFEST_BRANCH=linaro_android_4.0.3 \r\nexport MANIFEST_FILENAME=landing-panda.xml\r\nmkdir ~\/work\r\nmkdir ~\/work\/android \r\ncd ~\/work\/android \r\nrepo init -u ${MANIFEST_REPO} -b ${MANIFEST_BRANCH} -m ${MANIFEST_FILENAME} \r\nrepo sync\r\n<\/pre>\n<p>This will download > 2 Gb of sources and will take around one hour (highly depends on your Internet speed).<\/p>\n<h5>Download toolchain<\/h5>\n<pre>\r\ncd ~\/work \r\nwget --no-check-certificate http:\/\/releases.linaro.org\/12.01\/components\/android\/toolchain\/4.6\/android-toolchain-eabi-linaro-4.6-2012.01-2-2012-01-13_19-04-18-linux-x86.tar.bz2\r\ntar -jxvf android-toolchain-eabi-linaro-4.6-2012.01-2-2012-01-13_19-04-18-linux-x86.tar.bz2\r\n<\/pre>\n<h5>Build source code<\/h5>\n<pre>\r\ncd ~\/work\/android \r\nexport TARGET_PRODUCT=pandaboard \r\nexport TARGET_SIMULATOR=false \r\nexport TARGET_TOOLS_PREFIX=~\/work\/android-toolchain-eabi\/bin\/arm-linux-androideabi-\r\nmake TARGET_PRODUCT=${TARGET_PRODUCT} TARGET_TOOLS_PREFIX=${TARGET_TOOLS_PREFIX} HOST_CC=gcc-4.5 HOST_CXX=g++-4.5 HOST_CPP=cpp-4.5 boottarball systemtarball userdatatarball\r\n<\/pre>\n<p>If you have multi-core processor, then you should try to use &#8220;make -jX &#8230;&#8221; to speed-up compilation. I used &#8220;make -j8 &#8230;&#8221; on my i7 processor. Compilation time highly depends on your computer and can vary from 20 minutes to several hours. So, have another cup of coffee and keep fingers crossed \ud83d\ude42<\/p>\n<h5>Build source code<\/h5>\n<pre>\r\ncd ~\/work\/android \r\nexport TARGET_PRODUCT=pandaboard \r\nexport TARGET_SIMULATOR=false \r\nexport TARGET_TOOLS_PREFIX=~\/work\/android-toolchain-eabi\/bin\/arm-linux-androideabi-\r\nmake TARGET_PRODUCT=${TARGET_PRODUCT} TARGET_TOOLS_PREFIX=${TARGET_TOOLS_PREFIX} HOST_CC=gcc-4.5 HOST_CXX=g++-4.5 HOST_CPP=cpp-4.5 boottarball systemtarball userdatatarball\r\n<\/pre>\n<p>If you have multi-core processor, then you should try to use &#8220;make -jX &#8230;&#8221; to speed-up compilation. I used &#8220;make -j8 &#8230;&#8221; on my i7 processor. Compilation time highly depends on your computer and can vary from 20 minutes to several hours.<\/p>\n<h5>Find out the name of your SD card device<\/h5>\n<p>Insert SD card and enter the following command:<\/p>\n<pre>\r\ndf -h\r\n<\/pre>\n<p>You will see the list of storage devices, you should find out which one is your SD card. Mine has name &#8220;sdb&#8221;, and I will use it in the next command.<\/p>\n<h5>Install Android image to SD card<\/h5>\n<pre>\r\ncd ~\/work\/android\/out\/target\/product\/pandaboard \r\nsudo linaro-android-media-create --mmc \/dev\/sdb --dev panda --system system.tar.bz2 --boot boot.tar.bz2 --userdata userdata.tar.bz2 \r\nsync\r\n<\/pre>\n<p>We use here &#8220;sdb&#8221; as a name of SD card. Now remove SD card and insert it again &#8211; you will see several partitions opened in separate windows.<\/p>\n<h5>Apply Android binary patch<\/h5>\n<p>Insert SD card and enter the following command:<\/p>\n<pre>\r\ncd ~\/work\r\nwget http:\/\/releases.linaro.org\/12.01\/android\/images\/landing-panda\/install-binaries.sh \r\nchmod a+x install-binaries.sh\r\n.\/install-binaries.sh \/dev\/sdb2\r\nsync\r\n<\/pre>\n<p>Here we again use &#8220;sdb&#8221; as a name of SD card (2 is added to point to system partition).<\/p>\n<h5>Set correct LCD resolution<\/h5>\n<p>Go to &#8220;\/media\/boot&#8221; folder (this is boot partition of your SD card), open file &#8220;boot.txt&#8221; and add the following arguments to &#8220;setenv bootargs &#8230;&#8221; string: <\/p>\n<pre>\r\nomapfb.mode=dvi:1024x600MR-24@60 consoleblank=0\r\n<\/pre>\n<p>Now save file. And enter the following command to generate boot script:<\/p>\n<pre>\r\nsudo mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n 'boot script' -d boot.txt boot.scr \r\nsync\r\n<\/pre>\n<p>Now we have working Android with correct LCD output, but our touchscreen doesn&#8217;t work. Well, that&#8217;s right time to recompile kernel to add touchscreen support. Lets&#8217; proceed!<\/p>\n<h5>Configure kernel<\/h5>\n<pre>\r\ncd ~work\/android\/kernel \r\nmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- panda_defconfig \r\nmake ARCH=arm menuconfig \r\n<\/pre>\n<p>Now select this driver in configuration menu: <\/p>\n<pre>\r\nDevice Drivers --> HID Devices --> Special HID drivers --> HID Multitouch panels \r\n<\/pre>\n<p>Save configuration and exit.<\/p>\n<h5>Build kernel and copy to boot partition on SD card<\/h5>\n<pre>\r\nmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage\r\ncp ~work\/android\/kernel\/arch\/arm\/boot\/uImage \/media\/boot\r\nsync\r\n<\/pre>\n<p>Now we have working touchscreen, but it works really weird &#8211; only left top corner is working as projected to whole screen. This is because Android gets HDMI default resolution (1920&#215;1080) and assigns it to touchscreen. Our touchscreen is connected through USB and is considered as &#8220;external&#8221; device, so Android thinks it is related to HDMI input. Therefore we have to configure touchscreen to be considered as &#8220;internal&#8221; device (just set parameter . Then Android will assign DVI resolution to it.<\/p>\n<h5>Configure touchscreen resolution<\/h5>\n<ol class=\"number-list\">\n<li>Connect Pandaboard to PC with mini-USB cable and run ADB utility (it is available in Android SDK)<\/li>\n<li>Get file from this link <a href=http:\/\/goo.gl\/XstK2>Vendor_2087_Product_0a01.idc<\/a> and put it to your current folder<\/li>\n<li>Enter the following commands to remount Android file system in R\/W mode and to copy configuration file:\n<pre>\r\nadb remount\r\nadb push Vendor_2087_Product_0a01.idc \/system\/usr\/idc\/Vendor_2087_Product_0a01.idc\r\nadb sync<\/pre>\n<\/li>\n<li>Restart Pandaboard<\/li>\n<li>You should have fully working touchscreen now.\n<\/ol>\n<div class=\"line\"><\/div>\n<p>Here are links to built images, kernel and boot.scr file:<br \/>\n<a href=http:\/\/goo.gl\/FBvCE>boot.tar.bz2<\/a><br \/>\n<a href=http:\/\/goo.gl\/bNcTs>system.tar.bz2<\/a><br \/>\n<a href=http:\/\/goo.gl\/Mf34j>userdata.tar.bz2<\/a><br \/>\n<a href=http:\/\/goo.gl\/ihKY9>boot.scr<\/a><br \/>\n<a href=http:\/\/goo.gl\/ps3SV>Kernel<\/a><br \/>\n<a href=http:\/\/goo.gl\/Ta3RH>Full SD card image (use DD or Win32DiskImage to write to card)<\/a><\/p>\n<div class=\"line\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>OK, lets make our own Android ICS tablet based on PandaBoard and our 10&#8243; LCD bundle. We will use Linaro 12.01 build. Prerequisites We will need Ubuntu 11.04 x64 as a host machine. I tried different others hosts including 10.04LTS and 11.10, but only 11.04 x64 gave me working result. You can install your machine [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-1426","post","type-post","status-publish","format-standard","hentry","category-howto"],"_links":{"self":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/1426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1426"}],"version-history":[{"count":10,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/1426\/revisions"}],"predecessor-version":[{"id":2265,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=\/wp\/v2\/posts\/1426\/revisions\/2265"}],"wp:attachment":[{"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chalk-elec.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}