summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/Makefile3
-rw-r--r--tools/mkenvimage.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 8097d95..a7d1e18 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -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) $@
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index 5521268..4001d2f 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -46,6 +46,13 @@
#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));