On Fri, Oct 7, 2011 at 6:26 PM, Arnd Bergmann <email address hidden> wrote:
> On Thursday 06 October 2011, Dave Martin wrote:
>> Can someone give this a try?
>>
>> For now, I've only attempted to touch headers that look like
>> they are expoerted to userspace.
>
> I've looked at the patch and found small typos:
>
> -#if defined(__linux__)
> +#if define (__linux_kernel__) || defined(__linux__)
> ^^^^^^
>
> -#ifndef __KERNEL__
> +#ifndef __liunx_kernel__
> ^^^^^
Good spots, thanks -- those patches were put together pretty hastily,
I'm afraid.
> More importantly, it's not at all clear from the description why you are
> even doing this. If the android toolchain does not set __linux__, this
> sounds more like a bug in the android toolchain. I would expect much
> more stuff to break because of that.
My view is that __linux__ means "being built with a toolchain which
targets a linux-hosted userspace environment". This macro has no
meaningful interpretation when building the kernel, but it is
meaningful when building build-time tools etc.
This has nothing whatever to do with the runtime environment inside
the kernel -- the kernel _itself_ determines that, which is why (in my
view) this should be indicated by a separate define in the kernel
Makefile.
There's no reason in general why the Linux kernel shouldn't be built
with a BSD-targeted or bare-metal compiler. There's may also be no
reason why the BSD kernel shouldn't be built with a Linux-targeted
compiler -- however, I'm not familiar with the BSD build process, so
that may not make so much sense.
On Fri, Oct 7, 2011 at 6:26 PM, Arnd Bergmann <email address hidden> wrote:
> On Thursday 06 October 2011, Dave Martin wrote:
>> Can someone give this a try?
>>
>> For now, I've only attempted to touch headers that look like
>> they are expoerted to userspace.
>
> I've looked at the patch and found small typos:
>
> -#if defined(__linux__)
> +#if define (__linux_kernel__) || defined(__linux__)
> ^^^^^^
>
> -#ifndef __KERNEL__
> +#ifndef __liunx_kernel__
> ^^^^^
Good spots, thanks -- those patches were put together pretty hastily,
I'm afraid.
> More importantly, it's not at all clear from the description why you are
> even doing this. If the android toolchain does not set __linux__, this
> sounds more like a bug in the android toolchain. I would expect much
> more stuff to break because of that.
My view is that __linux__ means "being built with a toolchain which
targets a linux-hosted userspace environment". This macro has no
meaningful interpretation when building the kernel, but it is
meaningful when building build-time tools etc.
This has nothing whatever to do with the runtime environment inside
the kernel -- the kernel _itself_ determines that, which is why (in my
view) this should be indicated by a separate define in the kernel
Makefile.
There's no reason in general why the Linux kernel shouldn't be built
with a BSD-targeted or bare-metal compiler. There's may also be no
reason why the BSD kernel shouldn't be built with a Linux-targeted
compiler -- however, I'm not familiar with the BSD build process, so
that may not make so much sense.
Cheers
---Dave