From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dennis Ehlin (ECS)" To: "'Jonathan Larmour'" Cc: ecos-discuss@sources.redhat.com Subject: RE: [ECOS] Redboot boot script? Date: Tue, 01 May 2001 22:57:00 -0000 Message-id: <2310E22AE31BD51189DB00A0C9DF89F85A27AD@eseklnt101.kl.sw.ericsson.se> X-SW-Source: 2001-05/msg00012.html Hi, Is this what you ment ? I tested it on my ppc target and it seems to work. //Dennis diff -ur redboot.orig/current/cdl/redboot.cdl redboot/current/cdl/redboot.cdl --- redboot.orig/current/cdl/redboot.cdl Sat Apr 7 05:17:50 2001 +++ redboot/current/cdl/redboot.cdl Wed Apr 25 08:22:29 2001 @@ -323,11 +323,37 @@ this is somewhat safer, it does add overhead during updates." } + cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK { + display "Use CRC checksums on FIS images." + flavor bool + default_value 1 + description " + When this option is enabled, RedBoot will use CRC checksums + when reading and writing flash images." + } + } + + cdl_option CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT { + display "Use default RedBoot boot script" + flavor booldata + default_value 0 + description " + If enabled, this option will tell RedBoot to use this options value + as a default boot script." + } + + cdl_component CYGSEM_REDBOOT_BOOT_SCRIPT { + display "Activates RedBoot boot script" + flavor bool + default_value { CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT || CYGSEM_REDBOOT_FLASH_CONFIG } + description " + This option enables the RedBoot boot script functionality." + cdl_option CYGNUM_REDBOOT_FLASH_SCRIPT_TIMEOUT_RESOLUTION { display "Resolution (in ms) for script timeout value." flavor data default_value 1000 - active_if CYGSEM_REDBOOT_FLASH_CONFIG + active_if { CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT || CYGSEM_REDBOOT_FLASH_CONFIG } description " This option controls the resolution of the script timeout. The value is specified in milliseconds (ms), thus to have the @@ -338,19 +364,10 @@ display "Default script timeout value" flavor data default_value 10 - active_if CYGSEM_REDBOOT_FLASH_CONFIG + active_if { CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT || CYGSEM_REDBOOT_FLASH_CONFIG } description " This option is used to set the default timeout for startup scripts, when they are enabled." - } - - cdl_option CYGSEM_REDBOOT_FIS_CRC_CHECK { - display "Use CRC checksums on FIS images." - flavor bool - default_value 1 - description " - When this option is enabled, RedBoot will use CRC checksums - when reading and writing flash images." } } diff -ur redboot.orig/current/include/redboot.h redboot/current/include/redboot.h --- redboot.orig/current/include/redboot.h Sat Apr 7 05:17:50 2001 +++ redboot/current/include/redboot.h Tue Apr 24 14:45:19 2001 @@ -87,7 +87,7 @@ EXTERN int gdb_port; #endif -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT EXTERN unsigned char *script; EXTERN int script_timeout; #endif diff -ur redboot.orig/current/src/io.c redboot/current/src/io.c --- redboot.orig/current/src/io.c Sat Apr 7 05:17:51 2001 +++ redboot/current/src/io.c Tue Apr 24 14:02:09 2001 @@ -183,7 +183,7 @@ static char last_ch = '\0'; while (true) { -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT if (script && *script) { c = *script++; do_idle(false); @@ -318,18 +318,18 @@ { va_list ap; char ans[8]; -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT unsigned char *hold_script = script; #endif va_start(ap, fmt); vprintf(fmt, ap); printf(" - are you sure (y/n)? "); -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT script = (unsigned char *)0; #endif gets(ans, sizeof(ans), 0); -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT script = hold_script; #endif return ((ans[0] == 'y') || (ans[0] == 'Y')); diff -ur redboot.orig/current/src/main.c redboot/current/src/main.c --- redboot.orig/current/src/main.c Sat Apr 7 05:17:52 2001 +++ redboot/current/src/main.c Tue Apr 24 14:47:31 2001 @@ -205,8 +205,13 @@ user_ram_end = workspace_end; do_version(0,0); -#ifdef CYGSEM_REDBOOT_FLASH_CONFIG +#ifdef CYGSEM_REDBOOT_BOOT_SCRIPT // Give the guy a chance to abort any boot script +#ifdef CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT + script_timeout = CYGNUM_REDBOOT_FLASH_SCRIPT_DEFAULT_TIMEOUT; + if (!script) + script = CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT; +#endif if (script) { unsigned char *hold_script = script; int script_timeout_ms = script_timeout * CYGNUM_REDBOOT_FLASH_SCRIPT_TIMEOUT_RESOLUTION; -----Original Message----- From: Jonathan Larmour [ mailto:jlarmour@redhat.com ] Sent: Monday, April 23, 2001 7:58 PM To: Dennis Ehlin (ECS) Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] Redboot boot script? "Dennis Ehlin (ECS)" wrote: > > Is it possible to use a "static boot script" i.e a script defined when RedBoot is compiled ? > And this without having any flash memory support compiled into RedBoot. > > What I want to do is to get RedBoot to load an image from flash into RAM an exec it after a delay. Not at present but I think it would be trivial to add. FWIW, here's my thoughts. Create a new CDL option for scripting, CYGFUN_REDBOOT_BOOT_SCRIPT. This can be enabled either when CYGSEM_REDBOOT_FLASH_CONFIG is enabled, or if a new option of flavor booldata called CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT is defined. Change this ifdef in redboot.h: #ifdef CYGSEM_REDBOOT_FLASH_CONFIG EXTERN unsigned char *script; EXTERN int script_timeout; #endif to #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT At around line 215 or so of redboot's main.c change: #ifdef CYGSEM_REDBOOT_FLASH_CONFIG // Give the guy a chance to abort any boot script if (script) { to #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT // Give the guy a chance to abort any boot script #ifdef CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT if (!script) script = CYGDAT_REDBOOT_DEFAULT_BOOT_SCRIPT; #endif if (script) { You'll need to do some further tweaking of the CDL options to move some of the existing options to do with scripting underneath the new CYGFUN_REDBOOT_BOOT_SCRIPT component. If you did that and sent the patches, that would be brill :-). Jifl -- Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062 Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine