public inbox for
 help / color / mirror / Atom feed
From: "" <>
Subject: Specifying Custom Kernel headers
Date: Fri, 20 Dec 2019 15:09:00 -0000	[thread overview]
Message-ID: <15d6-5dfce400-3-23e84100@72070313> (raw)


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.

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)
    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

                 reply	other threads:[~2019-12-20 15:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15d6-5dfce400-3-23e84100@72070313 \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).