LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Kernel sources for ARM (https://www.linuxquestions.org/questions/linux-kernel-70/kernel-sources-for-arm-4175559890/)

anglsix 11-25-2015 03:29 PM

Kernel sources for ARM
 
I've built the kernel 4.3 from source on an x86 Ubuntu machine using the arm-linux-gnueabi cross compile tools.

I've installed the modules, headers, and copied the kernel source folder (the one used to make these files) to the targets /usr/src folder, and the /lib/modules/4.3.0/build and source links point to /usr/src/linux4.3 folder.

I need to build a wifi driver for the ARM target board, so I am building it on that board.

When I run the make command on the target board, I just get:

arch/armv7l/Makefile: No such file or directory

Thats because there isn't one. The Arch should be just arm not armv7l. So if I do:

make ARCH=arm I then get:

scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: end of file unexpected (expecting ")")


How do I get a usable kernel headers + source on the ARM target board so I can build kernel module drivers?

anglsix 11-25-2015 03:38 PM

I also found a post that states I need to:

cd /usr/src/4.3.0
make modules_prepare

However that gives:

fatal error: sys/types.h: No such file or directory.

The compilation of the headers on the x86 machine with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- headers_install INSTALL_HDR_PATH=../output

Doesn't generate any sys folder in the include folder, so not sure what to do for that.


UPDATE
Ok so I've installed build-essentials and bc then run modules_prepare which then succeeded.

After that I could compile. So I think thats all I was missing. I found it very difficult to find any information about copying kernel sources to /usr/src and running modules_prepare etc...

blue_z 11-25-2015 03:57 PM

If you really want to, you can natively compile on your target board or cross-compile the kernel on a host.
A long time ago I was cross-compiling the kernel and building the rootfs with scripts.
But nowadays I make my life simple by using Buildroot to build a toolchain, the Linux kernel, Busybox and other applications and wrapped up into a rootfs, and boot programs.
Buildroot does add another layer of makefiles, so it can get a little confusing, but it can eliminate a lot of little problems like what you're encountering.
There are other build tools (such as Yocto), but they typically require more effort to use.

E.G. See this for building Kodi on a Wandboard i.MX6Q using Buildroot


Regards

anglsix 11-25-2015 04:03 PM

Thanks. Yes my first plan was to use buildroot, however this is a dual-purpose. It's a huge learning curve and education for me so I wanted to build everything from ground up to learn these things.

Looks like I've fixed that issue now however I think I need another kernel recompile as I now get an error of Unknown symbol wireless_send_event, which I think just needs CONFIG_WIRELESS_EXT enabled in the kernel so I'll move onto that next.

blue_z 11-25-2015 08:56 PM

Quote:

Originally Posted by anglsix (Post 5455346)
It's a huge learning curve and education for me so I wanted to build everything from ground up to learn these things.

Then you've skipped a step/lesson. You haven't built the toolchain (e.g. gcc, binutils. uClibc) from source.
I've done it, but now use crosstool-NG.

Regarsd


All times are GMT -5. The time now is 08:12 AM.