Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-10 Thread Christoph Hellwig
On Fri, Mar 09, 2007 at 11:23:32PM +0100, Sam Ravnborg wrote:
> > >> ===
> > >> --- linux-2.6.21-rc3.orig/scripts/kallsyms.c 2007-03-07 
> > >> 05:41:20.0 +0100
> > >> +++ linux-2.6.21-rc3/scripts/kallsyms.c  2007-03-07 23:46:46.249005000 
> > >> +0100
> > >> @@ -378,6 +378,40 @@
> > >>  table_cnt = pos;
> > >>  }
> > >>  
> > >> +#ifdef __sun__
> > >> +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
> > >> +void *
> > >> +memmem (haystack, haystack_len, needle, needle_len)
> > >> + const void *haystack;
> > >> +  return (void *) begin;
> > >> +
> > >> +  return NULL;
> > >> +}
> > >> +#endif
> > >> +
> > >>  /* replace a given token in all the valid symbols. Use the sampled 
> > >> symbols
> > >>   * to update the counts */
> > >>  static void compress_symbols(unsigned char *str, int idx)
> > 
> > This one, I am just waiting for someone to object to the extra #if-#endif.
> I was planning to ask Paulo if strstr could not be used - Paulo?

Yeah.  And if we can't use something else all the missing functions
should be in a compat-solaris.c files, similarly to how sparse handles
missing functions on various systems instead of polluting implementation
files with ifdefs and duplicates of library code.

> > >> -HOST_EXTRACFLAGS += -DLOCALE
> > >> +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
> > >>  
> > >>  PHONY += $(obj)/dochecklxdialog
> > >>  $(obj)/dochecklxdialog:
> > 
> > The error message for this one was:  only valid in C99 mode.
> > Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
> > know offhand who is right.
> The -std= looks safe.

It's not though.  It's a gccisms, and I'm not sure we want to mandate
gcc for the host copiler, given that the only way you'd build a working
kernel on a foreign system would be a cross compilation anyway.

> > >>  #define M_EVENT (KEY_MAX+1)
> > >> +
> > >> +#ifndef KEY_RESIZE
> > >> +#   define KEY_RESIZE 0632
> > >> +#endif
> > 
> > Solaris only has curses, not ncurses. Consider this a supreme hack.
> > In fact, menuconfig has some weird display errors still.
> This hack looks OK to me.

Except that solaris curses doesn't actually understand this random
value for KEY_RESIZE.  Either we mandate that ncurses is installed on
the host for menuconfig to work (and ncurses at least used to work
on most unix variants), or some needs to do a proper curses port.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-10 Thread Christoph Hellwig
On Fri, Mar 09, 2007 at 11:23:32PM +0100, Sam Ravnborg wrote:
   ===
   --- linux-2.6.21-rc3.orig/scripts/kallsyms.c 2007-03-07 
   05:41:20.0 +0100
   +++ linux-2.6.21-rc3/scripts/kallsyms.c  2007-03-07 23:46:46.249005000 
   +0100
   @@ -378,6 +378,40 @@
table_cnt = pos;
}

   +#ifdef __sun__
   +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
   +void *
   +memmem (haystack, haystack_len, needle, needle_len)
   + const void *haystack;
   +  return (void *) begin;
   +
   +  return NULL;
   +}
   +#endif
   +
/* replace a given token in all the valid symbols. Use the sampled 
   symbols
 * to update the counts */
static void compress_symbols(unsigned char *str, int idx)
  
  This one, I am just waiting for someone to object to the extra #if-#endif.
 I was planning to ask Paulo if strstr could not be used - Paulo?

Yeah.  And if we can't use something else all the missing functions
should be in a compat-solaris.c files, similarly to how sparse handles
missing functions on various systems instead of polluting implementation
files with ifdefs and duplicates of library code.

   -HOST_EXTRACFLAGS += -DLOCALE
   +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__

PHONY += $(obj)/dochecklxdialog
$(obj)/dochecklxdialog:
  
  The error message for this one was: stdbool.h only valid in C99 mode.
  Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
  know offhand who is right.
 The -std= looks safe.

It's not though.  It's a gccisms, and I'm not sure we want to mandate
gcc for the host copiler, given that the only way you'd build a working
kernel on a foreign system would be a cross compilation anyway.

#define M_EVENT (KEY_MAX+1)
   +
   +#ifndef KEY_RESIZE
   +#   define KEY_RESIZE 0632
   +#endif
  
  Solaris only has curses, not ncurses. Consider this a supreme hack.
  In fact, menuconfig has some weird display errors still.
 This hack looks OK to me.

Except that solaris curses doesn't actually understand this random
value for KEY_RESIZE.  Either we mandate that ncurses is installed on
the host for menuconfig to work (and ncurses at least used to work
on most unix variants), or some needs to do a proper curses port.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Jan Engelhardt

On Mar 9 2007 23:23, Sam Ravnborg wrote:

>Date: Fri, 9 Mar 2007 23:23:32 +0100
>From: Sam Ravnborg <[EMAIL PROTECTED]>
>To: Jan Engelhardt <[EMAIL PROTECTED]>,
>Paulo Marques <[EMAIL PROTECTED]>
>Cc: [EMAIL PROTECTED], Christoph Hellwig <[EMAIL PROTECTED]>,
>Deepak Saxena <[EMAIL PROTECTED]>,
>Andrew Morton <[EMAIL PROTECTED]>, linux-kernel@vger.kernel.org
>Subject: Re: [PATCH] Fix building kernel under Solaris 11_snv
>

Reference: http://lkml.org/lkml/2007/3/8/368
Signed-off-by: Jan Engelhardt <[EMAIL PROTECTED]>

Happy cherrypicking.
More comments below.

>> >> Index: linux-2.6.21-rc3/scripts/kallsyms.c
>> >> ===
>> >> --- linux-2.6.21-rc3.orig/scripts/kallsyms.c  2007-03-07 
>> >> 05:41:20.0 +0100
>> >> +++ linux-2.6.21-rc3/scripts/kallsyms.c   2007-03-07 23:46:46.249005000 
>> >> +0100
>> >> @@ -378,6 +378,40 @@
>> >>   table_cnt = pos;
>> >>  }
>> >>  
>> >> +#ifdef __sun__
>> >> +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
>> >> +void *
>> >> +memmem (haystack, haystack_len, needle, needle_len)
>> >> + const void *haystack;
>> >> +  return (void *) begin;
>> >> +
>> >> +  return NULL;
>> >> +}
>> >> +#endif
>> >> +
>> >>  /* replace a given token in all the valid symbols. Use the sampled 
>> >> symbols
>> >>   * to update the counts */
>> >>  static void compress_symbols(unsigned char *str, int idx)
>> 
>> This one, I am just waiting for someone to object to the extra #if-#endif.
>
>I was planning to ask Paulo if strstr could not be used - Paulo?

I am not sure, but I would tend to say "no".

kallsyms.c:
p1 = table[i].sym;  

/* find the token on the symbol */  
p2 = memmem(p1, len, str, 2);   
if (!p2) continue;  

My first impression would be that 'p1' is a multi-nul-terminated string
array ("foo\0bar\0next\0symbol\0..."), much like the entire .strtab
section (I have not actually bothered to check, so it is a raw guess), and
I do not think strstr would replace memmem here if that was the case.

>> >> Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
>> >> ===
>> >> --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile2007-03-07 
>> >> 05:41:20.0 +0100
>> >> +++ linux-2.6.21-rc3/scripts/kconfig/Makefile 2007-03-07 
>> >> 23:21:19.730679000 +0100
>> >> @@ -88,7 +88,7 @@
>> >>  HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
>> >>  HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
>> >> $(HOSTCC))
>> >>  
>> >> -HOST_EXTRACFLAGS += -DLOCALE
>> >> +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
>> >>  
>> >>  PHONY += $(obj)/dochecklxdialog
>> >>  $(obj)/dochecklxdialog:
>> 
>> The error message for this one was:  only valid in C99 mode.
>> Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
>> know offhand who is right.
>
>The -std= looks safe. The __EXTENSIONS__ part seems safe and needed after a
>bit googling.

Humm humm. Linux's /usr/include does not have any (glibc) file with the
string __EXTENSIONS__ in it. Though, the linux manpage for fileno() does
not mention fileno() conforming to anything. Under Linux, fileno() is
wrapped inside __USE_POSIX, and the comments in Solaris's headers also
indicate it is something posixy.

Perhaps have something like

#ifdef __sun__
#   define __EXTENSIONS__ 1
#endif

>> >> Index: linux-2.6.21-rc3/scripts/mod/file2alias.c
>> >> ===
>> >> --- linux-2.6.21-rc3.orig/scripts/mod/file2alias.c2007-03-07 
>> >> 05:41:20.0 +0100
>> >> +++ linux-2.6.21-rc3/scripts/mod/file2alias.c 2007-03-07 
>> >> 23:41:23.772026000 +0100
>> >> @@ -32,6 +32,8 @@
>> >>  typedef uint32_t __u32;
>> >>  typedef uint16_t __u16;
>> >>  typedef unsigned char__u8;
>> >> +typedef int32_t  __s32;
>> >> +typedef int16_t   

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Sam Ravnborg
On Fri, Mar 09, 2007 at 09:16:35PM +0100, Jan Engelhardt wrote:
> 
> On Mar 9 2007 20:00, Sam Ravnborg wrote:
> >On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
> >> 
> >> Since Solaris seems to be on the run, I did myself try compile it. 
> >> However, unlike the original poster who said he did so on SunOS 4.8, I 
> >> did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
> >> share the diff that piled up so far. It needs a lot of hacks on the 
> >> Solaris side - prioritizing GNU names, then, second, gnu ld has a 
> >> glitch, then, gcc has a missing file... it's fun fun fun!
> >
> >Can I please have a signed-off version of this patch.
> 
> _Are you sure_ you want all these hacks without further
> review from other people? Also note the patch is incomplete,
> for example I could not compile the acpi pieces because
> acsolaris.h -- which is referenced in the acpi includes --
> does not exist. (Yet another piece of software that has
> crossplatform compatibilty stuff, like XFS.)

The Signed-off-by: document the origin of the path.
I'm planning only to take the sensible bits of the patch anyway.

> >> --- linux-2.6.21-rc3.orig/include/linux/input.h2007-03-07 
> >> 05:41:20.0 +0100
> >> +++ linux-2.6.21-rc3/include/linux/input.h 2007-03-07 23:40:39.417339000 
> >> +0100
> >> @@ -16,7 +16,9 @@
> >>  #include 
> >>  #include 
> >>  #include 
> >> -#include 
> >> +#ifndef __sun__
> >> +# include 
> >> +#endif
> >>  #endif
> 
> This is not a proper fix for sure. The problem lies in
> file2alias.c, see (your own) http://lkml.org/lkml/2007/3/8/339
I already committed my own fix - so this chunk can be ignored.

