public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Redboots CRC checking
@ 2004-05-27 13:22 Winkler Andreas
  2004-05-27 14:40 ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Winkler Andreas @ 2004-05-27 13:22 UTC (permalink / raw)
  To: eCos Discussion

Hi,

after some troubles i got the CRC checking to work. But it doesn't work as i
expected.
I need the CRC checking to prevent Redboot from executing a corrupted
kernel.
But Redboot only prints a message while loading.
The execute command tries to start the kernel, and look what happens:

RedBoot> fi loa kernel
** Warning - checksum failure.  stored: 0x7ca3fe54, computed: 0xdde742c4
RedBoot> e
Using base address 0x01008000 and length 0x000ba7c8
Uncompressing Linux...........

invalid compressed format (err=1)

 -- System halted

This system is defect for the use of a customer.
I expected Redboot to not start the kernel with the checksum error.
This would enable the start of a backup kernel in a startup script.
Is there an existing solution for my request or must i implement it by
myself?

Regards
Andreas

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Redboots CRC checking
  2004-05-27 13:22 [ECOS] Redboots CRC checking Winkler Andreas
@ 2004-05-27 14:40 ` Gary Thomas
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2004-05-27 14:40 UTC (permalink / raw)
  To: Winkler Andreas; +Cc: eCos Discussion, eCos patches

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

On Thu, 2004-05-27 at 06:54, Winkler Andreas wrote:
> Hi,
> 
> after some troubles i got the CRC checking to work. But it doesn't work as i
> expected.
> I need the CRC checking to prevent Redboot from executing a corrupted
> kernel.
> But Redboot only prints a message while loading.
> The execute command tries to start the kernel, and look what happens:
> 
> RedBoot> fi loa kernel
> ** Warning - checksum failure.  stored: 0x7ca3fe54, computed: 0xdde742c4
> RedBoot> e
> Using base address 0x01008000 and length 0x000ba7c8
> Uncompressing Linux...........
> 
> invalid compressed format (err=1)
> 
>  -- System halted
> 
> This system is defect for the use of a customer.
> I expected Redboot to not start the kernel with the checksum error.
> This would enable the start of a backup kernel in a startup script.
> Is there an existing solution for my request or must i implement it by
> myself?

I can see that the "Linux exec" code doesn't respect this failure,
sorry.

The problem is that the "Linux exec" function is [necessarily] 
implemented by each architecture.  Each of these need to be changed to
be sensitive to whether or not the load succeeds.

I've applied the attached patch, so this should now work as expected.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates

[-- Attachment #2: diffs --]
[-- Type: text/x-patch, Size: 14724 bytes --]

Index: hal/arm/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/arm/arch/current/ChangeLog,v
retrieving revision 1.97
diff -u -5 -p -r1.97 ChangeLog
--- hal/arm/arch/current/ChangeLog	24 May 2004 12:32:09 -0000	1.97
+++ hal/arm/arch/current/ChangeLog	27 May 2004 13:21:18 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-05-24   Ian Campbell <icampbell@arcom.com>
 
 	* src/hal_misc.c: __mem_fault_handler: Only do this if we have
 	CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS. This allows the HAL to be 
 	compiled without stubs.
Index: hal/arm/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/arm/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.10
diff -u -5 -p -r1.10 redboot_linux_exec.c
--- hal/arm/arch/current/src/redboot_linux_exec.c	11 Mar 2003 15:41:11 -0000	1.10
+++ hal/arm/arch/current/src/redboot_linux_exec.c	27 May 2004 13:15:12 -0000
@@ -7,11 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2003 Gary Thomas
+// Copyright (C) 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -312,10 +312,14 @@ do_exec(int argc, char *argv[])
               (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, 
               (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size");
     if (!scan_opts(argc, argv, 1, opts, 6, (void *)&entry, OPTION_ARG_TYPE_NUM, "[physical] starting address"))
     {
+        return;
+    }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
         return;
     }
 
     // Set up parameters to pass to kernel
 
Index: hal/h8300/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/h8300/arch/current/ChangeLog,v
retrieving revision 1.6
diff -u -5 -p -r1.6 ChangeLog
--- hal/h8300/arch/current/ChangeLog	22 Apr 2004 15:26:34 -0000	1.6
+++ hal/h8300/arch/current/ChangeLog	27 May 2004 13:17:58 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-22  Jani Monoses <jani@iv.ro>
 
 	 * cdl/hal_h8300.cdl :
 	 Invoke tail with stricter syntax that works in latest coreutils. 
 
Index: hal/h8300/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/h8300/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 redboot_linux_exec.c
--- hal/h8300/arch/current/src/redboot_linux_exec.c	6 Apr 2004 20:33:07 -0000	1.2
+++ hal/h8300/arch/current/src/redboot_linux_exec.c	27 May 2004 13:15:34 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -78,10 +79,14 @@ do_exec(int argc, char *argv[])
               &cmd_line, &command_line_set, "kernel command line");
     
     if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
 	    return ;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
   
     diag_printf("Now booting linux kernel:\n");
     diag_printf(" Entry Address 0x%08x\n", entry);
     diag_printf(" Cmdline : %s\n", cmd_line);
 
Index: hal/mips/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/mips/arch/current/ChangeLog,v
retrieving revision 1.73
diff -u -5 -p -r1.73 ChangeLog
--- hal/mips/arch/current/ChangeLog	27 May 2004 06:26:53 -0000	1.73
+++ hal/mips/arch/current/ChangeLog	27 May 2004 13:21:09 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-05-16  Andrew Dyer  <adyer@righthandtech.com>
 
 	* include/hal_cache.h: Changed the calculation of _IWAY and _DWAY
 	for the case where HAL_MIPS_CACHE_INSN_USES_LSB is set to only
 	affect the LSBs in the CACHE instruction offset field.  #define
Index: hal/mips/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/mips/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.7
diff -u -5 -p -r1.7 redboot_linux_exec.c
--- hal/mips/arch/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:13 -0000	1.7
+++ hal/mips/arch/current/src/redboot_linux_exec.c	27 May 2004 13:15:49 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -112,10 +113,14 @@ do_exec(int argc, char *argv[])
               (void **)&cmd_line, &cmd_line_set, "kernel command line");
     
     if (!scan_opts(argc, argv, 1, opts, 3, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
         return;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
 
     linux = (void *)entry;
 
     __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
     baud = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GETBAUD);
Index: hal/mn10300/am33/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/mn10300/am33/current/ChangeLog,v
retrieving revision 1.16
diff -u -5 -p -r1.16 ChangeLog
--- hal/mn10300/am33/current/ChangeLog	22 Apr 2004 15:26:47 -0000	1.16
+++ hal/mn10300/am33/current/ChangeLog	27 May 2004 13:17:52 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-22  Jani Monoses <jani@iv.ro>
 
 	 * cdl/hal_mn10300_am33.cdl :
 	 Invoke tail with stricter syntax that works in latest coreutils. 
 
Index: hal/mn10300/am33/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/mn10300/am33/current/src/redboot_linux_exec.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 redboot_linux_exec.c
--- hal/mn10300/am33/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:14 -0000	1.2
+++ hal/mn10300/am33/current/src/redboot_linux_exec.c	27 May 2004 13:16:12 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -101,10 +102,14 @@ do_exec(int argc, char *argv[])
     num_options = 2;
 
     if (!scan_opts(argc, argv, 1, opts, num_options, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "starting address"))
     {
+        return;
+    }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
         return;
     }
     if (cmd_line_set) {
 	memcpy((char*)CYGHWR_REDBOOT_AM33_LINUX_CMD_ADDRESS,"cmdline:",8);
         strncpy((char*)CYGHWR_REDBOOT_AM33_LINUX_CMD_ADDRESS+8,cmd_line,256);
Index: hal/powerpc/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/ChangeLog,v
retrieving revision 1.64
diff -u -5 -p -r1.64 ChangeLog
--- hal/powerpc/arch/current/ChangeLog	29 Apr 2004 03:39:58 -0000	1.64
+++ hal/powerpc/arch/current/ChangeLog	27 May 2004 13:20:58 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-29  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* include/hal_arch.h (HAL_SET_GDB_FLOATING_POINT_REGISTERS): Make
 	absolutely safe with respect to strict-aliasing.
 	(HAL_SET_GDB_FLOATING_POINT_REGISTERS): Ditto.
Index: hal/powerpc/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 redboot_linux_exec.c
--- hal/powerpc/arch/current/src/redboot_linux_exec.c	29 Apr 2004 03:22:17 -0000	1.3
+++ hal/powerpc/arch/current/src/redboot_linux_exec.c	27 May 2004 13:20:27 -0000
@@ -7,11 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002, 2003 Gary Thomas
+// Copyright (C) 2002, 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -116,10 +116,14 @@ do_exec(int argc, char *argv[])
     init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, 
               (void *)&cmd_line, (bool *)&cmd_line_set, "kernel command line");
     entry = entry_address;  // Default from last 'load' operation
     if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, 
                    "[physical] starting address")) {
+        return;
+    }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
         return;
     }
 
     // Determine baud rate on current console
     __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
Index: hal/sh/arch/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/sh/arch/current/ChangeLog,v
retrieving revision 1.51
diff -u -5 -p -r1.51 ChangeLog
--- hal/sh/arch/current/ChangeLog	14 May 2004 12:01:56 -0000	1.51
+++ hal/sh/arch/current/ChangeLog	27 May 2004 13:20:53 -0000
@@ -1,5 +1,11 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-30  Yoshinori Sato  <ysato@users.sourceforge.jp>
 
 	* src/sh.ld: Add entry section for targets, like Dreamcast, that
 	need special entry code.
 
Index: hal/sh/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/sh/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 redboot_linux_exec.c
--- hal/sh/arch/current/src/redboot_linux_exec.c	11 Mar 2003 17:14:15 -0000	1.3
+++ hal/sh/arch/current/src/redboot_linux_exec.c	27 May 2004 13:16:56 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -121,10 +122,14 @@ do_exec(int argc, char *argv[])
               (void **)&cmd_line, &cmd_line_set, "kernel command line");
     
     if (!scan_opts(argc, argv, 1, opts, 8, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
         return;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
   
     diag_printf("Now booting linux kernel:\n");
     diag_printf(" Base address 0x%08x Entry 0x%08x\n", base_addr, entry);
     diag_printf(" Cmdline : %s\n", cmd_line);
 


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ECOS] Redboots CRC checking
  2004-07-07 14:54 Winkler Andreas
@ 2004-07-07 14:57 ` Gary Thomas
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2004-07-07 14:57 UTC (permalink / raw)
  To: Winkler Andreas; +Cc: 'eCos Discussion'

