How to compile mainline Linux kernel for Apalis T30?

Hi Mr. Ziswiler,
I want to compile a mainline Linux kernel and I need some tips and tricks on how to do that. Can you tell me please the right way to solve this?
Many thanks
Tagangout

Hi Tagangout

Compiling a mainline Linux kernel for Apalis T30 is actually not that hard and given a few tweaks even LXDE and networking can be made to work. The basic procedure as explained in our regular article on compiling U-Boot/Linux still applies. A few additional notes are as follows:

I recommend going with a somewhat stable code base as release candidates (e.g. rc) and even more so linux-next may not quite be fully functional at times. Let’s say we just stick to latest stable being 4.5.2 at the time of this writing. Checking out those sources as follows:

[user@host ~]$ git clone -b linux-4.5.y git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

Alternatively one may directly reference a specific revision e.g. -b v4.5.2 in the above.

Due to our atypical way of fusing the gigabit Ethernet controller or rather not fusing the MAC address thereof but rather relying on our proprietary Toradex factory configuration block this patch has to be applied e.g. as follows:

[user@host linux-stable]$ patch -p1 < 3603e5a.patch

After having setup the cross compilation environment as mentioned in our article as linked above a somewhat decent configuration for the Tegras may be found as tegra_defconfig:

[user@host linux-stable]$ make tegra_defconfig

And compiling a uImage as usual:

[user@host linux-stable]$ make -j6 uImage LOADADDR=0x82008000
[user@host linux-stable]$ make -j6 dtbs

Optionally you may also want to compile the kernel modules:

[user@host linux-stable]$ make -j6 modules

As NVIDIA’s proprietary graphics stack is not compatible with the latest X server as used in Jethro our standard Apalis T30 BSP is still relying on an older X11 version in turn having difficulties with mainlines latest DRM stack.

For testing I therefore suggest relying on the rootfs from our latest Colibri Vybrid BSP where we recently switched to using DRM/modesetting by default. The easiest is to take our latest Apalis T30 BSP and just swapping out the rootfs folder but retaining /etc/issue as used for module type detection:

[user@host ~]$ sudo tar xjvf Apalis_T30_LinuxImageV2.6Beta1_20160331.tar.bz2
[user@host ~]$ sudo tar xjvf Colibri_VF_LinuxImageV2.6Beta1_20160331.tar.bz2
[user@host ~]$ sudo cp Apalis_T30_LinuxImageV2.6/rootfs/etc/issue .
[user@host ~]$ sudo rm -rf Apalis_T30_LinuxImageV2.6/rootfs
[user@host ~]$ sudo mv Colibri_VF_LinuxImageV2.6/rootfs Apalis_T30_LinuxImageV2.6/
[user@host ~]$ mv issue Apalis_T30_LinuxImageV2.6/rootfs/etc/

And make sure to get rid of the Vybrid’s default X configuration and fully rely on auto detection instead:

[user@host ~]$ sudo rm Apalis_T30_LinuxImageV2.6/rootfs/etc/X11/xorg.conf

Then simply deploy previously built uImage as well as the tegra30-apalis-eval.dtb device tree (plus optionally the kernel modules) before regenerating your update media:

[user@host linux-stable]$ sudo cp arch/arm/boot/uImage ~/Apalis_T30_LinuxImageV2.6/apalis-t30_bin/
[user@host linux-stable]$ sudo cp arch/arm/boot/ ~/Apalis_T30_LinuxImageV2.6/apalis-t30_bin/
[user@host linux-stable]$ sudo -E make INSTALL_MOD_PATH=~/Apalis_T30_LinuxImageV2.6/rootfs/ modules_install

As a next step just flashed this to your target module as usual.

Due to differences in the mainline vs. NVIDIA proprietary graphic stack I would also advice to clear our default vidargs from within U-Boot as follows:

Apalis T30 # setenv vidargs
Apalis T30 # saveenv
Saving Environment to MMC...
Writing to MMC(0)... done

Upon reboot your module should be booting Linux 4.5.2 subsequently launching X.Org X Server 1.17.2 with its modesetting driver and LXDE on top. Both our resistive VGA touch panel as well as a screen connected by DVI-D aka HDMI should default to VGA resolution as configured in the device tree.

BTW: For audio functionality one could integrate something along those lines.

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

A word of caution: Due to no DVFS functionality being implemented on T30 in mainline as of yet you may need to add an active cooling solution or alternatively limit the computational load being run otherwise serious overheating may result. The CPU temperature may be queried by catting /sys/class/hwmon/hwmon0/temp2_input while temp1 is the module temperature measured at the edge.

