Natively compile Linux kernel error on ubuntu14.04 for tk1

hi toradex
i compiled Linux kernel natively on Apalis tk1 with ubuntu14.04 according to following link
link text

and i improve make -j6 zImage error according to
link text

then i copied all the essentials to /media/ubuntu/BOOT and then i try

make modules_install 

i encountered some errors according to attached images
i dont know why?[upload|VbPQA6rNw1zVVkCtmZYOPC5EMQ8=]

[upload|QUN0fRWXUSfmvubWeVLTshP/K/4=]

Hi

Could you share some error log in text format instead of not helpful printscreen?

What is your application?
What exactly are you trying to do?

Best regards,
Jaski

Hi toradex
Why doesn’t anyone from toradex awnser my questions anymore?
Regards

HI @toradexvision

Sorry for the delay but usually nobody is working on weekend.

Best regards,
Jaski

hi Jaski

thank you for your response

first i excuse for my bad Linux knowledge i am only c++ developer .

according to my previous post link text

i tried to install Linux driver for EMP2-X403 mpcie card on UBUNTU 14.04 for apalis TK1

i used your prebuilt L4T in your site

EMP2-X403 has following make file

build:
        $(MAKE) -C $(KERNEL_SRC) SUBDIRS=$(PWD) modules

install:
        cp xr17v35x.ko /lib/modules/$(shell uname -r)/kernel/drivers/char
        depmod -a

clean:
        rm -f *~ *.o
        rm -f *~ *.ko
        rm -f modules.order Module.symvers xr17v35x.mod.c xr17v35x.o.ur-safe
        rm -f .xr17v35x.ko.cmd .xr17v35x.mod.o.cmd .xr17v35x.o.cmd .xr17v35x.o.d .cache.mk
        rm -rf .tmp_versions
        rm -f /lib/modules/$(shell uname -r)/kernel/drivers/char/xr17v35x.ko

when i make above makefile i encountered an error:

make -C /lib/modules/`uname -r`/build SUBDIRS=/home/ubuntu/EMP2_Driver/driver modules
make: *** /lib/modules/3.10.40-2.8.6+g2c7a3c3af726/build: No such file or directory.  Stop.
make: *** [build] Error 2

and my (ls) command result on /lib/modules is

root@tegra-ubuntu:# ls /lib/modules
3.10.40-2.8.3+g6c533d3  3.10.40-g5abb340-dirty  

your Colleague (Dear Mr.Marcel Ziswiler) help me about this error such as natively compile Linux kernel on apalis TK1 then i did following steps

1-sudo su
2.git clone -b toradex_tk1_l4t_r21.7 git://git.toradex.com/linux-toradex.git
3.apt-get update
4.apt-get install u-boot-tools
5.cd linux-toradex
6.ake apalis-tk1_defconfig
7.make -j6
8.make -j6 zImage

but unfortunately in step 8 i got an error

     drivers/video/tegra/dc/of_dc.c:260:2: error :'for' initial declarations are only allowed in c99 mode 
     for(int i=0;i<5;i++){
     drivers/video/tegra/dc/of_dc.c:260:2: note:use option -std=c99 or -std=gnu99 to compile your code 

to fix initializing error i unrolled For loop in (of_dc.c) file

      if(temp[0]<0x100){
        drive_strength+=(u64)temp[0]<<0*8);
      }else{
       OF_DC_LOG("Invalid LVDS driver strength for lane %d\n",0);
     }
      if(temp[1]<0x100){
        drive_strength+=(u64)temp[1]<<1*8);
      }else{
       OF_DC_LOG("Invalid LVDS driver strength for lane %d\n",1);
     }

      if(temp[2]<0x100){
        drive_strength+=(u64)temp[2]<<2*8);
      }else{
       OF_DC_LOG("Invalid LVDS driver strength for lane %d\n",2);
     }

      if(temp[3]<0x100){
        drive_strength+=(u64)temp[3]<<3*8);
      }else{
       OF_DC_LOG("Invalid LVDS driver strength for lane %d\n",3);
     }

      if(temp[4]<0x100){
        drive_strength+=(u64)temp[4]<<4*8);
      }else{
       OF_DC_LOG("Invalid LVDS driver strength for lane %d\n",4);
     }

at lost zImage was built successfully .
i copied all essentials to /media/ubuntu/BOOT

then i executed ( make modules_install ) but i got some errors again

