]> git.sur5r.net Git - u-boot/commitdiff
tools: Fix mingw tools build
authorVladimir Yakovlev <nagos@inbox.ru>
Sat, 7 Jul 2012 10:05:06 +0000 (10:05 +0000)
committerWolfgang Denk <wd@denx.de>
Sun, 8 Jul 2012 20:41:19 +0000 (22:41 +0200)
mkenvimage does not build due to missed os_support.o and unsupported
file modes S_IRGRP S_IWGRP.
Tested with mingw 4.2.1 on ubuntu 12.04.

Signed-off-by: Vladimir Yakovlev <nagos@inbox.ru>
tools/Makefile
tools/mkenvimage.c

index 8097d9583b866a4863c0d60be3d95b2295d7220c..a7d1e18fe2a5fd425bd3177a2507da0df2e6c46b 100644 (file)
@@ -196,7 +196,8 @@ $(obj)xway-swap-bytes$(SFX):        $(obj)xway-swap-bytes.o
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
        $(HOSTSTRIP) $@
 
-$(obj)mkenvimage$(SFX):        $(obj)crc32.o $(obj)mkenvimage.o
+$(obj)mkenvimage$(SFX):        $(obj)crc32.o $(obj)mkenvimage.o \
+       $(obj)os_support.o
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
        $(HOSTSTRIP) $@
 
index 55212687e17d0162790002c1c3e5fffbfccb45ca..4001d2f517d78040653a2c51c5194e70552fc123 100644 (file)
 
 #define CRC_SIZE sizeof(uint32_t)
 
+#ifdef __MINGW32__
+#define FILE_PERM              (S_IRUSR | S_IWUSR)
+#else
+#define FILE_PERM              (S_IRUSR | S_IWUSR | S_IRGRP |\
+                                            S_IWGRP)
+#endif
+
 static void usage(const char *exec_name)
 {
        fprintf(stderr, "%s [-h] [-r] [-b] [-p <byte>] -s <environment partition size> -o <output> <input file>\n"
@@ -293,8 +300,7 @@ int main(int argc, char **argv)
        if (!bin_filename || strcmp(bin_filename, "-") == 0) {
                bin_fd = STDOUT_FILENO;
        } else {
-               bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP |
-                                            S_IWGRP);
+               bin_fd = creat(bin_filename, FILE_PERM);
                if (bin_fd == -1) {
                        fprintf(stderr, "Can't open output file \"%s\": %s\n",
                                        bin_filename, strerror(errno));