COM iMX25 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Christoph (talk | contribs)
Lzenz (talk | contribs)
 
(21 intermediate revisions by 2 users not shown)
Line 2: Line 2:




==Linux virtual machine for development ==
== Linux virtual machine for development ==
{{DebianVM Development}}
* Please have a look at: '''[[Virtual Machine for Application Development]]'''


==Building your own Kernel ==
==Building your own Kernel ==


=== Sources for the iMX25 Linux Kernel v2.6.38: ===
==== Sources for the iMX25 Linux Kernel v3.2.9 / v3.2.81: ====
* The latest Linux Kernel source code is available on GitHub: [https://github.com/dh-electronics/linux-imx25 https://github.com/dh-electronics/linux-imx25]
* We recommend to use on new projects the latest v3.2.81 Linux Kernel
 
==== How to build a kernel ====
Get sources from Github and build the linux kernel
{| class="wikitable"
|1. Start a terminal on Linux
|-
|2. <tt># ''git clone [https://github.com/dh-electronics/linux-imx25.git https://github.com/dh-electronics/linux-imx25.git]''</tt>
|-
|3. <tt># ''git checkout BRANCH''<br/>(BRANCH=dev/3.2.9_dhcom or BRANCH=dev/3.2.81_dhcom)</tt>
|-
|4. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make imx25_dhcom_defconfig''</tt>
|-
|5. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
* Your new <tt>uImage</tt> file is available in <tt>arch/arm/boot</tt>
 
 
{| style="width: 100%; color: #000000; border-spacing: 2px; border: 1px solid darkgray; background: lightgrey;" valign="top" |
| style="width: 100%;" |
|-
|
 
=== ''Sources older than February 2014'' ===
==== Sources for the iMX25 Linux Kernel v2.6.38: ====


:* [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2 Mainline Kernel version: 2.6.38 from www.kernel.org]
:* [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2 Mainline Kernel version: 2.6.38 from www.kernel.org]
Line 15: Line 41:
:* [[media:Linux-2.6.38_DHCOM_iMX25_config.zip|Kernel configuration for DHCOM iMX25 Linux (2014-09-29)]]
:* [[media:Linux-2.6.38_DHCOM_iMX25_config.zip|Kernel configuration for DHCOM iMX25 Linux (2014-09-29)]]


=== Sources for the iMX25 Linux Kernel v3.2.9: ===
==== Sources for the iMX25 Linux Kernel v3.2.9: ====
 


:* [http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.9.tar.bz2 Mainline Kernel version: 3.2.9 from www.kernel.org]
:* [http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.9.tar.bz2 Mainline Kernel version: 3.2.9 from www.kernel.org]
Line 23: Line 50:
:* [[media:DHCOM-linux-imx-3.2.9.config.zip|Kernel configuration for DHCOM iMX25 Linux 3.2.9 (2013-03-27)]]
:* [[media:DHCOM-linux-imx-3.2.9.config.zip|Kernel configuration for DHCOM iMX25 Linux 3.2.9 (2013-03-27)]]


=== How to build a kernel: ===
==== How to build a kernel ====
 
{| class="wikitable"
:{| class="wikitable"
|1. Start a terminal on Linux
|1. Start the Console on Linux
|-
|-
|2. Copy the above mentioned source files into our <code>work_path</code>
|2. Copy the above mentioned source files (linux-3.x.y.tar.bz2, .config, *.patch) into our <code>work_path</code>
|-
|-
|3. <code>''cd work_path''</code>
|3. <tt># ''cd work_path''</tt>
|-
|-
|4. <code>''tar xfjv linux-2.6.38.tar.bz2''</code>
|4. <tt># ''tar xfjv linux-2.6.38.tar.bz2''</tt>
|-
|-
|5. <code>''cd work_path/linux-2.6.38''</code>
|5. <tt># ''cd work_path/linux-2.6.38''</tt>
|-
|-
|6. <code>''patch -p1 <linux-2.6.38_DHCOM_iMX25.patch''</code>
|6. <tt># ''patch -p1 <linux-2.6.38_DHCOM_iMX25.patch''</tt>
|-
|-
|7. <code>''cp .config work_path/linux-2.6.38''</code>
|7. <tt># ''cp .config work_path/linux-2.6.38''</tt>
|-
|-
|8. <code>''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</code>
|8. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
:* Your new <tt>uImage</tt> file is available in <tt>work_path/linux-2.6.38/arch/arm/boot</tt>
|}
|}
:The <code>uImage</code> file will you find in <code>../build-linux/arch/arm/boot</code>


==Update the kernel with U-Boot ==
==Update the kernel with U-Boot ==
Line 48: Line 75:
:The linux kernel will be updated by the [[COM iMX25 Bootloader U-Boot#Update|U-Boot flash update]].
:The linux kernel will be updated by the [[COM iMX25 Bootloader U-Boot#Update|U-Boot flash update]].


:* [[media:Linux-2.6.38_DHCOM_iMX25_kernel.zip|Current built of the 2.6.38 DHCOM iMX25 linux kernel (2014-09-29)]]
:* [[media:Linux-2.6.38_DHCOM_iMX25_kernel.zip|Binary image 2.6.38 DHCOM iMX25 linux kernel (2014-09-29)]]
:* [[media:DHCOM-linux-imx-3.2.9_BUILD.zip|Current built of the 3.2.9 DHCOM iMX25 linux kernel (2013-09-20)]]
:* [[media:DHCOM-linux-imx-3.2.9_BUILD.zip|Binary image 3.2.9 DHCOM iMX25 linux kernel (2016-02-24)]]
:* [[media:DHCOM-linux-imx-3.2.78_BUILD.zip|Binary image 3.2.78 DHCOM iMX25 linux kernel (2016-03-08)]]


:{| class="wikitable"
:{| class="wikitable"
Line 61: Line 89:
|}
|}


==How to use/update our root file system ==
==Debian Rootfilesystem ==
=== Available Rootfilesystems ===
Please have a look at the [[COM_iMX25-D2#Downloads | iMX25 Downloads]] section.


:* [http://dl.dropbox.com/u/19433555/DHCOM/rootFS_DN_20110805et4_HL5%20%2803.02.2012%29.tar.bz2 Current Debian root file system, based on Debian 6.0 "Squeeze" (2012-02-03)]
=== External Documentation ===
:: [[COM iMX25 Linux#Debian system|Login data for the Debian system]]
* [https://debian-handbook.info/browse/stable/ The Debian Administrator's Handbook]: A reference book presenting the Debian distribution, from initial installation to configuration of services. The administration and configuration chapters apply to our Debian based root filesystems.
*  [https://www.debian.org/doc/ Debian Documentation]


=== Login ===
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
||
<tt>
Debian GNU/Linux 6.0 dhcom ttymxc1<br/>


:1. Format a microSD card like following (in linux e.g. you can use palimpsest) with '''Master Boot Record''' partition scheme
dhcom login: '''root'''<br/>
::{| class="wikitable"
Password: '''foo'''
|P1 '''FAT''' (Primary partition: 100MB)
</tt>
|-
|}
|P2 '''ext3''' (Primary partition: Residual space)
=== Calibrating the touchscreen ===
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<tt># TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate</tt>
|}
===Running example Qt Apps ===
{| class="wikitable" align="center" style="width: color: #000000; background: #FFFFFF;" valign="top" |
|<tt># QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws</tt>
|}
|}
*'''Remark:''' To start the Qt-Browser replace <tt>demoname</tt> with <tt>browser</tt>


:2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)
=== Shutdown ===
::{| class="wikitable"
{| class="wikitable" align="center" | style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|Start the Console on Linux
|<tt># shutdown -h now</tt>
|-
|<code>''su''</code>
|-
|<code>''chmod 755 /path/of/the/microSD_card''</code>
|-
|<code>''cd /path/of/the/microSD_card''</code>
|-
|<code>''tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2''</code>
|}
|}


==Debian Rootfilesystem ==
== How to create a microSD-card with a rootfilesystem on it ==
=== Calibrating the touchscreen ===
 
:{| class="wikitable"
1. Format a microSD card like following (in linux e.g. gparted, palimpsest) with '''Master Boot Record''' partition scheme
|<code>''TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate''</code>
{| class="wikitable" | style="width: 450px; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt>P1 '''FAT'''  (Primary partition: 100MB)</tt><br/>
<tt>P2 '''ext3''' (Primary partition: Residual space)</tt>
|}
|}
===Running example Qt Apps ===
2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)
:{| class="wikitable"
{| class="wikitable" | style="width: 450px; color: #000000; background: #FFFFFF;" valign="top" |
|<code>''QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws''</code>
|
|}
Start the Console on Linux<br/>
:For the Qt-Browser change <code>demoname</code> to <code>browser</code>
<tt># ''su''</tt><br/>
=== Login/Shutdown system ===
<tt># ''chmod 755 /path/of/the/microSD_card''</tt><br/>
:{| class="wikitable" style="width: 120px"
<tt># ''cd /path/of/the/microSD_card''</tt><br/>
||Username: ||root
<tt># ''tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2''</tt>
|-
||Password: ||foo
|}
:{| class="wikitable"
|<code>''shutdown -h now''</code>
|}
|}
'''Remark:''' If you got a *.tar.gz file so type <tt> tar xfzv ...  </tt> to extract the rootfilesystem.


==Busybox Rootfilesystem ==
==Busybox Rootfilesystem ==
Line 132: Line 166:
=== Serial (UART) Interfaces ===
=== Serial (UART) Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM (FF) UART 1||<code>/dev/ttymxc1</code>
  |style="width: 50%;"|DHCOM (FF) UART 1||<code>/dev/ttymxc1</code>
  |-
  |-
  ||DHCOM (BT) UART 2 ||<code>/dev/ttymxc2</code>
  ||DHCOM (BT) UART 2 ||<code>/dev/ttymxc2</code>
Line 141: Line 175:
=== I2C Interfaces ===
=== I2C Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM I2C 1||<code>/dev/i2c-1</code>
  |style="width: 50%;"|DHCOM I2C 1||<code>/dev/i2c-1</code>
  |-
  |-
  ||DHCOM I2C 2 ||<code>/dev/i2c-2</code>
  ||DHCOM I2C 2 ||<code>/dev/i2c-2</code>
Line 148: Line 182:
=== SPI Interfaces ===
=== SPI Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM SPI 1||<code>/dev/spidev1.0</code>
  |style="width: 50%;"|DHCOM SPI 1||<code>/dev/spidev1.0</code>
  |-
  |-
  ||DHCOM SPI 2 ||<code>/dev/spidev2.0</code>
  ||DHCOM SPI 2 ||<code>/dev/spidev2.0</code>
Line 154: Line 188:


=== Control the display brightness ===
=== Control the display brightness ===
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness''</code>
|<code>''echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness''</code>
|}
|}
Line 209: Line 243:


:Export
:Export
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''echo <GPIO#> >/sys/class/gpio/export''</code>
|<code>''echo <GPIO#> >/sys/class/gpio/export''</code>
|}
|}
:Set direction
:Set direction
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''echo in >/sys/class/gpio/gpioXX/direction''</code>
|<code>''echo in >/sys/class/gpio/gpioXX/direction''</code>
|-
|-
Line 219: Line 253:
|}
|}
:Set value
:Set value
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''echo 0 >/sys/class/gpio/gpioXX/value''</code>
|<code>''echo 0 >/sys/class/gpio/gpioXX/value''</code>
|-
|-
Line 225: Line 259:
|}
|}
:Get value
:Get value
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''cat /sys/class/gpio/gpioXX/value''</code>
|<code>''cat /sys/class/gpio/gpioXX/value''</code>
|}
|}