root@tegra-ubuntu:/home/ubuntu/linux-toradex# make modules_install
make: Warning: File `.vmlinux.cmd' has modification time 6.3e+08 s in the future
make[1]: Warning: File `scripts/Kbuild.include' has modification time 6.3e+08 s in the future
  INSTALL crypto/tcrypt.ko
cp: cannot stat ‘crypto/tcrypt.ko’: No such file or directory
  INSTALL crypto/twofish_common.ko
cp: cannot stat ‘crypto/twofish_common.ko’: No such file or directory
  INSTALL crypto/twofish_generic.ko
cp: cannot stat ‘crypto/twofish_generic.ko’: No such file or directory
  INSTALL drivers/ata/ahci.ko
cp: cannot stat ‘drivers/ata/ahci.ko’: No such file or directory
  INSTALL drivers/bluetooth/btusb.ko
cp: cannot stat ‘drivers/bluetooth/btusb.ko’: No such file or directory
  INSTALL drivers/gpio/gpio-apalis-tk1-k20.ko
cp: cannot stat ‘drivers/gpio/gpio-apalis-tk1-k20.ko’: No such file or directory
  INSTALL drivers/hid/hid-multitouch.ko
cp: cannot stat ‘drivers/hid/hid-multitouch.ko’: No such file or directory
  INSTALL drivers/iio/adc/apalis-tk1-k20_adc.ko
cp: cannot stat ‘drivers/iio/adc/apalis-tk1-k20_adc.ko’: No such file or directory
  INSTALL drivers/input/joydev.ko
cp: cannot stat ‘drivers/input/joydev.ko’: No such file or directory
  INSTALL drivers/input/joystick/xpad.ko
cp: cannot stat ‘drivers/input/joystick/xpad.ko’: No such file or directory
  INSTALL drivers/input/touchscreen/apalis-tk1-k20_ts.ko
cp: cannot stat ‘drivers/input/touchscreen/apalis-tk1-k20_ts.ko’: No such file or directory
  INSTALL drivers/input/touchscreen/atmel_mxt_ts.ko
cp: cannot stat ‘drivers/input/touchscreen/atmel_mxt_ts.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/adv7280.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/adv7280.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/ap1302.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/ap1302.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/ar0261_v4l2.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/ar0261_v4l2.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/ar0330_v4l2.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/ar0330_v4l2.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/imx135_v4l2.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/imx135_v4l2.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/ov5640.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/ov5640.ko’: No such file or directory
  INSTALL drivers/media/i2c/soc_camera/tc358743.ko
cp: cannot stat ‘drivers/media/i2c/soc_camera/tc358743.ko’: No such file or directory
  INSTALL drivers/media/platform/soc_camera/soc_camera_platform.ko
cp: cannot stat ‘drivers/media/platform/soc_camera/soc_camera_platform.ko’: No such file or directory
  INSTALL drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko
cp: cannot stat ‘drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko’: No such file or directory
  INSTALL drivers/media/v4l2-core/videobuf2-dma-contig.ko
cp: cannot stat ‘drivers/media/v4l2-core/videobuf2-dma-contig.ko’: No such file or directory
  INSTALL drivers/mfd/apalis-tk1-k20.ko
cp: cannot stat ‘drivers/mfd/apalis-tk1-k20.ko’: No such file or directory
  INSTALL drivers/net/ethernet/intel/e1000e/e1000e.ko
cp: cannot stat ‘drivers/net/ethernet/intel/e1000e/e1000e.ko’: No such file or directory
  INSTALL fs/nfs/nfs_layout_nfsv41_files.ko
cp: cannot stat ‘fs/nfs/nfs_layout_nfsv41_files.ko’: No such file or directory
  INSTALL fs/nls/nls_iso8859-15.ko
cp: cannot stat ‘fs/nls/nls_iso8859-15.ko’: No such file or directory
  INSTALL fs/squashfs/squashfs.ko
cp: cannot stat ‘fs/squashfs/squashfs.ko’: No such file or directory
  INSTALL lib/xz/xz_dec.ko
cp: cannot stat ‘lib/xz/xz_dec.ko’: No such file or directory
  INSTALL net/bluetooth/bluetooth.ko
cp: cannot stat ‘net/bluetooth/bluetooth.ko’: No such file or directory
  INSTALL net/bluetooth/bnep/bnep.ko
cp: cannot stat ‘net/bluetooth/bnep/bnep.ko’: No such file or directory
  INSTALL net/bluetooth/hidp/hidp.ko
