public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peter Tyser <ptyser@xes-inc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 12/15] Add support for building native win32 tools
Date: Thu, 05 Mar 2009 12:32:27 -0600	[thread overview]
Message-ID: <1236277947.27449.2189.camel@localhost.localdomain> (raw)
In-Reply-To: <200903041921.21162.vapier@gentoo.org>

On Wed, 2009-03-04 at 19:21 -0500, Mike Frysinger wrote:
> On Wednesday 04 March 2009 18:33:02 Peter Tyser wrote:
> > --- a/README
> > +++ b/README
> > +      the tools directory you can use the MinGW toolchain
> > +      (http://www.mingw.org).  Set your HOST tools to the MinGW
> > +      binaries and execute 'make tools'.  For example:
> 
> binaries -> cross-compiler

I think binaries is more fitting than cross-compiler since the mingw
strip utility is also used.  In theory other HOST tools might be used
down the road.

> > --- a/include/linux/types.h
> > +++ b/include/linux/types.h
> > @@ -10,10 +10,13 @@
> >
> >  #ifndef __KERNEL_STRICT_NAMES
> >
> > +#ifndef __MINGW32__
> > +/* prevent mingw overlaps for certain typedefs */
> >  typedef __kernel_fd_set		fd_set;
> >  typedef __kernel_dev_t		dev_t;
> >  typedef __kernel_ino_t		ino_t;
> >  typedef __kernel_mode_t		mode_t;
> > +#endif
> >  typedef __kernel_nlink_t	nlink_t;
> >  typedef __kernel_off_t		off_t;
> >  typedef __kernel_pid_t		pid_t;
> > @@ -54,7 +57,7 @@ typedef __kernel_loff_t		loff_t;
> >  typedef __kernel_size_t		size_t;
> >  #endif
> >
> > -#ifndef _SSIZE_T
> > +#if !defined(_SSIZE_T) && !defined(__MINGW32__)
> >  #define _SSIZE_T
> >  typedef __kernel_ssize_t	ssize_t;
> >  #endif
> 
> perhaps we should be defining __KERNEL_STRICT_NAMES for host builds instead

I'll look into it.

> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -79,6 +79,14 @@ SFX =
> >  endif
> >
> >  #
> > +# mingw toolchain requires mingw_support.c and generates .exe files
> > +#
> > +ifneq (,$(findstring mingw,$(shell $(HOSTCC) -v 2>&1 | grep mingw)))
> > +MINGW_OBJ_FILES-y += mingw_support.o
> > +SFX = .exe
> > +endif
> 
> perhaps we should create a sfx.sh script which handles the logic of detecting 
> the default suffix.  would be a lot cleaner than relying on strings in 
> toolchain names.

The above looks at the output of the "HOSTCC -v" command.  The "Target:
XXX" strings should contain mingw regardless of the naming of HOSTCC.
How about combining the SFX detection into:


ifeq ($(HOSTOS),cygwin)
HOST_CFLAGS += -ansi
endif

#
# toolchains targeting win32 generate .exe files
#
ifneq (,$(findstring WIN32 ,$(shell echo "" | $(HOSTCC) -E -dM -)))
SFX = .exe
else
SFX =
endif

> > +void *mmap(void *addr, size_t len, int prot, int flags, int fd, int
> > offset) +{
> 
> this is a pretty na?ve implementation ... but it seems like for u-boot's 
> usage, it should be complete ?

I hope:)  It looks sufficient based on my limited win32 programming
knowledge and I tested the resulting mkimage.exe to validate its
functionality.

> > --- a/tools/mkimage.c
> > +++ b/tools/mkimage.c
> > @@ -25,6 +25,10 @@
> > +#ifdef __MINGW32__
> > +#include "mingw_support.h"
> > +#endif
> > --- a/tools/mkimage.h
> > +++ b/tools/mkimage.h
> > @@ -28,7 +28,11 @@
> >  #ifndef __WIN32__
> >  #include <netinet/in.h>		/* for host / network byte order conversions	*/
> >  #endif
> > +#ifdef __MINGW32__
> > +#include <stdint.h>
> > +#else
> >  #include <sys/mman.h>
> > +#endif
> 
> why not move the mingw_support.h to mkimage.h ... then you wont have to touch 
> mkimage.c.  or create a new "os_support.h" header and move these differences 
> there.  then you wont have to copy & paste the same code to every tool that 
> uses mmap().

I'll implement the os_support.[ch] idea as suggested.

Best,
Peter

  reply	other threads:[~2009-03-05 18:32 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 23:32 [U-Boot] [PATCH 00/15] tools/Makefile cleanup and win32 tool support Peter Tyser
2009-03-04 23:32 ` [U-Boot] [PATCH 01/15] tools/Makefile: Remove inappropriate double-tabs Peter Tyser
2009-03-04 23:32   ` [U-Boot] [PATCH 02/15] tools/Makefile: Split variable declarations into multiple lines Peter Tyser
2009-03-04 23:32     ` [U-Boot] [PATCH 03/15] tools/Makefile: Build bmp_logo only when LCD or VIDEO logos are enabled Peter Tyser
2009-03-04 23:32       ` [U-Boot] [PATCH 04/15] tools/Makefile: Make img2srec dependent upon CONFIG_CMD_LOADS Peter Tyser
2009-03-04 23:32         ` [U-Boot] [PATCH 05/15] tools/Makefile: Make ubsha1 dependent upon CONFIG_SHA1_CHECK_UB_IMG Peter Tyser
2009-03-04 23:32           ` [U-Boot] [PATCH 06/15] tools/Makefile: Make inca-swap-bytes dependent on CONFIG_INCA_IP Peter Tyser
2009-03-04 23:32             ` [U-Boot] [PATCH 07/15] tools/Makefile: Make envcrc dependent upon CONFIG_ENV_IS_EMBEDDED Peter Tyser
2009-03-04 23:32               ` [U-Boot] [PATCH 08/15] tools/Makefile: Make gen_eth_addr dependent upon CONFIG_CMD_NET Peter Tyser
2009-03-04 23:32                 ` [U-Boot] [PATCH 09/15] tools/Makefile: Compile ncb when CONFIG_NETCONSOLE Peter Tyser
2009-03-04 23:33                   ` [U-Boot] [PATCH 10/15] gen_eth_addr: Use POSIX rand() and srand() Peter Tyser
2009-03-04 23:33                     ` [U-Boot] [PATCH 11/15] elf.h: Add missing int32_t typedef for WIN32 compilers Peter Tyser
2009-03-04 23:33                       ` [U-Boot] [PATCH 12/15] Add support for building native win32 tools Peter Tyser
2009-03-04 23:33                         ` [U-Boot] [PATCH 13/15] Makefile: Add removal of *.exe file to clean target Peter Tyser
2009-03-04 23:33                           ` [U-Boot] [PATCH 14/15] Deleted unused tools/Makefile.win32 Peter Tyser
2009-03-04 23:33                             ` [U-Boot] [PATCH 15/15] common/Makefile: Conditionally compile env_embedded.o Peter Tyser
2009-04-03 22:38                               ` Wolfgang Denk
2009-03-05  0:08                             ` [U-Boot] [PATCH 14/15] Deleted unused tools/Makefile.win32 Mike Frysinger
2009-04-03 22:37                             ` Wolfgang Denk
2009-04-03 22:37                           ` [U-Boot] [PATCH 13/15] Makefile: Add removal of *.exe file to clean target Wolfgang Denk
2009-03-05  0:21                         ` [U-Boot] [PATCH 12/15] Add support for building native win32 tools Mike Frysinger
2009-03-05 18:32                           ` Peter Tyser [this message]
2009-03-05 20:06                             ` Mike Frysinger
2009-04-03 22:36                         ` Wolfgang Denk
2009-03-04 23:54                       ` [U-Boot] [PATCH 11/15] elf.h: Add missing int32_t typedef for WIN32 compilers Mike Frysinger
2009-03-05  0:14                         ` Peter Tyser
2009-04-03 22:34                       ` Wolfgang Denk
2009-03-04 23:53                     ` [U-Boot] [PATCH 10/15] gen_eth_addr: Use POSIX rand() and srand() Mike Frysinger
2009-04-03 22:31                       ` Wolfgang Denk
2009-04-03 22:31                     ` Wolfgang Denk
2009-04-03 22:29                   ` [U-Boot] [PATCH 09/15] tools/Makefile: Compile ncb when CONFIG_NETCONSOLE Wolfgang Denk
2009-04-03 22:28                 ` [U-Boot] [PATCH 08/15] tools/Makefile: Make gen_eth_addr dependent upon CONFIG_CMD_NET Wolfgang Denk
2009-04-03 22:07               ` [U-Boot] [PATCH 07/15] tools/Makefile: Make envcrc dependent upon CONFIG_ENV_IS_EMBEDDED Wolfgang Denk
2009-04-03 22:06             ` [U-Boot] [PATCH 06/15] tools/Makefile: Make inca-swap-bytes dependent on CONFIG_INCA_IP Wolfgang Denk
2009-04-03 22:06           ` [U-Boot] [PATCH 05/15] tools/Makefile: Make ubsha1 dependent upon CONFIG_SHA1_CHECK_UB_IMG Wolfgang Denk
2009-04-03 22:05         ` [U-Boot] [PATCH 04/15] tools/Makefile: Make img2srec dependent upon CONFIG_CMD_LOADS Wolfgang Denk
2009-03-04 23:48       ` [U-Boot] [PATCH 03/15] tools/Makefile: Build bmp_logo only when LCD or VIDEO logos are enabled Mike Frysinger
2009-03-04 23:58         ` Peter Tyser
2009-03-05  0:22           ` Mike Frysinger
2009-03-08 22:51           ` Wolfgang Denk
2009-04-03 22:03       ` Wolfgang Denk
2009-04-03 22:02     ` [U-Boot] [PATCH 02/15] tools/Makefile: Split variable declarations into multiple lines Wolfgang Denk
2009-04-03 22:02   ` [U-Boot] [PATCH 01/15] tools/Makefile: Remove inappropriate double-tabs Wolfgang Denk
2009-03-05  0:27 ` [U-Boot] [PATCH 00/15] tools/Makefile cleanup and win32 tool support Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1236277947.27449.2189.camel@localhost.localdomain \
    --to=ptyser@xes-inc.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox