Hi Sam
enclosed is the 'k_smf.patch' which modifies three files to enable the
kernel 2.6.21.3 to be built under cygwin:
host: cygwin 1.5.24, hostcc= gcc 3.4.4
cross: arm-linux-uclibcgnueabi-gcc (GCC) 4.1.2
cmd: make ARCH=arm CROSS_COMPILE=arm-linux- \
HOST_LOADLIBES="-lcurses -lintl" at91rm9200dk_defconfig
I verified that this does not break building on a linux-host on this config:
host: FC5, gcc 4.1.1-1
cross: arm-none-linux-gnueabi-gcc 4.1.1
cmd: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Let me know if I can help any further.
Tom
k_smf.patch:
------------
diff -Naur -r o21.1/scripts/mod/file2alias.c
2.6.21.1/scripts/mod/file2alias.c
--- o21.1/scripts/mod/file2alias.c 2007-04-27 14:49:26.000000000
-0700
+++ 2.6.21.1/scripts/mod/file2alias.c 2007-05-29 20:35:01.209115300
-0700
@@ -29,7 +29,11 @@
#include <ctype.h>
+#ifdef __CYGWIN__
+typedef __uint32_t __u32;
+#else
typedef uint32_t __u32;
+#endif
typedef uint16_t __u16;
typedef unsigned char __u8;
diff -Naur -r o21.1/scripts/mod/modpost.h 2.6.21.1/scripts/mod/modpost.h
--- o21.1/scripts/mod/modpost.h 2007-04-27 14:49:26.000000000 -0700
+++ 2.6.21.1/scripts/mod/modpost.h 2007-05-29 20:35:01.599732800
-0700
@@ -9,6 +9,11 @@
#include <unistd.h>
#include <elf.h>
+#ifdef __CYGWIN__
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+#endif
+
#include "elfconfig.h"
#if KERNEL_ELFCLASS == ELFCLASS32
diff -Naur -r o21.1/scripts/mod/sumversion.c
2.6.21.1/scripts/mod/sumversion.c
--- o21.1/scripts/mod/sumversion.c 2007-04-27 14:49:26.000000000
-0700
+++ 2.6.21.1/scripts/mod/sumversion.c 2007-05-29 20:35:01.677856300
-0700
@@ -7,6 +7,7 @@
#include <ctype.h>
#include <errno.h>
#include <string.h>
+#include <limits.h>
#include "modpost.h"
/*
linux host error (old gcc!):
----------------------------
CC mm/bootmem.o
CC mm/filemap.o
CC mm/mempool.o
CC mm/oom_kill.o
CC mm/fadvise.o
CC mm/page_alloc.o
mm/page_alloc.c:684: warning: `setup_nr_node_ids' defined but not used
/tmp/ccj7iwRd.s: Assembler messages:
/tmp/ccj7iwRd.s:3089: Error: .err encountered
make[1]: *** [mm/page_alloc.o] Error 1
make: *** [mm] Error 2
arm-linux-gcc (GCC) 3.3.2 20030820 (prerelease)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
On Mon, Jun 04, 2007 at 11:45:29AM -0700, Tom wrote:
> Hi Sam
>
>
> enclosed is the 'k_smf.patch' which modifies three files to enable the
> kernel 2.6.21.3 to be built under cygwin:
> host: cygwin 1.5.24, hostcc= gcc 3.4.4
> cross: arm-linux-uclibcgnueabi-gcc (GCC) 4.1.2
> cmd: make ARCH=arm CROSS_COMPILE=arm-linux- \
> HOST_LOADLIBES="-lcurses -lintl" at91rm9200dk_defconfig
>
> I verified that this does not break building on a linux-host on this config:
> host: FC5, gcc 4.1.1-1
> cross: arm-none-linux-gnueabi-gcc 4.1.1
> cmd: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
>
>
> Let me know if I can help any further.
Hi Tom.
Patch looks good. The last bit touching sumversion.c is not
needed in latest kernel - we already include limits.h.
I need you to sign off the patch as per instruction in
Documentation/SubmittingPatch.
Please do so and send me a new mail containing both
changlog entry (the introduction part of your mail) and
the patch itself.
Sam
Hi,
Sam Ravnborg a ?crit :
> On Mon, Jun 04, 2007 at 11:45:29AM -0700, Tom wrote:
>> Hi Sam
>>
>>
>> enclosed is the 'k_smf.patch' which modifies three files to enable the
>> kernel 2.6.21.3 to be built under cygwin:
>> host: cygwin 1.5.24, hostcc= gcc 3.4.4
>> cross: arm-linux-uclibcgnueabi-gcc (GCC) 4.1.2
>> cmd: make ARCH=arm CROSS_COMPILE=arm-linux- \
>> HOST_LOADLIBES="-lcurses -lintl" at91rm9200dk_defconfig
>>
>> I verified that this does not break building on a linux-host on this config:
>> host: FC5, gcc 4.1.1-1
>> cross: arm-none-linux-gnueabi-gcc 4.1.1
>> cmd: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
>>
>>
>> Let me know if I can help any further.
> Hi Tom.
>
> Patch looks good. The last bit touching sumversion.c is not
> needed in latest kernel - we already include limits.h.
>
What about something like that for ncurses stuff ?
Matthieu
From: Tom Enderes <[email protected]>
The kernel build failed on cygwin hosts, because cygwin has slightly
different typedefs compared to linux:
scripts/mod/file2alias.c:518: error: dereferencing pointer to incomplete
type
Two files, scripts/mod/file2alias.c and scripts/mod/modpost.h, were
modified as follows:
Whever __CYGWIN__ is defined, __uint32 is defined as __uint32_t (instead
of uint_32_t) and the missing ElfxxSection definitions are added.
These changes have been tested both on cygwin 1.5.24, hostcc=gcc 3.4.4
and on FC5, hostcc=gcc 4.1.1-1. Any tests on cygwin, with and without
this change, were executed with the following set for make:
HOST_LOADLIBES="-lcurses -lintl".
Signed-off-by: Tom Enderes <[email protected]>
diff -Naur -r o21.1/scripts/mod/file2alias.c
2.6.21.1/scripts/mod/file2alias.c
--- o21.1/scripts/mod/file2alias.c 2007-04-27 14:49:26.000000000 -0700
+++ 2.6.21.1/scripts/mod/file2alias.c 2007-05-29 20:35:01.209115300
-0700
@@ -29,7 +29,11 @@
#include <ctype.h>
+#ifdef __CYGWIN__
+typedef __uint32_t __u32;
+#else
typedef uint32_t __u32;
+#endif
typedef uint16_t __u16;
typedef unsigned char __u8;
diff -Naur -r o21.1/scripts/mod/modpost.h 2.6.21.1/scripts/mod/modpost.h
--- o21.1/scripts/mod/modpost.h 2007-04-27 14:49:26.000000000 -0700
+++ 2.6.21.1/scripts/mod/modpost.h 2007-05-29 20:35:01.599732800
-0700
@@ -9,6 +9,11 @@
#include <unistd.h>
#include <elf.h>
+#ifdef __CYGWIN__
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+#endif
+
#include "elfconfig.h"
#if KERNEL_ELFCLASS == ELFCLASS32
On Fri, Jun 08, 2007 at 11:32:29AM -0700, Tom wrote:
> From: Tom Enderes <[email protected]>
>
> The kernel build failed on cygwin hosts, because cygwin has slightly
> different typedefs compared to linux:
> scripts/mod/file2alias.c:518: error: dereferencing pointer to incomplete
> type
> Two files, scripts/mod/file2alias.c and scripts/mod/modpost.h, were
> modified as follows:
> Whever __CYGWIN__ is defined, __uint32 is defined as __uint32_t (instead
> of uint_32_t) and the missing ElfxxSection definitions are added.
> These changes have been tested both on cygwin 1.5.24, hostcc=gcc 3.4.4
> and on FC5, hostcc=gcc 4.1.1-1. Any tests on cygwin, with and without
> this change, were executed with the following set for make:
> HOST_LOADLIBES="-lcurses -lintl".
>
> Signed-off-by: Tom Enderes <[email protected]>
>
>
> diff -Naur -r o21.1/scripts/mod/file2alias.c
> 2.6.21.1/scripts/mod/file2alias.c
> --- o21.1/scripts/mod/file2alias.c 2007-04-27 14:49:26.000000000 -0700
> +++ 2.6.21.1/scripts/mod/file2alias.c 2007-05-29 20:35:01.209115300
> -0700
> @@ -29,7 +29,11 @@
>
> #include <ctype.h>
>
> +#ifdef __CYGWIN__
> +typedef __uint32_t __u32;
> +#else
> typedef uint32_t __u32;
> +#endif
> typedef uint16_t __u16;
> typedef unsigned char __u8;
This change is wrong.
Somehow __uint32_t_defined gets defined and cygwin fails to define
uint32_t.
So we have hit a bug in cygwin here.
Browsing the code I think that including inttypes.h much sooner will fix it.
In file2alias.c I moved include of inttypes.h up.
> diff -Naur -r o21.1/scripts/mod/modpost.h 2.6.21.1/scripts/mod/modpost.h
> --- o21.1/scripts/mod/modpost.h 2007-04-27 14:49:26.000000000 -0700
> +++ 2.6.21.1/scripts/mod/modpost.h 2007-05-29 20:35:01.599732800
> -0700
> @@ -9,6 +9,11 @@
> #include <unistd.h>
> #include <elf.h>
>
> +#ifdef __CYGWIN__
> +typedef uint16_t Elf32_Section;
> +typedef uint16_t Elf64_Section;
> +#endif
I did this in an alternative way.
Replacing use of Elf32_section with Elf32_Half did the trick.
Same for the 64 bit type.
Let me know if this works on Cygwin.
I have tested with a few architectures on Linux with success.
(Needs to look into the lib part next).
Thanks for keeping attention on this.
Sam
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f646381..5e017a9 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -10,6 +10,14 @@
* of the GNU General Public License, incorporated herein by reference.
*/
+#ifdef __sun__
+#include <inttypes.h>
+#else
+#include <stdint.h>
+#endif
+
+#include <ctype.h>
+
#include "modpost.h"
/* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
@@ -21,13 +29,6 @@ typedef Elf32_Addr kernel_ulong_t;
typedef Elf64_Addr kernel_ulong_t;
#define BITS_PER_LONG 64
#endif
-#ifdef __sun__
-#include <inttypes.h>
-#else
-#include <stdint.h>
-#endif
-
-#include <ctype.h>
typedef uint32_t __u32;
typedef uint16_t __u16;
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 4156dd3..0ffed17 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -17,7 +17,7 @@
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Addr Elf32_Addr
-#define Elf_Section Elf32_Section
+#define Elf_Section Elf32_Half
#define ELF_ST_BIND ELF32_ST_BIND
#define ELF_ST_TYPE ELF32_ST_TYPE
@@ -31,7 +31,7 @@
#define Elf_Shdr Elf64_Shdr
#define Elf_Sym Elf64_Sym
#define Elf_Addr Elf64_Addr
-#define Elf_Section Elf64_Section
+#define Elf_Section Elf64_Half
#define ELF_ST_BIND ELF64_ST_BIND
#define ELF_ST_TYPE ELF64_ST_TYPE
Hi Matthieu.
Can you please try to tell what your patch actually does.
As for the part added in the MAkefile you pass -lintl for Cygwin -
but I fail to see _why_ -lintl is needed.
The patch to check-lxdialog.sh is outdated.
Could I ask you to redo it againt latest version and again explains
the _why_ part. The how part is obvious from the diff...
Do not get me worg. I would love to have Cygwin supported but I want
it in the cleanest possible way.
Sam
Sam Ravnborg wrote:
> On Fri, Jun 08, 2007 at 11:32:29AM -0700, Tom wrote:
>> From: Tom Enderes <[email protected]>
>>
>> The kernel build failed on cygwin hosts, because cygwin has slightly
>> different typedefs compared to linux:
>> scripts/mod/file2alias.c:518: error: dereferencing pointer to incomplete
>> type
>> Two files, scripts/mod/file2alias.c and scripts/mod/modpost.h, were
>> modified as follows:
>> Whever __CYGWIN__ is defined, __uint32 is defined as __uint32_t (instead
>> of uint_32_t) and the missing ElfxxSection definitions are added.
>> These changes have been tested both on cygwin 1.5.24, hostcc=gcc 3.4.4
>> and on FC5, hostcc=gcc 4.1.1-1. Any tests on cygwin, with and without
>> this change, were executed with the following set for make:
>> HOST_LOADLIBES="-lcurses -lintl".
>>
>> Signed-off-by: Tom Enderes <[email protected]>
>>
>>
>> diff -Naur -r o21.1/scripts/mod/file2alias.c
>> 2.6.21.1/scripts/mod/file2alias.c
>> --- o21.1/scripts/mod/file2alias.c 2007-04-27 14:49:26.000000000 -0700
>> +++ 2.6.21.1/scripts/mod/file2alias.c 2007-05-29 20:35:01.209115300
>> -0700
>> @@ -29,7 +29,11 @@
>>
>> #include <ctype.h>
>>
>> +#ifdef __CYGWIN__
>> +typedef __uint32_t __u32;
>> +#else
>> typedef uint32_t __u32;
>> +#endif
>> typedef uint16_t __u16;
>> typedef unsigned char __u8;
> This change is wrong.
> Somehow __uint32_t_defined gets defined and cygwin fails to define
> uint32_t.
>
> So we have hit a bug in cygwin here.
>
> Browsing the code I think that including inttypes.h much sooner will fix it.
> In file2alias.c I moved include of inttypes.h up.
>
>
>> diff -Naur -r o21.1/scripts/mod/modpost.h 2.6.21.1/scripts/mod/modpost.h
>> --- o21.1/scripts/mod/modpost.h 2007-04-27 14:49:26.000000000 -0700
>> +++ 2.6.21.1/scripts/mod/modpost.h 2007-05-29 20:35:01.599732800
>> -0700
>> @@ -9,6 +9,11 @@
>> #include <unistd.h>
>> #include <elf.h>
>>
>> +#ifdef __CYGWIN__
>> +typedef uint16_t Elf32_Section;
>> +typedef uint16_t Elf64_Section;
>> +#endif
>
> I did this in an alternative way.
> Replacing use of Elf32_section with Elf32_Half did the trick.
> Same for the 64 bit type.
>
>
> Let me know if this works on Cygwin.
This is what I got on cygwin:
In file included from scripts/mod/../../include/linux/input.h:19,
from scripts/mod/file2alias.c:41:
/usr/include/asm/types.h:21: error: conflicting types for '__u32'
scripts/mod/file2alias.c:33: error: previous declaration of '__u32' was here
scripts/mod/file2alias.c: In function `do_ieee1394_entry':
scripts/mod/file2alias.c:193: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:195: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:197: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:199: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c: In function `do_pci_entry':
scripts/mod/file2alias.c:221: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:222: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:223: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c:224: warning: unsigned int format, __u32 arg
(arg 3)
scripts/mod/file2alias.c: In function `do_pcmcia_entry':
scripts/mod/file2alias.c:346: warning: unsigned int format, long
unsigned int ar
g (arg 3)
scripts/mod/file2alias.c:347: warning: unsigned int format, long
unsigned int ar
g (arg 3)
scripts/mod/file2alias.c:348: warning: unsigned int format, long
unsigned int ar
g (arg 3)
scripts/mod/file2alias.c:349: warning: unsigned int format, long
unsigned int ar
g (arg 3)
scripts/mod/file2alias.c: In function `do_parisc_entry':
scripts/mod/file2alias.c:469: warning: unsigned int format, __u32 arg
(arg 3)
make[2]: *** [scripts/mod/file2alias.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
> I have tested with a few architectures on Linux with success.
>
> (Needs to look into the lib part next).
>
> Thanks for keeping attention on this.
>
> Sam
>
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index f646381..5e017a9 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -10,6 +10,14 @@
> * of the GNU General Public License, incorporated herein by reference.
> */
>
> +#ifdef __sun__
> +#include <inttypes.h>
> +#else
> +#include <stdint.h>
> +#endif
> +
> +#include <ctype.h>
> +
> #include "modpost.h"
>
> /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
> @@ -21,13 +29,6 @@ typedef Elf32_Addr kernel_ulong_t;
> typedef Elf64_Addr kernel_ulong_t;
> #define BITS_PER_LONG 64
> #endif
> -#ifdef __sun__
> -#include <inttypes.h>
> -#else
> -#include <stdint.h>
> -#endif
> -
> -#include <ctype.h>
>
> typedef uint32_t __u32;
> typedef uint16_t __u16;
> diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
> index 4156dd3..0ffed17 100644
> --- a/scripts/mod/modpost.h
> +++ b/scripts/mod/modpost.h
> @@ -17,7 +17,7 @@
> #define Elf_Shdr Elf32_Shdr
> #define Elf_Sym Elf32_Sym
> #define Elf_Addr Elf32_Addr
> -#define Elf_Section Elf32_Section
> +#define Elf_Section Elf32_Half
> #define ELF_ST_BIND ELF32_ST_BIND
> #define ELF_ST_TYPE ELF32_ST_TYPE
>
> @@ -31,7 +31,7 @@
> #define Elf_Shdr Elf64_Shdr
> #define Elf_Sym Elf64_Sym
> #define Elf_Addr Elf64_Addr
> -#define Elf_Section Elf64_Section
> +#define Elf_Section Elf64_Half
> #define ELF_ST_BIND ELF64_ST_BIND
> #define ELF_ST_TYPE ELF64_ST_TYPE
>
>
On Jun 9 2007 00:10, Sam Ravnborg wrote:
>Hi Matthieu.
>
>Can you please try to tell what your patch actually does.
>
>As for the part added in the MAkefile you pass -lintl for Cygwin -
>but I fail to see _why_ -lintl is needed.
It is because I think .DLLs do not have something like ELF's DT_NEEDED,
hence needing to specify all libs you ever need explicitly. Quite ugly.
Jan
--
Hi Sam,
Sam Ravnborg wrote:
> Hi Matthieu.
>
> Can you please try to tell what your patch actually does.
>
> As for the part added in the MAkefile you pass -lintl for Cygwin -
> but I fail to see _why_ -lintl is needed.
If I don't do it, I got [1] or [2].
Matthieu
[1]
scripts/kconfig/conf.o:conf.c:(.text+0x91): undefined reference to
`_libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0xa5): undefined reference to
`_libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0xb9): undefined reference to
`_libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x7b8): undefined reference to
`_libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0xf19): undefined reference to
`_libintl_gettext'
scripts/kconfig/conf.o:conf.c:(.text+0x1026): more undefined references
to `_libintl_gettext' follow
collect2: ld returned 1 exit status
[2]
scripts/kconfig/mconf.o:mconf.c:(.text+0x923): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0x9c9): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0xa66): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0xa91): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0xab1): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0xadd): more undefined references
to `_libintl_gettext' follow
scripts/kconfig/mconf.o:mconf.c:(.text+0x11af): undefined reference to
`_libintl_bindtextdomain'
scripts/kconfig/mconf.o:mconf.c:(.text+0x11bb): undefined reference to
`_libintl_textdomain'
scripts/kconfig/mconf.o:mconf.c:(.text+0x1207): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0x1414): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0x1467): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0x1482): undefined reference to
`_libintl_gettext'
scripts/kconfig/mconf.o:mconf.c:(.text+0x14af): undefined reference to
`_libintl_gettext'
scripts/kconfig/zconf.tab.o:zconf.tab.c:(.text+0x54e6): more undefined
references to `_libintl_gettext' follow
Info: resolving _stdscr by linking to __imp__stdscr (auto-import)
Info: resolving _COLS by linking to __imp__COLS (auto-import)
Info: resolving _LINES by linking to __imp__LINES (auto-import)
collect2: ld returned 1 exit status
On Fri, Jun 08, 2007 at 11:32:29AM -0700, Tom wrote:
> From: Tom Enderes <[email protected]>
>
> The kernel build failed on cygwin hosts, because cygwin has slightly
> different typedefs compared to linux:
> scripts/mod/file2alias.c:518: error: dereferencing pointer to incomplete
> type
> Two files, scripts/mod/file2alias.c and scripts/mod/modpost.h, were
> modified as follows:
> Whever __CYGWIN__ is defined, __uint32 is defined as __uint32_t (instead
> of uint_32_t) and the missing ElfxxSection definitions are added.
> These changes have been tested both on cygwin 1.5.24, hostcc=gcc 3.4.4
> and on FC5, hostcc=gcc 4.1.1-1. Any tests on cygwin, with and without
> this change, were executed with the following set for make:
> HOST_LOADLIBES="-lcurses -lintl".
Hi Tom.
I have revisited this and have made a successfull kernel build on a
windows/cygwin box now.
I had to change two things only:
1) The -lintl workaround was fixed by introducing a little script.
If gcc cannot link a program that sues gettext then NLS is disabled.
2) Elf32_Section and Elf64_Section was replaced by Elfnn_Half
The build succeeds with a number of warnings that I just ignored.
fixdep and friends always get rebuild because kbuild does
not know about the .exe suffix so it does not
see that the binaries exists.
This is annoying and I hope to fix it before the merge.
These change will hit mainline during next merge window
so it will take a while before you can benefit.
For now they are in the kbuild.git tree at git.kernel.org
and will soon be part of -mm.
Sam