* [PATCH] unbreak bootm @ 2010-10-13 9:54 Eric Bénard 2010-10-13 10:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 11:14 ` Sascha Hauer 0 siblings, 2 replies; 7+ messages in thread From: Eric Bénard @ 2010-10-13 9:54 UTC (permalink / raw) To: s.hauer; +Cc: barebox commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was not tested as all the tests are wrong and it breaks bootm Signed-off-by: Eric Bénard <eric@eukrea.com> --- commands/bootm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/bootm.c b/commands/bootm.c index 83d36d3..666deeb 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -167,7 +167,7 @@ struct image_handle *map_image(const char *filename, int verify) goto err_out; } - if (image_check_magic(header)) { + if (! image_check_magic(header)) { puts ("Bad Magic Number\n"); goto err_out; } @@ -332,7 +332,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) os_header = &os_handle->header; - if (image_check_arch(os_header, IH_ARCH)) { + if (! image_check_arch(os_header, IH_ARCH)) { printf("Unsupported Architecture 0x%x\n", image_get_arch(os_header)); goto err_out; @@ -409,7 +409,7 @@ static int image_info (ulong addr) /* Copy header so we can blank CRC field for re-calculation */ memmove (&header, (char *)addr, image_get_header_size()); - if (image_check_magic(hdr)) { + if (! image_check_magic(hdr)) { puts (" Bad Magic Number\n"); return 1; } -- 1.7.0.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 9:54 [PATCH] unbreak bootm Eric Bénard @ 2010-10-13 10:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 10:19 ` Eric Bénard 2010-10-13 11:14 ` Sascha Hauer 1 sibling, 1 reply; 7+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-13 10:08 UTC (permalink / raw) To: Eric Bénard; +Cc: barebox On 11:54 Wed 13 Oct , Eric Bénard wrote: > commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was > not tested as all the tests are wrong and it breaks bootm I test it but no see it > > Signed-off-by: Eric Bénard <eric@eukrea.com> > --- > commands/bootm.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/commands/bootm.c b/commands/bootm.c > index 83d36d3..666deeb 100644 > --- a/commands/bootm.c > +++ b/commands/bootm.c > @@ -167,7 +167,7 @@ struct image_handle *map_image(const char *filename, int verify) > goto err_out; > } > > - if (image_check_magic(header)) { > + if (! image_check_magic(header)) { no space after ! > puts ("Bad Magic Number\n"); > goto err_out; > } Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 10:08 ` Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-13 10:19 ` Eric Bénard 0 siblings, 0 replies; 7+ messages in thread From: Eric Bénard @ 2010-10-13 10:19 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox Hi Jean-Christophe, Le 13/10/2010 12:08, Jean-Christophe PLAGNIOL-VILLARD a écrit : > On 11:54 Wed 13 Oct , Eric Bénard wrote: >> commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was >> not tested as all the tests are wrong and it breaks bootm Sorry this was not meant to be offensive, just spent to much time on this so my comment may be a little bit to agressive. > I test it but no see it How do you test this ? In the present case it prevents to boot a uImage. I think some other tests may be concerned also but I didn't have time to check everywhere. Will resend with the space fixed. Eric _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 9:54 [PATCH] unbreak bootm Eric Bénard 2010-10-13 10:08 ` Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-13 11:14 ` Sascha Hauer 2010-10-13 12:28 ` Eric Bénard 1 sibling, 1 reply; 7+ messages in thread From: Sascha Hauer @ 2010-10-13 11:14 UTC (permalink / raw) To: Eric Bénard; +Cc: barebox On Wed, Oct 13, 2010 at 11:54:44AM +0200, Eric Bénard wrote: > commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was > not tested as all the tests are wrong and it breaks bootm > :-( How about the following patch (currently untested)? [PATCH] image: remove confusing image_check_* functions The function names do not make it clear what return value is expected and do not save a single line of code. Put the code inline and unbreak the wrong checks introduced with a3c1e5d888d0ee317ffc7635694684bb71213c9c. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/lib/armlinux.c | 2 +- arch/m68k/lib/m68k-linuxboot.c | 2 +- arch/ppc/lib/ppclinux.c | 2 +- commands/bootm.c | 8 +++--- common/image.c | 7 +++-- include/image.h | 55 ---------------------------------------- 6 files changed, 11 insertions(+), 65 deletions(-) diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index 7c2cbf9..f690fef 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -212,7 +212,7 @@ int do_bootm_linux(struct image_data *data) void (*theKernel)(int zero, int arch, void *params); image_header_t *os_header = &data->os->header; - if (image_check_type(os_header, IH_TYPE_MULTI)) { + if (image_get_type(os_header) == IH_TYPE_MULTI) { printf("Multifile images not handled at the moment\n"); return -1; } diff --git a/arch/m68k/lib/m68k-linuxboot.c b/arch/m68k/lib/m68k-linuxboot.c index e5e90a8..144d5a3 100644 --- a/arch/m68k/lib/m68k-linuxboot.c +++ b/arch/m68k/lib/m68k-linuxboot.c @@ -109,7 +109,7 @@ static int do_bootm_linux(struct image_data *data) const char *commandline = getenv ("bootargs"); uint32_t loadaddr,loadsize; - if (image_check_type(os_header, IH_TYPE_MULTI)) { + if (image_get_type(os_header) == IH_TYPE_MULTI) { printf("Multifile images not handled at the moment\n"); return -1; } diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c index 5ee908d..fc22a87 100644 --- a/arch/ppc/lib/ppclinux.c +++ b/arch/ppc/lib/ppclinux.c @@ -45,7 +45,7 @@ static int do_bootm_linux(struct image_data *idata) printf("entering %s: os_header: %p initrd_header: %p oftree: %s\n", __FUNCTION__, os_header, initrd_header, idata->oftree); - if (image_check_type(os_header, IH_TYPE_MULTI)) { + if (image_get_type(os_header) == IH_TYPE_MULTI) { unsigned long *data = (unsigned long *)(idata->os->data); unsigned long len1 = 0, len2 = 0; diff --git a/commands/bootm.c b/commands/bootm.c index 83d36d3..a7cbfb9 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -167,7 +167,7 @@ struct image_handle *map_image(const char *filename, int verify) goto err_out; } - if (image_check_magic(header)) { + if (image_get_magic(header) != IH_MAGIC) { puts ("Bad Magic Number\n"); goto err_out; } @@ -332,7 +332,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) os_header = &os_handle->header; - if (image_check_arch(os_header, IH_ARCH)) { + if (image_get_arch(os_header) != IH_ARCH) { printf("Unsupported Architecture 0x%x\n", image_get_arch(os_header)); goto err_out; @@ -350,7 +350,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) /* loop through the registered handlers */ list_for_each_entry(handler, &handler_list, list) { - if (image_check_os(os_header, handler->image_type)) { + if (image_get_os(hdr) == handler->image_type) { handler->bootm(&data); printf("handler returned!\n"); goto err_out; @@ -409,7 +409,7 @@ static int image_info (ulong addr) /* Copy header so we can blank CRC field for re-calculation */ memmove (&header, (char *)addr, image_get_header_size()); - if (image_check_magic(hdr)) { + if (image_get_magic(hdr) != IH_MAGIC) { puts (" Bad Magic Number\n"); return 1; } diff --git a/common/image.c b/common/image.c index 104446a..2b2c410 100644 --- a/common/image.c +++ b/common/image.c @@ -266,6 +266,7 @@ void image_print_contents(const void *ptr) { const image_header_t *hdr = (const image_header_t *)ptr; const char *p; + int type; #ifdef __BAREBOX__ p = " "; @@ -285,8 +286,8 @@ void image_print_contents(const void *ptr) printf ("%sLoad Address: %08x\n", p, image_get_load(hdr)); printf ("%sEntry Point: %08x\n", p, image_get_ep(hdr)); - if (image_check_type(hdr, IH_TYPE_MULTI) || - image_check_type(hdr, IH_TYPE_SCRIPT)) { + type = image_get_type(hdr); + if (type != IH_TYPE_MULTI || type != IH_TYPE_SCRIPT) { int i; ulong data, len; ulong count = image_multi_count(hdr); @@ -298,7 +299,7 @@ void image_print_contents(const void *ptr) printf("%s Image %d: ", p, i); image_print_size(len); - if (image_check_type(hdr, IH_TYPE_SCRIPT) && i > 0) { + if (image_get_type(hdr) != IH_TYPE_SCRIPT && i > 0) { /* * the user may need to know offsets * if planning to do something with diff --git a/include/image.h b/include/image.h index 2c5956d..a42d06b 100644 --- a/include/image.h +++ b/include/image.h @@ -320,61 +320,6 @@ static inline void image_set_name(image_header_t *hdr, const char *name) strncpy(image_get_name(hdr), name, IH_NMLEN); } -static inline int image_check_magic(const image_header_t *hdr) -{ - return (image_get_magic(hdr) == IH_MAGIC); -} -static inline int image_check_type(const image_header_t *hdr, uint8_t type) -{ - return (image_get_type(hdr) == type); -} -static inline int image_check_arch(const image_header_t *hdr, uint8_t arch) -{ - return (image_get_arch(hdr) == arch); -} -static inline int image_check_os(const image_header_t *hdr, uint8_t os) -{ - return (image_get_os(hdr) == os); -} - -#ifdef __BAREBOX__ -static inline int image_check_target_arch(const image_header_t *hdr) -{ -#if defined(__ARM__) - if (!image_check_arch(hdr, IH_ARCH_ARM)) -#elif defined(__avr32__) - if (!image_check_arch(hdr, IH_ARCH_AVR32)) -#elif defined(__bfin__) - if (!image_check_arch(hdr, IH_ARCH_BLACKFIN)) -#elif defined(__I386__) - if (!image_check_arch(hdr, IH_ARCH_I386)) -#elif defined(__m68k__) - if (!image_check_arch(hdr, IH_ARCH_M68K)) -#elif defined(__microblaze__) - if (!image_check_arch(hdr, IH_ARCH_MICROBLAZE)) -#elif defined(__mips__) - if (!image_check_arch(hdr, IH_ARCH_MIPS)) -#elif defined(__nios__) - if (!image_check_arch(hdr, IH_ARCH_NIOS)) -#elif defined(__nios2__) - if (!image_check_arch(hdr, IH_ARCH_NIOS2)) -#elif defined(__PPC__) - if (!image_check_arch(hdr, IH_ARCH_PPC)) -#elif defined(__sh__) - if (!image_check_arch(hdr, IH_ARCH_SH)) -#elif defined(__sparc__) - if (!image_check_arch(hdr, IH_ARCH_SPARC)) -#elif defined(CONFIG_LINUX) - if (!image_check_arch(hdr, IH_ARCH_LINUX)) -#else -# error Unknown CPU type -#endif - return 0; - - return 1; -} -#endif - ulong image_multi_count(const image_header_t *hdr); void image_multi_getimg(const image_header_t *hdr, ulong idx, ulong *data, ulong *len); -- 1.7.2.3 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 11:14 ` Sascha Hauer @ 2010-10-13 12:28 ` Eric Bénard 2010-10-13 13:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 15:40 ` Sascha Hauer 0 siblings, 2 replies; 7+ messages in thread From: Eric Bénard @ 2010-10-13 12:28 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox [-- Attachment #1: Type: text/plain, Size: 354 bytes --] Hi Sascha, Le 13/10/2010 13:14, Sascha Hauer a écrit : > On Wed, Oct 13, 2010 at 11:54:44AM +0200, Eric Bénard wrote: >> commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was >> not tested as all the tests are wrong and it breaks bootm >> > > :-( > > How about the following patch (currently untested)? > works with the attached fix. Eric [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-fix-Sascha-s-patch.patch --] [-- Type: text/x-patch; name="0001-fix-Sascha-s-patch.patch", Size: 1848 bytes --] From 214d68524f90e4d7f223d1bf05b49e9958bd3c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com> Date: Wed, 13 Oct 2010 14:27:19 +0200 Subject: [PATCH] fix Sascha's patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eric B��nard <eric@eukrea.com> --- commands/bootm.c | 2 +- common/image.c | 2 +- scripts/mkimage.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/bootm.c b/commands/bootm.c index a7cbfb9..14475c7 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -350,7 +350,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[]) /* loop through the registered handlers */ list_for_each_entry(handler, &handler_list, list) { - if (image_get_os(hdr) == handler->image_type) { + if (image_get_os(os_header) == handler->image_type) { handler->bootm(&data); printf("handler returned!\n"); goto err_out; diff --git a/common/image.c b/common/image.c index 2b2c410..a4c8b95 100644 --- a/common/image.c +++ b/common/image.c @@ -287,7 +287,7 @@ void image_print_contents(const void *ptr) printf ("%sEntry Point: %08x\n", p, image_get_ep(hdr)); type = image_get_type(hdr); - if (type != IH_TYPE_MULTI || type != IH_TYPE_SCRIPT) { + if (type == IH_TYPE_MULTI || type == IH_TYPE_SCRIPT) { int i; ulong data, len; ulong count = image_multi_count(hdr); diff --git a/scripts/mkimage.c b/scripts/mkimage.c index f6cbb1c..40a3483 100644 --- a/scripts/mkimage.c +++ b/scripts/mkimage.c @@ -224,7 +224,7 @@ NXTARG: ; */ memcpy (hdr, ptr, sizeof(image_header_t)); - if (image_check_magic(hdr)) { + if (image_get_magic(hdr) != IH_MAGIC) { fprintf (stderr, "%s: Bad Magic Number: \"%s\" is no valid image\n", cmdname, imagefile); -- 1.7.0.4 [-- Attachment #3: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 12:28 ` Eric Bénard @ 2010-10-13 13:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 15:40 ` Sascha Hauer 1 sibling, 0 replies; 7+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-13 13:08 UTC (permalink / raw) To: Eric Bénard; +Cc: barebox On 14:28 Wed 13 Oct , Eric Bénard wrote: > Hi Sascha, > > Le 13/10/2010 13:14, Sascha Hauer a écrit : > >On Wed, Oct 13, 2010 at 11:54:44AM +0200, Eric Bénard wrote: > >>commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was > >>not tested as all the tests are wrong and it breaks bootm > >> > > > >:-( > > > >How about the following patch (currently untested)? > > > works with the attached fix. Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] unbreak bootm 2010-10-13 12:28 ` Eric Bénard 2010-10-13 13:08 ` Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-13 15:40 ` Sascha Hauer 1 sibling, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2010-10-13 15:40 UTC (permalink / raw) To: Eric Bénard; +Cc: barebox On Wed, Oct 13, 2010 at 02:28:38PM +0200, Eric Bénard wrote: > Hi Sascha, > > Le 13/10/2010 13:14, Sascha Hauer a écrit : >> On Wed, Oct 13, 2010 at 11:54:44AM +0200, Eric Bénard wrote: >>> commit a3c1e5d888d0ee317ffc7635694684bb71213c9c was >>> not tested as all the tests are wrong and it breaks bootm >>> >> >> :-( >> >> How about the following patch (currently untested)? >> > works with the attached fix. Ok, thanks for testing and fixing. I squashed the fixes into my patch and added it to next. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-10-13 15:40 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-10-13 9:54 [PATCH] unbreak bootm Eric Bénard 2010-10-13 10:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 10:19 ` Eric Bénard 2010-10-13 11:14 ` Sascha Hauer 2010-10-13 12:28 ` Eric Bénard 2010-10-13 13:08 ` Jean-Christophe PLAGNIOL-VILLARD 2010-10-13 15:40 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox