COM iMX25 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Lzenz (talk | contribs)
Lzenz (talk | contribs)
 
(13 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 v3.2.9: ====
==== 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]
* 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 ====
==== How to build a kernel ====
Get sources from Github and build the linux kernel using 5 threads and a build directory
Get sources from Github and build the linux kernel
{| class="wikitable"
{| class="wikitable"
|1. Start a terminal on Linux
|1. Start a terminal on Linux
Line 17: Line 18:
|2. <tt># ''git clone [https://github.com/dh-electronics/linux-imx25.git https://github.com/dh-electronics/linux-imx25.git]''</tt>
|2. <tt># ''git clone [https://github.com/dh-electronics/linux-imx25.git https://github.com/dh-electronics/linux-imx25.git]''</tt>
|-
|-
|3. <tt># ''mkdir build''</tt>
|3. <tt># ''git checkout BRANCH''<br/>(BRANCH=dev/3.2.9_dhcom or BRANCH=dev/3.2.81_dhcom)</tt>
|-
|4. <tt># ''cd linux-imx25''</tt>
|-
|-
|5. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make O=../build/ imx25_dhcom_defconfig''</tt>
|4. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make imx25_dhcom_defconfig''</tt>
|-
|-
|6. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make -j5 O=../build/ uImage''</tt>
|5. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
|}
* Your new <tt>uImage</tt> file is available in <tt>../build/arch/arm/boot</tt>
* Your new <tt>uImage</tt> file is available in <tt>arch/arm/boot</tt>
'''Remark:'''
 
* On i.MX25 we use the git branch "master".


{| style="width: 100%; color: #000000; border-spacing: 2px; border: 1px solid darkgray;" valign="top" |
{| style="width: 100%; color: #000000; border-spacing: 2px; border: 1px solid darkgray; background: lightgrey;" valign="top" |
| style="width: 100%; |
| style="width: 100%;" |
|-
|-
|
|
=== Sources olden than February 2014 ===
 
=== ''Sources older than February 2014'' ===
==== Sources for the iMX25 Linux Kernel v2.6.38: ====
==== Sources for the iMX25 Linux Kernel v2.6.38: ====


Line 69: Line 68:
|8. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|8. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
|}
:* Your new <code>uImage</code> file is available in <code>work_path/linux-2.6.38/arch/arm/boot</tt>
:* Your new <tt>uImage</tt> file is available in <tt>work_path/linux-2.6.38/arch/arm/boot</tt>
|}
|}


Line 76: 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 89: 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.


:* [https://dl.dropboxusercontent.com/u/19433555/DHCOM/rootFS_DN_20110805et4_HL7%20%2830.10.2014%29.tar.bz2 Current Debian root file system, based on Debian 6.0 "Squeeze" (2014-10-30)]
=== External Documentation ===
:: Remark: Shellshock (CVE-2014-6271) is already fixed.
* [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.
:: [[COM iMX25 Linux#Debian system|Login data for the Debian system]]
*  [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 299: Line 304:
== Additional Information ==
== Additional Information ==
*[[Linux Kernel Features | Linux Kernel Features ]]
*[[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