proposed patch for cross compiling from Solaris 2.8

8 messages, 3 authors, 2004-07-09 · open the first message on its own page

proposed patch for cross compiling from Solaris 2.8

From: Jean-Christophe Dubois <hidden>
Date: 2004-07-06 09:20:51

Hi,

I got into several issues while trying to cross-compile a Linux 2.6 PPC
kernel from a Solaris 2.8 host (beside getting a valid cross compilation
chain). Mainly some programs compiled on the host are not planned to be
compiled on anything but Linux (The host has to run Linux).

While I understand that it makes more sense to use Linux to (cross)
compile Linux, there are case/companies where this is not (yet) an
option.

So here are few minor modifications (against 2.6.7 from kernel.org) I
had to do to get things going. I guess all of these are not PPC
specific. It just happens I am working with PPC targets.

Regards

JC
--- linux-2.6.7/arch/ppc/boot/utils/mkbugboot.c Wed Jun 16 01:19:36 2004
+++ linux-2.6.7.work/arch/ppc/boot/utils/mkbugboot.c    Tue Jul  6
03:27:50 2004
@@ -49,10 +49,12 @@
 /* size of read buffer */
 #define SIZE 0x1000

+#ifdef __linux__
 /* typedef long int32_t; */
 typedef unsigned long uint32_t;
 typedef unsigned short uint16_t;
 typedef unsigned char uint8_t;
