public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 12/15] Add support for building native win32 tools
Date: Wed, 4 Mar 2009 19:21:20 -0500	[thread overview]
Message-ID: <200903041921.21162.vapier@gentoo.org> (raw)
In-Reply-To: <3c6c8b0c8a5a0dacbd19c414465b312cb0256a7d.1236207433.git.ptyser@xes-inc.com>

On Wednesday 04 March 2009 18:33:02 Peter Tyser wrote:
> --- a/README
> +++ b/README
> +Note: If you wish to generate WIN32 versions of the utilities in

WIN32 -> Windows

> +      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

> +      Binaries such as tools/mkimage.exe will be created which can
> +      be executed on computers using Windows.

using -> running

> --- 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

> --- 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.

as for the mingw_support.c, how about we create a new "os_support.c" file 
which is always compiled and in there we can do things like:
#ifdef MINGW
# include "mingw_support.c"
#elif .....
... other system warts ...
#endif

that would allow us to keep system-specific OBJ vars from popping up all over 
and having to constantly update the Makefile for them

> -$(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
> +$(LOGO_H):	$(obj)bmp_logo$(SFX) $(LOGO_BMP)

this is unrelated ... please move to a more appropriate patch and/or make it 
into its own

> +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 ?

> --- /dev/null
> +++ b/tools/mingw_support.h
> +/* Windows 64-bit access macros */
> +#define LODWORD(l) ((DWORD)((DWORDLONG)(l)))
> +#define HIDWORD(l) ((DWORD)(((DWORDLONG)(l)>>32)&0xFFFFFFFF))

ugh, this makes my eyes burn.  please change I to something that doesnt look 
like a bar (perhaps the common "x"), and add whitespace where appropriate.

> --- 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().
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090304/ec2416e5/attachment-0001.pgp 

  parent reply	other threads:[~2009-03-05  0:21 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                         ` Mike Frysinger [this message]
2009-03-05 18:32                           ` [U-Boot] [PATCH 12/15] Add support for building native win32 tools Peter Tyser
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=200903041921.21162.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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