Natively compile Linux kernel error on ubuntu14.04 for tk1

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

Hi jaski

Thank you very much for your attention but I don’t understand what to do in UMS feature, would you please help me step by step in simple format

Best Regards

Hi @toradexvision

Ok, actually you need to copy the zImage and the devicetree to the boot partition.

One easy way to do this, which is very handy for just changing the kernel on module is the following:

First you need to copy the compiled kernel to a USB stick or other media of your choice which can be accessed from your host.

For this you need to make a connection between the connector X9 of Ixora and your host and remove the JP2. Then you will bootup the module and stop in U-Boot. Once you are in U-Boot, then you type ums 0 mmc 0. This will mount the boot and RFS Partition of the module in your Host as folders. Once you see these folders, then you should copy the kernel and device-tree to the boot partition.
Once you did this, you have to unmount the folder and stop the UMS connection in U-Boot.
Reboot the module.

Best regards,
Jaski

Hi

Thank you for everything i will check it

Best Regards

You are welcome. Let us know your results.

Hi Jaski

excuse me for lot of my questions

to execute the zImage copy process , after removing JP2 and use a usb connections between ixora(x9) and host pc,do i need to short circuit pins 2 and 3 from JP4 on the Ixora board with a jumper?

and for stoping in U-boot do i need a serial port connection between ixora(x22) and my host PC serial port?

and if the answer is yes what program is better as terminal program (like hyper terminal in windows) in my host UBUNTU to stop in U-boot?

Best Regards

HI

host pc,do i need to short circuit pins 2 and 3 from JP4 on the Ixora board with a jumper?

No, You need to stop in U-Boot and don’t go to recovery mode.

for stoping in U-boot do i need a serial port connection between ixora(x22) and my host PC serial port?

Yes.

what program is better as terminal program (like hyper terminal in windows) in my host UBUNTU to stop in U-boot?

Please have a look here.

Best regards,
Jaski

hi

i get a little bit confused for stoping in U-boot and copy the generated zimage to apalis tk1 …
should i use usb(x9) connection and rs232(x22) connection from tk1 to my host simultaneously?
is it true that to stop in UBoot , i should use x22 ,GTKterm (host side) and rs232 cross cable and to copy zimage from host to tk1 i should use x9 and usb connection?

Best Regards