cp: cannot stat ‘net/bluetooth/hidp/hidp.ko’: No such file or directory
  INSTALL net/bluetooth/rfcomm/rfcomm.ko
cp: cannot stat ‘net/bluetooth/rfcomm/rfcomm.ko’: No such file or directory
  INSTALL net/ipv4/ip_tunnel.ko
cp: cannot stat ‘net/ipv4/ip_tunnel.ko’: No such file or directory
  INSTALL net/ipv6/sit.ko
cp: cannot stat ‘net/ipv6/sit.ko’: No such file or directory
  INSTALL net/mac80211/mac80211.ko
cp: cannot stat ‘net/mac80211/mac80211.ko’: No such file or directory
  INSTALL net/wireless/cfg80211.ko
cp: cannot stat ‘net/wireless/cfg80211.ko’: No such file or directory
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Warning: File `scripts/Makefile.host' has modification time 6.3e+08 s in the future
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
  DEPMOD  3.10.40-g5abb340-dirty
make: warning:  Clock skew detected.  Your build may be incomplete.

now i dont know what should i do next for installing EMP2-X403 driver on Ubuntu ?

thank you

hi @toradexvision

I can reproduce the error on my side. Let me check for a solution and come back to you within this week.

Best regards,
Jaski

OK thank you for your attention , I will be wait

Best regards

hi @toradexvision

Thanks for your patience. I have looked into this issue and it may lot of time to do the native compilation.

May I suggest you to do the cross compilation on your host as explained here.
What is your use case and application for Apalis TK1?

Best regards,
Jaski

hi jaski

I have two applications first one is to add 4 extra RS232 by EMP2-X403 to Apalis TK1 to control actuators in a factory so that, operators interact with my application to send commands to actuators.
In second project that is also is my PHD project is to add an analog camera adapter with 4 camera support (VMX200-4 from Vecow) to mini pci express slot for QC of factory products that lead me to implement deep learning and cuda .( that is the reason for choose Apalis TK1 instead of other Toradex products)
all of two above mpcie devices has a driver that need to make and add in UBUNTU .
operators also are very familiar with UBUNTU because it is very user friendly and I’m not allowed to use angstrom instead of UBUNTU.
at lost by cross compiling the linux source can i add ubuntu headers and all essential builds to /lib/modules of UBUNTU 14.04 so that i can make and build driver source of Mipci device on UBUNTU?

thank you

Hi toradex

I’m still waiting for a simple answer to my question…

Best regards

HI @toradexvision

at lost by cross compiling the linux source can i add ubuntu headers and all essential builds to /lib/modules of UBUNTU 14.04 so that i can make and build driver source of Mipci device on UBUNTU?

Actually I don’t understand what are you trying to do? Is cross compilation working for you or not?

Best regards,
Jaski

Hi jaski

I didnt try cross compilation I will check it thank you

Best Regards,

Hi @toradexvision

As we recommend to do cross compilation, you should do this in the first place.

Regarding Native compilation, there are three errors which will corrected in near Future:

  1. First Error is also about Documentation, during the compilation you may get Clock skew detected. For the solution of this error, have a look here.

  2. Second Error is about Documentation, to build the kernel modules, you need to use the command make modules. This command should be launched before the the installation of the kernel modules.

  3. Third Error is about the code. There are two errors which could be resolved using the following patch:

    diff --git a/drivers/net/can/apalis-tk1-k20-can.c b/drivers/net/can/apalis-tk1-k
    index 2a61036…10534ad 100644
    — a/drivers/net/can/apalis-tk1-k20-can.c
    +++ b/drivers/net/can/apalis-tk1-k20-can.c
    @@ -145,6 +145,7 @@ static int apalis_tk1_k20_can_hw_rx(struct net_device *net,
    struct apalis_tk1_k20_priv *priv = netdev_priv(net);
    struct sk_buff *skb;
    struct can_frame *frame;

    •   int i;
        u8 buf[CAN_TRANSFER_BUF_LEN * APALIS_TK1_MAX_CAN_DMA_XREF];
        u32 frame_available = 0;
      

    @@ -161,7 +162,7 @@ static int apalis_tk1_k20_can_hw_rx(struct net_device *net,
    CAN_TRANSFER_BUF_LEN * frame_available);
    apalis_tk1_k20_unlock(priv->apalis_tk1_k20);

    •   for (int i = 0; i < frame_available; i++) {
      
    •   for (i = 0; i < frame_available; i++) {
                skb = alloc_can_skb(priv->net, &frame);
                if (!skb) {
                        dev_err(&net->dev, "cannot allocate RX skb\n");
      

    diff --git a/drivers/video/tegra/dc/of_dc.c b/drivers/video/tegra/dc/of_dc.c
    index 57ebf76…8c8ac7b 100644
    ubuntu@tegra-ubuntu:~/linux-toradex$ ^C
    ubuntu@tegra-ubuntu:~/linux-toradex$ git diff
    diff --git a/drivers/net/can/apalis-tk1-k20-can.c b/drivers/net/can/apalis-tk1-k
    index 2a61036…10534ad 100644
    — a/drivers/net/can/apalis-tk1-k20-can.c
    +++ b/drivers/net/can/apalis-tk1-k20-can.c
    @@ -145,6 +145,7 @@ static int apalis_tk1_k20_can_hw_rx(struct net_device *net,
    struct apalis_tk1_k20_priv *priv = netdev_priv(net);
    struct sk_buff *skb;
    struct can_frame *frame;

    •   int i;
        u8 buf[CAN_TRANSFER_BUF_LEN * APALIS_TK1_MAX_CAN_DMA_XREF];
        u32 frame_available = 0;
      

    @@ -161,7 +162,7 @@ static int apalis_tk1_k20_can_hw_rx(struct net_device *net,
    CAN_TRANSFER_BUF_LEN * frame_available);
    apalis_tk1_k20_unlock(priv->apalis_tk1_k20);

    •   for (int i = 0; i < frame_available; i++) {
      
    •   for (i = 0; i < frame_available; i++) {
                skb = alloc_can_skb(priv->net, &frame);
                if (!skb) {
                        dev_err(&net->dev, "cannot allocate RX skb\n");
      

    diff --git a/drivers/video/tegra/dc/of_dc.c b/drivers/video/tegra/dc/of_dc.c
    index 57ebf76…8c8ac7b 100644
    Best regards,
    Jaski

hi jaski.tx

thank you for you response
i execute patch it is ok and built successfully.
then

root@tegra-ubuntu:/home/ubuntu/linux-toradex# make modules_install
make: Warning: File `.vmlinux.cmd' has modification time 6.3e+08 s in the future
make[1]: Warning: File `scripts/Kbuild.include' has modification time 6.3e+08 s in the future
  INSTALL crypto/tcrypt.ko
  INSTALL crypto/twofish_common.ko
  INSTALL crypto/twofish_generic.ko
  INSTALL drivers/ata/ahci.ko
  INSTALL drivers/bluetooth/btusb.ko
  INSTALL drivers/gpio/gpio-apalis-tk1-k20.ko
  INSTALL drivers/hid/hid-multitouch.ko
  INSTALL drivers/iio/adc/apalis-tk1-k20_adc.ko
  INSTALL drivers/input/joydev.ko
  INSTALL drivers/input/joystick/xpad.ko
  INSTALL drivers/input/touchscreen/apalis-tk1-k20_ts.ko
  INSTALL drivers/input/touchscreen/atmel_mxt_ts.ko
  INSTALL drivers/media/i2c/soc_camera/adv7280.ko
  INSTALL drivers/media/i2c/soc_camera/ap1302.ko
  INSTALL drivers/media/i2c/soc_camera/ar0261_v4l2.ko
  INSTALL drivers/media/i2c/soc_camera/ar0330_v4l2.ko
  INSTALL drivers/media/i2c/soc_camera/imx135_v4l2.ko
  INSTALL drivers/media/i2c/soc_camera/ov5640.ko
  INSTALL drivers/media/i2c/soc_camera/tc358743.ko
  INSTALL drivers/media/platform/soc_camera/soc_camera_platform.ko
  INSTALL drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko
  INSTALL drivers/media/v4l2-core/videobuf2-dma-contig.ko
  INSTALL drivers/mfd/apalis-tk1-k20.ko
  INSTALL drivers/net/can/apalis-tk1-k20-can.ko
  INSTALL drivers/net/ethernet/intel/e1000e/e1000e.ko
  INSTALL drivers/net/ppp/bsd_comp.ko
  INSTALL drivers/net/ppp/ppp_async.ko
  INSTALL drivers/net/ppp/ppp_deflate.ko
  INSTALL drivers/net/ppp/ppp_generic.ko
  INSTALL drivers/net/ppp/ppp_mppe.ko
  INSTALL drivers/net/ppp/ppp_synctty.ko
  INSTALL drivers/net/ppp/pppolac.ko
  INSTALL drivers/net/ppp/pppopns.ko
  INSTALL drivers/net/ppp/pppox.ko
  INSTALL drivers/net/slip/slhc.ko
  INSTALL drivers/ssb/ssb.ko
  INSTALL drivers/tty/serial/8250/8250_pci.ko
  INSTALL drivers/usb/class/cdc-acm.ko
  INSTALL drivers/usb/class/cdc-wdm.ko
  INSTALL drivers/usb/host/xhci-hcd.ko
  INSTALL drivers/usb/serial/baseband_usb_chr.ko
  INSTALL drivers/usb/serial/option.ko
  INSTALL drivers/usb/serial/usb_wwan.ko
  INSTALL drivers/video/tegra/host/vi/nvhost-vi.ko
  INSTALL fs/nfs/nfs_layout_nfsv41_files.ko
  INSTALL fs/nls/nls_iso8859-15.ko
  INSTALL fs/squashfs/squashfs.ko
  INSTALL lib/xz/xz_dec.ko
  INSTALL net/bluetooth/bluetooth.ko
  INSTALL net/bluetooth/bnep/bnep.ko
  INSTALL net/bluetooth/hidp/hidp.ko
  INSTALL net/bluetooth/rfcomm/rfcomm.ko
  INSTALL net/ipv4/ip_tunnel.ko
  INSTALL net/ipv6/sit.ko
  INSTALL net/mac80211/mac80211.ko
  INSTALL net/wireless/cfg80211.ko
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Warning: File `scripts/Makefile.host' has modification time 6.3e+08 s in the future
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
  DEPMOD  3.10.40-g5abb340-dirty
make: warning:  Clock skew detected.  Your build may be incomplete.

it seems (Clock skew detected. Your build may be incomplete.) is only warning and not important
and everything has been installed successfully in 3.10.40-g5abb340-dirty

root@tegra-ubuntu:/lib/modules# ls
3.10.40-2.8.3+g6c533d3  3.10.40-g5abb340-dirty

root@tegra-ubuntu:/lib/modules# cd 3.10.40-g5abb340-dirty

root@tegra-ubuntu:/lib/modules/3.10.40-g5abb340-dirty# ls
build              modules.builtin      modules.devname  modules.symbols.bin
kernel             modules.builtin.bin  modules.order    source
modules.alias      modules.dep          modules.softdep
modules.alias.bin  modules.dep.bin      modules.symbols

what should i do next for built the driver , according to this error

root@tegra-ubuntu:/home/ubuntu/EMP2_Driver/driver# make
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/ubuntu/EMP2_Driver/driver modules
make: *** /lib/modules/3.10.40-2.8.6+g2c7a3c3af726/build: No such file or directory.  Stop.
make: *** [build] Error 2

thank you

Best Regards

Hi

Perfect that you had success with build. The command make modules install should be run with sudo rights.

Concerning the EMP2 _Driver, where did you get this driver?
It seems that the kernel version for both compilation is not the same.