On Wed, 2004-07-07 at 08:54, Winkler Andreas wrote:
> Hi,
> 
> > It looks like the patch I gave you before was a little incorrect.  Try
> > applying this change and let me know how it works.
> 
> Thank you, Gary, this works fine:
> 	RedBoot> e
> 	Can't execute Linux - invalid entry address
> 	RedBoot>
> Redboot keeps control. That's what i wanted to achieve.
> 
> > n.b. I'm doing this a little blind as I currently have no ARM hardware
> > online.
> 
> So we worked together as a team. You had the knowledge and i got the
> hardware to test. :-))

Good - I'll apply this to the repository.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ECOS] Redboots CRC checking
@ 2004-07-07 14:54 Winkler Andreas
  2004-07-07 14:57 ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Winkler Andreas @ 2004-07-07 14:54 UTC (permalink / raw)
  To: 'eCos Discussion'

Hi,

> It looks like the patch I gave you before was a little incorrect.  Try
> applying this change and let me know how it works.

Thank you, Gary, this works fine:
	RedBoot> e
	Can't execute Linux - invalid entry address
	RedBoot>
Redboot keeps control. That's what i wanted to achieve.

> n.b. I'm doing this a little blind as I currently have no ARM hardware
> online.

So we worked together as a team. You had the knowledge and i got the
hardware to test. :-))