:unexport
:unexport
:{| class="wikitable"
:{| class="wikitable" style="width: 640px"
|<code>''echo <GPIO#> >/sys/class/gpio/unexport''</code>
|<code>''echo <GPIO#> >/sys/class/gpio/unexport''</code>
|}
|}
Line 268: Line 302:
:* [[media:dh_framebuffer_tools.zip|DH framebuffer tools v1.0 (ARM)]]
:* [[media:dh_framebuffer_tools.zip|DH framebuffer tools v1.0 (ARM)]]


==[[Linux Kernel Features | Linux Kernel Features ]]==
== Additional Information ==
----
*[[Linux Kernel Features | Linux Kernel Features ]]
 
*[[ELBE Overview| Embedded Linux Build Environment (ELBE)]]
==[[ELBE Overview| Embedded Linux Build Environment (ELBE)]]==

Latest revision as of 08:58, 7 October 2016


Linux virtual machine for development

Building your own Kernel

Sources for the iMX25 Linux Kernel v3.2.9 / v3.2.81:

How to build a kernel

Get sources from Github and build the linux kernel

1. Start a terminal on Linux
2. # git clone https://github.com/dh-electronics/linux-imx25.git
3. # git checkout BRANCH
(BRANCH=dev/3.2.9_dhcom or BRANCH=dev/3.2.81_dhcom)
4. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make imx25_dhcom_defconfig
5. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
  • Your new uImage file is available in arch/arm/boot