> 
> >> Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
> >> ===
> >> --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c  2007-03-07 
> >> 05:41:20.0 +0100
> >> +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c   2007-03-07 
> >> 23:28:35.659555000 +0100
> >> @@ -21,6 +21,7 @@
> >> along with this program; if not, write to the Free Software Foundation,
> >> Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
> >>  
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> 
> This is however, is valid. Can I gave sign-offs for single hunks?
Agree and yes.

> 
> >> Index: linux-2.6.21-rc3/scripts/kallsyms.c
> >> ===
> >> --- linux-2.6.21-rc3.orig/scripts/kallsyms.c   2007-03-07 
> >> 05:41:20.0 +0100
> >> +++ linux-2.6.21-rc3/scripts/kallsyms.c2007-03-07 23:46:46.249005000 
> >> +0100
> >> @@ -378,6 +378,40 @@
> >>table_cnt = pos;
> >>  }
> >>  
> >> +#ifdef __sun__
> >> +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
> >> +void *
> >> +memmem (haystack, haystack_len, needle, needle_len)
> >> + const void *haystack;
> >> +  return (void *) begin;
> >> +
> >> +  return NULL;
> >> +}
> >> +#endif
> >> +
> >>  /* replace a given token in all the valid symbols. Use the sampled symbols
> >>   * to update the counts */
> >>  static void compress_symbols(unsigned char *str, int idx)
> 
> This one, I am just waiting for someone to object to the extra #if-#endif.
I was planning to ask Paulo if strstr could not be used - Paulo?

> 
> >> Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
> >> ===
> >> --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile 2007-03-07 
> >> 05:41:20.0 +0100
> >> +++ linux-2.6.21-rc3/scripts/kconfig/Makefile  2007-03-07 
> >> 23:21:19.730679000 +0100
> >> @@ -88,7 +88,7 @@
> >>  HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
> >>  HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
> >> $(HOSTCC))
> >>  
> >> -HOST_EXTRACFLAGS += -DLOCALE
> >> +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
> >>  
> >>  PHONY += $(obj)/dochecklxdialog
> >>  $(obj)/dochecklxdialog:
> 
> The error message for this one was:  only valid in C99 mode.
> Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
> know offhand who is right.
The -std= looks safe. The __EXTENSIONS__ part seems safe and needed after a bit 
googling.

> 
> >> Index: linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h
> >> ===
> >> --- linux-2.6.21-rc3.orig/scripts/kconfig/lxdialog/dialog.h
> >> 2007-03-07 05:41:20.0 +0100
> >> +++ linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h 2007-03-07 
> >> 23:14:48.462956000 +0100
> >> @@ -222,3 +222,7 @@
> >>   *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
> >>   */
> >>  #define M_EVENT (KEY_MAX+1)
> >> +
> >> +#ifndef KEY_RESIZE
> >> +# define KEY_RESIZE 0632
> >> +#endif
> 
> Solaris only has curses, not ncurses. Consider this a supreme hack.
> In fact, menuconfig has some weird display errors still.

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Jan Engelhardt

On Mar 9 2007 20:00, Sam Ravnborg wrote:
>On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
>> 
>> Since Solaris seems to be on the run, I did myself try compile it. 
>> However, unlike the original poster who said he did so on SunOS 4.8, I 
>> did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
>> share the diff that piled up so far. It needs a lot of hacks on the 
>> Solaris side - prioritizing GNU names, then, second, gnu ld has a 
>> glitch, then, gcc has a missing file... it's fun fun fun!
>
>Can I please have a signed-off version of this patch.

_Are you sure_ you want all these hacks without further
review from other people? Also note the patch is incomplete,
for example I could not compile the acpi pieces because
acsolaris.h -- which is referenced in the acpi includes --
does not exist. (Yet another piece of software that has
crossplatform compatibilty stuff, like XFS.)

>> --- linux-2.6.21-rc3.orig/include/linux/input.h  2007-03-07 
>> 05:41:20.0 +0100
>> +++ linux-2.6.21-rc3/include/linux/input.h   2007-03-07 23:40:39.417339000 
>> +0100
>> @@ -16,7 +16,9 @@
>>  #include 
>>  #include 
>>  #include 
>> -#include 
>> +#ifndef __sun__
>> +#   include 
>> +#endif
>>  #endif

This is not a proper fix for sure. The problem lies in
file2alias.c, see (your own) http://lkml.org/lkml/2007/3/8/339

>> Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
>> ===
>> --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c2007-03-07 
>> 05:41:20.0 +0100
>> +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c 2007-03-07 
>> 23:28:35.659555000 +0100
>> @@ -21,6 +21,7 @@
>> along with this program; if not, write to the Free Software Foundation,
>> Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
>>  
>> +#include 
>>  #include 
>>  #include 
>>  #include 

This is however, is valid. Can I gave sign-offs for single hunks?

>> Index: linux-2.6.21-rc3/scripts/kallsyms.c
>> ===
>> --- linux-2.6.21-rc3.orig/scripts/kallsyms.c 2007-03-07 05:41:20.0 
>> +0100
>> +++ linux-2.6.21-rc3/scripts/kallsyms.c  2007-03-07 23:46:46.249005000 
>> +0100
>> @@ -378,6 +378,40 @@
>>  table_cnt = pos;
>>  }
>>  
>> +#ifdef __sun__
>> +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
>> +void *
>> +memmem (haystack, haystack_len, needle, needle_len)
>> + const void *haystack;
>> + size_t haystack_len;
>> + const void *needle;
>> + size_t needle_len;
>> +{
>> +  const char *begin;
>> +  const char *const last_possible
>> += (const char *) haystack + haystack_len - needle_len;
>> +
>> +  if (needle_len == 0)
>> +/* The first occurrence of the empty string is deemed to occur at
>> +   the beginning of the string.  */
>> +return (void *) haystack;
>> +
>> +  /* Sanity check, otherwise the loop might search through the whole
>> + memory.  */
>> +  if (__builtin_expect (haystack_len < needle_len, 0))
>> +return NULL;
>> +
>> +  for (begin = (const char *) haystack; begin <= last_possible; ++begin)
>> +if (begin[0] == ((const char *) needle)[0] &&
>> +!memcmp ((const void *) [1],
>> + (const void *) ((const char *) needle + 1),
>> + needle_len - 1))
>> +  return (void *) begin;
>> +
>> +  return NULL;
>> +}
>> +#endif
>> +
>>  /* replace a given token in all the valid symbols. Use the sampled symbols
>>   * to update the counts */
>>  static void compress_symbols(unsigned char *str, int idx)

This one, I am just waiting for someone to object to the extra #if-#endif.

>> Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
>> ===
>> --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile   2007-03-07 
>> 05:41:20.0 +0100
>> +++ linux-2.6.21-rc3/scripts/kconfig/Makefile2007-03-07 
>> 23:21:19.730679000 +0100
>> @@ -88,7 +88,7 @@
>>  HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
>>  HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
>> $(HOSTCC))
>>  
>> -HOST_EXTRACFLAGS += -DLOCALE
>> +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
>>  
>>  PHONY += $(obj)/dochecklxdialog
>>  $(obj)/dochecklxdialog:

The error message for this one was:  only valid in C99 mode.
Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
know offhand who is right.

>> Index: linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h
>> ===
>> --- linux-2.6.21-rc3.orig/scripts/kconfig/lxdialog/dialog.h  2007-03-07 
>> 05:41:20.0 +0100
>> +++ linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h   2007-03-07 
>> 23:14:48.462956000 +0100
>> @@ -222,3 +222,7 @@
>>   *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
>>   */
>>  #define 

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Sam Ravnborg
On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
> 
> On Mar 8 2007 22:25, Sam Ravnborg wrote:
> >Subject: Re: [PATCH] Fix building kernel under Solaris
> 
> Since Solaris seems to be on the run, I did myself try compile it. 
> However, unlike the original poster who said he did so on SunOS 4.8, I 
> did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
> share the diff that piled up so far. It needs a lot of hacks on the 
> Solaris side - prioritizing GNU names, then, second, gnu ld has a 
> glitch, then, gcc has a missing file... it's fun fun fun!

Can I please have a signed-off version of this patch.

Thanks,
Sam

> 
> Well, I will iterate the key problem with the missing file:
> 
>   *  include/linux/kernel.h (and many others) include 
>  BUT - since we are using -nostdinc, /usr/include/stdarg.h is not
>  considered. And gcc's stdarg.h (which lives at
>  /usr/lib/gcc/i586-suse-linux/4.1.2/include/stdarg.h in Linux land)
>  is missing in Solaris' GCC (which is version 3.4.3).
> 
> Hack #1:
>   ln -s \
>   
> /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/install-tools/include/stdarg.h \
>   /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h
> 
> Hack #2: GNU programs...
> 
>   mkdir -p ~/gnulink;
>   for i in addr2line ar as egrep grep ld make nm objcopy objdump \
> ranlib readelf size string strip tar; do
>   ln -s "/usr/sfw/bin/$i" "~/gnulink/$i";
>   done;
> 
>   for i in cat chgrp chmod chown chroot cksum cmp cp cut date \
> dd df diff du echo env expand expr false fgrep find fold \
> getopt groups head hostid install join ln locate ls mkdir \
> mkfifo mknod mv nice nohup od pwd rm rmdir sed seq shred \
> sleep sort split stty tac tail tee touch tr true uname \
> uniq uptime wc who whoami xargs yes gawk; do
>   ln -s "/opt/csw/bin/$i" "~/gnulink/$i";
>   done;
> 
> Hack #3: Diff file...
> 
> Hack #4: GNU ld glitch workaround (GNU ld looks in the current dir...)
> 
>   cd linux-2.6.21-rc3
>   ln -s /usr/sfw/i386-sun-solaris2.11/lib/ldscripts ldscripts
> 
> Fun #1:
> 
>   export PATH="$HOME/gnulink:$PATH";
>   make ARCH=i386
> 
> Oddity #1:
> 
>   ARCH=i386 required because the Makefiles seem to use `uname -m`
>   (which returns "i86pc") rather than `uname -p`. I think we are
>   at odds here though...
> 
>   uname -muname -p
>   SOL i86pc   i386
>   LINUX   i686athlon
> 
> 
> Expect compiler failures, especially with assembler code.
> 
> 
> Jan
> 
> <<< PATCH BELOW <<<
> 
> Index: linux-2.6.21-rc3/include/linux/input.h
> ===
> --- linux-2.6.21-rc3.orig/include/linux/input.h   2007-03-07 
> 05:41:20.0 +0100
> +++ linux-2.6.21-rc3/include/linux/input.h2007-03-07 23:40:39.417339000 
> +0100
> @@ -16,7 +16,9 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#ifndef __sun__
> +#include 
> +#endif
>  #endif
>  
>  /*
> Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
> ===
> --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c 2007-03-07 
> 05:41:20.0 +0100
> +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c  2007-03-07 
> 23:28:35.659555000 +0100
> @@ -21,6 +21,7 @@
> along with this program; if not, write to the Free Software Foundation,
> Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> Index: linux-2.6.21-rc3/scripts/kallsyms.c
> ===
> --- linux-2.6.21-rc3.orig/scripts/kallsyms.c  2007-03-07 05:41:20.0 
> +0100
> +++ linux-2.6.21-rc3/scripts/kallsyms.c   2007-03-07 23:46:46.249005000 
> +0100
> @@ -378,6 +378,40 @@
>   table_cnt = pos;
>  }
>  
> +#ifdef __sun__
> +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
> +void *
> +memmem (haystack, haystack_len, needle, needle_len)
> + const void *haystack;
> + size_t haystack_len;
> + const void *needle;
> + size_t needle_len;
> +{
> +  const char *begin;
> +  const char *const last_possible
> += (const char *) haystack + haystack_len - needle_len;
> +
> +  if (needle_len == 0)
> +/* The first occurrence of the empty string is deemed to occur at
> +   the beginning of the string.  */
> +

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Sam Ravnborg
On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
 
 On Mar 8 2007 22:25, Sam Ravnborg wrote:
 Subject: Re: [PATCH] Fix building kernel under Solaris
 
 Since Solaris seems to be on the run, I did myself try compile it. 
 However, unlike the original poster who said he did so on SunOS 4.8, I 
 did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
 share the diff that piled up so far. It needs a lot of hacks on the 
 Solaris side - prioritizing GNU names, then, second, gnu ld has a 
 glitch, then, gcc has a missing file... it's fun fun fun!

