From 04387d24a17b1ee13024dd4779da4b84d47c65cc Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Sat, 27 Mar 2010 23:37:46 +0100 Subject: mkimage: fix Segmentation Fault when run without "-n name" option The restructuring of the mkimage command in commit 89a4d6b1 ("tools: mkimage: split code into core, default and FIT image specific") introduced a bug that caused mkimage to segfault when run without "-n name" option. Initialize the imagename entry to prevent that. Signed-off-by: Wolfgang Denk --- tools/mkimage.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/mkimage.c b/tools/mkimage.c index f71f8e7..5c3e872 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -37,6 +37,7 @@ struct mkimage_params params = { .type = IH_TYPE_KERNEL, .comp = IH_COMP_GZIP, .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, + .imagename = "", }; /* -- cgit v1.1 From a2513e27e8df2b7bf481d03e7719f91ce19e89d5 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Sun, 4 Apr 2010 22:36:03 -0500 Subject: mkimage: Fix strict-aliasing compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version 4.2.4 of gcc produces the following warnings without this change: mkimage.c: In function ‘main’: mkimage.c:204: warning: dereferencing type-punned pointer will break strict-aliasing rules mkimage.c:222: warning: dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Peter Tyser --- tools/mkimage.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/mkimage.c b/tools/mkimage.c index 5c3e872..f5859d7 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -145,7 +145,7 @@ main (int argc, char **argv) { int ifd = -1; struct stat sbuf; - unsigned char *ptr; + char *ptr; int retval = 0; struct image_type_params *tparams = NULL; @@ -201,8 +201,7 @@ main (int argc, char **argv) case 'a': if (--argc <= 0) usage (); - params.addr = strtoul (*++argv, - (char **)&ptr, 16); + params.addr = strtoul (*++argv, &ptr, 16); if (*ptr) { fprintf (stderr, "%s: invalid load address %s\n", @@ -219,8 +218,7 @@ main (int argc, char **argv) case 'e': if (--argc <= 0) usage (); - params.ep = strtoul (*++argv, - (char **)&ptr, 16); + params.ep = strtoul (*++argv, &ptr, 16); if (*ptr) { fprintf (stderr, "%s: invalid entry point %s\n", -- cgit v1.1 From 78acc472d9719316f22e002a009a998d9ceec29d Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 12 Apr 2010 22:28:05 -0500 Subject: Rename lib_generic/ to lib/ Now that the other architecture-specific lib directories have been moved out of the top-level directory there's not much reason to have the '_generic' suffix on the common lib directory. Signed-off-by: Peter Tyser --- tools/Makefile | 8 ++++---- tools/env/Makefile | 2 +- tools/imls/Makefile | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/Makefile b/tools/Makefile index 743505f..a6f11c9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -68,9 +68,9 @@ BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) # Source files which exist outside the tools directory EXT_OBJ_FILES-y += common/env_embedded.o EXT_OBJ_FILES-y += common/image.o -EXT_OBJ_FILES-y += lib_generic/crc32.o -EXT_OBJ_FILES-y += lib_generic/md5.o -EXT_OBJ_FILES-y += lib_generic/sha1.o +EXT_OBJ_FILES-y += lib/crc32.o +EXT_OBJ_FILES-y += lib/md5.o +EXT_OBJ_FILES-y += lib/sha1.o # Source files located in the tools directory OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o @@ -196,7 +196,7 @@ $(obj)ubsha1$(SFX): $(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o $(obj)%.o: $(SRCTREE)/common/%.c $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< -$(obj)%.o: $(SRCTREE)/lib_generic/%.c +$(obj)%.o: $(SRCTREE)/lib/%.c $(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $< $(obj)%.o: $(SRCTREE)/libfdt/%.c diff --git a/tools/env/Makefile b/tools/env/Makefile index 9629ee5..2df631e 100644 --- a/tools/env/Makefile +++ b/tools/env/Makefile @@ -41,7 +41,7 @@ clean: rm -f $(obj)fw_printenv $(obj)crc32.c $(obj)crc32.c: - ln -s $(src)../../lib_generic/crc32.c $(obj)crc32.c + ln -s $(src)../../lib/crc32.c $(obj)crc32.c ######################################################################### diff --git a/tools/imls/Makefile b/tools/imls/Makefile index 9b2afb0..82c2728 100644 --- a/tools/imls/Makefile +++ b/tools/imls/Makefile @@ -23,9 +23,9 @@ include $(TOPDIR)/config.mk BIN_FILES-y += imls # Source files which exist outside the tools/imls directory -EXT_OBJ_FILES-y += lib_generic/crc32.o -EXT_OBJ_FILES-y += lib_generic/md5.o -EXT_OBJ_FILES-y += lib_generic/sha1.o +EXT_OBJ_FILES-y += lib/crc32.o +EXT_OBJ_FILES-y += lib/md5.o +EXT_OBJ_FILES-y += lib/sha1.o EXT_OBJ_FILES-y += common/image.o # Source files located in the tools/imls directory @@ -78,7 +78,7 @@ $(obj)imls.o: $(SRCTREE)/tools/imls/imls.c $(obj)%.o: $(SRCTREE)/common/%.c $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< -$(obj)%.o: $(SRCTREE)/lib_generic/%.c +$(obj)%.o: $(SRCTREE)/lib/%.c $(CC) -g $(HOSTCFLAGS) -c -o $@ $< $(obj)%.o: $(SRCTREE)/libfdt/%.c -- cgit v1.1 From 0de71d507157c4bd4fddcd3a419140d2b986eed2 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 12 Apr 2010 22:28:06 -0500 Subject: Move libfdt/ into lib/ Move the libfdt directory into the common lib/ directory to clean up the top-level directory. Signed-off-by: Peter Tyser --- tools/Makefile | 6 +++--- tools/imls/Makefile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/Makefile b/tools/Makefile index a6f11c9..749d994 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -122,7 +122,7 @@ endif # now $(obj) is defined HOSTSRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c)) HOSTSRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c)) -HOSTSRCS += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) +HOSTSRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y))) LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) @@ -136,7 +136,7 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y)) HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -idirafter $(OBJTREE)/include2 \ -idirafter $(OBJTREE)/include \ - -I $(SRCTREE)/libfdt \ + -I $(SRCTREE)/lib/libfdt \ -I $(SRCTREE)/tools \ -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \ -D__KERNEL_STRICT_NAMES @@ -199,7 +199,7 @@ $(obj)%.o: $(SRCTREE)/common/%.c $(obj)%.o: $(SRCTREE)/lib/%.c $(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $< -$(obj)%.o: $(SRCTREE)/libfdt/%.c +$(obj)%.o: $(SRCTREE)/lib/libfdt/%.c $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< subdirs: diff --git a/tools/imls/Makefile b/tools/imls/Makefile index 82c2728..8407277 100644 --- a/tools/imls/Makefile +++ b/tools/imls/Makefile @@ -41,7 +41,7 @@ LIBFDT_OBJ_FILES-y += fdt_wip.o # now $(obj) is defined SRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c)) SRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c)) -SRCS += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) +SRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y))) LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) @@ -52,7 +52,7 @@ LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -idirafter $(OBJTREE)/include2 \ -idirafter $(OBJTREE)/include \ - -I $(SRCTREE)/libfdt \ + -I $(SRCTREE)/lib/libfdt \ -I $(SRCTREE)/tools \ -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES @@ -81,7 +81,7 @@ $(obj)%.o: $(SRCTREE)/common/%.c $(obj)%.o: $(SRCTREE)/lib/%.c $(CC) -g $(HOSTCFLAGS) -c -o $@ $< -$(obj)%.o: $(SRCTREE)/libfdt/%.c +$(obj)%.o: $(SRCTREE)/lib/libfdt/%.c $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< clean: -- cgit v1.1