Best Regards
Andreas

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ECOS] Redboots CRC checking
  2004-07-07 13:41 Winkler Andreas
@ 2004-07-07 13:57 ` Gary Thomas
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2004-07-07 13:57 UTC (permalink / raw)
  To: Winkler Andreas; +Cc: 'eCos Discussion'

[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]

On Wed, 2004-07-07 at 07:41, Winkler Andreas wrote:
> Hi,
> 
> i first had to buy a flash programmer and to make some holidays.
> Now after some weeks i am again struggling with this old problem.
> Remember:
> I got a Patch from Gary Thomas for the "Linux exec", to
> respect the CRC failure.
> 
> In an earlier mail i wrote:
> > > after applying the patch i rebuilt Redboot and tried it.
> > > But it doesn't work.
> > > So i looked into the patch. The concerned file should be
> > > pachages/hal/arm/arch/current/src/redboot_linux_exec.c.
> > > There i find an addon 
> > >     if (entry == (unsigned long)NO_MEMORY) {
> > >         diag_printf("Can't execute Linux - invalid entry 
> > address\n");
> > >         return;
> > >     }
> > > For me this doesn't look like a CRC check.
> > > Or did I make a mistake in building Redboot?
> 
> Gary Thomas answered: 
> > No - the "fis load" command will set 'entry_address' to 'NO_MEMORY' if
> > there is a CRC error.  This code should catch that and cause 
> > the 'exec'
> > command to fail.  Of course, it can only do this if you do not specify
> > an entry point address.
> > 
> > Exactly what does it do?  Perhaps you could print the value of 'entry'
> > when it gets to this point.
> 
> I added this print command (entry printed as %x) and got the following:
> 
> 	RedBoot> fi loa kernel
> 	** Warning - checksum failure.  stored: 0x7ca3fe54, computed:
> 0xdde742c4
> 	RedBoot> e
> 	entry = 6000000
> 	Using base address 0x01008000 and length 0x000ba7c8
> 	Uncompressing Linux...........
> 
> 	invalid compressed format (err=1)
> 
> 	-- System halted
> 
> This means, that the CRC check is working out. But the exec command doesn't
> respect this and is starting the defect kernel.
> I had expected, that the exec command wouldn't start the kernel after
> recognizing
> the CRC failure. Therefore the value of entry should have been 0xffffffff.
> Where does this value 0x6000000 come from?

It looks like the patch I gave you before was a little incorrect.  Try
applying this change and let me know how it works.

n.b. I'm doing this a little blind as I currently have no ARM hardware
online.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates

[-- Attachment #2: diffs --]
[-- Type: text/x-patch, Size: 1686 bytes --]

Index: hal/arm/arch/current/src/redboot_linux_exec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/arm/arch/current/src/redboot_linux_exec.c,v
retrieving revision 1.11
diff -u -5 -p -r1.11 redboot_linux_exec.c
--- hal/arm/arch/current/src/redboot_linux_exec.c	27 May 2004 13:22:07 -0000	1.11
+++ hal/arm/arch/current/src/redboot_linux_exec.c	7 Jul 2004 13:55:13 -0000
@@ -289,10 +289,15 @@ do_exec(int argc, char *argv[])
     char line[8];
     char *cmd_line;
     struct tag *params = (struct tag *)CYGHWR_REDBOOT_ARM_LINUX_TAGS_ADDRESS;
     extern char __tramp_start__[], __tramp_end__[];
 
+    // Check to see if a valid image has been loaded
+    if (entry_address == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
     // Default physical entry point for Linux is kernel base.
     entry = (unsigned long)CYGHWR_REDBOOT_ARM_LINUX_EXEC_ADDRESS;
 
     base_addr = load_address;
     length = load_address_end - load_address;
@@ -312,14 +317,10 @@ do_exec(int argc, char *argv[])
               (void **)&ramdisk_addr, (bool *)&ramdisk_addr_set, "ramdisk_addr");
     init_opts(&opts[5], 's', true, OPTION_ARG_TYPE_NUM, 
               (void **)&ramdisk_size, (bool *)&ramdisk_size_set, "ramdisk_size");
     if (!scan_opts(argc, argv, 1, opts, 6, (void *)&entry, OPTION_ARG_TYPE_NUM, "[physical] starting address"))
     {
-        return;
-    }
-    if (entry == (unsigned long)NO_MEMORY) {
-        diag_printf("Can't execute Linux - invalid entry address\n");
         return;
     }
 
     // Set up parameters to pass to kernel
 


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ECOS] Redboots CRC checking
@ 2004-07-07 13:41 Winkler Andreas
  2004-07-07 13:57 ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Winkler Andreas @ 2004-07-07 13:41 UTC (permalink / raw)
  To: 'eCos Discussion'

Hi,

i first had to buy a flash programmer and to make some holidays.
Now after some weeks i am again struggling with this old problem.
Remember:
I got a Patch from Gary Thomas for the "Linux exec", to
respect the CRC failure.

In an earlier mail i wrote:
> > after applying the patch i rebuilt Redboot and tried it.
> > But it doesn't work.
> > So i looked into the patch. The concerned file should be
> > pachages/hal/arm/arch/current/src/redboot_linux_exec.c.
> > There i find an addon 
> >     if (entry == (unsigned long)NO_MEMORY) {
> >         diag_printf("Can't execute Linux - invalid entry 
> address\n");
> >         return;
> >     }
> > For me this doesn't look like a CRC check.
> > Or did I make a mistake in building Redboot?

Gary Thomas answered: 
> No - the "fis load" command will set 'entry_address' to 'NO_MEMORY' if
> there is a CRC error.  This code should catch that and cause 
> the 'exec'
> command to fail.  Of course, it can only do this if you do not specify
> an entry point address.
> 
> Exactly what does it do?  Perhaps you could print the value of 'entry'
> when it gets to this point.

I added this print command (entry printed as %x) and got the following:

	RedBoot> fi loa kernel
	** Warning - checksum failure.  stored: 0x7ca3fe54, computed:
0xdde742c4
	RedBoot> e
	entry = 6000000
	Using base address 0x01008000 and length 0x000ba7c8
	Uncompressing Linux...........

	invalid compressed format (err=1)

	-- System halted

This means, that the CRC check is working out. But the exec command doesn't
respect this and is starting the defect kernel.
I had expected, that the exec command wouldn't start the kernel after
recognizing
the CRC failure. Therefore the value of entry should have been 0xffffffff.
Where does this value 0x6000000 come from?

Best Regards
Andreas

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ECOS] Redboots CRC checking
       [not found] <BCB494E8B7BF2D40B56D1164C67BC2A801B168BF@kher443a.ww004.siemens.net>
@ 2004-05-28 14:41 ` Gary Thomas
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2004-05-28 14:41 UTC (permalink / raw)
  To: Winkler Andreas; +Cc: eCos Discussion