Can I please have a signed-off version of this patch.

Thanks,
Sam

 
 Well, I will iterate the key problem with the missing file:
 
   *  include/linux/kernel.h (and many others) include stdarg.h
  BUT - since we are using -nostdinc, /usr/include/stdarg.h is not
  considered. And gcc's stdarg.h (which lives at
  /usr/lib/gcc/i586-suse-linux/4.1.2/include/stdarg.h in Linux land)
  is missing in Solaris' GCC (which is version 3.4.3).
 
 Hack #1:
   ln -s \
   
 /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/install-tools/include/stdarg.h \
   /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h
 
 Hack #2: GNU programs...
 
   mkdir -p ~/gnulink;
   for i in addr2line ar as egrep grep ld make nm objcopy objdump \
 ranlib readelf size string strip tar; do
   ln -s /usr/sfw/bin/$i ~/gnulink/$i;
   done;
 
   for i in cat chgrp chmod chown chroot cksum cmp cp cut date \
 dd df diff du echo env expand expr false fgrep find fold \
 getopt groups head hostid install join ln locate ls mkdir \
 mkfifo mknod mv nice nohup od pwd rm rmdir sed seq shred \
 sleep sort split stty tac tail tee touch tr true uname \
 uniq uptime wc who whoami xargs yes gawk; do
   ln -s /opt/csw/bin/$i ~/gnulink/$i;
   done;
 
 Hack #3: Diff file...
 
 Hack #4: GNU ld glitch workaround (GNU ld looks in the current dir...)
 
   cd linux-2.6.21-rc3
   ln -s /usr/sfw/i386-sun-solaris2.11/lib/ldscripts ldscripts
 
 Fun #1:
 
   export PATH=$HOME/gnulink:$PATH;
   make ARCH=i386
 
 Oddity #1:
 
   ARCH=i386 required because the Makefiles seem to use `uname -m`
   (which returns i86pc) rather than `uname -p`. I think we are
   at odds here though...
 
   uname -muname -p
   SOL i86pc   i386
   LINUX   i686athlon
 
 
 Expect compiler failures, especially with assembler code.
 
 
 Jan
 
  PATCH BELOW 
 
 Index: linux-2.6.21-rc3/include/linux/input.h
 ===
 --- linux-2.6.21-rc3.orig/include/linux/input.h   2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/include/linux/input.h2007-03-07 23:40:39.417339000 
 +0100
 @@ -16,7 +16,9 @@
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 -#include asm/types.h
 +#ifndef __sun__
 +#include asm/types.h
 +#endif
  #endif
  
  /*
 Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
 ===
 --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c 2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c  2007-03-07 
 23:28:35.659555000 +0100
 @@ -21,6 +21,7 @@
 along with this program; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
 +#include alloca.h
  #include stdio.h
  #include string.h
  #include stdlib.h
 Index: linux-2.6.21-rc3/scripts/kallsyms.c
 ===
 --- linux-2.6.21-rc3.orig/scripts/kallsyms.c  2007-03-07 05:41:20.0 
 +0100
 +++ linux-2.6.21-rc3/scripts/kallsyms.c   2007-03-07 23:46:46.249005000 
 +0100
 @@ -378,6 +378,40 @@
   table_cnt = pos;
  }
  
 +#ifdef __sun__
 +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
 +void *
 +memmem (haystack, haystack_len, needle, needle_len)
 + const void *haystack;
 + size_t haystack_len;
 + const void *needle;
 + size_t needle_len;
 +{
 +  const char *begin;
 +  const char *const last_possible
 += (const char *) haystack + haystack_len - needle_len;
 +
 +  if (needle_len == 0)
 +/* The first occurrence of the empty string is deemed to occur at
 +   the beginning of the string.  */
 +return (void *) haystack;
 +
 +  /* Sanity check, otherwise the loop might search through the whole
 + memory.  */
 +  if (__builtin_expect (haystack_len  needle_len, 0))
 +return NULL;
 +
 +  for (begin = (const char *) haystack; begin = last_possible; ++begin)
 +if (begin[0] == ((const char *) needle)[0] 
 +!memcmp ((const void *) begin[1],
 + (const void *) ((const char *) needle + 1),
 + needle_len - 1))
 +  return (void *) begin;
 +
 +  return NULL

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Jan Engelhardt

On Mar 9 2007 20:00, Sam Ravnborg wrote:
On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
 
 Since Solaris seems to be on the run, I did myself try compile it. 
 However, unlike the original poster who said he did so on SunOS 4.8, I 
 did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
 share the diff that piled up so far. It needs a lot of hacks on the 
 Solaris side - prioritizing GNU names, then, second, gnu ld has a 
 glitch, then, gcc has a missing file... it's fun fun fun!

Can I please have a signed-off version of this patch.

_Are you sure_ you want all these hacks without further
review from other people? Also note the patch is incomplete,
for example I could not compile the acpi pieces because
acsolaris.h -- which is referenced in the acpi includes --
does not exist. (Yet another piece of software that has
crossplatform compatibilty stuff, like XFS.)

 --- linux-2.6.21-rc3.orig/include/linux/input.h  2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/include/linux/input.h   2007-03-07 23:40:39.417339000 
 +0100
 @@ -16,7 +16,9 @@
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 -#include asm/types.h
 +#ifndef __sun__
 +#   include asm/types.h
 +#endif
  #endif

This is not a proper fix for sure. The problem lies in
file2alias.c, see (your own) http://lkml.org/lkml/2007/3/8/339

 Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
 ===
 --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c 2007-03-07 
 23:28:35.659555000 +0100
 @@ -21,6 +21,7 @@
 along with this program; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
 +#include alloca.h
  #include stdio.h
  #include string.h
  #include stdlib.h

This is however, is valid. Can I gave sign-offs for single hunks?

 Index: linux-2.6.21-rc3/scripts/kallsyms.c
 ===
 --- linux-2.6.21-rc3.orig/scripts/kallsyms.c 2007-03-07 05:41:20.0 
 +0100
 +++ linux-2.6.21-rc3/scripts/kallsyms.c  2007-03-07 23:46:46.249005000 
 +0100
 @@ -378,6 +378,40 @@
  table_cnt = pos;
  }
  
 +#ifdef __sun__
 +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
 +void *
 +memmem (haystack, haystack_len, needle, needle_len)
 + const void *haystack;
 + size_t haystack_len;
 + const void *needle;
 + size_t needle_len;
 +{
 +  const char *begin;
 +  const char *const last_possible
 += (const char *) haystack + haystack_len - needle_len;
 +
 +  if (needle_len == 0)
 +/* The first occurrence of the empty string is deemed to occur at
 +   the beginning of the string.  */
 +return (void *) haystack;
 +
 +  /* Sanity check, otherwise the loop might search through the whole
 + memory.  */
 +  if (__builtin_expect (haystack_len  needle_len, 0))
 +return NULL;
 +
 +  for (begin = (const char *) haystack; begin = last_possible; ++begin)
 +if (begin[0] == ((const char *) needle)[0] 
 +!memcmp ((const void *) begin[1],
 + (const void *) ((const char *) needle + 1),
 + needle_len - 1))
 +  return (void *) begin;
 +
 +  return NULL;
 +}
 +#endif
 +
  /* replace a given token in all the valid symbols. Use the sampled symbols
   * to update the counts */
  static void compress_symbols(unsigned char *str, int idx)

This one, I am just waiting for someone to object to the extra #if-#endif.

 Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
 ===
 --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile   2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/scripts/kconfig/Makefile2007-03-07 
 23:21:19.730679000 +0100
 @@ -88,7 +88,7 @@
  HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
  HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
 $(HOSTCC))
  
 -HOST_EXTRACFLAGS += -DLOCALE
 +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
  
  PHONY += $(obj)/dochecklxdialog
  $(obj)/dochecklxdialog:

The error message for this one was: stdbool.h only valid in C99 mode.
Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
know offhand who is right.

 Index: linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h
 ===
 --- linux-2.6.21-rc3.orig/scripts/kconfig/lxdialog/dialog.h  2007-03-07 
 05:41:20.0 +0100
 +++ linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h   2007-03-07 
 23:14:48.462956000 +0100
 @@ -222,3 +222,7 @@
   *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
   */
  #define M_EVENT (KEY_MAX+1)
 +
 +#ifndef KEY_RESIZE
 +#   define KEY_RESIZE 0632
 +#endif

Solaris only has curses, not ncurses. 

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Sam Ravnborg
On Fri, Mar 09, 2007 at 09:16:35PM +0100, Jan Engelhardt wrote:
 
 On Mar 9 2007 20:00, Sam Ravnborg wrote:
 On Thu, Mar 08, 2007 at 11:01:57PM +0100, Jan Engelhardt wrote:
  
  Since Solaris seems to be on the run, I did myself try compile it. 
  However, unlike the original poster who said he did so on SunOS 4.8, I 
  did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
  share the diff that piled up so far. It needs a lot of hacks on the 
  Solaris side - prioritizing GNU names, then, second, gnu ld has a 
  glitch, then, gcc has a missing file... it's fun fun fun!
 
 Can I please have a signed-off version of this patch.
 
 _Are you sure_ you want all these hacks without further
 review from other people? Also note the patch is incomplete,
 for example I could not compile the acpi pieces because
 acsolaris.h -- which is referenced in the acpi includes --
 does not exist. (Yet another piece of software that has
 crossplatform compatibilty stuff, like XFS.)

