Cross-compile kernel different glibc - Linux

This is a discussion on Cross-compile kernel different glibc - Linux ; Can I compile the kernel for a different machine which is running a different version of glibc? Will everything always work? Thank you...

+ Reply to Thread
Results 1 to 12 of 12

Thread: Cross-compile kernel different glibc

  1. Cross-compile kernel different glibc

    Can I compile the kernel for a different machine which is running a
    different version of glibc? Will everything always work?

    Thank you

  2. Re: Cross-compile kernel different glibc

    linuxnewbie1234 wrote:
    > Can I compile the kernel for a different machine which is running a
    > different version of glibc? Will everything always work?


    The kernel is not dependent on glibc, rather it is the other way around.
    Kernel compiles are standalone and don't even require glibc in the
    cross toolchain.

    Chris

  3. Re: Cross-compile kernel different glibc

    Chris Friesen wrote:

    > The kernel is not dependent on glibc


    So the drivers do not use the CRT (c-runtime) at all?

    Or the CRT is not part of the glibc but part of the compiler? I am a bit
    confused regarding this.


    > rather it is the other way around.


    The "other way around" also can be a problem: any of the two depending
    on the other one can be a problem, in line of principle. E.g. I don't
    want a system that loads the kernel and then it cannot run (some of) the
    usermode programs.
    Anyway if you tell me that in this case it works, I believe you

  4. Re: Cross-compile kernel different glibc

    linuxnewbie1234 writes:
    > Chris Friesen wrote:
    >> The kernel is not dependent on glibc

    >
    > So the drivers do not use the CRT (c-runtime) at all?


    There is no such thing as a 'c-runtime' named 'CRT' and the kernel is
    a standalone program which is not (and cannot be) linked with any
    external libraries.

    > Or the CRT is not part of the glibc but part of the compiler? I am a
    > bit confused regarding this.
    >
    >
    >> rather it is the other way around.

    >
    > The "other way around" also can be a problem: any of the two depending
    > on the other one can be a problem, in line of principle. E.g. I don't
    > want a system that loads the kernel and then it cannot run (some of)
    > the usermode programs.


    That's theoretically possible, but in practice only if the new kernel
    doesn't include some of the features of the old kernel, which these
    programs happened to use.

  5. Re: Cross-compile kernel different glibc

    Rainer Weikusat wrote:
    > There is no such thing as a 'c-runtime' named 'CRT'


    The people at comp.lang.c might disagree

  6. Re: Cross-compile kernel different glibc

    linuxnewbie1234 writes:
    > Rainer Weikusat wrote:
    >> There is no such thing as a 'c-runtime' named 'CRT'

    >
    > The people at comp.lang.c might disagree


    Unlikely.

  7. Re: Cross-compile kernel different glibc

    In article <87abepv6co.fsf@fever.mssgmbh.com>,
    Rainer Weikusat wrote:

    > linuxnewbie1234 writes:
    > > Chris Friesen wrote:
    > >> The kernel is not dependent on glibc

    > >
    > > So the drivers do not use the CRT (c-runtime) at all?

    >
    > There is no such thing as a 'c-runtime' named 'CRT'


    There is, but not on Linux/Unix. It's the Windows equivalent of glibc.

  8. Re: Cross-compile kernel different glibc

    "Wayne C. Morris" writes:
    > In article <87abepv6co.fsf@fever.mssgmbh.com>,
    > Rainer Weikusat wrote:
    >> linuxnewbie1234 writes:
    >> > Chris Friesen wrote:
    >> >> The kernel is not dependent on glibc
    >> >
    >> > So the drivers do not use the CRT (c-runtime) at all?

    >>
    >> There is no such thing as a 'c-runtime' named 'CRT'

    >
    > There is, but not on Linux/Unix. It's the Windows equivalent of
    > glibc.


    Presumably, something named 'CRT' exists in some place the OP happens
    to be more familiar with and the assumption that this refers to 'some
    random Windows-DLL' isn't exactly a far fetched one.


  9. Re: Cross-compile kernel different glibc

    On Wed, 03 Sep 2008 14:46:55 +0200 linuxnewbie1234 wrote:

    | Rainer Weikusat wrote:
    |> There is no such thing as a 'c-runtime' named 'CRT'
    |
    | The people at comp.lang.c might disagree

    The kernel is the foundation upon which other programming environments are
    based. Just because it is mostly coded in C does NOT mean that the kernel
    uses the same programming environment that typical C programs use.

    There are 2 general categories of programs you might write in C. The better
    known category is called "hosted". These are programs that generally use a
    library, which is generally the standard C library, plus any additional ones
    that might be useful (for example GUI libraries). The other category is
    called "stand alone". In this category, no operating system, and few if any
    libraries are used. It is what early embedded firmware would be written in.
    But it is also how an operating system kernel, itself, would be done in.

    So the kernel is on the bottom. The libraries are stacked on top of the
    kernel, and thus have to interface with the kernel in the way that kernel
    works (not necessarily POSIX, but usually similar to it for Unix systems).
    Then hosted applications go on top of that (usually with additional libraries
    these days).

    --
    |WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance |
    | by the abuse department, bellsouth.net is blocked. If you post to |
    | Usenet from these places, find another Usenet provider ASAP. |
    | Phil Howard KA9WGN (email for humans: first name in lower case at ipal.net) |

  10. Re: Cross-compile kernel different glibc

    phil-news-nospam@ipal.net wrote:
    > The other category is
    > called "stand alone". In this category, no operating system, and few if any
    > libraries are used.


    Thanks for your clear explanation.
    So in gcc if I want to compile something "stand alone", what is the
    compile flag? ("same as when compiling the kernel" you will say, but I
    can't easily see it because I just type "make")
    Also I suppose the main() function is replaced with something at a fixed
    memory address... is there an option for putting a function at a fixed
    memory address in GCC? It is not obvious to me from reading the manpage.

    Thank you

  11. Re: Cross-compile kernel different glibc

    linuxnewbie1234 writes:
    > phil-news-nospam@ipal.net wrote:
    >> The other category is
    >> called "stand alone". In this category, no operating system, and few if any
    >> libraries are used.

    >
    > Thanks for your clear explanation.


    Actually, these two categories come from the C-standard and refer to
    C-implementations. A 'conforming hosted implementation' shall provide
    all library facilities defined in the standard, while a 'conforming
    freestanding implementation' basically only provides the type
    definitions which are supposed to be part of the standard C library.
    'gcc on Linux' is, of course, a [maybe] conforming hosted
    implementation.

    > So in gcc if I want to compile something "stand alone", what is the
    > compile flag?


    The compiler knows nothing about this. The last step of creating an
    executable binary is invocation of the link editor which is supposed
    to combine all the object files making up a program and 'some set of
    libaries'. The compiler driver will usually add 'startup files' and
    'standard system libraries' when invoking the linker on behalf of a
    user. This can be inhibited by using the -nostdlib switch when linking
    via gcc.

    > Also I suppose the main() function is replaced with something at a
    > fixed memory address... is there an option for putting a function at a
    > fixed memory address in GCC?


    This could be accomplished by using a custom linker script.

  12. Re: Cross-compile kernel different glibc

    On Sep 5, 4:59*am, linuxnewbie1234
    wrote:

    > Thanks for your clear explanation.
    > So in gcc if I want to compile something "stand alone", what is the
    > compile flag?


    Nothing special is needed. Just don't include any standard library
    header files or invoke the linker.

    > ("same as when compiling the kernel" you will say, but I
    > can't easily see it because I just type "make")
    > Also I suppose the main() function is replaced with something at a fixed
    > memory address... is there an option for putting a function at a fixed
    > memory address in GCC? It is not obvious to me from reading the manpage.


    The 'main' function is not placed at a fixed memory address on any
    modern system I know of. Instead, the 'main' function is called by the
    C run-time.

    There are two things you might want to do. One would be to create a
    program that does not use the C runtime but still runs as a normal
    user-level process. The other would be to create a program that runs
    as something other than a user-level process. For the former, you need
    to replicate the startup functions of the C runtime. For the latter,
    you need to link specially to create the format your loader requires.

    DS

+ Reply to Thread