public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* Specifying Custom Kernel headers
@ 2019-12-20 15:09 pmatos
  0 siblings, 0 replies; only message in thread
From: pmatos @ 2019-12-20 15:09 UTC (permalink / raw)
  To: crossgcc


Hello,

I am running into trouble building a cross-compiler from a sample for rpi3 using armv7l (arm32) with crosstool-ng 1.24.0
It looks straightforward, however doing:

$ ct-ng armv7-rpi2-linux-gnueabihf
$ ct-ng build

generates a toolchain that compiles just fine but then using qemu-arm-static to emulate it causes a 'kernel too old' message.
So, I noticed that my kernel is 4.15.0-66-generic (ubuntu 18.04) and ct-ng uses by default kernel headers from 4.20.  I changes the config to enable backwards compatibility to 4.15.0.
CT_LINUX_V_4_20=y
...
CT_GLIBC_KERNEL_VERSION_CHOSEN=y
CT_GLIBC_MIN_KERNEL_VERSION="4.15.0"
CT_GLIBC_MIN_KERNEL="4.15.0"

Then I rebuild and qemu works but the result is strange.
 cat listdir.c
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>

int main(void)
{
    struct dirent *de;
    DIR *dr = opendir("/");
    errno = 0;
    while ((de = readdir(dr)) != NULL)
            printf("%s\n", de->d_name);
    if (errno == EOVERFLOW)
      perror("");
    closedir(dr);
    return 0;
}

When compiled:
$ armv7-rpi2-linux-gnueabihf-gcc -static -o listdir listdir.c
$ qemu-arm-static -L /home/pmatos/x-tools/armv7-rpi2-linux-gnueabihf/armv7-rpi2-linux-gnueabihf/sysroot/ ./listdir               
Value too large for defined data type

I assume this is still related to kernel headers. Possibly I need to use the kernel headers for my exact kernel version. Is there a way to do this?

If I do:
$ ct-ng armv7-rpi2-linux-gnueabihf
$ ct-ng menuconfig

In Operating System -> Source of linux the only available option is Released tarball.

Am I correct in saying this is due to the kernel headers version difference? Any hints on how to solve this?

Kind regards,

Paulo Matos
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-20 15:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 15:09 Specifying Custom Kernel headers pmatos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).