The Signed-off-by: document the origin of the path.
I'm planning only to take the sensible bits of the patch anyway.

  --- linux-2.6.21-rc3.orig/include/linux/input.h2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/include/linux/input.h 2007-03-07 23:40:39.417339000 
  +0100
  @@ -16,7 +16,9 @@
   #include sys/time.h
   #include sys/ioctl.h
   #include sys/types.h
  -#include asm/types.h
  +#ifndef __sun__
  +# include asm/types.h
  +#endif
   #endif
 
 This is not a proper fix for sure. The problem lies in
 file2alias.c, see (your own) http://lkml.org/lkml/2007/3/8/339
I already committed my own fix - so this chunk can be ignored.

 
  Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
  ===
  --- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c  2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c   2007-03-07 
  23:28:35.659555000 +0100
  @@ -21,6 +21,7 @@
  along with this program; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
   
  +#include alloca.h
   #include stdio.h
   #include string.h
   #include stdlib.h
 
 This is however, is valid. Can I gave sign-offs for single hunks?
Agree and yes.

 
  Index: linux-2.6.21-rc3/scripts/kallsyms.c
  ===
  --- linux-2.6.21-rc3.orig/scripts/kallsyms.c   2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/kallsyms.c2007-03-07 23:46:46.249005000 
  +0100
  @@ -378,6 +378,40 @@
 table_cnt = pos;
   }
   
  +#ifdef __sun__
  +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
  +void *
  +memmem (haystack, haystack_len, needle, needle_len)
  + const void *haystack;
  +  return (void *) begin;
  +
  +  return NULL;
  +}
  +#endif
  +
   /* replace a given token in all the valid symbols. Use the sampled symbols
* to update the counts */
   static void compress_symbols(unsigned char *str, int idx)
 
 This one, I am just waiting for someone to object to the extra #if-#endif.
I was planning to ask Paulo if strstr could not be used - Paulo?

 
  Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
  ===
  --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile 2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/kconfig/Makefile  2007-03-07 
  23:21:19.730679000 +0100
  @@ -88,7 +88,7 @@
   HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
   HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
  $(HOSTCC))
   
  -HOST_EXTRACFLAGS += -DLOCALE
  +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
   
   PHONY += $(obj)/dochecklxdialog
   $(obj)/dochecklxdialog:
 
 The error message for this one was: stdbool.h only valid in C99 mode.
 Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
 know offhand who is right.
The -std= looks safe. The __EXTENSIONS__ part seems safe and needed after a bit 
googling.

 
  Index: linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h
  ===
  --- linux-2.6.21-rc3.orig/scripts/kconfig/lxdialog/dialog.h
  2007-03-07 05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/kconfig/lxdialog/dialog.h 2007-03-07 
  23:14:48.462956000 +0100
  @@ -222,3 +222,7 @@
*   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
*/
   #define M_EVENT (KEY_MAX+1)
  +
  +#ifndef KEY_RESIZE
  +# define KEY_RESIZE 0632
  +#endif
 
 Solaris only has curses, not ncurses. Consider this a supreme hack.
 In fact, menuconfig has some weird display errors still.
This hack looks OK to me.

 
  Index: linux-2.6.21-rc3/scripts/mod/file2alias.c
  ===
  --- linux-2.6.21-rc3.orig/scripts/mod/file2alias.c 

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-09 Thread Jan Engelhardt

On Mar 9 2007 23:23, Sam Ravnborg wrote:

Date: Fri, 9 Mar 2007 23:23:32 +0100
From: Sam Ravnborg [EMAIL PROTECTED]
To: Jan Engelhardt [EMAIL PROTECTED],
Paulo Marques [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED], Christoph Hellwig [EMAIL PROTECTED],
Deepak Saxena [EMAIL PROTECTED],
Andrew Morton [EMAIL PROTECTED], linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix building kernel under Solaris 11_snv


Reference: http://lkml.org/lkml/2007/3/8/368
Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]

Happy cherrypicking.
More comments below.

  Index: linux-2.6.21-rc3/scripts/kallsyms.c
  ===
  --- linux-2.6.21-rc3.orig/scripts/kallsyms.c  2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/kallsyms.c   2007-03-07 23:46:46.249005000 
  +0100
  @@ -378,6 +378,40 @@
table_cnt = pos;
   }
   
  +#ifdef __sun__
  +/* Return the first occurrence of NEEDLE in HAYSTACK.  */
  +void *
  +memmem (haystack, haystack_len, needle, needle_len)
  + const void *haystack;
  +  return (void *) begin;
  +
  +  return NULL;
  +}
  +#endif
  +
   /* replace a given token in all the valid symbols. Use the sampled 
  symbols
* to update the counts */
   static void compress_symbols(unsigned char *str, int idx)
 
 This one, I am just waiting for someone to object to the extra #if-#endif.

I was planning to ask Paulo if strstr could not be used - Paulo?

I am not sure, but I would tend to say no.

kallsyms.c:
p1 = table[i].sym;  

/* find the token on the symbol */  
p2 = memmem(p1, len, str, 2);   
if (!p2) continue;  

My first impression would be that 'p1' is a multi-nul-terminated string
array (foo\0bar\0next\0symbol\0...), much like the entire .strtab
section (I have not actually bothered to check, so it is a raw guess), and
I do not think strstr would replace memmem here if that was the case.

  Index: linux-2.6.21-rc3/scripts/kconfig/Makefile
  ===
  --- linux-2.6.21-rc3.orig/scripts/kconfig/Makefile2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/kconfig/Makefile 2007-03-07 
  23:21:19.730679000 +0100
  @@ -88,7 +88,7 @@
   HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
   HOST_LOADLIBES   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags 
  $(HOSTCC))
   
  -HOST_EXTRACFLAGS += -DLOCALE
  +HOST_EXTRACFLAGS += -DLOCALE -std=c99 -D__EXTENSIONS__
   
   PHONY += $(obj)/dochecklxdialog
   $(obj)/dochecklxdialog:
 
 The error message for this one was: stdbool.h only valid in C99 mode.
 Linux GCC 4.1.2 does not print that, Solaris GCC 3.4.3 does. I do not
 know offhand who is right.

The -std= looks safe. The __EXTENSIONS__ part seems safe and needed after a
bit googling.

Humm humm. Linux's /usr/include does not have any (glibc) file with the
string __EXTENSIONS__ in it. Though, the linux manpage for fileno() does
not mention fileno() conforming to anything. Under Linux, fileno() is
wrapped inside __USE_POSIX, and the comments in Solaris's headers also
indicate it is something posixy.

Perhaps have something like

