<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.samygo.tv/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=E3V3A</id>
	<title>SamyGO - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.samygo.tv/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=E3V3A"/>
	<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Special:Contributions/E3V3A"/>
	<updated>2026-05-25T03:14:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Extracting_the_ES-series_firmware&amp;diff=3662</id>
		<title>Extracting the ES-series firmware</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Extracting_the_ES-series_firmware&amp;diff=3662"/>
		<updated>2013-02-09T15:56:40Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* 6. Extracting exeDSP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Extracting the ES-series Firmware ==&lt;br /&gt;
&lt;br /&gt;
Here we will show you how to extract an official Samsung stock firmware for your ES-model, based on the MStar processor found in most of these models. The best way to illustrate how this is done, is by providing a working example, for a particular model. Then you just have to determine your model and download the appropriate firmware (FW) for your TV set. In our case we have a European ES5700 running the T-MST10PDEUC firmware. So we will take it from there. &lt;br /&gt;
&lt;br /&gt;
However, there are some tool requirements that you need satisfy before proceeding. For example, you need a working Python installation, some standard file extraction utilities, in addition to downloading the correct firmware. Here is the extraction procedure:&lt;br /&gt;
&lt;br /&gt;
# Install Python&lt;br /&gt;
# Install PyCrypto&lt;br /&gt;
# Download latest SamyGO patcher script from svn&lt;br /&gt;
# Extract your firmware&lt;br /&gt;
# Decrypt it (just example)&lt;br /&gt;
# Uncompress exe.img with 7zip and extract exeDSP or any other file you want. &amp;lt;br&amp;gt; Or mount image file as a loop device under linux...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example extraction for:&lt;br /&gt;
&lt;br /&gt;
 PC OS:      Windows + Cygwin&lt;br /&gt;
 TV Model:   UExxES5700&lt;br /&gt;
 Processor:  MST-10 Plus&lt;br /&gt;
 FW series:  T-MST10PDEUC&lt;br /&gt;
 FW version: 1029.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1. Installing ''Python'' (on Windows) ==== &lt;br /&gt;
&lt;br /&gt;
I really hate using native Windows Python/Perl interpreters. So I will not &lt;br /&gt;
show you how to install those. Instead, you will eventually be grateful to&lt;br /&gt;
have installed ''Cygwin'', which is the most simple way to do this. Just install &lt;br /&gt;
Cygwin and then run setup and select one of the Python (Python 2.x.x or 3) &lt;br /&gt;
packages... &lt;br /&gt;
&lt;br /&gt;
(For installing Python3 on Cygwin check here. Not yet needed...) &lt;br /&gt;
http://stackoverflow.com/questions/440547/installing-python-3-0-on-cygwin )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 2. Installing ''PyCrypt'' in Cygwin ====&lt;br /&gt;
&lt;br /&gt;
If you already have a previous installation of Python in Cygwin (like any &lt;br /&gt;
descent hacker should have), all you have to do is installing the PyCrypt &lt;br /&gt;
modules. Just fire up your latest Cygwin &amp;quot;setup.exe&amp;quot;, and in the &amp;quot;Python&amp;quot; &lt;br /&gt;
category you'll find the &amp;quot;python-crypto&amp;quot; package. (2.6-1 at this writing).&lt;br /&gt;
Select and continue installation to finish.&lt;br /&gt;
&lt;br /&gt;
If you need to compile your own, check:&lt;br /&gt;
https://www.dlitz.net/software/pycrypto/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 3. Downloading &amp;quot;''SamyGO''&amp;quot; ==== &lt;br /&gt;
&lt;br /&gt;
The SamyGo script is also known as the &amp;quot;SamyGO Firmware Patcher&amp;quot; script. &lt;br /&gt;
This is what you need to download. Be sure to get the latest build possible. &lt;br /&gt;
&lt;br /&gt;
The script (always updated and recent) can be found on svn:&lt;br /&gt;
 http://sourceforge.net/p/samygo/code&lt;br /&gt;
Navigate to '''patcher/trunk/''', click on '''SamyGO Firmware Patcher.py''' and press &amp;quot;Download this file&amp;quot; at the top.&lt;br /&gt;
&lt;br /&gt;
Rename script to &amp;quot;SamyGO.py&amp;quot;, if needed.&lt;br /&gt;
&lt;br /&gt;
==== 4. Extract your firmware ==== &lt;br /&gt;
&lt;br /&gt;
Of course you have already downloaded your firmware, so you need to &lt;br /&gt;
decompress the firmware. The firmware is usually delivered as a Windows &lt;br /&gt;
executable file. If you use 7-zip, it will automatically extract the &lt;br /&gt;
files into a sub-directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, extracting:&lt;br /&gt;
&lt;br /&gt;
 T-MST10PDEUC_1029.0.exe  ==[7-zip]==&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Will result in a subdirectory structure as:&lt;br /&gt;
&lt;br /&gt;
 ./T-MST10PDEUC_1029.0/T-MST10PDEUC/image/&lt;br /&gt;
&lt;br /&gt;
containing the files:&lt;br /&gt;
&lt;br /&gt;
 appext.img.sec&lt;br /&gt;
 appext.img.sec.cs&lt;br /&gt;
 appext.img.sec.vs&lt;br /&gt;
 exe.img.sec&lt;br /&gt;
 exe.img.sec.cs&lt;br /&gt;
 exe.img.sec.vs&lt;br /&gt;
 rootfs.img.sec&lt;br /&gt;
 rootfs.img.sec.cs&lt;br /&gt;
 rootfs.img.sec.vs&lt;br /&gt;
 uImage.sec&lt;br /&gt;
 uImage.sec.cs&lt;br /&gt;
 uImage.sec.vs&lt;br /&gt;
 appext.img.sec.cmac&lt;br /&gt;
 exe.img.sec.cmac&lt;br /&gt;
 info.txt&lt;br /&gt;
 major_version&lt;br /&gt;
 minor_version&lt;br /&gt;
 rootfs.img.sec.cmac&lt;br /&gt;
 uImage.sec.cmac&lt;br /&gt;
 validinfo.txt&lt;br /&gt;
 version_info.txt&lt;br /&gt;
&lt;br /&gt;
You need to be working in the &amp;quot;T-MST10PDEUC_1029.0&amp;quot; directory, and copy the &lt;br /&gt;
SamyGo.py script there, unless it's already in your PATH.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 5. Decrypting with ''SamyGO.py'' ==== &lt;br /&gt;
&lt;br /&gt;
 '''$ python SamyGO.py decrypt_all T-MST10PDEUC'''&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 SamyGO Firmware Patcher v0.34 (c) 2010-2011 Erdem U. Altinyurt&lt;br /&gt;
 &lt;br /&gt;
 		   -=BIG FAT WARNING!=-&lt;br /&gt;
 	    You can brick your TV with this tool!&lt;br /&gt;
 Authors accept no responsibility about ANY DAMAGE on your devices!&lt;br /&gt;
 	 project home: http://www.SamyGO.tv&lt;br /&gt;
 &lt;br /&gt;
 Firmware:  T-MST10PDEUC v1029.0&lt;br /&gt;
 &lt;br /&gt;
 AES Encrytped CI+ firmware detected.&lt;br /&gt;
 Processing file appext.img.sec&lt;br /&gt;
 secret key :  b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba&lt;br /&gt;
 Decrypting AES...&lt;br /&gt;
 Decrypting with  XOR Key :  T-MST10PDEUC&lt;br /&gt;
 Crypto package found, using fast XOR engine.&lt;br /&gt;
 &lt;br /&gt;
 Calculated CRC : 0x37E3430D&lt;br /&gt;
 CRC Validation passed&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Processing file exe.img.sec&lt;br /&gt;
 secret key :  b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba&lt;br /&gt;
 Decrypting AES...&lt;br /&gt;
 Decrypting with  XOR Key :  T-MST10PDEUC&lt;br /&gt;
 Crypto package found, using fast XOR engine.&lt;br /&gt;
 &lt;br /&gt;
 Calculated CRC : 0xE48D94E0&lt;br /&gt;
 CRC Validation passed&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Processing file rootfs.img.sec&lt;br /&gt;
 secret key :  b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba&lt;br /&gt;
 Decrypting AES...&lt;br /&gt;
 Decrypting with  XOR Key :  T-MST10PDEUC&lt;br /&gt;
 Crypto package found, using fast XOR engine.&lt;br /&gt;
 &lt;br /&gt;
 Calculated CRC : 0x76AC7C2C&lt;br /&gt;
 CRC Validation passed&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Processing file uImage.sec&lt;br /&gt;
 secret key :  b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba&lt;br /&gt;
 Decrypting AES...&lt;br /&gt;
 Decrypting with  XOR Key :  T-MST10PDEUC&lt;br /&gt;
 Crypto package found, using fast XOR engine.&lt;br /&gt;
 &lt;br /&gt;
 Calculated CRC : 0xF1681A66&lt;br /&gt;
 CRC Validation passed&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
The result of this operation is that we get a number of new files:&lt;br /&gt;
&lt;br /&gt;
 uImage&lt;br /&gt;
 uImage.enc&lt;br /&gt;
 rootfs.img&lt;br /&gt;
 rootfs.img.enc&lt;br /&gt;
 exe.img&lt;br /&gt;
 exe.img.enc&lt;br /&gt;
 appext.img&lt;br /&gt;
 appext.img.enc&lt;br /&gt;
&lt;br /&gt;
The files without the &amp;quot;.enc&amp;quot; (encrypted) extension can then be extracted &lt;br /&gt;
or mounted, again to see all individual files. &lt;br /&gt;
&lt;br /&gt;
==== 6. Extracting '''''exeDSP''''' ==== &lt;br /&gt;
&lt;br /&gt;
Now you can open any of the resulting disk image files:&lt;br /&gt;
&lt;br /&gt;
 uImage&lt;br /&gt;
 rootfs.img&lt;br /&gt;
 exe.img&lt;br /&gt;
 appext.img&lt;br /&gt;
&lt;br /&gt;
Here ''uImage'' is the &amp;quot;VDLinux&amp;quot; based kernel image. The ''exeDSP'' is contained in the ''exe.img'', which can be either expanded with 7-zip or mounted as a loop image by the standard &amp;quot;mount&amp;quot; Linux utility.&lt;br /&gt;
&lt;br /&gt;
For example, in Linux:&lt;br /&gt;
&lt;br /&gt;
 mount -t loop exe.img /dev/tmp/imgdata&lt;br /&gt;