Please copy the eCos discussion list so that all may benefit.  Private
email is only available with a support contract from MLB Associates.

On Fri, 2004-05-28 at 01:34, Winkler Andreas wrote:
> > I've applied the attached patch, so this should now work as expected.
> 
> Hi Gary,
> 
> after applying the patch i rebuilt Redboot and tried it.
> But it doesn't work.
> So i looked into the patch. The concerned file should be
> pachages/hal/arm/arch/current/src/redboot_linux_exec.c.
> There i find an addon 
>     if (entry == (unsigned long)NO_MEMORY) {
>         diag_printf("Can't execute Linux - invalid entry address\n");
>         return;
>     }
> For me this doesn't look like a CRC check.
> Or did I make a mistake in building Redboot?

No - the "fis load" command will set 'entry_address' to 'NO_MEMORY' if
there is a CRC error.  This code should catch that and cause the 'exec'
command to fail.  Of course, it can only do this if you do not specify
an entry point address.

Exactly what does it do?  Perhaps you could print the value of 'entry'
when it gets to this point.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-07 14:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27 13:22 [ECOS] Redboots CRC checking Winkler Andreas
2004-05-27 14:40 ` Gary Thomas
     [not found] <BCB494E8B7BF2D40B56D1164C67BC2A801B168BF@kher443a.ww004.siemens.net>
2004-05-28 14:41 ` Gary Thomas
2004-07-07 13:41 Winkler Andreas
2004-07-07 13:57 ` Gary Thomas
2004-07-07 14:54 Winkler Andreas
2004-07-07 14:57 ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).