#ifdef __sun__
#   define __EXTENSIONS__ 1
#endif

  Index: linux-2.6.21-rc3/scripts/mod/file2alias.c
  ===
  --- linux-2.6.21-rc3.orig/scripts/mod/file2alias.c2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/mod/file2alias.c 2007-03-07 
  23:41:23.772026000 +0100
  @@ -32,6 +32,8 @@
   typedef uint32_t __u32;
   typedef uint16_t __u16;
   typedef unsigned char__u8;
  +typedef int32_t  __s32;
  +typedef int16_t  __s16;
   
   /* Big exception to the don't include kernel headers into userspace, 
  which
* even potentially has different endianness and word sizes, since
 
 HAX.

This goes away when we do not include input.h I think.

Exactly.

  Index: linux-2.6.21-rc3/scripts/mod/modpost.h
  ===
  --- linux-2.6.21-rc3.orig/scripts/mod/modpost.h   2007-03-07 
  05:41:20.0 +0100
  +++ linux-2.6.21-rc3/scripts/mod/modpost.h2007-03-07 
  23:37:01.31529 +0100
  @@ -41,6 +41,11 @@
   #define ELF_R_TYPE  ELF64_R_TYPE
   #endif
   
  +#ifdef __sun__
  +typedef uint16_t Elf32_Section;
  +typedef uint16_t Elf64_Section;
  +#endif
  +
   /* The 64-bit MIPS ELF ABI uses an unusual reloc format. */
   typedef struct
   {
 
 More HAX because Sol does not have them :-(

Yup - but needed.

How much do we want to support Solaris anyway? It's like trying to make
ICC a thoroughly supported compiler. Hey, do we want to support GCC
compilation under

Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-08 Thread Jan Engelhardt

On Mar 8 2007 22:25, Sam Ravnborg wrote:
>Subject: Re: [PATCH] Fix building kernel under Solaris

Since Solaris seems to be on the run, I did myself try compile it. 
However, unlike the original poster who said he did so on SunOS 4.8, I 
did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
share the diff that piled up so far. It needs a lot of hacks on the 
Solaris side - prioritizing GNU names, then, second, gnu ld has a 
glitch, then, gcc has a missing file... it's fun fun fun!

Well, I will iterate the key problem with the missing file:

  *  include/linux/kernel.h (and many others) include 
 BUT - since we are using -nostdinc, /usr/include/stdarg.h is not
 considered. And gcc's stdarg.h (which lives at
 /usr/lib/gcc/i586-suse-linux/4.1.2/include/stdarg.h in Linux land)
 is missing in Solaris' GCC (which is version 3.4.3).

Hack #1:
ln -s \

/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/install-tools/include/stdarg.h \
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h

Hack #2: GNU programs...

mkdir -p ~/gnulink;
for i in addr2line ar as egrep grep ld make nm objcopy objdump \
  ranlib readelf size string strip tar; do
ln -s "/usr/sfw/bin/$i" "~/gnulink/$i";
done;

for i in cat chgrp chmod chown chroot cksum cmp cp cut date \
  dd df diff du echo env expand expr false fgrep find fold \
  getopt groups head hostid install join ln locate ls mkdir \
  mkfifo mknod mv nice nohup od pwd rm rmdir sed seq shred \
  sleep sort split stty tac tail tee touch tr true uname \
  uniq uptime wc who whoami xargs yes gawk; do
ln -s "/opt/csw/bin/$i" "~/gnulink/$i";
done;

Hack #3: Diff file...

Hack #4: GNU ld glitch workaround (GNU ld looks in the current dir...)

cd linux-2.6.21-rc3
ln -s /usr/sfw/i386-sun-solaris2.11/lib/ldscripts ldscripts

Fun #1:

export PATH="$HOME/gnulink:$PATH";
make ARCH=i386

Oddity #1:

ARCH=i386 required because the Makefiles seem to use `uname -m`
(which returns "i86pc") rather than `uname -p`. I think we are
at odds here though...

uname -muname -p
SOL i86pc   i386
LINUX   i686athlon


Expect compiler failures, especially with assembler code.


Jan

<<< PATCH BELOW <<<

Index: linux-2.6.21-rc3/include/linux/input.h
===
--- linux-2.6.21-rc3.orig/include/linux/input.h 2007-03-07 05:41:20.0 
+0100
+++ linux-2.6.21-rc3/include/linux/input.h  2007-03-07 23:40:39.417339000 
+0100
@@ -16,7 +16,9 @@
 #include 
 #include 
 #include 
-#include 
+#ifndef __sun__
+#  include 
+#endif
 #endif
 
 /*
Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
===
--- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c   2007-03-07 
05:41:20.0 +0100
+++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c2007-03-07 
23:28:35.659555000 +0100
@@ -21,6 +21,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include 
 #include 
 #include 
 #include 
Index: linux-2.6.21-rc3/scripts/kallsyms.c
===
--- linux-2.6.21-rc3.orig/scripts/kallsyms.c2007-03-07 05:41:20.0 
+0100
+++ linux-2.6.21-rc3/scripts/kallsyms.c 2007-03-07 23:46:46.249005000 +0100
@@ -378,6 +378,40 @@
table_cnt = pos;
 }
 
+#ifdef __sun__
+/* Return the first occurrence of NEEDLE in HAYSTACK.  */
+void *
+memmem (haystack, haystack_len, needle, needle_len)
+ const void *haystack;
+ size_t haystack_len;
+ const void *needle;
+ size_t needle_len;
+{
+  const char *begin;
+  const char *const last_possible
+= (const char *) haystack + haystack_len - needle_len;
+
+  if (needle_len == 0)
+/* The first occurrence of the empty string is deemed to occur at
+   the beginning of the string.  */
+return (void *) haystack;
+
+  /* Sanity check, otherwise the loop might search through the whole
+ memory.  */
+  if (__builtin_expect (haystack_len < needle_len, 0))
+return NULL;
+
+  for (begin = (const char *) haystack; begin <= last_possible; ++begin)
+if (begin[0] == ((const char *) needle)[0] &&
+!memcmp ((const void *) [1],
+ (const void *) ((const char *) needle + 1),
+ needle_len - 1))
+  return (void *) begin;
+
+  return NULL;
+}
+#endif
+
 /* replace a given token in all the valid symbols. Use the sampled symbols
  * to update the counts */
 static void compress_symbols(unsigned char *str, int idx)
Index: linux-2.6.21-rc3/scripts/kconfig/Makefil

Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Sam Ravnborg
On Thu, Mar 08, 2007 at 09:43:46PM +0100, Jan Engelhardt wrote:
> 
> On Mar 8 2007 08:35, Christoph Hellwig wrote:
> >On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
> >> 
> >> On Mar 7 2007 09:42, Christoph Hellwig wrote:
> >> >>  #include 
> >> >>  #include 
> >> >>  #include 
> >> >> +#ifndef __sun__
> >> >>  #include 
> >> >>  #endif
> >> >> +#endif
> >> >
> >> >So if solaris doesn't need it, why do we need it on Linux?
> >> 
> >> For __s32 and __s16.
> >
> >We shouldn't use those from asm/types.h on Linux either, but
> >get them consitantly by defining them to the C99 or BSD types
> >from the libc headers.
> 
> It's a bit icky. file2alias.c includes "../../include/linux/input.h" and it is
> _input.h_ that requires __s16/__s32 and hence includes .
> If you ask me, it's file2alias.c that's broken.
Took a closer look and agree on that.
I have queued up below patch to fix it.
I expect to see an updated patch on the other issues from Deepak.

Sam

diff --git a/include/linux/input.h b/include/linux/input.h
index bde65c8..13d510c 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1010,6 +1010,10 @@ struct input_dev {
 #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
 #endif
 
+#if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING
+#error "KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not 
match"
+#endif
+
 #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
 #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
 #endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e0c393c..5e89204 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -262,6 +262,7 @@ struct i2c_device_id {
 
 /* Input */
 #define INPUT_DEVICE_ID_EV_MAX 0x1f
+#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING0x71
 #define INPUT_DEVICE_ID_KEY_MAX0x1ff
 #define INPUT_DEVICE_ID_REL_MAX0x0f
 #define INPUT_DEVICE_ID_ABS_MAX0x3f
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f61c9cc..96319eb 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -37,7 +37,6 @@ typedef unsigned char __u8;
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
 #include "../../include/linux/mod_devicetable.h"
-#include "../../include/linux/input.h"
 
 #define ADD(str, sep, cond, field)  \
 do {\
@@ -416,31 +415,33 @@ static int do_input_entry(const char *filename, struct 
input_device_id *id,
 
sprintf(alias + strlen(alias), "-e*");
if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT)
-   do_input(alias, id->evbit, 0, EV_MAX);
+   do_input(alias, id->evbit, 0, INPUT_DEVICE_ID_EV_MAX);
sprintf(alias + strlen(alias), "k*");
if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT)
-   do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX);
+   do_input(alias, id->keybit,
+INPUT_DEVICE_ID_KEY_MIN_INTERESTING,
+INPUT_DEVICE_ID_KEY_MAX);
sprintf(alias + strlen(alias), "r*");
if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT)
-   do_input(alias, id->relbit, 0, REL_MAX);
+   do_input(alias, id->relbit, 0, INPUT_DEVICE_ID_REL_MAX);
sprintf(alias + strlen(alias), "a*");
if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT)
-   do_input(alias, id->absbit, 0, ABS_MAX);
+   do_input(alias, id->absbit, 0, INPUT_DEVICE_ID_ABS_MAX);
sprintf(alias + strlen(alias), "m*");
if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT)
-   do_input(alias, id->mscbit, 0, MSC_MAX);
+   do_input(alias, id->mscbit, 0, INPUT_DEVICE_ID_MSC_MAX);
sprintf(alias + strlen(alias), "l*");
if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT)
-   do_input(alias, id->ledbit, 0, LED_MAX);
+   do_input(alias, id->ledbit, 0, INPUT_DEVICE_ID_LED_MAX);
sprintf(alias + strlen(alias), "s*");
if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT)
-   do_input(alias, id->sndbit, 0, SND_MAX);
+   do_input(alias, id->sndbit, 0, INPUT_DEVICE_ID_SND_MAX);
sprintf(alias + strlen(alias), "f*");
if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT)
-   do_input(alias, id->ffbit, 0, FF_MAX);
+   do_input(alias, id->ffbit, 0, INPUT_DEVICE_ID_FF_MAX);
sprintf(alias + strlen(alias), "w*");
if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT)
-   do_input(alias, id->swbit, 0, SW_MAX);
+   do_input(alias, id->swbit, 0, INPUT_DEVICE_ID_SW_MAX);
return 1;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  

Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Jan Engelhardt

On Mar 8 2007 08:35, Christoph Hellwig wrote:
>On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
>> 
>> On Mar 7 2007 09:42, Christoph Hellwig wrote:
>> >>  #include 
>> >>  #include 
>> >>  #include 
>> >> +#ifndef __sun__
>> >>  #include 
>> >>  #endif
>> >> +#endif
>> >
>> >So if solaris doesn't need it, why do we need it on Linux?
>> 
>> For __s32 and __s16.
>
>We shouldn't use those from asm/types.h on Linux either, but
>get them consitantly by defining them to the C99 or BSD types
>from the libc headers.

It's a bit icky. file2alias.c includes "../../include/linux/input.h" and it is
_input.h_ that requires __s16/__s32 and hence includes .
If you ask me, it's file2alias.c that's broken.


Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Christoph Hellwig
On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
> 
> On Mar 7 2007 09:42, Christoph Hellwig wrote:
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#ifndef __sun__
> >>  #include 
> >>  #endif
> >> +#endif
> >
> >So if solaris doesn't need it, why do we need it on Linux?
> 
> For __s32 and __s16.

We shouldn't use those from asm/types.h on Linux either, but
get them consitantly by defining them to the C99 or BSD types
from the libc headers.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Jan Engelhardt

On Mar 8 2007 08:35, Christoph Hellwig wrote:
On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
 
 On Mar 7 2007 09:42, Christoph Hellwig wrote:
   #include sys/time.h
   #include sys/ioctl.h
   #include sys/types.h
  +#ifndef __sun__
   #include asm/types.h
   #endif
  +#endif
 
 So if solaris doesn't need it, why do we need it on Linux?
 
 For __s32 and __s16.

We shouldn't use those from asm/types.h on Linux either, but
get them consitantly by defining them to the C99 or BSD types
from the libc headers.

It's a bit icky. file2alias.c includes ../../include/linux/input.h and it is
_input.h_ that requires __s16/__s32 and hence includes asm/types.h.
If you ask me, it's file2alias.c that's broken.


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Sam Ravnborg
On Thu, Mar 08, 2007 at 09:43:46PM +0100, Jan Engelhardt wrote:
 
 On Mar 8 2007 08:35, Christoph Hellwig wrote:
 On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
  
  On Mar 7 2007 09:42, Christoph Hellwig wrote:
#include sys/time.h
#include sys/ioctl.h
#include sys/types.h
   +#ifndef __sun__
#include asm/types.h
#endif
   +#endif
  
  So if solaris doesn't need it, why do we need it on Linux?
  
  For __s32 and __s16.
 
 We shouldn't use those from asm/types.h on Linux either, but
 get them consitantly by defining them to the C99 or BSD types
 from the libc headers.
 
 It's a bit icky. file2alias.c includes ../../include/linux/input.h and it is
 _input.h_ that requires __s16/__s32 and hence includes asm/types.h.
 If you ask me, it's file2alias.c that's broken.
Took a closer look and agree on that.
I have queued up below patch to fix it.
I expect to see an updated patch on the other issues from Deepak.

Sam