+#endif

 /* PPCBUG ROM boot header */
 typedef struct bug_boot_header {
--- linux-2.6.7/scripts/genksyms/genksyms.c     Wed Jun 16 01:19:23 2004
+++ linux-2.6.7.work/scripts/genksyms/genksyms.c        Mon Jul  5
17:03:19 2004
@@ -27,7 +27,9 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdarg.h>
+#ifdef __linux__
 #include <getopt.h>
+#endif

 #include "genksyms.h"
@@ -516,6 +518,7 @@
 {
   int o;

+#ifdef __linux__
   struct option long_opts[] = {
     {"debug", 0, 0, 'd'},
     {"warnings", 0, 0, 'w'},
@@ -528,6 +531,9 @@

   while ((o = getopt_long(argc, argv, "dwqVDk:p:",
                          &long_opts[0], NULL)) != EOF)
+#else
+  while ((o = getopt(argc, argv, "dwqVDk:p:")) != EOF)
+#endif
     switch (o)
       {
       case 'd':
--- linux-2.6.7/scripts/sumversion.c    Wed Jun 16 01:19:43 2004
+++ linux-2.6.7.work/scripts/sumversion.c       Mon Jul  5 17:06:20 2004
@@ -1,5 +1,7 @@
 #include <netinet/in.h>
+#ifdef __linux__
 #include <stdint.h>
+#endif
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Bret Indrelee <hidden>
Date: 2004-07-06 13:28:55

On Tue, 6 Jul 2004, Jean-Christophe Dubois wrote:
Hi,

I got into several issues while trying to cross-compile a Linux 2.6 PPC
kernel from a Solaris 2.8 host (beside getting a valid cross compilation
chain). Mainly some programs compiled on the host are not planned to be
compiled on anything but Linux (The host has to run Linux).
All of the things you've changed look wrong to me.

Most of your changes are taking out <stdint.h>, which is not correct.
This header should be on any system, it is part of the C standard. Even
the getopt changes shouldn't be required, you should be using the
version of getopt that came with your package.

Are you sure that you've specified -nostdinc -nostdlib and given the
proper list of locations for the cross-compile system includes when
compiling?

-Bret

--
Bret Indrelee                 QLogic Corporation
Bret.Indrelee@qlogic.com      6321 Bury Drive, St 13, Eden Prairie, MN 55346


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Jean-Christophe Dubois <hidden>
Date: 2004-07-06 13:47:45

On Tue, 2004-07-06 at 15:28, Bret Indrelee wrote:
All of the things you've changed look wrong to me.

Most of your changes are taking out <stdint.h>, which is not correct.
This header should be on any system, it is part of the C standard.
Sorry but stdint.h is not present on my Solaris 2.8 system. There is
little I can do about this. So maybe Solaris doesn't respect the
standard somewhere but ...
Even
the getopt changes shouldn't be required, you should be using the
version of getopt that came with your package.
Same here getopt.h is not part of solaris headers. Solaris does not seem
to support getopt_long() and getopt() prototype is part of stdio.h,
stdlib.h or unistd.h. But no getopt.h on the horizon ... Should use one
of the other mentioned files.
Are you sure that you've specified -nostdinc -nostdlib and given the
proper list of locations for the cross-compile system includes when
compiling?
For what I understand these programs (the ones build from the source I
modified) should not be cross-compiled but build for the host platform
(here Solaris) with the native compiler. Am I wrong?

Oh and I didn't specify any particular -nostdinc -nostdlib flag
anywhere. I am just using the standard Linux 2.6.7 Makefile. The command
used is:

make ARCH=ppc CROSS_COMPILE=powerpc-7400-linux-gnu-

JC
-Bret

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Jean-Christophe Dubois <hidden>
Date: 2004-07-06 14:57:40

On Tue, 2004-07-06 at 15:47, Jean-Christophe Dubois wrote:
Sorry but stdint.h is not present on my Solaris 2.8 system. There is
little I can do about this. So maybe Solaris doesn't respect the
standard somewhere but ...
I guess the problem here is that Solaris 2.8 is not necessarily
compliant with "The Open Group Base Specifications Issue 6"/IEEE Std
1003.1-2001-conforming systems. But should it disqualify it as an host
platform?

http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

On the other hand Solaris 2.8 does support <inttypes.h> which could do
the trick

http://www.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html
quoted
Even
the getopt changes shouldn't be required, you should be using the
version of getopt that came with your package.
Same here getopt.h is not part of solaris headers. Solaris does not seem
to support getopt_long() and getopt() prototype is part of stdio.h,
stdlib.h or unistd.h. But no getopt.h on the horizon ... Should use one
of the other mentioned files.
getopt_long() is not part of any IEEE standard (AFAIK) and getopt.h is
not part of IEEE Std 1003.1-2001-conforming systems. This seems to be
very GNU specific and not part of Solaris base system (so far).

http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html
quoted
Are you sure that you've specified -nostdinc -nostdlib and given the
proper list of locations for the cross-compile system includes when
compiling?
For what I understand these programs (the ones build from the source I
modified) should not be cross-compiled but build for the host platform
(here Solaris) with the native compiler. Am I wrong?

Oh and I didn't specify any particular -nostdinc -nostdlib flag
anywhere. I am just using the standard Linux 2.6.7 Makefile. The command
used is:

make ARCH=ppc CROSS_COMPILE=powerpc-7400-linux-gnu-

JC
quoted
-Bret
--
Jean-Christophe Dubois [off-list ref]
Mercury Computer Systems


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Jean-Christophe Dubois <hidden>
Date: 2004-07-08 09:35:31

Hello,

I rewrote my patches to be a little more well behaved in regards to non
linux systems.

Any feedback is welcome. Once again this is just to enable Solaris 2.8
(and others?) to be a valid host to cross-compile the 2.6 Linux Kernel
(for PPC).

Regards

JC
--- linux-2.6.7/arch/ppc/boot/utils/mkbugboot.c Wed Jun 16 01:19:36 2004
+++ linux-2.6.7.work/arch/ppc/boot/utils/mkbugboot.c    Wed Jul  7
05:45:55 2004
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <inttypes.h>

 #ifdef __i386__
 #define cpu_to_be32(x) le32_to_cpu(x)
@@ -48,11 +49,6 @@

 /* size of read buffer */
 #define SIZE 0x1000
-
-/* typedef long int32_t; */
-typedef unsigned long uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;

 /* PPCBUG ROM boot header */
 typedef struct bug_boot_header {
--- linux-2.6.7/scripts/genksyms/genksyms.c     Wed Jun 16 01:19:23 2004
+++ linux-2.6.7.work/scripts/genksyms/genksyms.c        Wed Jul  7
05:58:24 2004
@@ -27,7 +27,9 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdarg.h>
+#ifdef __GNU_LIBRARY__
 #include <getopt.h>
+#endif // __GNU_LIBRARY__

 #include "genksyms.h"
@@ -502,12 +504,21 @@
        fputs("Usage:\n"
              "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n"
              "\n"
+#ifdef __GNU_LIBRARY__
              "  -d, --debug           Increment the debug level
(repeatable)\n"
              "  -D, --dump            Dump expanded symbol defs (for
debugging only)\n"
              "  -w, --warnings        Enable warnings\n"
              "  -q, --quiet           Disable warnings (default)\n"
              "  -h, --help            Print this message\n"
              "  -V, --version         Print the release version\n"
+#else // __GNU_LIBRARY__
+             "  -d                    Increment the debug level
(repeatable)\n"
+             "  -D                    Dump expanded symbol defs (for
debugging only)\n"
+             "  -w                    Enable warnings\n"
+             "  -q                    Disable warnings (default)\n"
+             "  -h                    Print this message\n"
+             "  -V                    Print the release version\n"
+#endif // __GNU_LIBRARY__
              , stderr);
 }
@@ -516,6 +527,7 @@
 {
   int o;

+#ifdef __GNU_LIBRARY__
   struct option long_opts[] = {
     {"debug", 0, 0, 'd'},
     {"warnings", 0, 0, 'w'},
@@ -528,6 +540,9 @@

   while ((o = getopt_long(argc, argv, "dwqVDk:p:",
                          &long_opts[0], NULL)) != EOF)
+#else // __GNU_LIBRARY__
+  while ((o = getopt(argc, argv, "dwqVDk:p:")) != EOF)
+#endif // __GNU_LIBRARY__
     switch (o)
       {
       case 'd':
--- linux-2.6.7/scripts/sumversion.c    Wed Jun 16 01:19:43 2004
+++ linux-2.6.7.work/scripts/sumversion.c       Wed Jul  7 05:52:12 2004
@@ -1,5 +1,5 @@
 #include <netinet/in.h>
-#include <stdint.h>
+#include <inttypes.h>
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>

On Tue, 2004-07-06 at 16:57, Jean-Christophe Dubois wrote:
On Tue, 2004-07-06 at 15:47, Jean-Christophe Dubois wrote:
quoted
Sorry but stdint.h is not present on my Solaris 2.8 system. There is
little I can do about this. So maybe Solaris doesn't respect the
standard somewhere but ...
I guess the problem here is that Solaris 2.8 is not necessarily
compliant with "The Open Group Base Specifications Issue 6"/IEEE Std
1003.1-2001-conforming systems. But should it disqualify it as an host
platform?

http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

On the other hand Solaris 2.8 does support <inttypes.h> which could do
the trick

http://www.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html
quoted
quoted
Even
the getopt changes shouldn't be required, you should be using the
version of getopt that came with your package.
Same here getopt.h is not part of solaris headers. Solaris does not seem
to support getopt_long() and getopt() prototype is part of stdio.h,
stdlib.h or unistd.h. But no getopt.h on the horizon ... Should use one
of the other mentioned files.
getopt_long() is not part of any IEEE standard (AFAIK) and getopt.h is
not part of IEEE Std 1003.1-2001-conforming systems. This seems to be
very GNU specific and not part of Solaris base system (so far).

http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html
quoted
quoted
Are you sure that you've specified -nostdinc -nostdlib and given the
proper list of locations for the cross-compile system includes when
compiling?
For what I understand these programs (the ones build from the source I
modified) should not be cross-compiled but build for the host platform
(here Solaris) with the native compiler. Am I wrong?

Oh and I didn't specify any particular -nostdinc -nostdlib flag
anywhere. I am just using the standard Linux 2.6.7 Makefile. The command
used is:

make ARCH=ppc CROSS_COMPILE=powerpc-7400-linux-gnu-

JC
quoted
-Bret
--
Jean-Christophe Dubois [off-list ref]
Mercury Computer Systems

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Tom Rini <hidden>
Date: 2004-07-09 00:58:32

On Tue, Jul 06, 2004 at 11:20:51AM +0200, Jean-Christophe Dubois wrote:
I got into several issues while trying to cross-compile a Linux 2.6 PPC
kernel from a Solaris 2.8 host (beside getting a valid cross compilation
chain). Mainly some programs compiled on the host are not planned to be
compiled on anything but Linux (The host has to run Linux).
[snip]
quoted hunk
--- linux-2.6.7/arch/ppc/boot/utils/mkbugboot.c Wed Jun 16 01:19:36 2004
+++ linux-2.6.7.work/arch/ppc/boot/utils/mkbugboot.c    Tue Jul  6
03:27:50 2004
@@ -49,10 +49,12 @@
 /* size of read buffer */
 #define SIZE 0x1000

+#ifdef __linux__
 /* typedef long int32_t; */
 typedef unsigned long uint32_t;
 typedef unsigned short uint16_t;
 typedef unsigned char uint8_t;
+#endif

 /* PPCBUG ROM boot header */
 typedef struct bug_boot_header {
This, and possibly the rest, should probably be #ifndef __sun__.  Or at
least mkbugboot.c is OK with that on cygwin (haven't heard of a 2.6 compile
on cygwin yet so I can't say for certain if the other two are OK there).
I'll change and push up.  Thanks.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Tom Rini <hidden>
Date: 2004-07-09 01:48:53

On Thu, Jul 08, 2004 at 11:35:31AM +0200, Jean-Christophe Dubois wrote:
Hello,

I rewrote my patches to be a little more well behaved in regards to non
linux systems.

Any feedback is welcome. Once again this is just to enable Solaris 2.8
(and others?) to be a valid host to cross-compile the 2.6 Linux Kernel
(for PPC).
Sadly, it looks like Cygwin (the other odd host to build a linux kernel on)
lacks <inttypes.h>.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: proposed patch for cross compiling from Solaris 2.8

From: Jean-Christophe Dubois <hidden>
Date: 2004-07-09 09:06:34

On Fri, 2004-07-09 at 03:48, Tom Rini wrote:
Sadly, it looks like Cygwin (the other odd host to build a linux kernel on)
lacks <inttypes.h>.
too bad :(

So here is another shot at it:
--- linux-2.6.7/scripts/sumversion.c    Wed Jun 16 01:19:43 2004
+++ 2.6/scripts/sumversion.c    Fri Jul  9 04:10:27 2004
@@ -1,5 +1,9 @@
 #include <netinet/in.h>
+#ifdef __sun__
+#include <inttypes.h>
+#else // __sun__
 #include <stdint.h>
+#endif // __sun__
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
--- linux-2.6.7/scripts/genksyms/genksyms.c     Wed Jun 16 01:19:23 2004
+++ 2.6/scripts/genksyms/genksyms.c     Thu Jul  8 11:04:04 2004
@@ -27,7 +27,9 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdarg.h>
+#ifdef __GNU_LIBRARY__
 #include <getopt.h>
+#endif /* __GNU_LIBRARY__ */

 #include "genksyms.h"
@@ -502,12 +504,21 @@
        fputs("Usage:\n"
              "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n"
              "\n"
+#ifdef __GNU_LIBRARY__
              "  -d, --debug           Increment the debug level
(repeatable)\n"
              "  -D, --dump            Dump expanded symbol defs (for
debugging only)\n"
              "  -w, --warnings        Enable warnings\n"
              "  -q, --quiet           Disable warnings (default)\n"
              "  -h, --help            Print this message\n"
              "  -V, --version         Print the release version\n"
+#else  /* __GNU_LIBRARY__ */
+             "  -d                    Increment the debug level
(repeatable)\n"
+             "  -D                    Dump expanded symbol defs (for
debugging only)\n"
+             "  -w                    Enable warnings\n"
+             "  -q                    Disable warnings (default)\n"
+             "  -h                    Print this message\n"
+             "  -V                    Print the release version\n"
+#endif /* __GNU_LIBRARY__ */
              , stderr);
 }
@@ -516,6 +527,7 @@
 {
   int o;

+#ifdef __GNU_LIBRARY__
   struct option long_opts[] = {
     {"debug", 0, 0, 'd'},
     {"warnings", 0, 0, 'w'},
@@ -528,6 +540,9 @@

   while ((o = getopt_long(argc, argv, "dwqVDk:p:",
                          &long_opts[0], NULL)) != EOF)
+#else  /* __GNU_LIBRARY__ */
+  while ((o = getopt(argc, argv, "dwqVDk:p:")) != EOF)
+#endif /* __GNU_LIBRARY__ */
     switch (o)
       {
       case 'd':
--- linux-2.6.7/arch/ppc/boot/utils/mkbugboot.c Wed Jun 16 01:19:36 2004
+++ 2.6/arch/ppc/boot/utils/mkbugboot.c Fri Jul  9 04:11:43 2004
@@ -21,6 +21,11 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __sun__
+#include <inttypes.h>
+#else // __sun__
+#include <stdint.h>
+#endif // __sun__

 #ifdef __i386__
 #define cpu_to_be32(x) le32_to_cpu(x)
@@ -48,11 +53,6 @@

 /* size of read buffer */
 #define SIZE 0x1000
-
-/* typedef long int32_t; */
-typedef unsigned long uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;

 /* PPCBUG ROM boot header */
 typedef struct bug_boot_header {

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help