tools: Fix mingw tools build

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>
This commit is contained in:
Vladimir Yakovlev 2012-07-07 10:05:06 +00:00 committed by Wolfgang Denk
parent db7720bad4
commit 8b6a4952e6
2 changed files with 10 additions and 3 deletions

View file

@ -196,7 +196,8 @@ $(obj)xway-swap-bytes$(SFX): $(obj)xway-swap-bytes.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@ $(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 $@ $^ $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@ $(HOSTSTRIP) $@

View file

@ -46,6 +46,13 @@
#define CRC_SIZE sizeof(uint32_t) #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) static void usage(const char *exec_name)
{ {
fprintf(stderr, "%s [-h] [-r] [-b] [-p <byte>] -s <environment partition size> -o <output> <input file>\n" 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) { if (!bin_filename || strcmp(bin_filename, "-") == 0) {
bin_fd = STDOUT_FILENO; bin_fd = STDOUT_FILENO;
} else { } else {
bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | bin_fd = creat(bin_filename, FILE_PERM);
S_IWGRP);
if (bin_fd == -1) { if (bin_fd == -1) {
fprintf(stderr, "Can't open output file \"%s\": %s\n", fprintf(stderr, "Can't open output file \"%s\": %s\n",
bin_filename, strerror(errno)); bin_filename, strerror(errno));