diff --git a/include/linux/input.h b/include/linux/input.h
index bde65c8..13d510c 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1010,6 +1010,10 @@ struct input_dev {
 #error EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match
 #endif
 
+#if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING
+#error KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not 
match
+#endif
+
 #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
 #error KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match
 #endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e0c393c..5e89204 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -262,6 +262,7 @@ struct i2c_device_id {
 
 /* Input */
 #define INPUT_DEVICE_ID_EV_MAX 0x1f
+#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING0x71
 #define INPUT_DEVICE_ID_KEY_MAX0x1ff
 #define INPUT_DEVICE_ID_REL_MAX0x0f
 #define INPUT_DEVICE_ID_ABS_MAX0x3f
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f61c9cc..96319eb 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -37,7 +37,6 @@ typedef unsigned char __u8;
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
 #include ../../include/linux/mod_devicetable.h
-#include ../../include/linux/input.h
 
 #define ADD(str, sep, cond, field)  \
 do {\
@@ -416,31 +415,33 @@ static int do_input_entry(const char *filename, struct 
input_device_id *id,
 
sprintf(alias + strlen(alias), -e*);
if (id-flags  INPUT_DEVICE_ID_MATCH_EVBIT)
-   do_input(alias, id-evbit, 0, EV_MAX);
+   do_input(alias, id-evbit, 0, INPUT_DEVICE_ID_EV_MAX);
sprintf(alias + strlen(alias), k*);
if (id-flags  INPUT_DEVICE_ID_MATCH_KEYBIT)
-   do_input(alias, id-keybit, KEY_MIN_INTERESTING, KEY_MAX);
+   do_input(alias, id-keybit,
+INPUT_DEVICE_ID_KEY_MIN_INTERESTING,
+INPUT_DEVICE_ID_KEY_MAX);
sprintf(alias + strlen(alias), r*);
if (id-flags  INPUT_DEVICE_ID_MATCH_RELBIT)
-   do_input(alias, id-relbit, 0, REL_MAX);
+   do_input(alias, id-relbit, 0, INPUT_DEVICE_ID_REL_MAX);
sprintf(alias + strlen(alias), a*);
if (id-flags  INPUT_DEVICE_ID_MATCH_ABSBIT)
-   do_input(alias, id-absbit, 0, ABS_MAX);
+   do_input(alias, id-absbit, 0, INPUT_DEVICE_ID_ABS_MAX);
sprintf(alias + strlen(alias), m*);
if (id-flags  INPUT_DEVICE_ID_MATCH_MSCIT)
-   do_input(alias, id-mscbit, 0, MSC_MAX);
+   do_input(alias, id-mscbit, 0, INPUT_DEVICE_ID_MSC_MAX);
sprintf(alias + strlen(alias), l*);
if (id-flags  INPUT_DEVICE_ID_MATCH_LEDBIT)
-   do_input(alias, id-ledbit, 0, LED_MAX);
+   do_input(alias, id-ledbit, 0, INPUT_DEVICE_ID_LED_MAX);
sprintf(alias + strlen(alias), s*);
if (id-flags  INPUT_DEVICE_ID_MATCH_SNDBIT)
-   do_input(alias, id-sndbit, 0, SND_MAX);
+   do_input(alias, id-sndbit, 0, INPUT_DEVICE_ID_SND_MAX);
sprintf(alias + strlen(alias), f*);
if (id-flags  INPUT_DEVICE_ID_MATCH_FFBIT)
-   do_input(alias, id-ffbit, 0, FF_MAX);
+   do_input(alias, id-ffbit, 0, INPUT_DEVICE_ID_FF_MAX);
sprintf(alias + strlen(alias), w*);
if (id-flags  INPUT_DEVICE_ID_MATCH_SWBIT)
-   do_input(alias, id-swbit, 0, SW_MAX);
+   do_input(alias, id-swbit, 0, INPUT_DEVICE_ID_SW_MAX);
return 1;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris 11_snv

2007-03-08 Thread Jan Engelhardt

On Mar 8 2007 22:25, Sam Ravnborg wrote:
Subject: Re: [PATCH] Fix building kernel under Solaris

Since Solaris seems to be on the run, I did myself try compile it. 
However, unlike the original poster who said he did so on SunOS 4.8, I 
did it on 5.11_snv39, yielding a bigger changeset. I thought I just 
share the diff that piled up so far. It needs a lot of hacks on the 
Solaris side - prioritizing GNU names, then, second, gnu ld has a 
glitch, then, gcc has a missing file... it's fun fun fun!

Well, I will iterate the key problem with the missing file:

  *  include/linux/kernel.h (and many others) include stdarg.h
 BUT - since we are using -nostdinc, /usr/include/stdarg.h is not
 considered. And gcc's stdarg.h (which lives at
 /usr/lib/gcc/i586-suse-linux/4.1.2/include/stdarg.h in Linux land)
 is missing in Solaris' GCC (which is version 3.4.3).

Hack #1:
ln -s \

/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/install-tools/include/stdarg.h \
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h

Hack #2: GNU programs...

mkdir -p ~/gnulink;
for i in addr2line ar as egrep grep ld make nm objcopy objdump \
  ranlib readelf size string strip tar; do
ln -s /usr/sfw/bin/$i ~/gnulink/$i;
done;

for i in cat chgrp chmod chown chroot cksum cmp cp cut date \
  dd df diff du echo env expand expr false fgrep find fold \
  getopt groups head hostid install join ln locate ls mkdir \
  mkfifo mknod mv nice nohup od pwd rm rmdir sed seq shred \
  sleep sort split stty tac tail tee touch tr true uname \
  uniq uptime wc who whoami xargs yes gawk; do
ln -s /opt/csw/bin/$i ~/gnulink/$i;
done;

Hack #3: Diff file...

Hack #4: GNU ld glitch workaround (GNU ld looks in the current dir...)

cd linux-2.6.21-rc3
ln -s /usr/sfw/i386-sun-solaris2.11/lib/ldscripts ldscripts

Fun #1:

export PATH=$HOME/gnulink:$PATH;
make ARCH=i386

Oddity #1:

ARCH=i386 required because the Makefiles seem to use `uname -m`
(which returns i86pc) rather than `uname -p`. I think we are
at odds here though...

uname -muname -p
SOL i86pc   i386
LINUX   i686athlon


Expect compiler failures, especially with assembler code.


Jan

 PATCH BELOW 

Index: linux-2.6.21-rc3/include/linux/input.h
===
--- linux-2.6.21-rc3.orig/include/linux/input.h 2007-03-07 05:41:20.0 
+0100
+++ linux-2.6.21-rc3/include/linux/input.h  2007-03-07 23:40:39.417339000 
+0100
@@ -16,7 +16,9 @@
 #include sys/time.h
 #include sys/ioctl.h
 #include sys/types.h
-#include asm/types.h
+#ifndef __sun__
+#  include asm/types.h
+#endif
 #endif
 
 /*
Index: linux-2.6.21-rc3/scripts/genksyms/genksyms.c
===
--- linux-2.6.21-rc3.orig/scripts/genksyms/genksyms.c   2007-03-07 
05:41:20.0 +0100
+++ linux-2.6.21-rc3/scripts/genksyms/genksyms.c2007-03-07 
23:28:35.659555000 +0100
@@ -21,6 +21,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include alloca.h
 #include stdio.h
 #include string.h
 #include stdlib.h
Index: linux-2.6.21-rc3/scripts/kallsyms.c
===
--- linux-2.6.21-rc3.orig/scripts/kallsyms.c2007-03-07 05:41:20.0 
+0100
+++ linux-2.6.21-rc3/scripts/kallsyms.c 2007-03-07 23:46:46.249005000 +0100
@@ -378,6 +378,40 @@
table_cnt = pos;
 }
 
+#ifdef __sun__
+/* Return the first occurrence of NEEDLE in HAYSTACK.  */
+void *
+memmem (haystack, haystack_len, needle, needle_len)
+ const void *haystack;
+ size_t haystack_len;
+ const void *needle;
+ size_t needle_len;
+{
+  const char *begin;
+  const char *const last_possible
+= (const char *) haystack + haystack_len - needle_len;
+
+  if (needle_len == 0)
+/* The first occurrence of the empty string is deemed to occur at
+   the beginning of the string.  */
+return (void *) haystack;
+
+  /* Sanity check, otherwise the loop might search through the whole
+ memory.  */
+  if (__builtin_expect (haystack_len  needle_len, 0))
+return NULL;
+
+  for (begin = (const char *) haystack; begin = last_possible; ++begin)
+if (begin[0] == ((const char *) needle)[0] 
+!memcmp ((const void *) begin[1],
+ (const void *) ((const char *) needle + 1),
+ needle_len - 1))
+  return (void *) begin;
+
+  return NULL;
+}
+#endif
+
 /* replace a given token in all the valid symbols. Use the sampled symbols
  * to update the counts */
 static void compress_symbols(unsigned char *str, int idx)
Index: linux-2.6.21-rc3/scripts/kconfig/Makefile

Re: [PATCH] Fix building kernel under Solaris

2007-03-08 Thread Christoph Hellwig
On Wed, Mar 07, 2007 at 11:45:11PM +0100, Jan Engelhardt wrote:
 
 On Mar 7 2007 09:42, Christoph Hellwig wrote:
   #include sys/time.h
   #include sys/ioctl.h
   #include sys/types.h
  +#ifndef __sun__
   #include asm/types.h
   #endif
  +#endif
 
 So if solaris doesn't need it, why do we need it on Linux?
 
 For __s32 and __s16.

We shouldn't use those from asm/types.h on Linux either, but
get them consitantly by defining them to the C99 or BSD types
from the libc headers.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-07 Thread Jan Engelhardt

On Mar 7 2007 09:42, Christoph Hellwig wrote:
>>  #include 
>>  #include 
>>  #include 
>> +#ifndef __sun__
>>  #include 
>>  #endif
>> +#endif
>
>So if solaris doesn't need it, why do we need it on Linux?

For __s32 and __s16.


Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-07 Thread Christoph Hellwig
On Tue, Mar 06, 2007 at 10:09:40AM -0800, Deepak Saxena wrote:
> @@ -16,8 +16,10 @@
>  #include 
>  #include 
>  #include 
> +#ifndef __sun__
>  #include 
>  #endif
> +#endif

So if solaris doesn't need it, why do we need it on Linux?

> +/*
> + * Solaris does not strsep
> + */
> +#ifndef __sun__
>   while ((fname = strsep(, " ")) != NULL) {
>   if (!*fname)
>   continue;
> +#else
> + for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
> +#endif
>   if (!parse_source_files(fname, ))
>   goto release;
>   }

Please either provide a strsep for solaris, or use strtok unconditionally.
ut this ifdef mess is not acceptable.

>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-07 Thread Christoph Hellwig
On Tue, Mar 06, 2007 at 10:09:40AM -0800, Deepak Saxena wrote:
 @@ -16,8 +16,10 @@
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 +#ifndef __sun__
  #include asm/types.h
  #endif
 +#endif

So if solaris doesn't need it, why do we need it on Linux?

 +/*
 + * Solaris does not strsep
 + */
 +#ifndef __sun__
   while ((fname = strsep(sources,  )) != NULL) {
   if (!*fname)
   continue;
 +#else
 + for (fname = strtok(sources,  ); fname; fname = strtok(NULL,  )) {
 +#endif
   if (!parse_source_files(fname, md))
   goto release;
   }

Please either provide a strsep for solaris, or use strtok unconditionally.
ut this ifdef mess is not acceptable.


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-07 Thread Jan Engelhardt

On Mar 7 2007 09:42, Christoph Hellwig wrote:
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 +#ifndef __sun__
  #include asm/types.h
  #endif
 +#endif

So if solaris doesn't need it, why do we need it on Linux?

For __s32 and __s16.


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-06 Thread Sam Ravnborg
On Tue, Mar 06, 2007 at 10:09:40AM -0800, Deepak Saxena wrote:
> 
> Fix varous build breakages that occur when building on a Solaris system
> (SunOS 4.8 to be exact)
> 
> - No asm/types.h
> 
> - lpptest doesn't make sense on a Solaris host (this should really be
>   cross-built..)
> 
> - Need to define __s32 and __s16
> 
> - Need to define Elf32_Section and Elf64_Section
> 
> - Solaris does not provide strsep
> 
> Signed-off-by: Deepak Saxena <[EMAIL PROTECTED]>
> 
> 
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
> linux-2.6.18_pro500/include/linux/input.h
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
> 2007-03-05 21:54:45.0 -0800
> +++ linux-2.6.18_pro500/include/linux/input.h 2007-03-05 19:19:01.0 
> -0800
> @@ -16,8 +16,10 @@
>  #include 
>  #include 
>  #include 
> +#ifndef __sun__
>  #include 
>  #endif
> +#endif
Either we need it - or we do not need it - no?
So we can just kill the include.

>  
>  /*
>   * The event structure itself
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
> linux-2.6.18_pro500/scripts/Makefile
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile  
> 2007-03-05 21:54:43.0 -0800
> +++ linux-2.6.18_pro500/scripts/Makefile  2007-03-05 19:54:52.0 
> -0800
> @@ -12,10 +12,12 @@
>  hostprogs-$(CONFIG_VT)   += conmakehash
>  hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
>  hostprogs-$(CONFIG_IKCONFIG) += bin2c
> +HOST_OS := $(shell uname)
> +ifneq ($(HOST_OS),SunOS)
>  ifdef CONFIG_LPPTEST
>  hostprogs-y  += testlpp
>  endif
> -
> +endif
>  always   := $(hostprogs-y)
testlpp is not in mainline - what is it?
[downloading -mm now]

> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c  
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/file2alias.c  2007-03-05 
> 19:19:26.0 -0800
> @@ -29,6 +29,11 @@
>  
>  #include 
>  
> +#if defined(__sun__)
> +typedef int32_t  __s32;
> +typedef int16_t  __s16;
> +#endif
> +
>  #if defined(__CYGWIN__)
>  typedef __uint32_t   __u32;
>  #else
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
> linux-2.6.18_pro500/scripts/mod/modpost.h
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/modpost.h 2007-03-05 19:13:16.0 
> -0800
> @@ -15,6 +15,11 @@
>  
>  #include "elfconfig.h"
>  
> +#if defined(__sun__)
> +typedef uint16_t Elf32_Section;
> +typedef uint16_t Elf64_Section;
> +#endif
> +
>  #if KERNEL_ELFCLASS == ELFCLASS32
>  
>  #define Elf_EhdrElf32_Ehdr
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
> linux-2.6.18_pro500/scripts/mod/sumversion.c
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c  
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/sumversion.c  2007-03-05 
> 19:33:55.0 -0800
> @@ -1,6 +1,7 @@
>  #if defined(__sun__)
>  #include 
>  #include 
> +#include 
>  #elif defined(__CYGWIN__)
>  #include/* For ntohl/htonl */
>  #include 
> @@ -421,9 +422,16 @@
>   *end = '\0';
>  
>   md4_init();
> +/*
> + * Solaris does not strsep
> + */
> +#ifndef __sun__
>   while ((fname = strsep(, " ")) != NULL) {
>   if (!*fname)
>   continue;
> +#else
> + for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
> +#endif
>   if (!parse_source_files(fname, ))
>   goto release;
>   }
Why the ifdef - I assume it is always OK to use the latter version?
Please send next diff cc: to me (at least the parts that touches scripts/

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-06 Thread Deepak Saxena

SIGRETRACT

I have -rt merged into my tree so this won't apply cleanly to mainline.

~Deepak

On Mar 06 2007, at 10:09, Deepak Saxena was caught saying:
> 
> Fix varous build breakages that occur when building on a Solaris system
> (SunOS 4.8 to be exact)
> 
> - No asm/types.h
> 
> - lpptest doesn't make sense on a Solaris host (this should really be
>   cross-built..)
> 
> - Need to define __s32 and __s16
> 
> - Need to define Elf32_Section and Elf64_Section
> 
> - Solaris does not provide strsep
> 
> Signed-off-by: Deepak Saxena <[EMAIL PROTECTED]>
> 
> 
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
> linux-2.6.18_pro500/include/linux/input.h
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
> 2007-03-05 21:54:45.0 -0800
> +++ linux-2.6.18_pro500/include/linux/input.h 2007-03-05 19:19:01.0 
> -0800
> @@ -16,8 +16,10 @@
>  #include 
>  #include 
>  #include 
> +#ifndef __sun__
>  #include 
>  #endif
> +#endif
>  
>  /*
>   * The event structure itself
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
> linux-2.6.18_pro500/scripts/Makefile
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile  
> 2007-03-05 21:54:43.0 -0800
> +++ linux-2.6.18_pro500/scripts/Makefile  2007-03-05 19:54:52.0 
> -0800
> @@ -12,10 +12,12 @@
>  hostprogs-$(CONFIG_VT)   += conmakehash
>  hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
>  hostprogs-$(CONFIG_IKCONFIG) += bin2c
> +HOST_OS := $(shell uname)
> +ifneq ($(HOST_OS),SunOS)
>  ifdef CONFIG_LPPTEST
>  hostprogs-y  += testlpp
>  endif
> -
> +endif
>  always   := $(hostprogs-y)
>  
>  subdir-$(CONFIG_MODVERSIONS) += genksyms
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c 
> linux-2.6.18_pro500/scripts/mod/file2alias.c
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c  
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/file2alias.c  2007-03-05 
> 19:19:26.0 -0800
> @@ -29,6 +29,11 @@
>  
>  #include 
>  
> +#if defined(__sun__)
> +typedef int32_t  __s32;
> +typedef int16_t  __s16;
> +#endif
> +
>  #if defined(__CYGWIN__)
>  typedef __uint32_t   __u32;
>  #else
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
> linux-2.6.18_pro500/scripts/mod/modpost.h
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/modpost.h 2007-03-05 19:13:16.0 
> -0800
> @@ -15,6 +15,11 @@
>  
>  #include "elfconfig.h"
>  
> +#if defined(__sun__)
> +typedef uint16_t Elf32_Section;
> +typedef uint16_t Elf64_Section;
> +#endif
> +
>  #if KERNEL_ELFCLASS == ELFCLASS32
>  
>  #define Elf_EhdrElf32_Ehdr
> diff -uNr -X /home/src/dontdiff 
> /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
> linux-2.6.18_pro500/scripts/mod/sumversion.c
> --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c  
> 2007-03-05 21:54:42.0 -0800
> +++ linux-2.6.18_pro500/scripts/mod/sumversion.c  2007-03-05 
> 19:33:55.0 -0800
> @@ -1,6 +1,7 @@
>  #if defined(__sun__)
>  #include 
>  #include 
> +#include 
>  #elif defined(__CYGWIN__)
>  #include/* For ntohl/htonl */
>  #include 
> @@ -421,9 +422,16 @@
>   *end = '\0';
>  
>   md4_init();
> +/*
> + * Solaris does not strsep
> + */
> +#ifndef __sun__
>   while ((fname = strsep(, " ")) != NULL) {
>   if (!*fname)
>   continue;
> +#else
> + for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
> +#endif
>   if (!parse_source_files(fname, ))
>   goto release;
>   }
> 
> 
> -- 
> Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net
> 
> In the end, they will not say, "those were dark times,"  they will ask
> "why were their poets silent?" - Bertolt Brecht
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

In the end, they will not say, "those were dark times,"  they will ask
"why were their poets silent?" - Bertolt Brecht
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Fix building kernel under Solaris

2007-03-06 Thread Deepak Saxena

Fix varous build breakages that occur when building on a Solaris system
(SunOS 4.8 to be exact)

- No asm/types.h

- lpptest doesn't make sense on a Solaris host (this should really be
  cross-built..)

- Need to define __s32 and __s16

- Need to define Elf32_Section and Elf64_Section

- Solaris does not provide strsep

Signed-off-by: Deepak Saxena <[EMAIL PROTECTED]>


diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
linux-2.6.18_pro500/include/linux/input.h
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h   
2007-03-05 21:54:45.0 -0800
+++ linux-2.6.18_pro500/include/linux/input.h   2007-03-05 19:19:01.0 
-0800
@@ -16,8 +16,10 @@
 #include 
 #include 
 #include 
+#ifndef __sun__
 #include 
 #endif
+#endif
 
 /*
  * The event structure itself
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
linux-2.6.18_pro500/scripts/Makefile
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile
2007-03-05 21:54:43.0 -0800
+++ linux-2.6.18_pro500/scripts/Makefile2007-03-05 19:54:52.0 
-0800
@@ -12,10 +12,12 @@
 hostprogs-$(CONFIG_VT)   += conmakehash
 hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
 hostprogs-$(CONFIG_IKCONFIG) += bin2c
+HOST_OS := $(shell uname)
+ifneq ($(HOST_OS),SunOS)
 ifdef CONFIG_LPPTEST
 hostprogs-y  += testlpp
 endif
-
+endif
 always := $(hostprogs-y)
 
 subdir-$(CONFIG_MODVERSIONS) += genksyms
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c 
linux-2.6.18_pro500/scripts/mod/file2alias.c
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/file2alias.c2007-03-05 
19:19:26.0 -0800
@@ -29,6 +29,11 @@
 
 #include 
 
+#if defined(__sun__)
+typedef int32_t__s32;
+typedef int16_t__s16;
+#endif
+
 #if defined(__CYGWIN__)
 typedef __uint32_t __u32;
 #else
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
linux-2.6.18_pro500/scripts/mod/modpost.h
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h   
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/modpost.h   2007-03-05 19:13:16.0 
-0800
@@ -15,6 +15,11 @@
 
 #include "elfconfig.h"
 
+#if defined(__sun__)
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+#endif
+
 #if KERNEL_ELFCLASS == ELFCLASS32
 
 #define Elf_EhdrElf32_Ehdr
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
linux-2.6.18_pro500/scripts/mod/sumversion.c
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/sumversion.c2007-03-05 
19:33:55.0 -0800
@@ -1,6 +1,7 @@
 #if defined(__sun__)
 #include 
 #include 
+#include 
 #elif defined(__CYGWIN__)
 #include  /* For ntohl/htonl */
 #include 
@@ -421,9 +422,16 @@
*end = '\0';
 
md4_init();
+/*
+ * Solaris does not strsep
+ */
+#ifndef __sun__
while ((fname = strsep(, " ")) != NULL) {
if (!*fname)
continue;
+#else
+   for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
+#endif
if (!parse_source_files(fname, ))
goto release;
}


-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

In the end, they will not say, "those were dark times,"  they will ask
"why were their poets silent?" - Bertolt Brecht
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Fix building kernel under Solaris

2007-03-06 Thread Deepak Saxena

Fix varous build breakages that occur when building on a Solaris system
(SunOS 4.8 to be exact)

- No asm/types.h

- lpptest doesn't make sense on a Solaris host (this should really be
  cross-built..)