&lt;br /&gt;
However, if you're using Windows you'll need to first extract the above disk image. You can only '''extract''' since there is no reliable Windows utility which can mount a disk image with '''Read &amp;amp; Write'''. (Cygwin does not support &amp;quot;loop&amp;quot; devices as shown above.) The recommended one to use is ''DiskInternal''s [http://www.diskinternals.com/linux-reader/ Linux Reader]. Download and install this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt; This WIP and may need some more editing... &amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ask in forum, if not understood.&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Service_Manuals&amp;diff=3658</id>
		<title>Service Manuals</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Service_Manuals&amp;diff=3658"/>
		<updated>2013-02-03T10:48:40Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: removed broken link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Service Manuals for Samsung LE-32-55B55x, 65x, 57x, 67x, 62x, 75x LCD TVs and Samsung UE-xxB7000_xxB7020_xxB8000 LED TVs are publicly available on the Internet.&lt;br /&gt;
* For LCD TV service manuals, search for N68A, or download it from here: http://rs629.rapidshare.com/files/248480133/N68A_chassis_LCD_SAMSUNG_LE-32-55B55x_65x_57x_67x_.rar&lt;br /&gt;
* For LED TV service manuals, search for N74A.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
These service manuals include:&lt;br /&gt;
* Product specifications for each model&lt;br /&gt;
* Detailed disassembly and reassembly instructions (to access the PCB or the LCD/LED panel)&lt;br /&gt;
* Exploded view and part list including the specifications of every chip, capacitor, resistor, etc. on the PCB&lt;br /&gt;
* Troubleshooting guides with standard waveforms of some measurement points&lt;br /&gt;
* List of available service menu options&lt;br /&gt;
* Calibration instructions&lt;br /&gt;
* Wiring diagrams&lt;br /&gt;
&lt;br /&gt;
== Service manual to restore bricked TV from u-boot ==&lt;br /&gt;
* Here is service manual of UN46B6000VM (and whole N72A chasis). Download from here: http://www.turuta.md/SMODE/UN40B6000VM.pdf&lt;br /&gt;
* List of available service menu options and default settings of SM.&lt;br /&gt;
* Calibration instructions&lt;br /&gt;
* Firmware restoring fom u-boot&lt;br /&gt;
* Firmware flashing with DCC manager by MasTech&lt;br /&gt;
&lt;br /&gt;
== Other service manuals ==&lt;br /&gt;
* Chasis N73A Download from here: http://www.turuta.md/SMODE/UN46B8000.pdf&lt;br /&gt;
* Chasis N66A Download from here: http://www.turuta.md/SMODE/LA32B530P7R.pdf&lt;br /&gt;
&lt;br /&gt;
Manuals include:&lt;br /&gt;
* List of available service menu options&lt;br /&gt;
* Calibration instructions&lt;br /&gt;
* USB upgrade manual&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Samsung_3D_Glasses&amp;diff=3657</id>
		<title>Samsung 3D Glasses</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Samsung_3D_Glasses&amp;diff=3657"/>
		<updated>2013-02-01T22:04:56Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: added lidt&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page I tried to explain Samsung 3D glass features.&lt;br /&gt;
&lt;br /&gt;
Samsung uses 2 different technique in their 3D glasses.&lt;br /&gt;
&lt;br /&gt;
==For C Series==&lt;br /&gt;
In 2010 model Samsung TVs, aka C series, TV emits 3D information via Infra-Red LED diode from bottom left of TV frame... So you needed to buy IR compatible 3D glasses for those TVs.&lt;br /&gt;
&lt;br /&gt;
There are two Samsung 3D Glasses modal compatible with IR&lt;br /&gt;
&lt;br /&gt;
*[[File:SSG-2100.jpg|link=http://electronics.shop.ebay.com/Gadgets-/14948/i.html?_nkw=SSG+2100]]     [http://electronics.shop.ebay.com/Gadgets-/14948/i.html?_nkw=SSG+2100 SSG-2100]&lt;br /&gt;
&lt;br /&gt;
*[[File:SSG-2200.jpg|link=http://electronics.shop.ebay.com/Gadgets-/14948/i.html?_nkw=SSG+2200]]     [http://electronics.shop.ebay.com/Gadgets-/14948/i.html?_nkw=SSG+2200 SSG-2200]&lt;br /&gt;
&lt;br /&gt;
I don't know what the difference between those models but first one looks better to my eye :)&lt;br /&gt;
&lt;br /&gt;
==For D Series==&lt;br /&gt;
In 2011 model Samsung TVs, aka D series, TV doesn't emit 3D information via IR. So your old goggles will not work for those TVs. Instead TV send 3D information via Bluetooth connection. Your glasses needed to have Bluetooth connection option to TV to work.&lt;br /&gt;
&lt;br /&gt;
[[File:SWC1000A.jpg|left|http://shop.ebay.com/?_nkw=SWC1000A]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Samsung also placed [http://shop.ebay.com/?_nkw=SWC1000A Wireless Charging Hub] for some of Samsung 3D Glasses without cables.&lt;br /&gt;
&lt;br /&gt;
Supported modals are bellow. Might be useful if you like to watch cinema with your whole family. But not valuable for 2 person watching...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[File:SSG-3100GB.jpg|link=http://shop.ebay.com/i.html?_nkw=SSG%203100GB&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10]]   [http://shop.ebay.com/i.html?_nkw=SSG%203100GB&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10 SSG-3100GB] '''Cheapest one''', but doesn't support charging. Operates with lithium button cell batteries. Personally don't like it.&lt;br /&gt;
*[[File:SSG-3300GR.jpg|link=http://shop.ebay.com/i.html?_nkw=SSG%203300GR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10]]   [http://shop.ebay.com/i.html?_nkw=SSG%203300GR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10 SSG-3300GR] Standard Black 3D Goggle that support ''Wireless Charging Hub'' or charge via USB cable.&lt;br /&gt;
*[[File:SSG-3300CR.jpg|link=http://shop.ebay.com/i.html?_nkw=SSG%203300GR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10]]   [http://shop.ebay.com/i.html?_nkw=SSG%203300CR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10 SSG-3300CR] White one of 3300GR.&lt;br /&gt;
*[[File:SSG-3500CR.jpg|link=http://shop.ebay.com/i.html?_nkw=SSG%203300CR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10]]   [http://shop.ebay.com/i.html?_nkw=SSG%203500CR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10&amp;amp;_sc=1 SSG-3500CR] Light 3D glass frame without ''Wireless Charging Hub'' support but you could recharge via TV's USB port :) ('''SamyGO's choice'''  price/performance)&lt;br /&gt;
*[[File:SSG-3700CR.jpg|link=http://shop.ebay.com/i.html?_nkw=SSG%203700CR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10]][http://shop.ebay.com/i.html?_nkw=SSG%203700GR&amp;amp;_mPrRngCbx=1&amp;amp;_udlo=10 SSG-3700CR] 3500CR with ''Wireless Charging Hub'' option. Nothing more...&lt;br /&gt;
&lt;br /&gt;
===Summary===&lt;br /&gt;
*Personally 3100GB modal is not good choice if you don't want to fight with button cells. There is ~$10 price difference between other chargeable models .&lt;br /&gt;
&lt;br /&gt;
*For me SSG-3300 and SSG-3500 modals looks good and have almost same price.&lt;br /&gt;
&lt;br /&gt;
*SSG-3500 doesn't support inductive charging but I don't think if you want to spend extra ~$150 to that charging hub and extra ~$30 for SGG-3700.&lt;br /&gt;
&lt;br /&gt;
== List of 3D glasses ==&lt;br /&gt;
&lt;br /&gt;
The currently available Samsung Active 3D glasses are:&lt;br /&gt;
&lt;br /&gt;
    Model           Receiver        FullHD  FCCID&lt;br /&gt;
    --------------------------------------------------------------&lt;br /&gt;
    SSG-2100AB      IR              No      -&lt;br /&gt;
    SSG-2200AR      IR              No      -&lt;br /&gt;
    SSG-3100GB      RF              No      A3LSSG3100GB ?&lt;br /&gt;
    SSG-3300CR      RF              No      A3LSSG3300CR ?&lt;br /&gt;
    SSG-3300GR      RF              No      A3LSSG3300GR&lt;br /&gt;
    SSG-3500CR      RF              Yes     A3LSSG3500&lt;br /&gt;
    SSG-3700CR      RF              No      A3LSSG3700CR ?&lt;br /&gt;
    SSG-4100GB      RF              Yes     A3LSSG4100GB ?&lt;br /&gt;
&lt;br /&gt;
 *&amp;quot;RF&amp;quot; is based on BlueTooth&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Main_Page&amp;diff=3656</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Main_Page&amp;diff=3656"/>
		<updated>2013-02-01T21:41:11Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Welcome to SamyGO Wiki */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Welcome to SamyGO Wiki ==&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!width=&amp;quot;480&amp;quot;|[[File:Logo.png]]&lt;br /&gt;
!align=&amp;quot;left&amp;quot; valign=&amp;quot;top&amp;quot;|&amp;lt;center&amp;gt;&lt;br /&gt;
{{red |&lt;br /&gt;
'''&amp;lt;big&amp;gt;WARNING&amp;lt;/big&amp;gt;: DO NOT UPDATE THE SAMSUNG LATEST FIRMWARE UPGRADES&amp;lt;br&amp;gt;or YOU &amp;lt;u&amp;gt;CAN NOT USE&amp;lt;/u&amp;gt; OUR HACKS AND CAN NOT REVERT FIRMWARE BACK EASILY!'''&lt;br /&gt;
}}&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{small |&lt;br /&gt;
We do not allow normal users to write on this Wiki. (If you want to change anything, please contact Wiki/forum administrators.)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{red |&lt;br /&gt;
'''We are on a new server host from now on, so you may need to [[replace your password]].'''&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:gray&amp;quot;&amp;gt;&lt;br /&gt;
NOTE: For editing permissions, please send a request to ([https://forum.samygo.tv/ucp.php?i=pm&amp;amp;mode=compose&amp;amp;u=68 Erdem_ua] or [https://forum.samygo.tv/memberlist.php?mode=viewprofile&amp;amp;u=791 juzis]). Make sure to include a reason why you want to edit our wiki.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compatibility Overview ==&lt;br /&gt;
See the [[Compatibility]] page to see which TV models should work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Safety Measures &amp;lt;small&amp;gt;(which you shouldn't start without)&amp;lt;/small&amp;gt; ==&lt;br /&gt;
#Have a working [[Enable Serial Console on non CI+ Devices|Ex-Link cable]] at hand.&lt;br /&gt;
#Ensure the backup ''exe.img'' ( stored on ''/dev/tbml10'' ) is in good condition ( and ideally not altered ).&lt;br /&gt;
#Ensure your RS232 Setting in the Service-Menu is set to &amp;quot;debug&amp;quot; and that the Watchdog option in the service-menu is turned off (''Control'' -&amp;gt; ''SubOption'').&lt;br /&gt;
#Know that your TV will reset RS232 jack back to UART mode after new firmware installation or reverting back to old version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Useful WIKI articles ==&lt;br /&gt;
&amp;lt;big&amp;gt;Do you want to hack your TV? &amp;lt;/big&amp;gt;&lt;br /&gt;
* [[This is the first document you have to read]]&lt;br /&gt;
*[[Is my TV supported?]]&lt;br /&gt;
*[[Do the SamyGO tools void my warranty?]]&lt;br /&gt;
*'''[[SamyGO for DUMMIES]]'''&lt;br /&gt;
*[[The A Series Wiki]]&lt;br /&gt;
*[[The B Series Wiki]]&lt;br /&gt;
*[[The C Series Wiki]]&lt;br /&gt;
*[[The D Series Wiki]]&lt;br /&gt;
*[[The E Series Wiki]]&lt;br /&gt;
*[[Using NoN-Samsung USB WiFi dongles with TV]]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/SamyGO Wikipedia article] - ''spread the word''&lt;br /&gt;
*[[SamyGO on WEB]] - Articles about SamyGO&lt;br /&gt;
*[[Calibration]] - How to calibrate your TV.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== General Information ===&lt;br /&gt;
*[[Samsung TV Skype Cameras]]&lt;br /&gt;
*[[Samsung 3D Glasses]]&lt;br /&gt;
*[[Card Sharing between TVs]]&lt;br /&gt;
*[[Frequently Asked Questions]]&lt;br /&gt;
*[[Service Manuals]]&lt;br /&gt;
*[[Service Menu]]&lt;br /&gt;
*[[Engineering Codes]]&lt;br /&gt;
*[[Top Debug Menu: TDM]]&lt;br /&gt;
*[[Media Play and DLNA]]&lt;br /&gt;
*[[DLNA format Requirements]]&lt;br /&gt;
*[[Samsung channel list format]]&lt;br /&gt;
*[[MessageBoxService request format]]&lt;br /&gt;
*[[Samsung TV network remote control protocol]]&lt;br /&gt;
*[[RFS file system support for linux]]&lt;br /&gt;
*[[Donation List of SamyGO Project]]&lt;br /&gt;
*[[Acronyms &amp;amp; Abbreviations]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== SamyGO DIY Hardwares ==&lt;br /&gt;
*[[SamyGO Brightness Sensor]]&lt;br /&gt;
*'''[[Remote_Control_emulator:_send_custom_IR_codes#Build_your_own_IR_transmitter | Build the dual led IR transmitter]]''' (e.g. send Factory + 3SPEED codes)&lt;br /&gt;
*[[Enable Serial Console on non CI+ Devices |Ex-Link Cable for B-Series]]&lt;br /&gt;
*'''[[Ex-Link Cable for C/D/E Series and BD players]]'''&lt;br /&gt;
*'''[[Ethernet multi-function Interface]]'''&lt;br /&gt;
*[[Upgrade TV by replacing mainboard]]&lt;br /&gt;
*'''[[UnBricking TV by EEPROM Reset]]'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interesting Reference Material ==&lt;br /&gt;
*[http://www.samsung.com/global/business/semiconductor/products/flash/downloads/applicationnote/rfs_v12_application_note.pdf Introduction to SAMSUNG's Linux Flash File System - RFS]  &lt;br /&gt;
*[http://www.samsung.com/global/business/semiconductor/products/fusionmemory/downloads/RFS_130_Porting_Guide.pdf Linux RFS ( Robust FAT File System ) Porting Guide]&lt;br /&gt;
The file-system used in the the recent Samsung TVs is &amp;quot;RFS&amp;quot;. Its proprietary nature and consequently so the absence of an according Linux RFS-Module in the standard Linux distributions makes it currently impossible to modify files by simply mounting the respective image as &amp;quot;RW&amp;quot;, modifying it and saving the respective image again. This is the reason why currently all changes are done via patching of the image-binaries. &lt;br /&gt;
[http://forum.samygo.tv/viewtopic.php?f=4&amp;amp;t=1399 But the hope never dies].&lt;br /&gt;
*[http://www.samsung.com/global/business/semiconductor/products/flash/downloads/LinuStoreII_GPL%20Compliance_10.pdf License info about XRS and TinyXSR in Linux kernel and u-boot]&lt;br /&gt;
*[http://opensource.samsung.com Samsung's source codes] or [http://www.samsung.com/global/opensource/ old source code site]&lt;br /&gt;
All the source code Samsung is legally obliged to post can be found here.&lt;br /&gt;
*[http://forums.cnet.com/samsung-forum Official Samsung Forums]&lt;br /&gt;
Should be able to find useful info somewhere.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Disclaimer ==&lt;br /&gt;
Neither this WIKI/Forum nor the author(s) of articles and information provided accept any responsibility for damage that may be caused by use of the information provided. You do everything at your own risk. Be aware that &amp;quot;hacking&amp;quot; activities may void your warranty!&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;big&amp;gt;'''[[Crew List]]'''&amp;lt;/big&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;br&amp;gt;&amp;amp;&amp;lt;br&amp;gt;[[Rest In Peace]]&amp;lt;/small&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Rooting_the_ES-series&amp;diff=3647</id>
		<title>Rooting the ES-series</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Rooting_the_ES-series&amp;diff=3647"/>
		<updated>2013-01-26T08:20:31Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&amp;lt;big&amp;gt;'''WARNING!'''&amp;lt;/big&amp;gt;&amp;lt;/font color&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the WIP status of this, we are working on a non-permanent rooting utility. The plan is to use a USB memory stick based rooting tool, that must be activated manually every time TV is started. Preferably it should be done by linking it to the useless &amp;quot;Family Story&amp;quot; button on the remote control.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Prepare the USB memory stick =&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
0. make sure your USB flash drive is formatted as FAT. &amp;lt;br&amp;gt;&lt;br /&gt;
1. Download [http://forum.samygo.tv/download/file.php?id=1509 usb_card_updated.zip]&amp;lt;br&amp;gt;&lt;br /&gt;
2. [http://www.7-zip.org/download.html Unzip] to the root directory of your USB stick.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Done.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create the SMART-HUB developer account=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
1. Enter &amp;quot;SMART HUB&amp;quot; screen by pressing the smarthub button on the remote &amp;lt;br&amp;gt;&lt;br /&gt;
2. Press the &amp;quot;TOOLS&amp;quot; button&amp;lt;br&amp;gt;&lt;br /&gt;
3. Go to &amp;quot;Settings&amp;quot; entry in the Tools menu&amp;lt;br&amp;gt;&lt;br /&gt;
3. Press &amp;quot;Create an account&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
4. Enter the name: '''develop''' and any password (keep it simple this time)&amp;lt;br&amp;gt;&lt;br /&gt;
5. EXIT &amp;quot;SMART HUB&amp;quot; and reboot TV&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! If you can`t create account (option is greyed out)&amp;lt;br&amp;gt;&lt;br /&gt;
Then go direct to Login (red or A) and enter:&lt;br /&gt;
 user: develop&lt;br /&gt;
 password: 111111 (or any other six digits as password)&lt;br /&gt;
&lt;br /&gt;
=Installing SamyGO Hack=&lt;br /&gt;
&lt;br /&gt;
'''NB! &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;All your previously installed widgets will be deleted!&amp;lt;/font&amp;gt;''' &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Start SmartHub&amp;lt;br&amp;gt;&lt;br /&gt;
2. Go to Login (red or &amp;quot;A&amp;quot;)&amp;lt;br&amp;gt;&lt;br /&gt;
3. Go to Settings (blue or &amp;quot;D&amp;quot;) -&amp;gt; Development -&amp;gt; '''Setting Server IP'''&amp;lt;br&amp;gt;&lt;br /&gt;
4. Enter this IP:&lt;br /&gt;
[[Image:Develop_ip.png|250px|thumb|left| ]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
5. Press '''User Application Synchronization''' &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wait until TV installs widget (SamyGO Extensions)...&amp;lt;br&amp;gt;&lt;br /&gt;
This could take a while, it depends on your internet speed. Wait until TV says &amp;quot;done&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Exit developer menu, exit SmartHub.&amp;lt;br&amp;gt;&lt;br /&gt;
7. Remove any other USB devices connected to your TV. (You can connect them back later.)&amp;lt;br&amp;gt;&lt;br /&gt;
8. Insert USB stick. When the automatic selection menu appears, just cancel by hitting [EXIT].&amp;lt;br&amp;gt;&lt;br /&gt;
9. Return to SmartHub and you will find a new widget '''Test2'''. Execute it.&amp;lt;br&amp;gt;&lt;br /&gt;
10. You will be greeted with a white screen that says &amp;quot;Press ENTER to continue&amp;quot;, do so.&amp;lt;br&amp;gt;&lt;br /&gt;
11. If your USB stick is made properly you will see:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Log:&lt;br /&gt;
 NumUSBs:1&lt;br /&gt;
 VendorName: &amp;lt;something&amp;gt;&lt;br /&gt;
 ModelName =USB Flash Drive&lt;br /&gt;
 MountPatch=sda1&lt;br /&gt;
 AvailSize = &amp;lt;something&amp;gt;&lt;br /&gt;
 TotalSize = &amp;lt;something&amp;gt;&lt;br /&gt;
 ----------------------------&lt;br /&gt;
 Now run web browser to continue&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
12. Hit [EXIT].&amp;lt;br /&amp;gt;&lt;br /&gt;
13. Run your web browser two times! Hit [EXIT] after each time. &amp;lt;br /&amp;gt;&lt;br /&gt;
The second time it should take about 10 seconds before starting. This means that your hack is working.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Done.&lt;br /&gt;
&lt;br /&gt;
= How To Use =&lt;br /&gt;
&lt;br /&gt;
== Remote Shell ==&lt;br /&gt;
{{#ev:youtube|B4JFRVeZmzw| |right|How to use netcat to connect to SamsungTV on windows.}}&lt;br /&gt;
&lt;br /&gt;
Remote shell of the current ES series is obtained through a reverse shell hack. Standard Telnet (''telnetd'') and SSH (''sshd'') daemon implementation have not yet been possible due to a crippled kernel FS, not allowing for proper handling of ''/dev/pty'' devices.&lt;br /&gt;
&lt;br /&gt;
This poses some strong limitations on the interactiveness of the shell. Basically, normal ANSI control sequences are not available, which means that you cannot edit command lines at all. You just have to retype everything. In addition, you do not receive any error messages either. &lt;br /&gt;
&lt;br /&gt;
To connect to the shell we use ''netcat'' (nc) or ''telnet'' from a PC on the local network. &lt;br /&gt;
&lt;br /&gt;
 nc &amp;lt;your_tv_ip&amp;gt; 1023&lt;br /&gt;
 '''or'''&lt;br /&gt;
 telnet &amp;lt;your_tv_ip&amp;gt; 1023&lt;br /&gt;
&lt;br /&gt;
For example: &lt;br /&gt;
&lt;br /&gt;
 nc 192.168.1.1 1023&lt;br /&gt;
 shell&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Done.&lt;br /&gt;
&lt;br /&gt;
== ExLink Shell ==&lt;br /&gt;
We have root shell on ExLink, but shell entry is currently crippled by only allowing HEX characters... &lt;br /&gt;
&lt;br /&gt;
TBA&lt;br /&gt;
&lt;br /&gt;
==FTP==&lt;br /&gt;
Connect using any FTP client to your TV`s port 21.&lt;br /&gt;
 user     - not required, leave blank&lt;br /&gt;
 password - not required, leave blank&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3644</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3644"/>
		<updated>2013-01-24T20:03:45Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The setup script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
'''sexport.sh''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# sexport.sh - Exports variables used by the CodeSorcery ARM cross-compiler &lt;br /&gt;
#==============================================================================&lt;br /&gt;
# NOTE: Export doesn't work when used in shell script. It can only be &amp;quot;sourced&amp;quot;&lt;br /&gt;
#       So you need to run this with:  &amp;quot;. ./sexport.sh&amp;quot;&lt;br /&gt;
#------------------------------------------------------------------------------&lt;br /&gt;
checkwindrives () {&lt;br /&gt;
 MYOS=`uname -o`&lt;br /&gt;
 if [[ $MYOS == &amp;quot;Cygwin&amp;quot; ]]; then &lt;br /&gt;
	 TEST=`mount |grep -i &amp;quot;posix=0&amp;quot;`&lt;br /&gt;
	 if [ $? != 1 ]; then&lt;br /&gt;
	    echo -e &amp;quot;One or more of your harddrives are mounted as NOT case-sensitive!\n&amp;quot;;&lt;br /&gt;
	    echo -e &amp;quot;$TEST\n&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;A case sensitive NTFS drive may be necessary for compiling Linux Kernels on Cygwin.&amp;quot;; &lt;br /&gt;
	    echo &amp;quot;You can fix this by enabling case sensitivity in the windows registry and rebooting:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\ DWORD:obcaseinsensitive 0&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;You can also try to remounting cygdrives in 'posix=1' mode by editing /etc/fstab to:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'none /cygdrive cygdrive binary,posix=1,user 0 0'&amp;quot;&lt;br /&gt;
	    echo &amp;quot;or try directly on command line (after reboot) with:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'umount /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'mount -f -o binary,posix=1 d: /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;WARNING: Doing this may have unknown consequences for other native windows programs.&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;    See: http://tiny.cc/4s0uqw and http://tiny.cc/ik1uqw and http://tiny.cc/4oavqw &amp;quot;;&lt;br /&gt;
	 fi&lt;br /&gt;
 fi&lt;br /&gt;
}&lt;br /&gt;
if [ $0 != &amp;quot;bash&amp;quot; ]; then&lt;br /&gt;
	echo &amp;quot;This export script need to be sourced!&amp;quot;;&lt;br /&gt;
	echo &amp;quot;That is, you have to run it with: . ./sexport.sh&amp;quot;&lt;br /&gt;
	exit 1;&lt;br /&gt;
else&lt;br /&gt;
	export ARCH=arm &lt;br /&gt;
	export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
	export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
	export PATH=${PATH}:/cygdrive/d/zarm/devbin/bin:.&lt;br /&gt;
	export SAMYGO=arm-samygo-linux-gnueabi-&lt;br /&gt;
	export SYSROOT=/cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
&lt;br /&gt;
	export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \ &lt;br /&gt;
			-marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \ &lt;br /&gt;
			-march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	MODHOME=/cygdrive/d/zarm/myarm/kernel_modules&lt;br /&gt;
	export INSTALL_PATH=${MODHOME}/kimagemap&lt;br /&gt;
	export MODLIB=${MODHOME}/kmods&lt;br /&gt;
	export INSTALL_MOD_PATH=/&lt;br /&gt;
&lt;br /&gt;
	shopt -s checkwinsize&lt;br /&gt;
	shopt -s extglob&lt;br /&gt;
	shopt -u hostcomplete&lt;br /&gt;
&lt;br /&gt;
	echo -e &amp;quot;\nExported:\n &amp;quot;&lt;br /&gt;
	echo &amp;quot; ARCH=$ARCH&amp;quot;&lt;br /&gt;
	echo &amp;quot; CROSS_COMPILE=$CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; CONFIG_CROSS_COMPILE=$CONFIG_CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; SAMYGO=$SAMYGO&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; GCC_EXEC_PREFIX=${GCC_EXEC_PREFIX}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; SYSROOT=${SYSROOT}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; LD_RUN_PATH=${LD_RUN_PATH}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; KCPPFLAGS=$KCPPFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KAFLAGS=$KAFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KCFLAGS=$KCFLAGS&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; INSTALL_PATH=${INSTALL_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; INSTALL_MOD_PATH=${INSTALL_MOD_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; MODLIB=${MODLIB}&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;You can use: 'export -n &amp;lt;VAR&amp;gt;'  OR:  'unset &amp;lt;VAR&amp;gt;'  to remove property.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Also confirm that 'alias'es are not masking any important commands. Use 'unalias' to fix.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; SHELL=${SHELL}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGPATH=${CYGPATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGWIN=${CYGWIN}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;Enabled BASH(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${BASHOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Enabled SHELL(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${SHELLOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Use 'set +o &amp;lt;shell_opt&amp;gt;' and 'shopt -u &amp;lt;bash_opt&amp;gt;' to disable.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Use 'set -o &amp;lt;shell_opt&amp;gt;' and 'shopt -s &amp;lt;bash_opt&amp;gt;' to enable.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	&lt;br /&gt;
	# Check locally mounted drives for case sensitivity (Cygwin only):&lt;br /&gt;
	checkwindrives&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Obviously you have to edit the paths to what you have...&lt;br /&gt;
&lt;br /&gt;
==== Patching the Kernel for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here. &amp;lt;br /&amp;gt;&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
Since there is no available info how to patch '''VDLinux''' (based on 2.6.35.13) for Cygwin compilation, the patches used to get this working was handpicked and applied by hand from the sources below. It is not clear as to what patches are actually needed, and others may overlap in their functionality. &lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
 [1] https://sourcery.mentor.com/GNUToolchain/kbentry21&lt;br /&gt;
 [2] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01267.html&lt;br /&gt;
 [3] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01799.html&lt;br /&gt;
 &lt;br /&gt;
 [4] [http://cygwin.com/ml/cygwin/2007-08/msg00101.html HOWTO: Linux kernel compilation for ARM using cygwin] (01 Aug 2007)&lt;br /&gt;
 [5] [http://cygwin.com/ml/cygwin/2012-06/msg00221.html HOWTO: cross-compile the Linux kernel on Cygwin] (11 Jun 2012)&lt;br /&gt;
 [6] [http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html Cygwin User guide]&lt;br /&gt;
 &lt;br /&gt;
 [7] Google: &amp;quot;cygwin kernel compile error site:communities.mentor.com/community/cs/archives/arm-gnu/&amp;quot;&lt;br /&gt;
 [8] [https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c Patch for Toolchain 4.6.3-cygwin] (perhaps not needed)&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3643</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3643"/>
		<updated>2013-01-24T20:03:14Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The setup script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# sexport.sh - Exports variables used by the CodeSorcery ARM cross-compiler &lt;br /&gt;
#==============================================================================&lt;br /&gt;
# NOTE: Export doesn't work when used in shell script. It can only be &amp;quot;sourced&amp;quot;&lt;br /&gt;
#       So you need to run this with:  &amp;quot;. ./sexport.sh&amp;quot;&lt;br /&gt;
#------------------------------------------------------------------------------&lt;br /&gt;
checkwindrives () {&lt;br /&gt;
 MYOS=`uname -o`&lt;br /&gt;
 if [[ $MYOS == &amp;quot;Cygwin&amp;quot; ]]; then &lt;br /&gt;
	 TEST=`mount |grep -i &amp;quot;posix=0&amp;quot;`&lt;br /&gt;
	 if [ $? != 1 ]; then&lt;br /&gt;
	    echo -e &amp;quot;One or more of your harddrives are mounted as NOT case-sensitive!\n&amp;quot;;&lt;br /&gt;
	    echo -e &amp;quot;$TEST\n&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;A case sensitive NTFS drive may be necessary for compiling Linux Kernels on Cygwin.&amp;quot;; &lt;br /&gt;
	    echo &amp;quot;You can fix this by enabling case sensitivity in the windows registry and rebooting:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\ DWORD:obcaseinsensitive 0&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;You can also try to remounting cygdrives in 'posix=1' mode by editing /etc/fstab to:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'none /cygdrive cygdrive binary,posix=1,user 0 0'&amp;quot;&lt;br /&gt;
	    echo &amp;quot;or try directly on command line (after reboot) with:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'umount /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'mount -f -o binary,posix=1 d: /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;WARNING: Doing this may have unknown consequences for other native windows programs.&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;    See: http://tiny.cc/4s0uqw and http://tiny.cc/ik1uqw and http://tiny.cc/4oavqw &amp;quot;;&lt;br /&gt;
	 fi&lt;br /&gt;
 fi&lt;br /&gt;
}&lt;br /&gt;
if [ $0 != &amp;quot;bash&amp;quot; ]; then&lt;br /&gt;
	echo &amp;quot;This export script need to be sourced!&amp;quot;;&lt;br /&gt;
	echo &amp;quot;That is, you have to run it with: . ./sexport.sh&amp;quot;&lt;br /&gt;
	exit 1;&lt;br /&gt;
else&lt;br /&gt;
	export ARCH=arm &lt;br /&gt;
	export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
	export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
	export PATH=${PATH}:/cygdrive/d/zarm/devbin/bin:.&lt;br /&gt;
	export SAMYGO=arm-samygo-linux-gnueabi-&lt;br /&gt;
	export SYSROOT=/cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
&lt;br /&gt;
	export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \ &lt;br /&gt;
			-marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \ &lt;br /&gt;
			-march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	MODHOME=/cygdrive/d/zarm/myarm/kernel_modules&lt;br /&gt;
	export INSTALL_PATH=${MODHOME}/kimagemap&lt;br /&gt;
	export MODLIB=${MODHOME}/kmods&lt;br /&gt;
	export INSTALL_MOD_PATH=/&lt;br /&gt;
&lt;br /&gt;
	shopt -s checkwinsize&lt;br /&gt;
	shopt -s extglob&lt;br /&gt;
	shopt -u hostcomplete&lt;br /&gt;
&lt;br /&gt;
	echo -e &amp;quot;\nExported:\n &amp;quot;&lt;br /&gt;
	echo &amp;quot; ARCH=$ARCH&amp;quot;&lt;br /&gt;
	echo &amp;quot; CROSS_COMPILE=$CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; CONFIG_CROSS_COMPILE=$CONFIG_CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; SAMYGO=$SAMYGO&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; GCC_EXEC_PREFIX=${GCC_EXEC_PREFIX}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; SYSROOT=${SYSROOT}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; LD_RUN_PATH=${LD_RUN_PATH}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; KCPPFLAGS=$KCPPFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KAFLAGS=$KAFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KCFLAGS=$KCFLAGS&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; INSTALL_PATH=${INSTALL_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; INSTALL_MOD_PATH=${INSTALL_MOD_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; MODLIB=${MODLIB}&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;You can use: 'export -n &amp;lt;VAR&amp;gt;'  OR:  'unset &amp;lt;VAR&amp;gt;'  to remove property.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Also confirm that 'alias'es are not masking any important commands. Use 'unalias' to fix.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; SHELL=${SHELL}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGPATH=${CYGPATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGWIN=${CYGWIN}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;Enabled BASH(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${BASHOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Enabled SHELL(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${SHELLOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Use 'set +o &amp;lt;shell_opt&amp;gt;' and 'shopt -u &amp;lt;bash_opt&amp;gt;' to disable.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Use 'set -o &amp;lt;shell_opt&amp;gt;' and 'shopt -s &amp;lt;bash_opt&amp;gt;' to enable.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	&lt;br /&gt;
	# Check locally mounted drives for case sensitivity (Cygwin only):&lt;br /&gt;
	checkwindrives&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Obviously you have to edit the paths to what you have...&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching the Kernel for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here. &amp;lt;br /&amp;gt;&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
Since there is no available info how to patch '''VDLinux''' (based on 2.6.35.13) for Cygwin compilation, the patches used to get this working was handpicked and applied by hand from the sources below. It is not clear as to what patches are actually needed, and others may overlap in their functionality. &lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
 [1] https://sourcery.mentor.com/GNUToolchain/kbentry21&lt;br /&gt;
 [2] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01267.html&lt;br /&gt;
 [3] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01799.html&lt;br /&gt;
 &lt;br /&gt;
 [4] [http://cygwin.com/ml/cygwin/2007-08/msg00101.html HOWTO: Linux kernel compilation for ARM using cygwin] (01 Aug 2007)&lt;br /&gt;
 [5] [http://cygwin.com/ml/cygwin/2012-06/msg00221.html HOWTO: cross-compile the Linux kernel on Cygwin] (11 Jun 2012)&lt;br /&gt;
 [6] [http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html Cygwin User guide]&lt;br /&gt;
 &lt;br /&gt;
 [7] Google: &amp;quot;cygwin kernel compile error site:communities.mentor.com/community/cs/archives/arm-gnu/&amp;quot;&lt;br /&gt;
 [8] [https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c Patch for Toolchain 4.6.3-cygwin] (perhaps not needed)&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3642</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3642"/>
		<updated>2013-01-24T20:00:46Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The setup script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# sexport.sh - Exports variables used by the CodeSorcery ARM cross-compiler &lt;br /&gt;
#==============================================================================&lt;br /&gt;
# NOTE: Export doesn't work when used in shell script. It can only be &amp;quot;sourced&amp;quot;&lt;br /&gt;
#       So you need to run this with:  &amp;quot;. ./sexport.sh&amp;quot;&lt;br /&gt;
#------------------------------------------------------------------------------&lt;br /&gt;
checkwindrives () {&lt;br /&gt;
 MYOS=`uname -o`&lt;br /&gt;
 if [[ $MYOS == &amp;quot;Cygwin&amp;quot; ]]; then &lt;br /&gt;
	 TEST=`mount |grep -i &amp;quot;posix=0&amp;quot;`&lt;br /&gt;
	 if [ $? != 1 ]; then&lt;br /&gt;
	    echo -e &amp;quot;One or more of your harddrives are mounted as NOT case-sensitive!\n&amp;quot;;&lt;br /&gt;
	    echo -e &amp;quot;$TEST\n&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;A case sensitive NTFS drive may be necessary for compiling Linux Kernels on Cygwin.&amp;quot;; &lt;br /&gt;
	    echo &amp;quot;You can fix this by enabling case sensitivity in the windows registry and rebooting:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\ DWORD:obcaseinsensitive 0&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;You can also try to remounting cygdrives in 'posix=1' mode by editing /etc/fstab to:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'none /cygdrive cygdrive binary,posix=1,user 0 0'&amp;quot;&lt;br /&gt;
	    echo &amp;quot;or try directly on command line (after reboot) with:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'umount /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'mount -f -o binary,posix=1 d: /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;WARNING: Doing this may have unknown consequences for other native windows programs.&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;    See: http://tiny.cc/4s0uqw and http://tiny.cc/ik1uqw and http://tiny.cc/4oavqw &amp;quot;;&lt;br /&gt;
	 fi&lt;br /&gt;
 fi&lt;br /&gt;
}&lt;br /&gt;
if [ $0 != &amp;quot;bash&amp;quot; ]; then&lt;br /&gt;
	echo &amp;quot;This export script need to be sourced!&amp;quot;;&lt;br /&gt;
	echo &amp;quot;That is, you have to run it with: . ./sexport.sh&amp;quot;&lt;br /&gt;
	exit 1;&lt;br /&gt;
else&lt;br /&gt;
	export ARCH=arm &lt;br /&gt;
	export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
	export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
	export PATH=${PATH}:/cygdrive/d/zarm/devbin/bin:.&lt;br /&gt;
	export SAMYGO=arm-samygo-linux-gnueabi-&lt;br /&gt;
	export SYSROOT=/cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
&lt;br /&gt;
	export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \ &lt;br /&gt;
			-marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \ &lt;br /&gt;
			-march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	MODHOME=/cygdrive/d/zarm/myarm/kernel_modules&lt;br /&gt;
	export INSTALL_PATH=${MODHOME}/kimagemap&lt;br /&gt;
	export MODLIB=${MODHOME}/kmods&lt;br /&gt;
	export INSTALL_MOD_PATH=/&lt;br /&gt;
&lt;br /&gt;
	shopt -s checkwinsize&lt;br /&gt;
	shopt -s extglob&lt;br /&gt;
	shopt -u hostcomplete&lt;br /&gt;
&lt;br /&gt;
	echo -e &amp;quot;\nExported:\n &amp;quot;&lt;br /&gt;
	echo &amp;quot; ARCH=$ARCH&amp;quot;&lt;br /&gt;
#	echo &amp;quot; SUBARCH=$SUBARCH&amp;quot;&lt;br /&gt;
	echo &amp;quot; CROSS_COMPILE=$CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; CONFIG_CROSS_COMPILE=$CONFIG_CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; SAMYGO=$SAMYGO&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; GCC_EXEC_PREFIX=${GCC_EXEC_PREFIX}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; SYSROOT=${SYSROOT}&amp;quot;;&lt;br /&gt;
#	echo &amp;quot; LD_LIBRARY_PATH=${LD_LIBRARY_PATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; LD_RUN_PATH=${LD_RUN_PATH}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; KCPPFLAGS=$KCPPFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KAFLAGS=$KAFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KCFLAGS=$KCFLAGS&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; INSTALL_PATH=${INSTALL_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; INSTALL_MOD_PATH=${INSTALL_MOD_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; MODLIB=${MODLIB}&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;You can use: 'export -n &amp;lt;VAR&amp;gt;'  OR:  'unset &amp;lt;VAR&amp;gt;'  to remove property.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Also confirm that 'alias'es are not masking any important commands. Use 'unalias' to fix.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; SHELL=${SHELL}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGPATH=${CYGPATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGWIN=${CYGWIN}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;Enabled BASH(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${BASHOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Enabled SHELL(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${SHELLOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Use 'set +o &amp;lt;shell_opt&amp;gt;' and 'shopt -u &amp;lt;bash_opt&amp;gt;' to disable.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Use 'set -o &amp;lt;shell_opt&amp;gt;' and 'shopt -s &amp;lt;bash_opt&amp;gt;' to enable.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	&lt;br /&gt;
	# Check locally mounted drives for case sensitivity (Cygwin only):&lt;br /&gt;
	checkwindrives&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching the Kernel for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here. &amp;lt;br /&amp;gt;&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
Since there is no available info how to patch '''VDLinux''' (based on 2.6.35.13) for Cygwin compilation, the patches used to get this working was handpicked and applied by hand from the sources below. It is not clear as to what patches are actually needed, and others may overlap in their functionality. &lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
 [1] https://sourcery.mentor.com/GNUToolchain/kbentry21&lt;br /&gt;
 [2] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01267.html&lt;br /&gt;
 [3] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01799.html&lt;br /&gt;
 &lt;br /&gt;
 [4] [http://cygwin.com/ml/cygwin/2007-08/msg00101.html HOWTO: Linux kernel compilation for ARM using cygwin] (01 Aug 2007)&lt;br /&gt;
 [5] [http://cygwin.com/ml/cygwin/2012-06/msg00221.html HOWTO: cross-compile the Linux kernel on Cygwin] (11 Jun 2012)&lt;br /&gt;
 [6] [http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html Cygwin User guide]&lt;br /&gt;
 &lt;br /&gt;
 [7] Google: &amp;quot;cygwin kernel compile error site:communities.mentor.com/community/cs/archives/arm-gnu/&amp;quot;&lt;br /&gt;
 [8] [https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c Patch for Toolchain 4.6.3-cygwin] (perhaps not needed)&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3641</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3641"/>
		<updated>2013-01-24T19:57:15Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The setup script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# sexport.sh - Exports variables used by the CodeSorcery ARM cross-compiler &lt;br /&gt;
#==============================================================================&lt;br /&gt;
# NOTE: Export doesn't work when used in shell script. It can only be &amp;quot;sourced&amp;quot;&lt;br /&gt;
#       So you need to run this with:  &amp;quot;. ./sexport.sh&amp;quot;&lt;br /&gt;
#------------------------------------------------------------------------------&lt;br /&gt;
checkwindrives () {&lt;br /&gt;
 MYOS=`uname -o`&lt;br /&gt;
 if [[ $MYOS == &amp;quot;Cygwin&amp;quot; ]]; then &lt;br /&gt;
	 TEST=`mount |grep -i &amp;quot;posix=0&amp;quot;`&lt;br /&gt;
	 if [ $? != 1 ]; then&lt;br /&gt;
	    echo -e &amp;quot;One or more of your harddrives are mounted as NOT case-sensitive!\n&amp;quot;;&lt;br /&gt;
	    echo -e &amp;quot;$TEST\n&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;A case sensitive NTFS drive may be necessary for compiling Linux Kernels on Cygwin.&amp;quot;; &lt;br /&gt;
	    echo &amp;quot;You can fix this by enabling case sensitivity in the windows registry and rebooting:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\ DWORD:obcaseinsensitive 0&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;You can also try to remounting cygdrives in 'posix=1' mode by editing /etc/fstab to:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'none /cygdrive cygdrive binary,posix=1,user 0 0'&amp;quot;&lt;br /&gt;
	    echo &amp;quot;or try directly on command line (after reboot) with:&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'umount /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;  'mount -f -o binary,posix=1 d: /cygdrive/d'&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;WARNING: Doing this may have unknown consequences for other native windows programs.&amp;quot;;&lt;br /&gt;
	    echo &amp;quot;    See: http://tiny.cc/4s0uqw and http://tiny.cc/ik1uqw and http://tiny.cc/4oavqw &amp;quot;;&lt;br /&gt;
	 fi&lt;br /&gt;
 fi&lt;br /&gt;
}&lt;br /&gt;
if [ $0 != &amp;quot;bash&amp;quot; ]; then&lt;br /&gt;
	echo &amp;quot;This export script need to be sourced!&amp;quot;;&lt;br /&gt;
	echo &amp;quot;That is, you have to run it with: . ./sexport.sh&amp;quot;&lt;br /&gt;
	exit 1;&lt;br /&gt;
else&lt;br /&gt;
	export ARCH=arm &lt;br /&gt;
	export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
	export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
	export PATH=${PATH}:/cygdrive/d/zarm/devbin/bin:.&lt;br /&gt;
	export SAMYGO=arm-samygo-linux-gnueabi-&lt;br /&gt;
	export SYSROOT=/cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
&lt;br /&gt;
	export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	MODHOME=/cygdrive/d/zarm/myarm/kernel_modules&lt;br /&gt;
	export INSTALL_PATH=${MODHOME}/kimagemap&lt;br /&gt;
	export MODLIB=${MODHOME}/kmods&lt;br /&gt;
	export INSTALL_MOD_PATH=/&lt;br /&gt;
&lt;br /&gt;
	shopt -s checkwinsize&lt;br /&gt;
	shopt -s extglob&lt;br /&gt;
	shopt -u hostcomplete&lt;br /&gt;
&lt;br /&gt;
	echo -e &amp;quot;\nExported:\n &amp;quot;&lt;br /&gt;
	echo &amp;quot; ARCH=$ARCH&amp;quot;&lt;br /&gt;
#	echo &amp;quot; SUBARCH=$SUBARCH&amp;quot;&lt;br /&gt;
	echo &amp;quot; CROSS_COMPILE=$CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; CONFIG_CROSS_COMPILE=$CONFIG_CROSS_COMPILE&amp;quot;&lt;br /&gt;
	echo &amp;quot; SAMYGO=$SAMYGO&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; GCC_EXEC_PREFIX=${GCC_EXEC_PREFIX}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; SYSROOT=${SYSROOT}&amp;quot;;&lt;br /&gt;
#	echo &amp;quot; LD_LIBRARY_PATH=${LD_LIBRARY_PATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; LD_RUN_PATH=${LD_RUN_PATH}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; KCPPFLAGS=$KCPPFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KAFLAGS=$KAFLAGS&amp;quot;&lt;br /&gt;
	echo &amp;quot; KCFLAGS=$KCFLAGS&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot; INSTALL_PATH=${INSTALL_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; INSTALL_MOD_PATH=${INSTALL_MOD_PATH}&amp;quot;&lt;br /&gt;
	echo &amp;quot; MODLIB=${MODLIB}&amp;quot;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;You can use: 'export -n &amp;lt;VAR&amp;gt;'  OR:  'unset &amp;lt;VAR&amp;gt;'  to remove property.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Also confirm that 'alias'es are not masking any important commands. Use 'unalias' to fix.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
#	echo &amp;quot; SHELL=${SHELL}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGPATH=${CYGPATH}&amp;quot;;&lt;br /&gt;
	echo &amp;quot; CYGWIN=${CYGWIN}&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	echo &amp;quot;Enabled BASH(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${BASHOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Enabled SHELL(OPTS) environment variables:&amp;quot;;&lt;br /&gt;
	echo -e &amp;quot;\n ${SHELLOPTS}\n&amp;quot; |sed -r 's/\:/\n /g'&lt;br /&gt;
	echo &amp;quot;Use 'set +o &amp;lt;shell_opt&amp;gt;' and 'shopt -u &amp;lt;bash_opt&amp;gt;' to disable.&amp;quot;;&lt;br /&gt;
	echo &amp;quot;Use 'set -o &amp;lt;shell_opt&amp;gt;' and 'shopt -s &amp;lt;bash_opt&amp;gt;' to enable.&amp;quot;;&lt;br /&gt;
	echo;&lt;br /&gt;
	&lt;br /&gt;
	# Check locally mounted drives for case sensitivity (Cygwin only):&lt;br /&gt;
	checkwindrives&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching the Kernel for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here. &amp;lt;br /&amp;gt;&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
Since there is no available info how to patch '''VDLinux''' (based on 2.6.35.13) for Cygwin compilation, the patches used to get this working was handpicked and applied by hand from the sources below. It is not clear as to what patches are actually needed, and others may overlap in their functionality. &lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
 [1] https://sourcery.mentor.com/GNUToolchain/kbentry21&lt;br /&gt;
 [2] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01267.html&lt;br /&gt;
 [3] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01799.html&lt;br /&gt;
 &lt;br /&gt;
 [4] [http://cygwin.com/ml/cygwin/2007-08/msg00101.html HOWTO: Linux kernel compilation for ARM using cygwin] (01 Aug 2007)&lt;br /&gt;
 [5] [http://cygwin.com/ml/cygwin/2012-06/msg00221.html HOWTO: cross-compile the Linux kernel on Cygwin] (11 Jun 2012)&lt;br /&gt;
 [6] [http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html Cygwin User guide]&lt;br /&gt;
 &lt;br /&gt;
 [7] Google: &amp;quot;cygwin kernel compile error site:communities.mentor.com/community/cs/archives/arm-gnu/&amp;quot;&lt;br /&gt;
 [8] [https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c Patch for Toolchain 4.6.3-cygwin] (perhaps not needed)&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3640</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3640"/>
		<updated>2013-01-24T19:46:43Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Patching VDLinux for Cygwin use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching the Kernel for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here. &amp;lt;br /&amp;gt;&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
Since there is no available info how to patch '''VDLinux''' (based on 2.6.35.13) for Cygwin compilation, the patches used to get this working was handpicked and applied by hand from the sources below. It is not clear as to what patches are actually needed, and others may overlap in their functionality. &lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
 [1] https://sourcery.mentor.com/GNUToolchain/kbentry21&lt;br /&gt;
 [2] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01267.html&lt;br /&gt;
 [3] http://communities.mentor.com/community/cs/archives/arm-gnu/msg01799.html&lt;br /&gt;
 &lt;br /&gt;
 [4] [http://cygwin.com/ml/cygwin/2007-08/msg00101.html HOWTO: Linux kernel compilation for ARM using cygwin] (01 Aug 2007)&lt;br /&gt;
 [5] [http://cygwin.com/ml/cygwin/2012-06/msg00221.html HOWTO: cross-compile the Linux kernel on Cygwin] (11 Jun 2012)&lt;br /&gt;
 [6] [http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html Cygwin User guide]&lt;br /&gt;
 &lt;br /&gt;
 [7] Google: &amp;quot;cygwin kernel compile error site:communities.mentor.com/community/cs/archives/arm-gnu/&amp;quot;&lt;br /&gt;
 [8] [https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c Patch for Toolchain 4.6.3-cygwin] (perhaps not needed)&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3638</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3638"/>
		<updated>2013-01-24T09:52:06Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Inserting the Module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
&lt;br /&gt;
For our TV set we have in dmesg:&lt;br /&gt;
    ...&lt;br /&gt;
     SAMSUNG VDLP Kernel&lt;br /&gt;
     Version : 0064, release&lt;br /&gt;
     Applied Last Patch Number : 0716, DTV, X10P, release, DEU_BRANCH&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
So if we try to insert a kernel module with the wrong vermagic, we get an error message in &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; /tmp/bin/busybox insmod /dtv/usb/sda1/hellok1.ko&lt;br /&gt;
    shell&amp;gt; dmesg&lt;br /&gt;
    ...&lt;br /&gt;
    hellok1: version magic '0062, release SMP preempt mod_unload ARMv7 ' should be '0064, release SMP preempt mod_unload ARMv7 '&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
We edit the version.h file (mentioned above) and recompile our module. This time &amp;quot;dmesg&amp;quot; greets us with:&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    E:V:A is in the Kernel!&lt;br /&gt;
    hellok1 mod ld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
You can then see your module in the FS:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; ls -l /sys/module/hellok1&lt;br /&gt;
    drwxr-xr-x    2 root     0                0 Jan  1 00:41 holders&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 initstate&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 refcnt&lt;br /&gt;
    -r--r--r--    1 root     0             4096 Jan  1 00:41 srcversion&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; cat /sys/module/hellok1/initstate&lt;br /&gt;
    live&lt;br /&gt;
&lt;br /&gt;
To remove your module from the kernel use:&lt;br /&gt;
&lt;br /&gt;
    shell&amp;gt; rmmod hellok1&lt;br /&gt;
&lt;br /&gt;
In &amp;quot;dmesg&amp;quot;:&lt;br /&gt;
    ...&lt;br /&gt;
    Goodbye TV Kernel!&lt;br /&gt;
    hellok1 mod uld&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
If you try to load the hellok2.ko module on a linux kernel configured without DEBUGFS, you'll get this message (dmesg):&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    hellok2: Unknown symbol debugfs_remove_recursive (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_file (err 0)&lt;br /&gt;
    hellok2: Unknown symbol debugfs_create_dir (err 0)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3637</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3637"/>
		<updated>2013-01-24T05:37:41Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (Z) Place Holder Template */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 	[http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html LINK]&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3636</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3636"/>
		<updated>2013-01-24T05:35:53Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (Z) Place Holder Template */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
Next line.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3635</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3635"/>
		<updated>2013-01-24T05:35:13Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (Z) Place Holder Template */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
Some ''whacky'' code.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Testing more:&lt;br /&gt;
 Some ''whacky'' code.&lt;br /&gt;
 last line&lt;br /&gt;
&lt;br /&gt;
ok&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3634</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3634"/>
		<updated>2013-01-23T00:08:34Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The Compiler Specific variables = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3633</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3633"/>
		<updated>2013-01-23T00:08:21Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The Cygwin Specific variables = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables ====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3632</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3632"/>
		<updated>2013-01-23T00:07:44Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Patching VDLinux for Cygwin use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum [http://forum.samygo.tv/viewtopic.php?f=50&amp;amp;t=5230 HERE] for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah&lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3631</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3631"/>
		<updated>2013-01-22T23:58:53Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Patching the VDLinux kernel for Cygwin use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
==== Patching VDLinux for Cygwin use ====&lt;br /&gt;
&lt;br /&gt;
We will not show the boring details for this patching here.&lt;br /&gt;
Please have look in our forum HERE for all the gory details.&lt;br /&gt;
&lt;br /&gt;
The patches are based on the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!!WIP!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and install the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. &lt;br /&gt;
&lt;br /&gt;
This patch is only for use with Cygwin + CodeBench Lite (windows) cross compiler!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3630</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3630"/>
		<updated>2013-01-22T23:45:05Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Inserting the Module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
Copy the module to your TV in the same way we did in the beginning.&lt;br /&gt;
Then check some information about the module:&lt;br /&gt;
&lt;br /&gt;
 modinfo hellok1.ko&lt;br /&gt;
&lt;br /&gt;
Insert the module with:&lt;br /&gt;
&lt;br /&gt;
 insmod hellok1.ko&lt;br /&gt;
&lt;br /&gt;
and check kernel/debug messages for the module:&lt;br /&gt;
&lt;br /&gt;
 dmesg&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3629</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3629"/>
		<updated>2013-01-22T23:35:34Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The Makefile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
==== The Makefile ====&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3628</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3628"/>
		<updated>2013-01-22T23:30:46Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Setting up your Cygwin environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The BASH Shell environment ====&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Cygwin Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Next you should set these two variables.&lt;br /&gt;
&lt;br /&gt;
 export CYGWIN=nodosfilewarning&lt;br /&gt;
 export CYGPATH=cygpath&lt;br /&gt;
&lt;br /&gt;
The first one disables the Warning message that appears when Cygwin detects files using DOS EOL. While the second sets the path used for CodeBench to find the cygpath.exe path conversion program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The Compiler Specific variables =====&lt;br /&gt;
&lt;br /&gt;
Then to avoid having to type very long command lines for just doing a &amp;quot;make&amp;quot;, we define the following:&lt;br /&gt;
&lt;br /&gt;
 export ARCH=arm &lt;br /&gt;
 export CROSS_COMPILE=arm-none-linux-gnueabi-&lt;br /&gt;
 export CONFIG_CROSS_COMPILE=${CROSS_COMPILE}&lt;br /&gt;
 export KCFLAGS=&amp;quot;-imultilib ./ -mno-unaligned-access -mlittle-endian \&lt;br /&gt;
                 -marm -mapcs -mabi=aapcs-linux -mno-thumb-interwork \&lt;br /&gt;
                 -march=armv7-a -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== The setup script ==== &lt;br /&gt;
&lt;br /&gt;
All of the above (and more) can is put in our setup script. &lt;br /&gt;
&lt;br /&gt;
sexport.sh:&lt;br /&gt;
&lt;br /&gt;
[WIP]...&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3627</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3627"/>
		<updated>2013-01-22T22:49:39Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Patching the VDLinux kernel for Cygwin use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Setting up your Cygwin environment ===&lt;br /&gt;
&lt;br /&gt;
We need to make sure our Cygwin Bash shell environment is as close as possible to what &lt;br /&gt;
you'd find on a typical Linux distribution. The way to find out what those settings are &lt;br /&gt;
is to issue the following command, which will display the enabled and disabled Bash &lt;br /&gt;
shell environment settings.  contained in the $BASHOPTS and $SHELLOPTS environment variables.&lt;br /&gt;
&lt;br /&gt;
 set -o &amp;amp;&amp;amp; echo -e &amp;quot;\n&amp;quot; &amp;amp;&amp;amp; shopt -p &lt;br /&gt;
&lt;br /&gt;
The $BASHOPTS and $SHELLOPTS environment variables only show the enabled ones. &lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;SHELLOPTS=$SHELLOPTS&amp;quot;&lt;br /&gt;
 SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor&lt;br /&gt;
 &lt;br /&gt;
 $ echo &amp;quot;BASHOPTS=$BASHOPTS&amp;quot;&lt;br /&gt;
 BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:&lt;br /&gt;
          interactive_comments:login_shell:progcomp:promptvars:sourcepath&lt;br /&gt;
&lt;br /&gt;
Make them match these, and you should be ok.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3626</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3626"/>
		<updated>2013-01-22T22:28:51Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* REQUIREMENTS!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that? Good, then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3625</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3625"/>
		<updated>2013-01-22T12:43:44Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* REQUIREMENTS!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstrated with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the environment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32 uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3624</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3624"/>
		<updated>2013-01-22T12:41:33Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Download and instal the patched VDLinux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
NOTE: This is '''not''' the same as the &amp;quot;Patched Firmware&amp;quot; in the top E-Series Wiki page. This is only for use with Cygwin!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=The_E_Series_Wiki&amp;diff=3623</id>
		<title>The E Series Wiki</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=The_E_Series_Wiki&amp;diff=3623"/>
		<updated>2013-01-22T12:39:21Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= SamyGO E Series Wiki Page Main =&lt;br /&gt;
[[File:e_wiki.png|140px|right]]&lt;br /&gt;
&lt;br /&gt;
Here you will find hacks related to the E / ES series TVs.&lt;br /&gt;
&lt;br /&gt;
Samsung recently decided to change naming scheme of their newer &amp;quot;Smart&amp;quot; TVs. They now also use 'ES' in the name, instead of just 'E'. The 'S' denoting &amp;quot;Slim&amp;quot;. But we will just continue to refer to this series as the &amp;quot;E Series&amp;quot; instead of &amp;quot;ES Series&amp;quot;. The first digit following the 'ES', is the new series. Thus, for example, the UE40ES'''5'''700  belong to their &amp;quot;Series 5&amp;quot; and so on. For further details regarding the &amp;quot;E&amp;quot; series product codes and numbering, see below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Samsung put a camera on their top-end models, [http://www.amazon.com/s?ie=UTF8&amp;amp;field-keywords=ES7500 ES7500] and [http://www.amazon.com/s?ie=UTF8&amp;amp;field-keywords=ES8000 ES8000]. So if you want to make Skype calls from TV and want to interact with your TV, using your voice and you don't know about what to do with your money, you could buy these devices. However, it is very likely that all this functionality is already available in the lower end model, where you could just connect an external web camera to make it work. Our job here is to help you figure out how this is done. (For example, it is well known that some simple Engineering/Service Menu modifications can upgrade your model to a limited extent, depending on the hardware.) So far we have not been successful in making other than Samsung &amp;quot;certified&amp;quot; web cameras work with our TVs. But then again we have not tried very hard either. So if you know anything how to write Linux drivers and video kernel modules for ARM processors, please come in help!&lt;br /&gt;
&lt;br /&gt;
Before you start, it is strongly recommended to first read:&lt;br /&gt;
*[[SamyGO for DUMMIES]]&lt;br /&gt;
*[[FAQ (ES-series)]] (WIP)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[The Samsung E-series Product and Model Codes]]&lt;br /&gt;
*[[Ex-Link Cable for C/D/E Series and BD players]]&lt;br /&gt;
*[[The Service Menu (ES-series)]] (TBA)&lt;br /&gt;
*[[Top Debug Menu: TDM]]&lt;br /&gt;
*[[Formatting /mtd rwarea/]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Extracting the ES-series firmware]]&lt;br /&gt;
*[[Rooting the ES-series]] (WIP)&lt;br /&gt;
*[[Cross-compiling (ES series)]] (WIP)&lt;br /&gt;
*[[Cross-compiling VM-style (ES)]] (TBA)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Remote Control emulator: send custom IR codes#Build your own IR transmitter | Remote Control emulator: send custom IR codes]] (e.g. '''Factory + 3SPEED''' to unlock greyed out settings)&lt;br /&gt;
*[[Extended SM through ruSamsungTVCommunicator]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Patched firmware]] (TBA)&lt;br /&gt;
*[[Enable All Share on EH5xxxx]]&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3622</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3622"/>
		<updated>2013-01-22T12:31:26Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (F) Compiling the Kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Checking your Kernel version ====&lt;br /&gt;
&lt;br /&gt;
The special files with version information are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./include/linux/version.h:&lt;br /&gt;
#define LINUX_VERSION_CODE 132643&lt;br /&gt;
#define KERNEL_VERSION(a,b,c) (((a) &amp;lt;&amp;lt; 16) + ((b) &amp;lt;&amp;lt; 8) + (c))&lt;br /&gt;
&lt;br /&gt;
./include/generated/utsrelease.h:&lt;br /&gt;
#define UTS_RELEASE &amp;quot;2.6.35.13&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./include/linux/vdlp_version.h:		(is symlinked to: vdlp_version_X10P.h )&lt;br /&gt;
#define DTV_KERNEL_VERSION &amp;quot;0062, release&amp;quot;&lt;br /&gt;
#define DTV_LAST_PATCH &amp;quot;0713, DTV, X10P, release, AUS_BRANCH&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find a kernel module from either the TV itself or from downloading and &lt;br /&gt;
extracting the firmware. Then find your current Kernel version by:&lt;br /&gt;
&lt;br /&gt;
 strings &amp;lt;some-module&amp;gt;.ko |grep &amp;quot;vermagic&amp;quot; &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 $ strings drivers/hid/hid.ko |grep &amp;quot;vermagic&amp;quot;&lt;br /&gt;
 vermagic=0062, release SMP preempt mod_unload ARMv7&lt;br /&gt;
&lt;br /&gt;
Then edit the file above by changing the DTV_KERNEL_VERSION value to &lt;br /&gt;
what you found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3621</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3621"/>
		<updated>2013-01-22T12:21:04Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The HelloWorld-1 kernel module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &lt;br /&gt;
to include the '''kernel.h''' header file.&amp;lt;br /&amp;gt; &lt;br /&gt;
What is actually shown depend on the current kernel debug level as set in ''/proc/printk''...&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3620</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3620"/>
		<updated>2013-01-22T12:13:58Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Compiling the module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
Go to your directory containing your Makefile and module programs. &lt;br /&gt;
&lt;br /&gt;
Minimally containing:&lt;br /&gt;
&lt;br /&gt;
 Makefile&lt;br /&gt;
 hellok1.c&lt;br /&gt;
 hellok2.c&lt;br /&gt;
&lt;br /&gt;
Then just type &amp;quot;make&amp;quot;. (Make sure you have correctly setup your BASH environment variables.)&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3619</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3619"/>
		<updated>2013-01-22T12:06:52Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The Makefile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /your/path/to/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions Module.symvers modules.order ./.*.cmd ./*.mod.*&lt;br /&gt;
 	ls -al&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3618</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3618"/>
		<updated>2013-01-22T12:00:59Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Enabling DEBUGFS in Kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: (2) and (3) are not recommended for a production kernels.&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3617</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3617"/>
		<updated>2013-01-22T11:58:58Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* The HelloWorld-2 kernel module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Enabling DEBUGFS in Kernel ====&lt;br /&gt;
&lt;br /&gt;
Enter the kernel configuration menu: &lt;br /&gt;
&lt;br /&gt;
 make menuconfig&lt;br /&gt;
&lt;br /&gt;
and enable the following&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     (a) Go to the &amp;quot;Kernel Features&amp;quot; section.&lt;br /&gt;
         Enable ARM EABI:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_AEABI=y&lt;br /&gt;
&lt;br /&gt;
     (b) Go to the &amp;quot;Kernel hacking&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
        1. Enable the Debug Filesystem:&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_FS=y&lt;br /&gt;
&lt;br /&gt;
        2. Enable Kernel debugging. The screen will change and a&lt;br /&gt;
           number of new, debug-related options will come visible.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
&lt;br /&gt;
        3. Enable Compile the kernel with debug info. This turns on the&lt;br /&gt;
           standard -g option to the compiler and linker and expands the&lt;br /&gt;
           vmlinux image to include all the symbolic, line-level debugging&lt;br /&gt;
           information needed later.&lt;br /&gt;
&lt;br /&gt;
            CONFIG_DEBUG_INFO=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit. Then recompile your kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3616</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3616"/>
		<updated>2013-01-22T11:42:24Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (F) Compiling the Kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you build your own kernel module, it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3615</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3615"/>
		<updated>2013-01-22T11:40:07Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3614</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3614"/>
		<updated>2013-01-22T11:37:19Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* (F) Compiling a Kernel module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (G) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3613</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3613"/>
		<updated>2013-01-22T11:37:06Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Compiling the Kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3612</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3612"/>
		<updated>2013-01-22T11:36:44Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building the Kernel using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (E) Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3611</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3611"/>
		<updated>2013-01-22T11:33:55Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building the Kernel using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3610</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3610"/>
		<updated>2013-01-22T11:33:30Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building the Kernel using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3609</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3609"/>
		<updated>2013-01-22T11:32:52Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building the Kernel using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3608</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3608"/>
		<updated>2013-01-22T11:31:24Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building Kernel's using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the Kernel using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3607</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3607"/>
		<updated>2013-01-22T11:30:47Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building Kernel's using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
If you're not using Cygwin, you can skip directly to: [[Cross-compiling_(ES_series)#Compiling_the_Kernel]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3606</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3606"/>
		<updated>2013-01-22T11:29:27Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /*Compiling the Kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Compiling the Kernel ==&lt;br /&gt;
&lt;br /&gt;
Before you can build any kernel module it will help to first make sure you can build a kernel image.&lt;br /&gt;
Although this is not necessary, it will help with setting up some required automatically generated &lt;br /&gt;
scripts. These scripts generate some special header files that contain the Linux kernel versions and&lt;br /&gt;
&amp;quot;vermagic&amp;quot; that might be needed for your kernel module to work.&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3605</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3605"/>
		<updated>2013-01-22T11:23:21Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* WIP!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
placeholder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3604</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3604"/>
		<updated>2013-01-22T11:20:41Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* REQUIREMENTS!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first resolve &amp;lt;br /&amp;gt;&lt;br /&gt;
the above Windows problems. Second, you'll need to be aware of other Cygwin quirks, &amp;lt;br /&amp;gt;&lt;br /&gt;
that could affect your success. Here is how. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
	   (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
	   case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
	   would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
	   It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
	   have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
	   (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
	   and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
	   documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you read and understand all that?&lt;br /&gt;
&lt;br /&gt;
Yes? Then you are ready to patch the Supplied Samsung kernel. &lt;br /&gt;
&lt;br /&gt;
I have actually patched it for you, but you should read through &lt;br /&gt;
to see what was done. (Download link at the end.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Patching the VDLinux kernel for Cygwin use ===&lt;br /&gt;
&lt;br /&gt;
blah &lt;br /&gt;
&lt;br /&gt;
==== Download and instal the patched VDLinux ====&lt;br /&gt;
&lt;br /&gt;
blah blah&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3603</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3603"/>
		<updated>2013-01-22T11:05:52Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* REQUIREMENTS!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not believe for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first &lt;br /&gt;
resolve the above Windows problems. Second, you'll need to be aware of &lt;br /&gt;
other Cygwin quirks, that could affect your success. Here is how.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have probably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin partitions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (b)    Enable NTFS case-sensitivity by editing the Windows registry. &lt;br /&gt;
	We are constantly warned by MS for unexpected results of doing this, and &lt;br /&gt;
	that it could have grave consequences for your system. That is complete &lt;br /&gt;
	BS, as the only unexpected consequence is that you start wondering why you &lt;br /&gt;
	didn't re-enable this idiotic Windows &amp;quot;feature&amp;quot; ages ago. I certainly &lt;br /&gt;
	questioned what the fcuk was going on every time I extracted some Linux &lt;br /&gt;
	tarball, and kept getting dozens of files having the &amp;quot;same&amp;quot; name and given &lt;br /&gt;
	the &amp;quot;choice&amp;quot; of renaming them! (WTF! They already had different names, as&lt;br /&gt;
	Ab.txt =/= aB.txt !) If you choose not to &amp;quot;rename&amp;quot; them, only the last one &lt;br /&gt;
	extracted will survive! You will never know! Do this, in your Cygwin Bash &lt;br /&gt;
	shell: &lt;br /&gt;
	&lt;br /&gt;
	$ regedit.exe &amp;amp;&lt;br /&gt;
	--&amp;gt; navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]&lt;br /&gt;
	--&amp;gt; add the following item:  obcaseinsensitive REG_DWORD 0&lt;br /&gt;
	&lt;br /&gt;
	Now reboot and and let your PC &amp;quot;settle&amp;quot;, by running some of your &lt;br /&gt;
	favorite apps. No problems? Good, reboot again and you're done.&lt;br /&gt;
	&lt;br /&gt;
	NOTE: Cygwin online documentation claim two things that are not true:&lt;br /&gt;
	&lt;br /&gt;
		  (1) that you can temporarily remount a disk as &amp;quot;posix=1&amp;quot; to enable&lt;br /&gt;
		  case sensitivity. This doesn't work, and even if it did, you&lt;br /&gt;
		  would immediately loose this, after closing last Cygwin shell.&lt;br /&gt;
		  It only works if NTFS case-sensitivity is already enabled, but &lt;br /&gt;
		  have been disabled when default mounted in /etc/fstab. &lt;br /&gt;
		  (2) &amp;quot;mount&amp;quot; only shows disk as &amp;quot;posix=0&amp;quot; (case insensitive), &lt;br /&gt;
		  and never as &amp;quot;posix=1&amp;quot; (case sensitive), as claimed by online &lt;br /&gt;
		  documentation.&lt;br /&gt;
	&lt;br /&gt;
	So until you have implemented a case sensitive system, avoid developing&lt;br /&gt;
	Linux systems using tarballs extracted under windows.&lt;br /&gt;
	&lt;br /&gt;
 (c)    Windows have it's own screwed up way of doing symbolic links, that are &lt;br /&gt;
	not compatible with linux symbolic links. A Win32 symlink is just a file&lt;br /&gt;
	with a special tag followed by the file inode address AFAIK. But Cygwin &lt;br /&gt;
	can't handle this very well, so that if you symlink a regular file, your &lt;br /&gt;
	Cygwin application will fail, reading the content, instead of following &lt;br /&gt;
	the link. But if you symlink a directory, it works. This is probably &lt;br /&gt;
	a Cygwin bug. But it doesn't matter, because if you use original symlinks&lt;br /&gt;
	(from a Linux tarball, for example) you will get fcuked by the Win32 API &lt;br /&gt;
	anyway, regarding both file permissions and ownerships. &lt;br /&gt;
		&lt;br /&gt;
	Instead, just find and delete all symlinks, and try to recreate them &lt;br /&gt;
	within Cygwin. But to be sure, just copy the files/directories instead.&lt;br /&gt;
	(This is specially important if you try to compile linux kernels with &lt;br /&gt;
	thousands of files, some which may be symlinked.)&lt;br /&gt;
	&lt;br /&gt;
	To find all symlinks use:  &amp;quot;find ./ -type l&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	So NEVER extract any source code tarballs using Windows utilities such &lt;br /&gt;
	as Winzip, 7zip etc, as they will fail to re-create proper hard links.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
 (d)    One major obstacle, when trying to use a (native windows) pre-compiled &lt;br /&gt;
	cross-compiler with Cygwin, is that they use Win32 file paths. These are&lt;br /&gt;
	not normally compatible with Linux based tools like binutils and make, &lt;br /&gt;
	which require POSIX paths. Cygwin has it's own internal mechanism for &lt;br /&gt;
	dealing with Win32 paths, through /bin/cygpath.exe. This program can &lt;br /&gt;
	convert back and forth. But the problem occurs when POSIX programs like &lt;br /&gt;
	&amp;quot;make&amp;quot; is using windows cross-compilers (e.g. Sourcery CodeBench Lite) &lt;br /&gt;
	which return results with Win32 paths. According to their documentation&lt;br /&gt;
	this can be handled by defining the shell variable &amp;quot;CYGPATH=cygpath&amp;quot;.&lt;br /&gt;
	However, this is not working as described and expected, as easily &lt;br /&gt;
	demonstarted with:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --print-sysroot&lt;br /&gt;
	  d:\zarm\csbench\bin\../arm-none-linux-gnueabi/libc&lt;br /&gt;
	&lt;br /&gt;
	So you might think that adding the &amp;quot;--sysroot&amp;quot; flag might help. Well it &lt;br /&gt;
	does somewhat: but not completely:&lt;br /&gt;
	&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe --sysroot=/cygdrive/d/zarm/ -print-sysroot&lt;br /&gt;
	  /cygdrive/d/zarm/&lt;br /&gt;
	&lt;br /&gt;
	becuase if you do the same with &amp;quot;-print-file-name&amp;quot; which is used in the &lt;br /&gt;
	top Makefile, you still get a Win32 path!&lt;br /&gt;
		&lt;br /&gt;
	  $ arm-none-linux-gnueabi-gcc.exe -print-file-name=include&lt;br /&gt;
	  d:/zarm/csbench/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		&lt;br /&gt;
	But apparently this is not all. It seem that CodeBench is also &amp;quot;leaking&amp;quot; &lt;br /&gt;
	out other internal variables that are poisoning the envronment with Win32&lt;br /&gt;
	pathnames that have been compiled in. For example, if you do the following: &lt;br /&gt;
		&lt;br /&gt;
		arm-none-linux-gnueabi-gcc.exe -v --help &amp;gt;/dev/null&lt;br /&gt;
	&lt;br /&gt;
	You'll get things like: &lt;br /&gt;
	&lt;br /&gt;
		COLLECT_GCC=D:\zarm\csbench\bin\arm-none-linux-gnueabi-gcc.exe&lt;br /&gt;
		COLLECT_LTO_WRAPPER=d:/zarm/csbench/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.2/lto-wrapper.exe&lt;br /&gt;
		COLLECT_GCC_OPTIONS&lt;br /&gt;
		COMPILER_PATH&lt;br /&gt;
		LIBRARY_PATH&lt;br /&gt;
	&lt;br /&gt;
	and whole bunch more. But these are not a problem...until they start popping &lt;br /&gt;
	up in your assembly code. The most interesting of these are the &amp;quot;-iprefix&amp;quot; &lt;br /&gt;
	and &amp;quot;-isysroot&amp;quot; which seem to propagate into assembler without anyone ever &lt;br /&gt;
	entering these. For example, in the file ./kernel/bounds.s we find:&lt;br /&gt;
	&lt;br /&gt;
		@ -iprefix d:\zarm\csbench\bin\../lib/gcc/arm-none-linux-gnueabi/4.7.2/&lt;br /&gt;
		@ -isysroot /cygdrive/d/zarm/csbench/arm-none-linux-gnueabi/libc&lt;br /&gt;
		...		&lt;br /&gt;
		@ -isystem /cygdrive/d/zarm/csbench/lib/gcc/arm-none-linux-gnueabi/4.7.2/include&lt;br /&gt;
		@ -include include/generated/autoconf.h -MMD kernel/.bounds.s.d&lt;br /&gt;
	&lt;br /&gt;
	The only soultion is to manually specify new paths for both -sysroot and -iprefix.&lt;br /&gt;
	If you use both this option and the -isysroot option, then the -sysroot option &lt;br /&gt;
	will apply to libraries, but the -isysroot option will apply to header files. &lt;br /&gt;
	We do this in the Makefile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 (e)    Then we have the issue with differing End-of-Line (EOL) character(s) on POSIX &lt;br /&gt;
	based systems like Cygwin (and Linux) and that used by windows. Where Win32	uses &lt;br /&gt;
	the 2 character combination of a Carriage-Return and a New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) &lt;br /&gt;
	for EOL representation, POSIX ony use NL (&amp;quot;\n&amp;quot;). This has serious consequences&lt;br /&gt;
	for the in-between compilation, where GCC is automatically creating link scripts&lt;br /&gt;
	to be used later in the linking process. Thus the linking scripts need to be &lt;br /&gt;
	converted. This is done by the &amp;quot;unix2dos&amp;quot; and &amp;quot;dos2unix&amp;quot; utilities. But we &lt;br /&gt;
	have to patch the Makefiles to use these. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
 (f)	The final Cygwin quirk relates to the automatic recognition of .exe files.&lt;br /&gt;
	As you know, Cygwin treats .exe files on equal footing as non-.exe files,&lt;br /&gt;
	almost! Basically if you have a script called &amp;quot;myprog&amp;quot; and an executable&lt;br /&gt;
	called &amp;quot;myprog.exe&amp;quot;, then &amp;quot;myprog.exe&amp;quot; takes precedence when typing &amp;quot;myprog&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
	http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html&lt;br /&gt;
	http://seit.unsw.adfa.edu.au/staff/sites/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#USING-CYGWINENV&lt;br /&gt;
&lt;br /&gt;
	 &amp;quot;Executable program filenames end with .exe but the .exe need not be included in &lt;br /&gt;
	 the command, so that traditional UNIX names can be used. However, for programs &lt;br /&gt;
	 that end in &amp;quot;.bat&amp;quot; and &amp;quot;.com&amp;quot;, you cannot omit the extension.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	As a side effect, the ls filename gives information about filename.exe if &lt;br /&gt;
	filename.exe exists and filename does not. In the same situation the function &lt;br /&gt;
	call stat(&amp;quot;filename&amp;quot;,..) gives information about filename.exe. The two files can &lt;br /&gt;
	be distinguished by examining their inodes, as demonstrated below. &lt;br /&gt;
&lt;br /&gt;
	If a shell script myprog and a program myprog.exe coexist in a directory, the &lt;br /&gt;
	program has precedence and is selected for execution of myprog.&lt;br /&gt;
&lt;br /&gt;
	The gcc compiler produces an executable named filename.exe when asked to produce &lt;br /&gt;
	filename. This allows many makefiles written for UNIX systems to work well under &lt;br /&gt;
	Cygwin.&lt;br /&gt;
&lt;br /&gt;
	Unfortunately, the install and strip commands do distinguish between filename &lt;br /&gt;
	and filename.exe. They fail when working on a non-existing filename even if &lt;br /&gt;
	filename.exe exists, thus breaking some makefiles. This problem can be solved by &lt;br /&gt;
	writing install and strip shell scripts to provide the extension &amp;quot;.exe&amp;quot; when &lt;br /&gt;
	needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3602</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3602"/>
		<updated>2013-01-22T10:15:00Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* Building Kernel's using Cygwin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''  First read these REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/p&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not beleive for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first &lt;br /&gt;
resolve the above Windows problems. Second, you'll need to be aware of &lt;br /&gt;
other Cygwin quirks, that could affect your success. Here is how.&lt;br /&gt;
&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have proably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin paritions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3601</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3601"/>
		<updated>2013-01-22T10:12:11Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* WIP!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building Kernel's using Cygwin ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''Must-Have REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/span&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not beleive for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first &lt;br /&gt;
resolve the above Windows problems. Second, you'll need to be aware of &lt;br /&gt;
other Cygwin quirks, that could affect your success. Here is how.&lt;br /&gt;
&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have proably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin paritions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3600</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3600"/>
		<updated>2013-01-21T23:56:20Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* WIP!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''Must-Have REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &amp;lt;br /&amp;gt;&lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling  &amp;lt;br /&amp;gt;&lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or  &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a  &amp;lt;br /&amp;gt;&lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux  &amp;lt;br /&amp;gt;&lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/span&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin &amp;lt;br /&amp;gt;&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &amp;lt;br /&amp;gt;&lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &amp;lt;br /&amp;gt;&lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support  &amp;lt;br /&amp;gt;&lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned! &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not beleive for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first &lt;br /&gt;
resolve the above Windows problems. Second, you'll need to be aware of &lt;br /&gt;
other Cygwin quirks, that could affect your success. Here is how.&lt;br /&gt;
&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have proably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin paritions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3599</id>
		<title>Cross-compiling (ES series)</title>
		<link rel="alternate" type="text/html" href="http://wiki.samygo.tv/index.php?title=Cross-compiling_(ES_series)&amp;diff=3599"/>
		<updated>2013-01-21T23:51:09Z</updated>

		<summary type="html">&lt;p&gt;E3V3A: /* REQUIREMENTS!! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''This is Work In Progress !!'''&amp;lt;/span&amp;gt;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No answers/solutions can be expected here yet. If you need quick answers Google the forums.&lt;br /&gt;
&lt;br /&gt;
'''@developers:''' &amp;lt;br /&amp;gt;&lt;br /&gt;
Do not change or update this page without first checking/asking on the &amp;quot;Talk&amp;quot; page or &lt;br /&gt;
support forum thread for latest status/info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an introduction to cross-compiling for MST10P (MStar/MediaTek) based TV &lt;br /&gt;
sets. It is primary intended as a crash course for getting even a novice to be &lt;br /&gt;
able to quickly compile his/her own programs to run on their TV sets. As such, &lt;br /&gt;
we will assume that you are using a Windows based PC with a basic installation &lt;br /&gt;
of Cygwin. The modification for using a Linux based PC will then be minimal and &lt;br /&gt;
even simpler. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cross Compiling ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
If you have never cross-compiled anything before, this is the right place for you. &lt;br /&gt;
If you already have experience and knowledge with cross compilation, this wiki may &lt;br /&gt;
still be helpful to get you started. If you are looking for information on how to &lt;br /&gt;
build your own cross-compiler, this place is not for you. (Look HERE instead.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''What this Wiki will cover and not.'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will use a popular pre-compiled cross-compiler.  &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will work on a Windows (Intel/AMD) based PC. &amp;lt;br/&amp;gt;&lt;br /&gt;
- All examples herein are based on a UExxES5700 TV set, and should be reproducable on the same. &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover the compilation of a cross-compiler! &amp;lt;br/&amp;gt;&lt;br /&gt;
- We will not cover other cross-compilers, operating systems or processor architectures. &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''A few Questions and Answers:'''&lt;br /&gt;
&lt;br /&gt;
 Q:  What is a cross-compiler?&lt;br /&gt;
 A:  Basically it is just a compiler built to run on one type of processor (e.g. Intel x86), &lt;br /&gt;
     but which is built and configured for compiling code for another processor (e.g. ARM).&lt;br /&gt;
 &lt;br /&gt;
 Q:  Should I get a pre-compiled cross-compiler or compile my own?&lt;br /&gt;
 A:  We hate to waste our time compiling compilers, so always try to find a pre-compiled one!&lt;br /&gt;
 &lt;br /&gt;
 Q:  Where can I find help to configure my cross-compiler?&lt;br /&gt;
 A:  Not here. If it's not already in here or in our forums, we don't know.&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I need to install the TV specific platform sources? (Such as UExxES6xxx.zip ?)&lt;br /&gt;
 A: '''**''' It depends on what you need to compile. (See below.)&lt;br /&gt;
 &lt;br /&gt;
 Q:  Do I have to install the Samsung platform ARM toolchain? (Such as VDLinux-ARMv7-4.4-202-toolchain-v2r2-20110630.tgz ?)&lt;br /&gt;
 A:  '''**''' Hopefully not, but it depends on what you need to compile. (See below.)&lt;br /&gt;
&lt;br /&gt;
'''**''' = unknown and not fact!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Things you need to get started. ===&lt;br /&gt;
&lt;br /&gt;
WIP! This need checking and adjustment...&lt;br /&gt;
&lt;br /&gt;
 1. Install Cygwin for Windows. (Not necessary, but very helpful for the various *nix tools and file utilities.)&lt;br /&gt;
 2. Install a good text editor (EditPlus, Notepad++ etc.)&lt;br /&gt;
 3. Download a suitable pre-compiled cross-compiler. &lt;br /&gt;
 4. Download your TV kernel sources.&lt;br /&gt;
 5. Download your TV firmware sources. (?)&lt;br /&gt;
 6. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
 (A) Install &amp;amp; Verify the pre-compiled cross-compiler on your PC.&lt;br /&gt;
 (B) Verify your TV sets processor / architecture. &lt;br /&gt;
 (C) Compile &amp;quot;HelloWorld&amp;quot; and run it on TV.&lt;br /&gt;
 (D) Installing the Samsung Kernel Sources.&lt;br /&gt;
 (E) Setting up your development environment.&lt;br /&gt;
     - Setting up your PATH's + other shell/system variables)&lt;br /&gt;
     - Setting up your Makefile&lt;br /&gt;
     - other?&lt;br /&gt;
 (F) Compiling a Kernel Module&lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
&lt;br /&gt;
Extras:&lt;br /&gt;
&lt;br /&gt;
 (D) &amp;lt;del&amp;gt;Installing the Samsung cross-compiler.&amp;lt;/del&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 (E) Installing your TV Kernel sources.   &lt;br /&gt;
 (F) Installing your TV firmware sources.&lt;br /&gt;
 &lt;br /&gt;
 (G) Compiling the Kernel&lt;br /&gt;
 (H) Compiling a Kernel module&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
== (A) Installing the Cross-Compiler ==&lt;br /&gt;
&lt;br /&gt;
Go to the Mentor Graphics website, and download the &amp;quot;Sourcery CodeBench Lite Edition&amp;quot; from [http://www.codesourcery.com/sgpp/lite_edition.html  HERE]. &amp;lt;br /&amp;gt; (You'll need to supply an email to get a download link.)&amp;lt;br /&amp;gt;&lt;br /&gt;
There you will get a few different choices based on the platform. You will have choices such as:&lt;br /&gt;
&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi.exe&lt;br /&gt;
 arm-2012.09-63-arm-none-eabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi.exe&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-mingw32.tar.bz2&lt;br /&gt;
 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2&lt;br /&gt;
&lt;br /&gt;
If you use a x86 Windows based system, choose: &amp;quot;arm-2012.09-64-arm-none-linux-gnueabi.exe&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Run it, and when asked, change the installation directory to something simple like:  ''C:\zarm\csbench''&amp;lt;br/&amp;gt;&lt;br /&gt;
The rest of the installation procedure is self explanatory.&lt;br /&gt;
&lt;br /&gt;
After installation, verify that the cross-compiler '''PATH''' variable is properly set and working:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc --version&lt;br /&gt;
 &lt;br /&gt;
 arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2012.09-64) 4.7.2&lt;br /&gt;
 Copyright (C) 2012 Free Software Foundation, Inc.&lt;br /&gt;
 This is free software; see the source for copying conditions.  There is NO&lt;br /&gt;
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &lt;br /&gt;
&lt;br /&gt;
Since this is a Windows installer, Cygwin may or may not catch the updated &lt;br /&gt;
system PATH variable. Open a new Cygwin shell and check: &lt;br /&gt;
&lt;br /&gt;
 $ echo $PATH&lt;br /&gt;
&lt;br /&gt;
If it's not working, you'll have to add the following line in your '''~/.bash_profile''' file. &amp;lt;br /&amp;gt;&lt;br /&gt;
(On some systems this file is called &amp;quot;.profile&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
 PATH=${PATH}:/cygdrive/path/to/csbench/bin;&lt;br /&gt;
&lt;br /&gt;
This should do it.&lt;br /&gt;
&lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
 If you want to have access to the cross-compiler's man pages you'll have to &lt;br /&gt;
 add the following line to /etc/man.conf:&lt;br /&gt;
 &lt;br /&gt;
  MANPATH_MAP /path/to/csbench/bin /path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man&lt;br /&gt;
 &lt;br /&gt;
 and/or possibly this line to your ~/.bashrc&lt;br /&gt;
 &lt;br /&gt;
  MANPATH=${MANPATH}:/path/to/csbench/share/doc/arm-arm-none-linux-gnueabi/man;&lt;br /&gt;
 &lt;br /&gt;
 *******************************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more questions, check out the [https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?@action=faq&amp;amp;target_arch=arm Sourcery ARM FAQ].&lt;br /&gt;
&lt;br /&gt;
== (B) Determine the TV processor &amp;amp; architecture ==&lt;br /&gt;
&lt;br /&gt;
In order to properly compile and run anything, you need to know what processor you're programming for.&lt;br /&gt;
Here is how to find that information.&lt;br /&gt;
&lt;br /&gt;
1. Root your TV and login to a shell. (Instructions HERE.)&lt;br /&gt;
&lt;br /&gt;
2. Verify your TV's processor type and architecture by executing the following at the shell prompt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; cat /proc/cpuinfo&lt;br /&gt;
 &lt;br /&gt;
 Processor       : ARMv7 Processor rev 0 (v7l)&lt;br /&gt;
 processor       : 0&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 processor       : 1&lt;br /&gt;
 BogoMIPS        : 1794.04&lt;br /&gt;
 Features        : swp half thumb fastmult vfp edsp neon vfpv3&lt;br /&gt;
 CPU implementer : 0x41&lt;br /&gt;
 CPU architecture: 7&lt;br /&gt;
 CPU variant     : 0x3&lt;br /&gt;
 CPU part        : 0xc09&lt;br /&gt;
 CPU revision    : 0 &lt;br /&gt;
 Hardware        : amber3&lt;br /&gt;
 Revision        : 0000&lt;br /&gt;
 Serial          : 0000000000000000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, this is not obvious in any way. Problem is that an &amp;quot;ARM&amp;quot; processor is really &lt;br /&gt;
only a license to manufacture a processor according to ARM Holding's specifications. &lt;br /&gt;
Therefore any hardware manufacturer can have a processor with an ARM &amp;quot;core&amp;quot;. In &lt;br /&gt;
addition, and to make it even more confusing, an ARM &amp;quot;core&amp;quot; belong to an ARM &lt;br /&gt;
&amp;quot;architecture&amp;quot; which belong to an ARM &amp;quot;family&amp;quot;, whose numbers are little related...&lt;br /&gt;
&lt;br /&gt;
The only way to get some insight is looking at the WikiPedia entries:&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/List_of_ARM_microprocessor_cores &amp;quot;List of ARM microprocessor cores&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
2. [http://en.wikipedia.org/wiki/ARM_architecture &amp;quot;ARM architecture&amp;quot;] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compare what you find there with the interpretation of the ARM &amp;quot;Features&amp;quot; &lt;br /&gt;
above, where:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Feature         Description&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 swp             SWP (SWaP) instruction, which is used to implement a binary semaphore (mutex)&lt;br /&gt;
 half            Half-precision (16-bit) floating point, &amp;quot;__fp16&amp;quot; data type in gcc&lt;br /&gt;
 thumb           Thumb instructions&lt;br /&gt;
 fastmult        Fast multiplication&lt;br /&gt;
 vfp             Vector Floating Point instruction extension&lt;br /&gt;
 edsp            Enhanced DSP instructions&lt;br /&gt;
 neon            NEON SIMD instructions&lt;br /&gt;
 vfpv3           Vector Floating Point instruction extension Version 3&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So from the above we think we have a dual core processor of the ARMv7-R or &lt;br /&gt;
ARMv7-A architecture. (Of either the Coretx-R or A families, respectively.)&lt;br /&gt;
But the only NEON enabled processors with both DSP and VFPV3, are the &lt;br /&gt;
Cortex-A8 and &amp;quot;Cortex-A9 MPCore&amp;quot;. But this is not good enough...for a perfectionist. &lt;br /&gt;
So we search in the ARM on-line documentation for &lt;br /&gt;
[http://infocenter.arm.com/help/index.jsp &amp;quot;Main ID Register&amp;quot;]:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Main ID Register''' bit functions:&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 Bits    Field                   Value   Function&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 [31:24] Implementor             0x41    implementor: ARM&lt;br /&gt;
 [23:20] Variant                 0x3     variant number or major revision of the processor&lt;br /&gt;
 [19:16] Architecture            0x7     architecture is given in the feature registers&lt;br /&gt;
 [15:4]  Primary part number     0xC09   part number: Cortex-A9&lt;br /&gt;
 [3:0]   Revision                0x0     revision number or minor revision of the processor&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a brief list of '''ARM primary part numbers'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ARM core       CPU part&lt;br /&gt;
 ------------------------&lt;br /&gt;
 ARM920         0x920&lt;br /&gt;
 ARM926         0x926&lt;br /&gt;
 ARM946         0x946&lt;br /&gt;
 ARM966         0x966&lt;br /&gt;
 &lt;br /&gt;
 ARM1136        0xb36&lt;br /&gt;
 ARM1156        0xb56&lt;br /&gt;
 ARM1176        0xb76&lt;br /&gt;
 ARM11 MPCore   0xb02&lt;br /&gt;
 &lt;br /&gt;
 Cortex A5      0xc05&lt;br /&gt;
 Cortex A8      0xc08&lt;br /&gt;
 Cortex A9      0xc09&lt;br /&gt;
 Cortex A15     0xc0f&lt;br /&gt;
 Cortex R4      0xc14 &lt;br /&gt;
 Cortex R5      0xc15&lt;br /&gt;
 ------------------------&lt;br /&gt;
&lt;br /&gt;
We finally conclude that our TV processor contains a dual core '''Cortex-A9 MPCore''' from the '''ARMv7-A''' architecture.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (C) Compiling &amp;quot;HelloWorld&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
We would like to compile our &amp;quot;Hello World&amp;quot; program for our TV. &amp;lt;br /&amp;gt;&lt;br /&gt;
So create a file like this:&lt;br /&gt;
&lt;br /&gt;
hellow.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main(void) {&lt;br /&gt;
        printf(&amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
        return (0);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
We now, need to determine what compiler flags to use with our cross-compiler. &lt;br /&gt;
There are several dozens of compiler options for the CodeSourcery compiler, &lt;br /&gt;
but we are only interested in the following. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the most important CodeSorcery ARM Cross Compiler options:&lt;br /&gt;
&lt;br /&gt;
 -march=                 Specify the name of the target architecture&lt;br /&gt;
 -mcpu=                  Specify the name of the target CPU&lt;br /&gt;
 -mfpu=                  Specify the name of the target FPU hardware/format&lt;br /&gt;
 &lt;br /&gt;
 -marm                   Generate code in 32 bit ARM state.&lt;br /&gt;
 -mthumb                 Generate code for Thumb state&lt;br /&gt;
 &lt;br /&gt;
 -mlittle-endian         Assume target CPU is configured as little endian&lt;br /&gt;
 -mthumb-interwork       Support calls between Thumb and ARM instruction&lt;br /&gt;
 &lt;br /&gt;
 -mglibc                 Use GNU C library&lt;br /&gt;
 -muclibc                Use uClibc C library&lt;br /&gt;
 &lt;br /&gt;
 -static                 Compile and include all static libraries&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are the choices for the above options:&lt;br /&gt;
&lt;br /&gt;
 Known ARM ABIs (for use with the -mabi= option):&lt;br /&gt;
   aapcs aapcs-linux apcs-gnu atpcs iwmmxt&lt;br /&gt;
 &lt;br /&gt;
 Known ARM architectures (for use with the -march= option):&lt;br /&gt;
   armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6&lt;br /&gt;
   armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m&lt;br /&gt;
   armv7-r armv7e-m ep9312 iwmmxt iwmmxt2 native&lt;br /&gt;
 &lt;br /&gt;
 Known ARM CPUs (for use with the -mcpu= and -mtune= options):&lt;br /&gt;
   arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s&lt;br /&gt;
   arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250&lt;br /&gt;
   arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710&lt;br /&gt;
   arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d&lt;br /&gt;
   arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920&lt;br /&gt;
   arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e&lt;br /&gt;
   arm9tdmi cortex-a15 cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-m0&lt;br /&gt;
   cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 ep9312 fa526&lt;br /&gt;
   fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 mpcore&lt;br /&gt;
   mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale&lt;br /&gt;
 &lt;br /&gt;
 Known ARM FPUs (for use with the -mfpu= option):&lt;br /&gt;
   fpa fpe2 fpe3 fpv4-sp-d16 maverick neon neon-fp16 neon-vfpv4 vfp vfp3 vfpv3&lt;br /&gt;
   vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARMed with our previous knowledge from part (B) we can try the following:&lt;br /&gt;
&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc -static hellow.c -o hellows&lt;br /&gt;
 $ arm-none-linux-gnueabi-gcc.exe -march=armv7-a -mcpu=cortex-a9 -marm -mlittle-endian -mglibc hellow.c -o hellowd&lt;br /&gt;
&lt;br /&gt;
Great! It seem to work. But as you can see, a statically compiled binary &lt;br /&gt;
is about 100x bigger than a dynamically compiled one of size ~10K. But&lt;br /&gt;
sometimes we need a static binary as it can help overcome crippled, buggy &lt;br /&gt;
or platform specific system libraries. &lt;br /&gt;
&lt;br /&gt;
But let's check if we got what we expected:&lt;br /&gt;
&lt;br /&gt;
 $ file hellows&lt;br /&gt;
 hellows: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, &lt;br /&gt;
 not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ file hellowd&lt;br /&gt;
 hellowd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), &lt;br /&gt;
 for GNU/Linux 2.6.16, not stripped&lt;br /&gt;
 &lt;br /&gt;
 $ arm-none-linux-gnueabi-objdump.exe -x hellows |less&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looks good, let's try to run it. ( /dtv/usb/sda1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ftp &amp;lt;tv_ip&amp;gt; &lt;br /&gt;
 ftp&amp;gt; put hellows /tmp/bin/hellows&lt;br /&gt;
 ftp&amp;gt; put hellowd /tmp/bin/hellowd&lt;br /&gt;
 ftp&amp;gt; quit&lt;br /&gt;
 &lt;br /&gt;
 nc &amp;lt;tv_ip&amp;gt; 23 &lt;br /&gt;
 shell&amp;gt; chmod 777 /tmp/bin/hellow*&lt;br /&gt;
 shell&amp;gt; hellows&lt;br /&gt;
 Hello world&lt;br /&gt;
 shell&amp;gt; hellowd&lt;br /&gt;
 Hello world&lt;br /&gt;
&lt;br /&gt;
Excellent! We are now ready to try a more advanced example where we will make &lt;br /&gt;
use of some platform specific system libraries to make a kernel module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== (D) Installing the Samsung Kernel Sources ==&lt;br /&gt;
&lt;br /&gt;
Download the sources relevant to your TV set from the [http://opensource.samsung.com/ Samsung Open Source] repository.&amp;lt;br /&amp;gt;&lt;br /&gt;
In our case (UE40ES5700) it would be '''UExxES6xxx.zip'''. For other ES models, it would be '''UNxxES8xxx.zip'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But these two are exactly the same, except the following:&lt;br /&gt;
 1. E8 and E6 have slightly different VDLinux kernels&lt;br /&gt;
 2. There is an additional ''OR1200.ZIP'' for the E8&lt;br /&gt;
The only files (~150) which are different are listed [http://pastebin.com/QdGYfnLY HERE].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After download, do test the downloaded zip archive with:&lt;br /&gt;
  $ unzip -t UExxES6xxx.zip&lt;br /&gt;
&lt;br /&gt;
If you are curious to see detailed info of what's inside the ZIP archive before unzipping, do this:&lt;br /&gt;
 $ unzip -Z UExxES6xxx.zip&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Extract the ZIP file to a directory where you would like to keep your sources. &lt;br /&gt;
&lt;br /&gt;
 $ cd /zarm/src/&lt;br /&gt;
 $ unzip UExxES6xxx.zip -d UExxES6xxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will unzip the following:&lt;br /&gt;
&lt;br /&gt;
 alsa-lib-1.0.23.tgz                            Advanced Linux Sound Architecture (audio and MIDI)&lt;br /&gt;
 ATK.tgz                                        Accessibility Toolkit (screen User Interface)&lt;br /&gt;
 binutils-2010q1.tgz                            A collection of binary tools (ld, as, nm, objdump etc.)&lt;br /&gt;
 BROADCOM-bthid.tgz                             Broadcom Bluetooth HID drivers (keyboards, mice, game controllers)&lt;br /&gt;
 BROADCOM-btusb.tgz                             Broadcom Bluetooth USB drivers (keyboards, mice, game controllers)&lt;br /&gt;
 busybox-1.18.1.tgz                             Busybox combines many common UNIX utilities into a single executable&lt;br /&gt;
 Cairo.tgz                                      A 2D graphics library (X Window, quartz, win32, PDF, PS, SVG file output)&lt;br /&gt;
 FFMPEG.tar.gz                                  A cross-platform solution to record, convert and stream audio and video&lt;br /&gt;
 glibc-2.11-2010q1.tgz                          The GNU C Library&lt;br /&gt;
 Glibmm.tgz                                     A C++ interface for the popular cross-platform library Glib&lt;br /&gt;
 gnutls-2.6.4.tar.gz                            GNU Transport Layer Security Library (SSL, TLS and DTLS protocols)&lt;br /&gt;
 iptables-1.4.10.tgz                            Linux kernel firewall&lt;br /&gt;
 libgcrypt-1.4.5.tar.gz                         A general purpose cryptographic library &lt;br /&gt;
 libgpg-error-1.7.tar.gz                        A library that defines common error values for all GnuPG components&lt;br /&gt;
 LIBGPHOTO2.tar                                 The core library designed to allow access to digital camera by external programs&lt;br /&gt;
 LibMMS_0.6.2.tgz                               A library for parsing mms:// and mmsh:// type network streams&lt;br /&gt;
 libsoup.20120109.tgz                           An HTTP client/server library for GNOME&lt;br /&gt;
 libtasn1-2.5.tar.gz                            The ASN.1 library used by GnuTLS&lt;br /&gt;
 LIBUSB.tar                                     A C library that gives applications easy access to USB devices&lt;br /&gt;
 Pango.tgz                                      A library for layout and rendering of multi-language text&lt;br /&gt;
 RALINK_RTNET5572STA_V_2_5_0_1.tgz              Ralink RTnet RT5572 (Wifi USB dongle drivers)&lt;br /&gt;
 RALINK_RTUTIL5572STA_V_2_5_0_1.tgz             Ralink RTnet RT5572 (Wifi USB dongle utilities)&lt;br /&gt;
 readme.zip                                     HOW_TO_BUILD_X9X10.txt&lt;br /&gt;
 SDL.tar.gz                                     Simple DirectMedia Layer (a multimedia library written in C)&lt;br /&gt;
 uvc.tar.gz                                     USB Video Class (streaming webcams, digital cameras etc)&lt;br /&gt;
 v4l2.tar.gz                                    Video4Linux-2 (a video capture API for Linux)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;'''VDLinux_2.6.35.11.tgz                          Kernel sources (VDLinux, Tuxera NTFS, RFS, LinuStoreIII, FSR)'''&amp;lt;/span&amp;gt;&lt;br /&gt;
 webkit-gtk.20120109.tgz                        WebKit is an open source web browser engine (Safari, Chrome)&lt;br /&gt;
 WIRELESSTOOLS_29.tgz                           Wireless Tools (iwconfig, iwlist, etc)&lt;br /&gt;
 xfsprogs-3.1.5.tgz                             A set of command-line tools to manage XFS filesystems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Which of these do you really need? Now that is the million dollar question. &lt;br /&gt;
The simple and stupid answer is, that it depends on what you want to do. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 a) If you need to compile some simple C-code using standard clibs and linux &lt;br /&gt;
    system calls, you probably don't need any. (E.g. helloworld.c)&lt;br /&gt;
 &lt;br /&gt;
 b) If you need to compile your own Kernel module (hellok.ko) you probably need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 c) If you want to compile your own Kernel image (uImage) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
 &lt;br /&gt;
 d) If you want to compile your own library object (somelib.so) you probably only need:&lt;br /&gt;
 &lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
    ++++&lt;br /&gt;
 &lt;br /&gt;
 e) If you need to compile your own device driver you probably need:&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;the device driver sources&amp;gt;&lt;br /&gt;
    VDLinux_2.6.35.11.tgz&lt;br /&gt;
  ? glibc-2.11-2010q1.tgz&lt;br /&gt;
  ? Glibmm.tgz&lt;br /&gt;
 &lt;br /&gt;
 f) If you want to compile your own TV DSP (exeDSP, micom etc) you're screwed &lt;br /&gt;
    (by Samsung) since there are no publicly available sources for that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The better answer is, that it depends on how your kernel image has been setup &lt;br /&gt;
and how you intend setup your compilation environment. We really don't want to &lt;br /&gt;
have to setup and compile all sources from scratch, just to make a simple kernel &lt;br /&gt;
module. The way to do that is by telling your cross-compiler where to find the &lt;br /&gt;
kernel header files that it has to use the same configuration as that used to &lt;br /&gt;
compile your kernel.&lt;br /&gt;
&lt;br /&gt;
So for further details, we look at '''HOW_TO_BUILD_X9X10.txt''' inside the &lt;br /&gt;
'''readme.zip'''. This file explains, in a very screwy way, how to build each of &lt;br /&gt;
the items included on the UExxES6xxx.zip file. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In fact you should not rely &lt;br /&gt;
blindly on this info.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 [ Building linux kernel ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : VDLinux_2.6.35.11.tgz &lt;br /&gt;
 * Unpack the kernel tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;cd VDLinux_2.6.35.11/linux-2.6.35.11/&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cp -ar arch/arm/configs/X10P_defconfig_release .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make uImage&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
 [ Building busybox ]&lt;br /&gt;
 &lt;br /&gt;
 * Source code name : busybox-1.18.1.tgz&lt;br /&gt;
 * Unpack the busybox tarball and cd into it.&lt;br /&gt;
 * Run &amp;quot;make clean&amp;quot;. &lt;br /&gt;
 * Run &amp;quot;cp -ar configs/busybox_config .config&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- oldconfig&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;make ARCH=arm CROSS_COMPILE=arm-v7a8v2r2-linux-gnueabi- CONFIG_PREFIX=../temp_rootfs install&amp;quot;.&lt;br /&gt;
 * Run &amp;quot;cd ../temp_rootfs/bin&amp;quot;.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clearly, for general purpose use we need at least the VDLinux sources installed.&amp;lt;br /&amp;gt;&lt;br /&gt;
So we extract this in the same directory with:&lt;br /&gt;
&lt;br /&gt;
 $ (tar -zxvf VDLinux_2.6.35.11.tgz &amp;gt;vdlinux_tar.log) 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we have redirected the output to a log file for reference, while any &lt;br /&gt;
errors will be shown on screen. This will create ''VDLinux_2.6.35.11'' &lt;br /&gt;
with the following sub-directories:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linux-2.6.35.11&amp;lt;/span&amp;gt;&lt;br /&gt;
 TUXERA_NTFS&lt;br /&gt;
 RFS_3.0.0_b043-LinuStoreIII_1.2.0_b039-FSR_1.2.1p1_b139_RTM&lt;br /&gt;
&lt;br /&gt;
The last two directories are soft linked into the ./tntfs and ./rfs sub-directories of ./linux-2.6.35.11. However, these links are not well re-made (especially after decompression). So if you think you'll need them, it is probably better to just copy them into there... &lt;br /&gt;
&lt;br /&gt;
&amp;lt; more details needed &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WIP!! ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;big&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''!! STOP !!'''&amp;lt;/span&amp;gt;    '''Must-Have REQUIREMENTS!!'''&amp;lt;/big&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before proceeding, read the following very carefully! I mean it!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color:yellow;&amp;quot;&amp;gt;&lt;br /&gt;
We strongly discourage the use of ''Mentor Graphics'' (Aka. ''CodeSourcery'') &lt;br /&gt;
'''''CodeBench Lite''''' ARM cross-compilers, for anything other than compiling &lt;br /&gt;
simple freestanding programs. If you intend to write a simple kernel module or &lt;br /&gt;
kernel device driver, or any other less trivial development, you &amp;quot;must&amp;quot; use a &lt;br /&gt;
native linux environment. Although Cygwin provides for an almost-linux &lt;br /&gt;
environment, the quirks introduced by mixing the various Windows-Cygwin-Linux &lt;br /&gt;
tools, creates a huge headache, that most people should avoid. &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below we will show you that you can indeed compile a Linux Kernel using Cygwin&lt;br /&gt;
and some of the tools mentioned above. But the road to get there is a horrible &lt;br /&gt;
waste of time and energy, trying to patch and resolve problems that should not &lt;br /&gt;
be there in the first palce. Do not bother to ask in the forums for support &lt;br /&gt;
using Cygwin or CodeBench + Windows combination. You have been warned!&lt;br /&gt;
&lt;br /&gt;
Instead follow the instructions:  [[Cross-compiling VM-style (ES)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== REQUIREMENTS!! ===&lt;br /&gt;
&lt;br /&gt;
If you intend to use Cygwin with the Sourcery CodeBench (a pre-compiled windows &lt;br /&gt;
executable) ARM cross-compiler, do not beleive for one second, that you will &lt;br /&gt;
be successful compiling anything other than ''HelloWorld.c'' for your Linux based &lt;br /&gt;
ARM (e.g. Android phone, SmartTV etc.) device, unless you follow these &lt;br /&gt;
requirements.&lt;br /&gt;
&lt;br /&gt;
First let me tell you what the main problems are with using windows.&lt;br /&gt;
&lt;br /&gt;
Standard Windows (XP, Vista, Windows-7):&lt;br /&gt;
&lt;br /&gt;
 - Uses ACL to set file permissions and ownership (Not Linux compatible.)&lt;br /&gt;
 - Has it's own way of creating symbolic links (Not Linux compatible.)&lt;br /&gt;
 - Uses a non case-sensitive default for its fixed NTFS drives. &lt;br /&gt;
   (Often and silently break archives originally compressed under Linux.)&lt;br /&gt;
 - Uses the Win32 (non POSIX) standard for file paths (Not Linux compatible.)&lt;br /&gt;
 - Uses the 2 characters Carriage-Return and New-Line (&amp;quot;\r&amp;quot; &amp;amp; &amp;quot;\n&amp;quot;) for&lt;br /&gt;
   End-of-Line (EOL) representation, contrary to POSIX, which uses only NL.&lt;br /&gt;
&lt;br /&gt;
If you're going to compile a Linux Kernel on Cygwin, you have to first &lt;br /&gt;
resolve the above Windows problems. Second, you'll need to be aware of &lt;br /&gt;
other Cygwin quirks, that could affect your success. Here is how.&lt;br /&gt;
&lt;br /&gt;
 (a)    &amp;quot;Disable&amp;quot; the native Windows use of Access Control Lists (ACL).&lt;br /&gt;
	This is probably not completely correct/possible, but by making yourself &lt;br /&gt;
	a permanent Administrator, it will have the same effect. If you have ever &lt;br /&gt;
	owned a Vista machine, you have proably already done this, as it created &lt;br /&gt;
	huge problems in the past. Google it! Apparently Cygwin has a bug that &lt;br /&gt;
	doesn't take into account default ACL settings and &amp;quot;umask&amp;quot; gives the wrong&lt;br /&gt;
	permissions. So you have to change permissions and ownerships manually&lt;br /&gt;
	with chmod/chown. There is one other possibility (not verified). You can &lt;br /&gt;
	try to mount your Cygwin paritions in /etc/fstab with the &amp;quot;noacl&amp;quot; flag: &lt;br /&gt;
	&lt;br /&gt;
	none /cygdrive cygdrive binary,noacl,posix=1,user 0 0&lt;br /&gt;
	&lt;br /&gt;
	But see below first. If you do insist on messing with Windows ACL's check &lt;br /&gt;
	out commands like: &amp;quot;getfacl, setfacl, cacls&amp;quot; and to recursively find and &lt;br /&gt;
	set all Users files ACLs to &amp;quot;rwx&amp;quot;, use: &lt;br /&gt;
	&amp;quot;find /cygdrive/c/Users -exec setfacl -r -m default:other:rwx {} \;&amp;quot;&lt;br /&gt;
	Or read all about it here: http://tiny.cc/pr9yqw &amp;amp; http://tiny.cc/rwczqw&lt;br /&gt;
&lt;br /&gt;
== (F) Compiling a Kernel module ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Linux is a monolithic kernel, where all of the code and data that makes up the &amp;lt;br /&amp;gt;&lt;br /&gt;
image are linked into one binary and loaded into memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;A very useful part of the Linux kernel architecture is the support for &amp;lt;br /&amp;gt;&lt;br /&gt;
loadable kernel modules. These modules allow the otherwise monolithic kernel &amp;lt;br /&amp;gt;&lt;br /&gt;
to be split up into smaller components that can later be loaded as required, &amp;lt;br /&amp;gt;&lt;br /&gt;
allowing the kernel to ship with support for a wide range features but only &amp;lt;br /&amp;gt;&lt;br /&gt;
load those that are needed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kernel modules also ease the development of new features such as file systems &amp;lt;br /&amp;gt;&lt;br /&gt;
or device drivers, as a new experimental modules can be quickly built, loaded &amp;lt;br /&amp;gt;&lt;br /&gt;
into a basic kernel, exercised, and then unloaded. This is much faster then &amp;lt;br /&amp;gt;&lt;br /&gt;
the build, flash, restart process that would otherwise be required.&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main reason for this, is that you don't have to re-compile the entire &amp;lt;br /&amp;gt;&lt;br /&gt;
kernel from the full kernel source tree. It should be enough to just have &amp;lt;br /&amp;gt;&lt;br /&gt;
the kernel header files, in order to build a module.  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally a module is a standard ELF executable file with a '''.ko''' extension and &amp;lt;br /&amp;gt;&lt;br /&gt;
a few special sections such as '''.modinfo''' for the module metadata and '''.init.text''' &amp;lt;br /&amp;gt;&lt;br /&gt;
for the module initialization code. (This is normally done by linking &amp;lt;br /&amp;gt;&lt;br /&gt;
''yourprogram.o'' with ''vermagic.o'', which is transparent to the developer.) &amp;lt;br /&amp;gt;&lt;br /&gt;
A nice thing about modules being ELF files is that they can be generated &amp;lt;br /&amp;gt;&lt;br /&gt;
and inspected by standard tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current 2.6 series, the ARM kernel is laid out as follows:&lt;br /&gt;
&lt;br /&gt;
 Start           End             Contents&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 0xFF000000      0xFFFFFFFF      Vector page, DMA region, and others&lt;br /&gt;
 VMALLOC_END     0xFEFFFFFF      free&lt;br /&gt;
 VMALLOC_START   VMALLOC_END     vmalloc() / ioremap() space&lt;br /&gt;
 PAGE_OFFSET     high_memory     The Linux kernel&lt;br /&gt;
 TASK_SIZE       PAGE_OFFSET-1   Kernel module space (16 MB)&lt;br /&gt;
 0x00001000      TASK_SIZE-1     User space (~3 GB)&lt;br /&gt;
 0x00000000      0x00001000      Vector page / Null pointer trap&lt;br /&gt;
 -----------------------------------------------------------------------------&lt;br /&gt;
 PAGE_OFFSET = 0xC0000000&lt;br /&gt;
 TASK_SIZE   = 0xBF000000&lt;br /&gt;
&lt;br /&gt;
Note that these are virtual addresses, which are different than the physical &lt;br /&gt;
address space of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-1 kernel module ===&lt;br /&gt;
&lt;br /&gt;
We will attempt to build two kernel modules. One very basic in &amp;quot;Hello World&amp;quot;&lt;br /&gt;
style to see that it compiles and works, &amp;lt;br /&amp;gt; &lt;br /&gt;
and another only slighlty more complicated to check if kernel debugfs works. &lt;br /&gt;
&lt;br /&gt;
Any module which want to send info to kernel messages ( ''/proc/kmsg'' ) have &amp;lt;br /&amp;gt;&lt;br /&gt;
to include the '''kernel.h''' header file. What is actually shown depend on the &amp;lt;br /&amp;gt;&lt;br /&gt;
current kernel debug level as set in ''/proc/printk''... 					&amp;lt;== check!&lt;br /&gt;
&lt;br /&gt;
./include/linux/kernel.h:&lt;br /&gt;
 ...&lt;br /&gt;
 #define KERN_EMERG      &amp;quot;&amp;lt;0&amp;gt;&amp;quot;   /* system is unusable                   */&lt;br /&gt;
 #define KERN_ALERT      &amp;quot;&amp;lt;1&amp;gt;&amp;quot;   /* action must be taken immediately     */&lt;br /&gt;
 #define KERN_CRIT       &amp;quot;&amp;lt;2&amp;gt;&amp;quot;   /* critical conditions                  */&lt;br /&gt;
 #define KERN_ERR        &amp;quot;&amp;lt;3&amp;gt;&amp;quot;   /* error conditions                     */&lt;br /&gt;
 #define KERN_WARNING    &amp;quot;&amp;lt;4&amp;gt;&amp;quot;   /* warning conditions                   */&lt;br /&gt;
 #define KERN_NOTICE     &amp;quot;&amp;lt;5&amp;gt;&amp;quot;   /* normal but significant condition     */&lt;br /&gt;
 #define KERN_INFO       &amp;quot;&amp;lt;6&amp;gt;&amp;quot;   /* informational                        */&lt;br /&gt;
 #define KERN_DEBUG      &amp;quot;&amp;lt;7&amp;gt;&amp;quot;   /* debug-level messages                 */&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can see your current kernel debug level with either:&lt;br /&gt;
&lt;br /&gt;
 shell&amp;gt; sysctl -a&lt;br /&gt;
 ...&lt;br /&gt;
 kernel.printk=&lt;br /&gt;
 ... &lt;br /&gt;
 OR &lt;br /&gt;
 shell&amp;gt; cat /proc/loglevel	???		&amp;lt;==  check!!&lt;br /&gt;
 shell&amp;gt; cat /proc/printk&lt;br /&gt;
 kernel.printk = 4  4  1  7&lt;br /&gt;
&lt;br /&gt;
You can read more about these here: &lt;br /&gt;
&lt;br /&gt;
 modinfo -p ${modulename}&lt;br /&gt;
 echo -n ${value} &amp;gt; /sys/module/${modulename}/parameters/${parm}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, to the actual kernel module code.&lt;br /&gt;
&lt;br /&gt;
hellok1.c:&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;  /* Needed by all modules */&lt;br /&gt;
 #include &amp;lt;linux/kernel.h&amp;gt;  /* Needed for KERN_ALERT */&lt;br /&gt;
 &lt;br /&gt;
 MODULE_LICENSE(&amp;quot;GPL&amp;quot;);&lt;br /&gt;
 MODULE_AUTHOR(&amp;quot;E:V:A 2013&amp;quot;);&lt;br /&gt;
 MODULE_DESCRIPTION(&amp;quot;Demo kernel module for MST-X10P (ARM Cortex A9)&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 int init_module(void) {&lt;br /&gt;
    printk(KERN_ALERT &amp;quot;E:V:A is in the Kernel!\n&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void cleanup_module(void) {&lt;br /&gt;
   printk(KERN_ALERT &amp;quot;Goodbye TV Kernel!\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that was the trivial part!&lt;br /&gt;
&lt;br /&gt;
=== The Makefile ===&lt;br /&gt;
&lt;br /&gt;
The most difficult part of compiling a kernel module, is setting up the &lt;br /&gt;
'''Makefile''' that contain all the compilation instructions, locations and &lt;br /&gt;
parameters needed for your cross-compiler. It is good to be familiar with &lt;br /&gt;
the &amp;quot;Makefile&amp;quot; language, as it is tab and space sensitive, and have many other &lt;br /&gt;
pitfalls, that can easily be overseen. The Makefile is also closely connected&lt;br /&gt;
with how your kernel have been compiled, so if you're missing kernel support&lt;br /&gt;
for your modules features (e.g. debugfs), you will not get anything...&lt;br /&gt;
(It should be noted that Makefile may also contain the functionality of &lt;br /&gt;
'''Kbuild''', which is very similar, but whose structure is even more simple. &lt;br /&gt;
We will not cover the details of this here.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Makefile:&lt;br /&gt;
&lt;br /&gt;
 ifneq ($(KERNELRELEASE),)&lt;br /&gt;
 	obj-m += hellok1.o&lt;br /&gt;
 else&lt;br /&gt;
 	KERNELDIR := /cygdrive/d/zarm/vdl_kernel/linux/linux-2.6.35.11/&lt;br /&gt;
 all:&lt;br /&gt;
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules&lt;br /&gt;
 clean:&lt;br /&gt;
 	rm -fr ./.tmp_versions modules.order &lt;br /&gt;
 	ls -al ./mods&lt;br /&gt;
 endif&lt;br /&gt;
&lt;br /&gt;
'''NOTE''': &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;The code above contains hidden tabs, so make sure they're still &lt;br /&gt;
there if you decide to copy &amp;amp; paste the code from above!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Compiling the module ====&lt;br /&gt;
&lt;br /&gt;
blah  blah 1&lt;br /&gt;
&lt;br /&gt;
==== Inserting the Module ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
blah  blah 2&lt;br /&gt;
&lt;br /&gt;
=== The HelloWorld-2 kernel module ===&lt;br /&gt;
&lt;br /&gt;
Now that we have gained some intellectual kernel meat, we can design a slightly more &lt;br /&gt;
useful kernel module. One that actually does something. &lt;br /&gt;
&lt;br /&gt;
The following code is an example kernel module that shows the life cycle and &lt;br /&gt;
provides a function to user space over ''debugfs''. It creates a new file in  &lt;br /&gt;
'''''/sys/kernel/debug/hello/ping''''' that can be opened and read from user space. &lt;br /&gt;
Reading this file gives a short message that includes the number of times the &lt;br /&gt;
file has been opened. All original comments have been removed, but can be &lt;br /&gt;
found in [3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
hellok2.c:&lt;br /&gt;
 #include &amp;lt;linux/init.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/module.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/debugfs.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;linux/seq_file.h&amp;gt;&lt;br /&gt;
 MODULE_LICENSE(&amp;quot;Dual BSD/GPL&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 static struct dentry *root_dir;	&lt;br /&gt;
 static int calls;&lt;br /&gt;
 static int hello_print(struct seq_file *s, void *p) {&lt;br /&gt;
 	seq_printf(s, &amp;quot;Called %d times\n&amp;quot;, ++calls);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static int hello_open(struct inode *inode, struct file *file) {&lt;br /&gt;
 	return single_open(file, hello_print, inode-&amp;gt;i_private);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static const struct file_operations hello_fops = {&lt;br /&gt;
 	.open = hello_open,&lt;br /&gt;
 	.write = NULL,&lt;br /&gt;
 	.read = seq_read,&lt;br /&gt;
 	.llseek = seq_lseek,&lt;br /&gt;
 	.owner = THIS_MODULE,&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 static int hello_init(void) {&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Hello world\n&amp;quot;);&lt;br /&gt;
 	root_dir = debugfs_create_dir(&amp;quot;hello&amp;quot;, NULL);&lt;br /&gt;
 	debugfs_create_file(&amp;quot;ping&amp;quot;, 0444, root_dir, NULL, &amp;amp;hello_fops);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 static void hello_exit(void) {&lt;br /&gt;
 	debugfs_remove_recursive(root_dir);&lt;br /&gt;
 	printk(KERN_ALERT &amp;quot;Goodbye Dear Module\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 module_init(hello_init);&lt;br /&gt;
 module_exit(hello_exit);&lt;br /&gt;
&lt;br /&gt;
The Makefile for this is your homework, but a good hint is that the tricky part &lt;br /&gt;
this time, is not the Makefile, but enabling DEBUGFS in your kernel, if not already &lt;br /&gt;
enabled...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; '''WIP!!''' ....&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&lt;br /&gt;
CodeSourcery Application Notes:&lt;br /&gt;
&lt;br /&gt;
[1] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach99/KernelExpress-AN001.pdf Flying Introduction to Linux Kernel Development]&amp;quot; (AN001)&amp;lt;br /&amp;gt;&lt;br /&gt;
[2] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach100/KernelDebug-AN002.pdf Using Sourcery CodeBench to Debug the Linux Kernel]&amp;quot; (AN002)&amp;lt;br /&amp;gt;&lt;br /&gt;
[3] &amp;quot;[https://sourcery.mentor.com/sgpp/lite/arm/portal/kbattach101/ModuleDebug-AN003.pdf Using Sourcery CodeBench to Develop and Debug a Linux Kernel Module]&amp;quot; (AN003)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[4] &amp;quot;[http://www.gnu.org/software/make/manual/html_node/index.html GNU make manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[5] &amp;quot;[http://kernel.org/doc/Documentation/kbuild/makefiles.txt Kernel.org Makefile manual]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[6] &amp;quot;[http://kernelnewbies.org/Documents/SeqFileHowTo seq_file HowTo]&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Common Make Variables ====&lt;br /&gt;
&lt;br /&gt;
Some commonly-used predefined &amp;quot;make&amp;quot; variables:&lt;br /&gt;
 AR              default 'r'           Archive-maintaining program&lt;br /&gt;
 AS              default 's'           Program for compiling assembly files&lt;br /&gt;
 CC              default 'c'           Program for compiling C programs&lt;br /&gt;
 CXX             default '++'          Program for compiling C++ programs&lt;br /&gt;
 CPP             default '(CC) -E'     Program for running the C preprocessor&lt;br /&gt;
 FC              default '77'          Program for compiling Fortran and Ratfor programs&lt;br /&gt;
 M2C             default '2c'          Program to use to compile Modula-2 source code&lt;br /&gt;
 PC              default 'c'           Program for compiling Pascal programs&lt;br /&gt;
 CO              default 'o'           Program for extracting a file from RCS&lt;br /&gt;
 GET             default 'et'          Program for extracting a file from SCCS&lt;br /&gt;
 LEX             default 'ex'          Program to use to turn Lex grammars into source code&lt;br /&gt;
 YACC            default 'acc'         Program to use to turn Yacc grammars into source code&lt;br /&gt;
 LINT            default 'int'         Program to use to run lint on source code&lt;br /&gt;
 MAKEINFO        default 'akeinfo'     Program to convert a Texinfo source file to Info file&lt;br /&gt;
 TEX             default 'ex'          Program to make TeX dvi files from TeX source&lt;br /&gt;
 TEXI2DVI        default 'exi2dvi'     Program to make TeX dvi files from Texinfo source&lt;br /&gt;
 WEAVE           default 'eave'        Program to translate Web into TeX&lt;br /&gt;
 CWEAVE          default 'weave'       Program to translate C Web into TeX&lt;br /&gt;
 TANGLE          default 'angle'       Program to translate Web into Pascal&lt;br /&gt;
 CTANGLE         default 'tangle'      Program to translate C Web into C&lt;br /&gt;
 RM              default 'm -f'        Command to remove a file&lt;br /&gt;
 # ------------------------------------------------------------------&lt;br /&gt;
 ARFLAGS         Extra flags to the archive-maintaining program; default 'rv'.&lt;br /&gt;
 ASFLAGS         Extra flags to the assembler when invoked on a '.s' or '.S' file.&lt;br /&gt;
 CFLAGS          Extra flags to the C compiler.&lt;br /&gt;
 CXXFLAGS        Extra flags to the C++ compiler.&lt;br /&gt;
 COFLAGS         Extra flags to the RCS co program.&lt;br /&gt;
 CPPFLAGS        Extra flags to the C and Fortran preprocessor&lt;br /&gt;
 FFLAGS          Extra flags to the Fortran compiler.&lt;br /&gt;
 GFLAGS          Extra flags to the SCCS get program.&lt;br /&gt;
 LDFLAGS         Extra flags to compilers when they invoke the linker, 'ld'.&lt;br /&gt;
 LFLAGS          Extra flags to Lex.&lt;br /&gt;
 YFLAGS          Extra flags to Yacc.&lt;br /&gt;
 PFLAGS          Extra flags to the Pascal compiler.&lt;br /&gt;
 RFLAGS          Extra flags to the Fortran compiler for Ratfor programs.&lt;br /&gt;
 LINTFLAGS       Extra flags to lint.&lt;br /&gt;
&lt;br /&gt;
== (Z) Place Holder Template ==&lt;br /&gt;
&lt;br /&gt;
Bah!&lt;/div&gt;</summary>
		<author><name>E3V3A</name></author>
		
	</entry>
</feed>