Dear Ziswiler,
many many thanks for your Tutorial. Realy nice.
I try this Tutorial today.
Tagangout

Dear Mr Ziswiler,
I have done the update today, but when I try to boot the kernel after flashing it, I become only the String “Starting kernel …” and before I become this Error “** Unable to read file tegra30-apalis-eval.dtb **”.
can you tell me please what I do wrong in the Procedure?

Environment size: 5037/8188 bytes
Apalis T30 # boot
Booting from internal eMMC chip...
reading tegra30-apalis-eval.dtb
** Unable to read file tegra30-apalis-eval.dtb **
reading uImage
5236584 bytes read in 140 ms (35.7 MiB/s)
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux-4.5.2-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5236520 Bytes = 5 MiB
   Load Address: 82008000
   Entry Point:  82008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Nothing will come after this String.

Many thanks
Tagangout

Dear Mr Ziswiler,
I have solved the error above, and I flashed the tegra30-apalis-eval.dtb.
Now I have a dmesg-log for you, can you please take a look? I have no Ethernet!?

Many thanks
Tagangout

Hi Abderrahim

Congratulation! You are almost there (;-p).

By any chance you are running this on a pre V1.1A hardware revision? If so we did not fuse their Intel i210/i211 gigabit Ethernet controller chips which results in them running in a so called tools only mode not using the standard PCI IDs. Usually the easiest to check would be doing lspci unfortunately as you are now running the Vybrid rootfs that tool won’t be available. Even though Intel claims not to support bringing up a link in that mode it can be done by hacking the driver to bind to that PCI ID instead. For an Apalis T30 2GB resp. 1GB IT you are looking at E1000_DEV_ID_I210_COPPER_FLASHLESS to be changed to 0x1531 and for an Apalis T30 1GB it would be E1000_DEV_ID_I211_COPPER to be changed to 0x1532.

BTW: The eMMC bug you are seeing may have something to do with background operation resp. high priority interrupt being broken in SKHynix’ firmware which can be disabled in the device tree.

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

Dear Mr Ziswiler,
First many thanks for your Help.
Seconde, i have the igb aktivated, for this i will thanks you so.
1 - What do you think about porting the Nvidia apalis Drivers from the V2.6, do you think i will have a chance to do so?
2 - When i boot the Kernel, i have this outputs, can you please take a look about this? link text
Many thanks.
Abderrahim

Dear Abderrahim

You are very welcome. Glad gigabit Ethernet is now working for you as well.

Concerning 1 - I am unsure as to what exactly you are referring to by ‘Nvidia apalis Drivers’. There is no such thing as Apalis specific NVIDIA drivers. Are you talking about NVIDIA’s proprietary graphics/multimedia stack? If so what exact feature thereof are you looking for?

Concerning 2 - I noticed that you have not heeded my advice on clearing the vidargs plus I noticed that for some reason on your setup it can’t seem to talk to the carrier board level I2C RTC. Other than that I don’t see anything wrong. Note that the -517 errors may be ignored as those are all just probe deferrals. What exactly is it that you would need further assistance with?

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

Dear Mr. Ziswiler

  1. The Goal that I follow, is QT5 with Linux Kernel 4.4+.
  2. While the CPU is being warm with the default settings, I ask me how would be the best way to implement and activate the temperature sensor and the CPU frequency scaling into the new kernel? If you have any advise, please welcome.
  3. The Variable vidargs is only activated to test the lcd that I connected to the Board (I know one can use fbset xxxx ;-)).
  4. I tested the Board in our Development Board without a RTC (at this moment).

Many thanks

Tagangout

Dear Mr Ziswiler,

I have some done changes in the *.dtsi-File to integrate the edt-ft5x06 - Touch driver instead of the stmpe one.

The Driver will be loaded and the probe-Function is called, but I think I have some other problems with the emmc-Card:

My command to read u-boot environment is failed:

$fw_printenv 
Cannot access MTD device /dev/mtd2: No such file or directory   

after a while running the linux kernel, i get this lines in the kernel log:

