0

However I Cross Compiled ARM Kernel instead of ARMHF(for my Cubietruck). I followed this tutorial: https://romanrm.net/a10/cross-compile-kernel

How can I determine for which architecture I´m cross-compiling?

csnewb
  • 1,190
  • 2
  • 19
  • 37
  • 1
    See https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel . –  Mar 11 '14 at 07:35
  • 1
    if u are looking for headers follow this http://stackoverflow.com/questions/21813667/are-kernel-headers-depend-on-processor-type-vendor-etc/21815412#21815412 and http://stackoverflow.com/questions/21740619/how-can-i-generate-kernel-headers-for-an-unknown-embedded-arm-system/21770830#21770830 – vinay hunachyal Mar 11 '14 at 09:48
  • @vinayhunachyal i installed it, how can i make sure it worked? i wanted to install a driver from a program and wanted to "make clean" it didn´t found the header-file version.h – csnewb Mar 11 '14 at 11:35
  • 1
    Can you please elaborate your query what actually you are trying to do Add some more details to understand it. – vinay hunachyal Mar 11 '14 at 12:16
  • @vinayhunachyal actually i wanted to install PCAN (Peak) on my Cubietruck with a ARMHF. I wanted to install the driver of this PCAN, so i typed the command "make clean" at first. I got an error that the version.h couldn´t be found. I figured out that the kernel headers are missing, so first I tried to cross-compile it. Didn´t work, so you gave me the advice to copy the header-files directly to my path without compiling anything. After doing your advice, the version.h is found, noew i got a new error that /linux/utsrealease.h is not found – csnewb Mar 11 '14 at 12:37

2 Answers2

2

i got a new error that /linux/utsrealease.h is not found

from above comment as you mentioned.. from that its clear that kernel module which your building must match with running kernel version . As kernel modules loading mechanism doesn't allow loading modules that were not compiled against the running kernel, due to mismatch error is coming.

The macro UTS_RELEASE is required by your driver in order to rebuild kernel modules from source.

retrieving the version string constant,

older versions require you to include<linux/version.h>,

others <linux/utsrelease.h>,

and newer ones <generated/utsrelease.h>

So my suggestion you do workaround by doing

you can find utsrelease.h in kernel source code make sure your running kernel must match with your source-code

copy linux-x.x.x/include/generated/utsrelease.h to installed header i.e ../include/linux/utsrelease.h

Im not sure give a try .

If above doesnot work pls update your question with 1)which kernel sourcode version you have 2)Whats the kernel version running on target

vinay hunachyal
  • 3,781
  • 2
  • 20
  • 31
  • Dunno how to figure out the kernel sourcecode version and the kernel version running on target. there is an information about something, that is not right: "Host machine kernel version=3.4.79" "Driver kernel version=3.4.61" – csnewb Mar 12 '14 at 07:42
  • this might help u http://stackoverflow.com/questions/22280598/error-while-compiling-linux-kernel-for-arm/22280859#22280859 and http://stackoverflow.com/questions/20763344/just-black-screen-after-running-qemu/20779114#20779114 – vinay hunachyal Mar 12 '14 at 08:23
  • trying to use my config included in the include/config path with "make ARCH=arm myconfig_config". getting an error with: "make[1]: *** No rule to make target 'myconfig_config'. Stop." "make: *** [myconfig_config] Error 2" – csnewb Mar 12 '14 at 09:20
  • what is myconfig_config where you got it? – vinay hunachyal Mar 12 '14 at 09:41
  • config of my system /proc/config.gz .edided the name to myconfig_config – csnewb Mar 12 '14 at 09:45
  • cp your myconfig_config to ../arch/arm/configs then make ARCH=arm myconfig_config . or else copy myconfig_config to .config in toplevel src-code – vinay hunachyal Mar 12 '14 at 09:48
  • also have look @ this http://stackoverflow.com/questions/21266404/cross-compiling-linux-arm-kernel-with-new-driver-module/21279185#21279185 – vinay hunachyal Mar 12 '14 at 09:50
  • 1
    sorry here i cant do it some restriction are there for chat it wont connect – vinay hunachyal Mar 12 '14 at 09:57
  • oh okay. allready moved my config to that path with the two methods u mentioned. got an error written 2 commands before – csnewb Mar 12 '14 at 09:59
  • i think you are not doing correctly. pls clean your source code and copy `myconfig_config` to `.config` then do `make ARCH=arm menuconfig` – vinay hunachyal Mar 12 '14 at 10:03
  • Tried an other kernel-source. now it worked. what the next step? Got a Kernel Configuration Menu. – csnewb Mar 12 '14 at 10:44
1

When you compile your kernel, mention the architecture you are compiling for in:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- EXTRAVERSION=-custom1 uImage

For eg, here ARCH=arm, so you are compiling for ARM, if it's x86, then you'll replace it with x86. Check what architecture your target board is on.

EDIT: gnueabihf is for armhf.

brokenfoot
  • 11,083
  • 10
  • 59
  • 80
  • actually i just need the headers. so i have to do in line: "fakeroot make-kpkg --arch armhf --cross-compile arm-linux-gnueabihf- --initrd --append-to-version=-custom1 kernel_image kernel_headers" instead of ".. --arch arm ..."? – csnewb Mar 11 '14 at 07:43
  • 1
    You looking for kernel headers? Check your linux source. – brokenfoot Mar 11 '14 at 07:47
  • I allready compiled kernel headers, but it was for arm not for armhf. – csnewb Mar 11 '14 at 08:08