- Need to define __s32 and __s16

- Need to define Elf32_Section and Elf64_Section

- Solaris does not provide strsep

Signed-off-by: Deepak Saxena [EMAIL PROTECTED]


diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
linux-2.6.18_pro500/include/linux/input.h
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h   
2007-03-05 21:54:45.0 -0800
+++ linux-2.6.18_pro500/include/linux/input.h   2007-03-05 19:19:01.0 
-0800
@@ -16,8 +16,10 @@
 #include sys/time.h
 #include sys/ioctl.h
 #include sys/types.h
+#ifndef __sun__
 #include asm/types.h
 #endif
+#endif
 
 /*
  * The event structure itself
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
linux-2.6.18_pro500/scripts/Makefile
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile
2007-03-05 21:54:43.0 -0800
+++ linux-2.6.18_pro500/scripts/Makefile2007-03-05 19:54:52.0 
-0800
@@ -12,10 +12,12 @@
 hostprogs-$(CONFIG_VT)   += conmakehash
 hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
 hostprogs-$(CONFIG_IKCONFIG) += bin2c
+HOST_OS := $(shell uname)
+ifneq ($(HOST_OS),SunOS)
 ifdef CONFIG_LPPTEST
 hostprogs-y  += testlpp
 endif
-
+endif
 always := $(hostprogs-y)
 
 subdir-$(CONFIG_MODVERSIONS) += genksyms
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c 
linux-2.6.18_pro500/scripts/mod/file2alias.c
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/file2alias.c2007-03-05 
19:19:26.0 -0800
@@ -29,6 +29,11 @@
 
 #include ctype.h
 
+#if defined(__sun__)
+typedef int32_t__s32;
+typedef int16_t__s16;
+#endif
+
 #if defined(__CYGWIN__)
 typedef __uint32_t __u32;
 #else
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
linux-2.6.18_pro500/scripts/mod/modpost.h
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h   
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/modpost.h   2007-03-05 19:13:16.0 
-0800
@@ -15,6 +15,11 @@
 
 #include elfconfig.h
 
+#if defined(__sun__)
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+#endif
+
 #if KERNEL_ELFCLASS == ELFCLASS32
 
 #define Elf_EhdrElf32_Ehdr
diff -uNr -X /home/src/dontdiff 
/home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
linux-2.6.18_pro500/scripts/mod/sumversion.c
--- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c
2007-03-05 21:54:42.0 -0800
+++ linux-2.6.18_pro500/scripts/mod/sumversion.c2007-03-05 
19:33:55.0 -0800
@@ -1,6 +1,7 @@
 #if defined(__sun__)
 #include netinet/in.h
 #include inttypes.h
+#include limits.h
 #elif defined(__CYGWIN__)
 #include asm/byteorder.h /* For ntohl/htonl */
 #include limits.h