....
root@apalis-t30:/# [ 1107.027767] mmcblk0: timed out sending r/w cmd command, card status 0x900
[ 1107.035732] blk_update_request: I/O error, dev mmcblk0, sector 604632
[ 1107.042528] EXT4-fs warning (device mmcblk0p2): ext4_end_bio:328: I/O error -5 writing to inode 67751 (offset 0 size 0 starting block 302317)
[ 1107.055326] Buffer I/O error on device mmcblk0p2, logical block 281836
[ 1107.061963] blk_update_request: I/O error, dev mmcblk0, sector 604634
[ 1107.068425] EXT4-fs warning (device mmcblk0p2): ext4_end_bio:328: I/O error -5 writing to inode 67752 (offset 0 size 0 starting block 302319)
[ 1107.081164] Buffer I/O error on device mmcblk0p2, logical block 281837
[ 1107.087698] Buffer I/O error on device mmcblk0p2, logical block 281838
[ 1107.095393] blk_update_request: I/O error, dev mmcblk0, sector 604638
[ 1107.101946] EXT4-fs warning (device mmcblk0p2): ext4_end_bio:328: I/O error -5 writing to inode 67751 (offset 0 size 0 starting block 302320)
[ 1107.114733] Buffer I/O error on device mmcblk0p2, logical block 281839
[ 1107.121459] blk_update_request: I/O error, dev mmcblk0, sector 604640
[ 1107.127924] EXT4-fs warning (device mmcblk0p2): ext4_end_bio:328: I/O error -5 writing to inode 67752 (offset 0 size 0 starting block 302322)
[ 1107.140709] Buffer I/O error on device mmcblk0p2, logical block 281840
[ 1107.147246] Buffer I/O error on device mmcblk0p2, logical block 281841
[ 1107.154986] blk_update_request: I/O error, dev mmcblk0, sector 604644
[ 1107.161549] EXT4-fs warning (device mmcblk0p2): ext4_end_bio:328: I/O error -5 writing to inode 67752 (offset 0 size 0 starting block 302323)
[ 1107.174345] Buffer I/O error on device mmcblk0p2, logical block 281842
[ 1107.182530] JBD2: Detected IO errors while flushing file data on mmcblk0p2-8
[ 1113.031864] JBD2: Detected IO errors while flushing file data on mmcblk0p2-8
...

Do you have seen this lines before?

Many Thanks for your Help

Tagangout

Hi Tagangout

  1. I have to admit that I don’ t know that much about Qt but at least older and maybe newer variants should work without OpenGL support as well. Alternatively one could probably run Mesa in software.
  2. The temperature sensor is not the problem as that one is already supported (e.g. see /sys/class/hwmon et. al.). However the DVFS part is much more complex and probably not an ideal target for a kernel novice.
  3. I am not quite sure whether the vidargs are even much used by mainline at all. Nowadays one should probably do this in the device tree.
  4. OK, makes sense.

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

Hi Tagangout

The edt-ft5x06 integration may require more effort than just some device tree updates

Given your use of the Vybrid root file system things like the U-Boot fw_printenv integration of course does not match.

The later eMMC errors are probably related to Lucas Stach’ s HS200 integration of late. I will need to take a closer look to get all this resolved.

Cheers

Marcel Ziswiler

Platform Manager Embedde Linux

Dear Mr. Ziswiler,

Many thanks for your Answer.

The integration of the edt-ft-Driver is done, and it works nice. I musst make some changes in the driver but it works fine.

1 - About the emmc, i don’t know where to start searching to solve this errors. But i will be happy if you can give me some tips, where i should begin!?

2 - do you have a tip for me how to change the size of the lcd to be 800x480 instead of 640x480?

Many thanks for your help, then without you i don’t have any chance to solve them.

Tagangout

Hi Tagangout

  1. Here you go.
  2. Here you go. Looking at simple-panel.c maybe your panel works with those Ampire settings.

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

Dear Mr Ziswiler,
the command “fw_printenv” doesn’t work in my environment, do you have any idea?
i use Apalis T30 with the mainline krenel like above.
Many thanks
Tagangout

Dear Mr Ziswiler,
i still have a problem with the Temperatur of the CPU with the main-line Kernel. Do you have aTips for me where to begin to backport the 3.1.10 funktionality in the 4.5.2 kernel version?
many thanks for your patience.
Tagangout

Hi Tagangout

The fw_printenv command requires specific post installation configuration which while done in our Apalis T30 BSPs is now of course missing when running the Colibri VF one.

Cheers

Marcel Ziswiler

Platform Manager Embedded Linux

Dear Mr. Ziswiler,

I have compiled new kernel with commands:

make -j6 uImage LOADADDR=0x82008000
make -j6 dtbs
make -j6 modules

and uploaded on the Apalis T30 board, but Linux stops with command Starting kernel …
during loading. Someone mentioned above that, had the same issue but didn’t mentioned how he resolved it. Could you give me the hint how to resolve this issue?