Sources older than February 2014

Sources for the iMX25 Linux Kernel v2.6.38:

Sources for the iMX25 Linux Kernel v3.2.9:

How to build a kernel

1. Start a terminal on Linux
2. Copy the above mentioned source files (linux-3.x.y.tar.bz2, .config, *.patch) into our work_path
3. # cd work_path
4. # tar xfjv linux-2.6.38.tar.bz2
5. # cd work_path/linux-2.6.38
6. # patch -p1 <linux-2.6.38_DHCOM_iMX25.patch
7. # cp .config work_path/linux-2.6.38
8. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
  • Your new uImage file is available in work_path/linux-2.6.38/arch/arm/boot

Update the kernel with U-Boot

The linux kernel will be updated by the U-Boot flash update.
1. Copy the uImage and uImage.env file onto a microSD card with a FAT file system (you can use the 1st partition on the microSD card)
2. Insert the microSD card and start the system
3. Go to the U-Boot console by pressing BACKSPACE on a RS232 terminal (during startup)
4. update linux

Debian Rootfilesystem

Available Rootfilesystems

Please have a look at the iMX25 Downloads section.

External Documentation

Login

Debian GNU/Linux 6.0 dhcom ttymxc1

dhcom login: root
Password: foo

Calibrating the touchscreen

# TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Running example Qt Apps

# QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws
  • Remark: To start the Qt-Browser replace demoname with browser

Shutdown

# shutdown -h now

How to create a microSD-card with a rootfilesystem on it

1. Format a microSD card like following (in linux e.g. gparted, palimpsest) with Master Boot Record partition scheme

P1 FAT (Primary partition: 100MB)
P2 ext3 (Primary partition: Residual space)

2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)

Start the Console on Linux
# su
# chmod 755 /path/of/the/microSD_card
# cd /path/of/the/microSD_card
# tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2

Remark: If you got a *.tar.gz file so type tar xfzv ... to extract the rootfilesystem.

Busybox Rootfilesystem

Calibrating the touchscreen

TSLIB_TSDEVICE=/dev/event0 ts_calibrate

Running example Qt Apps

QWS_MOUSE_PROTO=Tslib:/dev/event0 /usr/qt/demos/demoname/demoname -qws
For the Qt-Browser change demoname to browser

Login/Shutdown system

Username: root
Password: n/a
halt


Kernel Userspace Interfaces to Access Hardware

Serial (UART) Interfaces

DHCOM (FF) UART 1 /dev/ttymxc1
DHCOM (BT) UART 2 /dev/ttymxc2
DHCOM (STD) UART 3 /dev/ttymxc4

I2C Interfaces

DHCOM I2C 1 /dev/i2c-1
DHCOM I2C 2 /dev/i2c-2

SPI Interfaces

DHCOM SPI 1 /dev/spidev1.0
DHCOM SPI 2 /dev/spidev2.0

Control the display brightness

echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness
value range: 0..255

Control GPIOs

DHCOM Name: alt. DHCOM Name: Port: Pin: SO-DIMM Pin# Linux <GPIO#>
GPIO A 2 12 154 44
GPIO B 3 21 156 85
GPIO C 2 4 162 36
GPIO D 2 5 163 37
GPIO E 2 6 164 38
GPIO F 2 7 165 39
GPIO G 2 8 167 40
GPIO H 2 9 173 41
GPIO I 3 17 175 81
CIF HSYNC GPIO J 1 10 74 10
CIF PCLK GPIO K 1 11 72 11
CIF MCLK GPIO L 1 8 70 8
CIF VSYNC GPIO M 1 9 68 9
CIF D9 GPIO N 4 21 66 117
CIF D8 GPIO O 1 7 64 7
CIF D7 GPIO P 1 6 62 6
CIF D6 GPIO Q 1 31 60 31
CIF D5 GPIO R 1 30 58 30
CIF D4 GPIO S 1 29 56 29
CIF D3 GPIO T 1 28 54 28
CIF D2 GPIO U 1 27 52 27
Export
echo <GPIO#> >/sys/class/gpio/export
Set direction
echo in >/sys/class/gpio/gpioXX/direction
echo out >/sys/class/gpio/gpioXX/direction
Set value
echo 0 >/sys/class/gpio/gpioXX/value
echo 1 >/sys/class/gpio/gpioXX/value
Get value
cat /sys/class/gpio/gpioXX/value
unexport
echo <GPIO#> >/sys/class/gpio/unexport


Initialize and test CAN

Initialize:
ip link set can0 up type can bitrate 500000
Send test message via cansend (part of can-utils):
cansend can0 100#11.2233.44556677.88
Receive message via candump (part of can-utils):
candump can0
Get can-utils:

Test display / framebuffer

fb_1Colorfill Fills the framebuffer device with a given RGB color
Syntax: fb_1Colorfill [fb (0..31)] [Display Bits (1..8)] [Red value (0..255)] [Green value (0..255)] [Blue value (0..255)]
fb_fb2BMP Copies framebuffer device data into a 24Bit BMP-File
Syntax: fb_fb2BMP [fb (0..31)] [24-Bit BMP-File]
fb_LoadBMP Loads a 24Bit BMP-file into a 32Bit framebuffer device
Syntax: fb_LoadBMP [fb (0..31)] [24-Bit BMP-File] [Display Bits (1..8)] [Transparency (0..100)]
In most common cases the "Display Bits" should be "8"


Get DH framebuffer tools:

Additional Information