@@ -421,9 +422,16 @@
*end = '\0';
 
md4_init(md);
+/*
+ * Solaris does not strsep
+ */
+#ifndef __sun__
while ((fname = strsep(sources,  )) != NULL) {
if (!*fname)
continue;
+#else
+   for (fname = strtok(sources,  ); fname; fname = strtok(NULL,  )) {
+#endif
if (!parse_source_files(fname, md))
goto release;
}


-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

In the end, they will not say, those were dark times,  they will ask
why were their poets silent? - Bertolt Brecht
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-06 Thread Deepak Saxena

SIGRETRACT

I have -rt merged into my tree so this won't apply cleanly to mainline.

~Deepak

On Mar 06 2007, at 10:09, Deepak Saxena was caught saying:
 
 Fix varous build breakages that occur when building on a Solaris system
 (SunOS 4.8 to be exact)
 
 - No asm/types.h
 
 - lpptest doesn't make sense on a Solaris host (this should really be
   cross-built..)
 
 - Need to define __s32 and __s16
 
 - Need to define Elf32_Section and Elf64_Section
 
 - Solaris does not provide strsep
 
 Signed-off-by: Deepak Saxena [EMAIL PROTECTED]
 
 
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
 linux-2.6.18_pro500/include/linux/input.h
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
 2007-03-05 21:54:45.0 -0800
 +++ linux-2.6.18_pro500/include/linux/input.h 2007-03-05 19:19:01.0 
 -0800
 @@ -16,8 +16,10 @@
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 +#ifndef __sun__
  #include asm/types.h
  #endif
 +#endif
  
  /*
   * The event structure itself
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
 linux-2.6.18_pro500/scripts/Makefile
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile  
 2007-03-05 21:54:43.0 -0800
 +++ linux-2.6.18_pro500/scripts/Makefile  2007-03-05 19:54:52.0 
 -0800
 @@ -12,10 +12,12 @@
  hostprogs-$(CONFIG_VT)   += conmakehash
  hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
  hostprogs-$(CONFIG_IKCONFIG) += bin2c
 +HOST_OS := $(shell uname)
 +ifneq ($(HOST_OS),SunOS)
  ifdef CONFIG_LPPTEST
  hostprogs-y  += testlpp
  endif
 -
 +endif
  always   := $(hostprogs-y)
  
  subdir-$(CONFIG_MODVERSIONS) += genksyms
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c 
 linux-2.6.18_pro500/scripts/mod/file2alias.c
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c  
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/file2alias.c  2007-03-05 
 19:19:26.0 -0800
 @@ -29,6 +29,11 @@
  
  #include ctype.h
  
 +#if defined(__sun__)
 +typedef int32_t  __s32;
 +typedef int16_t  __s16;
 +#endif
 +
  #if defined(__CYGWIN__)
  typedef __uint32_t   __u32;
  #else
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
 linux-2.6.18_pro500/scripts/mod/modpost.h
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/modpost.h 2007-03-05 19:13:16.0 
 -0800
 @@ -15,6 +15,11 @@
  
  #include elfconfig.h
  
 +#if defined(__sun__)
 +typedef uint16_t Elf32_Section;
 +typedef uint16_t Elf64_Section;
 +#endif
 +
  #if KERNEL_ELFCLASS == ELFCLASS32
  
  #define Elf_EhdrElf32_Ehdr
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
 linux-2.6.18_pro500/scripts/mod/sumversion.c
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c  
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/sumversion.c  2007-03-05 
 19:33:55.0 -0800
 @@ -1,6 +1,7 @@
  #if defined(__sun__)
  #include netinet/in.h
  #include inttypes.h
 +#include limits.h
  #elif defined(__CYGWIN__)
  #include asm/byteorder.h   /* For ntohl/htonl */
  #include limits.h
 @@ -421,9 +422,16 @@
   *end = '\0';
  
   md4_init(md);
 +/*
 + * Solaris does not strsep
 + */
 +#ifndef __sun__
   while ((fname = strsep(sources,  )) != NULL) {
   if (!*fname)
   continue;
 +#else
 + for (fname = strtok(sources,  ); fname; fname = strtok(NULL,  )) {
 +#endif
   if (!parse_source_files(fname, md))
   goto release;
   }
 
 
 -- 
 Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net
 
 In the end, they will not say, those were dark times,  they will ask
 why were their poets silent? - Bertolt Brecht
 -
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

-- 
Deepak Saxena - [EMAIL PROTECTED] - http://www.plexity.net

In the end, they will not say, those were dark times,  they will ask
why were their poets silent? - Bertolt Brecht
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix building kernel under Solaris

2007-03-06 Thread Sam Ravnborg
On Tue, Mar 06, 2007 at 10:09:40AM -0800, Deepak Saxena wrote:
 
 Fix varous build breakages that occur when building on a Solaris system
 (SunOS 4.8 to be exact)
 
 - No asm/types.h
 
 - lpptest doesn't make sense on a Solaris host (this should really be
   cross-built..)
 
 - Need to define __s32 and __s16
 
 - Need to define Elf32_Section and Elf64_Section
 
 - Solaris does not provide strsep
 
 Signed-off-by: Deepak Saxena [EMAIL PROTECTED]
 
 
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
 linux-2.6.18_pro500/include/linux/input.h
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/include/linux/input.h 
 2007-03-05 21:54:45.0 -0800
 +++ linux-2.6.18_pro500/include/linux/input.h 2007-03-05 19:19:01.0 
 -0800
 @@ -16,8 +16,10 @@
  #include sys/time.h
  #include sys/ioctl.h
  #include sys/types.h
 +#ifndef __sun__
  #include asm/types.h
  #endif
 +#endif
Either we need it - or we do not need it - no?
So we can just kill the include.

  
  /*
   * The event structure itself
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile 
 linux-2.6.18_pro500/scripts/Makefile
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/Makefile  
 2007-03-05 21:54:43.0 -0800
 +++ linux-2.6.18_pro500/scripts/Makefile  2007-03-05 19:54:52.0 
 -0800
 @@ -12,10 +12,12 @@
  hostprogs-$(CONFIG_VT)   += conmakehash
  hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
  hostprogs-$(CONFIG_IKCONFIG) += bin2c
 +HOST_OS := $(shell uname)
 +ifneq ($(HOST_OS),SunOS)
  ifdef CONFIG_LPPTEST
  hostprogs-y  += testlpp
  endif
 -
 +endif
  always   := $(hostprogs-y)
testlpp is not in mainline - what is it?
[downloading -mm now]

 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/file2alias.c  
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/file2alias.c  2007-03-05 
 19:19:26.0 -0800
 @@ -29,6 +29,11 @@
  
  #include ctype.h
  
 +#if defined(__sun__)
 +typedef int32_t  __s32;
 +typedef int16_t  __s16;
 +#endif
 +
  #if defined(__CYGWIN__)
  typedef __uint32_t   __u32;
  #else
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
 linux-2.6.18_pro500/scripts/mod/modpost.h
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/modpost.h 
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/modpost.h 2007-03-05 19:13:16.0 
 -0800
 @@ -15,6 +15,11 @@
  
  #include elfconfig.h
  
 +#if defined(__sun__)
 +typedef uint16_t Elf32_Section;
 +typedef uint16_t Elf64_Section;
 +#endif
 +
  #if KERNEL_ELFCLASS == ELFCLASS32
  
  #define Elf_EhdrElf32_Ehdr
 diff -uNr -X /home/src/dontdiff 
 /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c 
 linux-2.6.18_pro500/scripts/mod/sumversion.c
 --- /home/src/mvista/kernel/PRO5-CLEAN/linux-2.6.18/scripts/mod/sumversion.c  
 2007-03-05 21:54:42.0 -0800
 +++ linux-2.6.18_pro500/scripts/mod/sumversion.c  2007-03-05 
 19:33:55.0 -0800
 @@ -1,6 +1,7 @@
  #if defined(__sun__)
  #include netinet/in.h
  #include inttypes.h
 +#include limits.h
  #elif defined(__CYGWIN__)
  #include asm/byteorder.h   /* For ntohl/htonl */
  #include limits.h
 @@ -421,9 +422,16 @@
   *end = '\0';
  
   md4_init(md);
 +/*
 + * Solaris does not strsep
 + */
 +#ifndef __sun__
   while ((fname = strsep(sources,  )) != NULL) {
   if (!*fname)
   continue;
 +#else
 + for (fname = strtok(sources,  ); fname; fname = strtok(NULL,  )) {
 +#endif
   if (!parse_source_files(fname, md))
   goto release;
   }
Why the ifdef - I assume it is always OK to use the latter version?
Please send next diff cc: to me (at least the parts that touches scripts/

Sam
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/