U-Boot SPL 2015.04 (Mar 31 2016 - 01:18:13)


U-Boot 2015.04 (Mar 31 2016 - 01:18:13)

TEGRA30
DRAM:  2 GiB
MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1, Tegra SD/MMC: 2
tegra-pcie: PCI regions:
tegra-pcie:   I/O: 0x2000000-0x2010000
tegra-pcie:   non-prefetchable memory: 0x20000000-0x30000000
tegra-pcie:   prefetchable memory: 0x30000000-0x40000000
tegra-pcie: 4x1, 1x2 configuration
tegra-pcie: probing port 2, using 1 lanes
In:    serial
Out:   lcd
Err:   lcd
Model: Toradex Apalis T30 2GB V1.0E, Serial# 02650732
Net:   e1000: no NVM
e1000#0
Hit any key to stop autoboot:  0 
Apalis T30 # run setupdate
reading flash_blk.img
710 bytes read in 13 ms (52.7 KiB/s)
reading flash_blk.img
710 bytes read in 13 ms (52.7 KiB/s)
## Executing script at 81000000
reading apalis_t30/flash_blk.img
4029 bytes read in 21 ms (186.5 KiB/s)
## Executing script at 80408000
enter "run update" to update the entire module
Apalis T30 # run update_fdt
reading apalis_t30/tegra30-apalis-eval.dtb
29450 bytes read in 32 ms (898.4 KiB/s)
writing 730a
0 bytes written
Apalis T30 # 
U-Boot SPL 2015.04 (Mar 31 2016 - 01:18:13)


U-Boot 2015.04 (Mar 31 2016 - 01:18:13)

TEGRA30
DRAM:  2 GiB
MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1, Tegra SD/MMC: 2
tegra-pcie: PCI regions:
tegra-pcie:   I/O: 0x2000000-0x2010000
tegra-pcie:   non-prefetchable memory: 0x20000000-0x30000000
tegra-pcie:   prefetchable memory: 0x30000000-0x40000000
tegra-pcie: 4x1, 1x2 configuration
tegra-pcie: probing port 2, using 1 lanes
In:    serial
Out:   lcd
Err:   lcd
Model: Toradex Apalis T30 2GB V1.0E, Serial# 02650732
Net:   e1000: no NVM
e1000#0
Hit any key to stop autoboot:  0 
Booting from internal eMMC chip...
reading tegra30-apalis-eval.dtb
** Unable to read file tegra30-apalis-eval.dtb **
reading uImage
5315360 bytes read in 143 ms (35.4 MiB/s)
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux-4.6.2
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5315296 Bytes = 5.1 MiB
   Load Address: 82008000
   Entry Point:  82008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Dear Mr. Ziswiler,

I would like to ask if someone is working on issue from above? Maybe the problem is, that the file tegra30-apalis-eval.dtb is not uploading with success on apalis?

 U-Boot SPL 2015.04 (Mar 31 2016 - 01:18:13)
 
 
 U-Boot 2015.04 (Mar 31 2016 - 01:18:13)
 
 TEGRA30
 DRAM:  2 GiB
 MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1, Tegra SD/MMC: 2
 tegra-pcie: PCI regions:
 tegra-pcie:   I/O: 0x2000000-0x2010000
 tegra-pcie:   non-prefetchable memory: 0x20000000-0x30000000
 tegra-pcie:   prefetchable memory: 0x30000000-0x40000000
 tegra-pcie: 4x1, 1x2 configuration
 tegra-pcie: probing port 2, using 1 lanes
 In:    serial
 Out:   lcd
 Err:   lcd
 Model: Toradex Apalis T30 2GB V1.0E, Serial# 02650732
 Net:   e1000: no NVM
 e1000#0
 Hit any key to stop autoboot:  0 
 Apalis T30 # run setupdate
 reading flash_blk.img
 710 bytes read in 13 ms (52.7 KiB/s)
 reading flash_blk.img
 710 bytes read in 13 ms (52.7 KiB/s)
 ## Executing script at 81000000
 reading apalis_t30/flash_blk.img
 4029 bytes read in 21 ms (186.5 KiB/s)
 ## Executing script at 80408000
 enter "run update" to update the entire module
 Apalis T30 # run update_fdt
 reading apalis_t30/tegra30-apalis-eval.dtb
 29450 bytes read in 32 ms (898.4 KiB/s)
 writing 730a
 **0 bytes written**
 Apalis T30 # 
 U-Boot SPL 2015.04 (Mar 31 2016 - 01:18:13)