Best regards,
Jaski

Hi

  1. I used sudo su
  2. I used Emp2 x403 on mini pci express according to following link

https://www.innodisk.com/en/products/embedded-peripheral/communication/EMP2-X403

Best regards

Emp2x403 has following make file

build:
            $(MAKE) -C $(KERNEL_SRC) SUBDIRS=$(PWD) modules
    
    install:
            cp xr17v35x.ko /lib/modules/$(shell uname -r)/kernel/drivers/char
            depmod -a
    
    clean:
            rm -f *~ *.o
            rm -f *~ *.ko
            rm -f modules.order Module.symvers xr17v35x.mod.c xr17v35x.o.ur-safe
            rm -f .xr17v35x.ko.cmd .xr17v35x.mod.o.cmd .xr17v35x.o.cmd .xr17v35x.o.d .cache.mk
            rm -rf .tmp_versions
            rm -f /lib/modules/$(shell uname -r)/kernel/drivers/char/xr17v35x.ko

emp2-x403 driver fileslink text

Hi
Thanks for your Input. I will have look into this and answer you next week.

Best regards,
Jaski

Hi @toradexvision

You need to copy the new compiled kernel (zImage) and devicetree to the boot partition and then compile the driver. One way to do this to use the UMS Feature.

I tried this and it works.

Best regards,
Jaski