Index: redboot/current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v retrieving revision 1.200 diff -u -r1.200 ChangeLog --- redboot/current/ChangeLog 13 Aug 2004 12:26:00 -0000 1.200 +++ redboot/current/ChangeLog 21 Aug 2004 12:41:22 -0000 @@ -1,9 +1,36 @@ +2004-08-17 Andrew Lunn + + * cdl/redboot.cdl: + * src/net/net_io.c: added CDL to allow the default server to + be configured. Also respect the CYGSEM_REDBOOT_DEFAULT_NO_BOOTP + setting. + +2004-08-16 Andrew Lunn + + * cdl/redboot.cdl: + * src/load.c: Added cdl to control the size of the buffer used + by getc. The size can have significant affect on load speed + when loading from a filesystem. + 2004-08-13 Jani Monoses * src/net/http_client.c: Fix off-by-one error in checking the HTTP response header, so the ending CRLF-CRLF is detected even if it's the last 4 bytes in the buffer. +2004-08-10 Andrew Lunn + + * cdl/redboot.cdl + * src/load.c (load_elf_image): Added a CDL option to configure + if the physical or virtual address in the headers should be used + when loading the image. + +2004-08-09 Andrew Lunn + + * cdl/redboot.cdl + * src/fs/fileio.c (do_ls) Added an ls command so we can see what + is inside the mounted filesystem. + 2004-06-25 Andrew Lunn * src/flash.c (find_free): fix endless loop when removing a Index: redboot/current/cdl/redboot.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/cdl/redboot.cdl,v retrieving revision 1.64 diff -u -r1.64 redboot.cdl --- redboot/current/cdl/redboot.cdl 24 Feb 2004 23:09:14 -0000 1.64 +++ redboot/current/cdl/redboot.cdl 21 Aug 2004 12:41:24 -0000 @@ -67,10 +67,21 @@ puts $::cdl_header "#include " } - cdl_option CYGSEM_REDBOOT_ELF { + cdl_component CYGSEM_REDBOOT_ELF { flavor bool display "Include support for ELF file format" default_value 1 + + cdl_option CYGOPT_REDBOOT_ELF_VIRTUAL_ADDRESS { + display "Use the virtual address in the ELF headers" + flavor bool + default_value 0 + description " + The ELF headers contain both a virtual and a physical address + for where code/data should be loaded. By default the physical + address is used but sometimes it is necassary to use the + virtual address because of bugy toolchains" + } } @@ -345,6 +356,20 @@ timeout. This option is overriden by the configuration stored in flash." } + cdl_option CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR { + display "Default bootp server" + flavor booldata + default_value CYGSEM_REDBOOT_FLASH_CONFIG ? 0 : \ + { "0, 0, 0, 0" } + description " + This IP address is the default server + address used by RedBoot if a BOOTP/DHCP + server does not respond. The numbers should + be separated by *commas*, and not dots. If + an IP address is configured into the Flash + configuration, that will be used in + preference." + } } cdl_component CYGSEM_REDBOOT_NETWORKING_DHCP { @@ -864,6 +889,16 @@ If this option is enabled then RedBoot will provide commands to load files from fileio file systems such as JFFS2." compile -library=libextras.a fs/fileio.c + + cdl_option CYGBLD_REDBOOT_FILEIO_WITH_LS { + display "Include an ls command" + flavor bool + default_value 1 + description " + If this option is enabled a simple ls command will be + included in redboot so the contents of a directory + can be listed" + } } cdl_component CYGPKG_REDBOOT_DISK { @@ -1057,6 +1092,16 @@ size of one flash sector." } } + cdl_option CYGNUM_REDBOOT_GETC_BUFFER { + display "Buffer size in getc when loading images" + flavor data + default_value { CYGPKG_REDBOOT_FILEIO ? 4096 : 256 } + description " + When loading images a buffer is used between redboot and the + underlying storage medium, eg a filesystem, or a socket etc. + The size of this buffer can have a big impart on load speed." + } + } } Index: redboot/current/src/load.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/load.c,v retrieving revision 1.42 diff -u -r1.42 load.c --- redboot/current/src/load.c 23 Apr 2004 20:38:18 -0000 1.42 +++ redboot/current/src/load.c 21 Aug 2004 12:41:25 -0000 @@ -104,7 +104,7 @@ extern struct load_io_entry __RedBoot_LOAD_TAB__[], __RedBoot_LOAD_TAB_END__; // Buffers, data used by redboot_getc -#define BUF_SIZE 256 +#define BUF_SIZE CYGNUM_REDBOOT_GETC_BUFFER struct { getc_io_funcs_t *io; int (*fun)(char *, int len, int *err); @@ -346,9 +346,14 @@ if (base) { // Set address offset based on lowest address in file. addr_offset = 0xFFFFFFFF; - for (phx = 0; phx < ehdr.e_phnum; phx++) { + for (phx = 0; phx < ehdr.e_phnum; phx++) { +#ifdef CYGOPT_REDBOOT_ELF_VIRTUAL_ADDRESS + if ((phdr[phx].p_type == PT_LOAD) && (phdr[phx].p_vaddr < addr_offset)) { + addr_offset = phdr[phx].p_vaddr; +#else if ((phdr[phx].p_type == PT_LOAD) && (phdr[phx].p_paddr < addr_offset)) { addr_offset = phdr[phx].p_paddr; +#endif } } addr_offset = (unsigned long)base - addr_offset; @@ -358,7 +363,11 @@ for (phx = 0; phx < ehdr.e_phnum; phx++) { if (phdr[phx].p_type == PT_LOAD) { // Loadable segment +#ifdef CYGOPT_REDBOOT_ELF_VIRTUAL_ADDRESS + addr = (unsigned char *)phdr[phx].p_vaddr; +#else addr = (unsigned char *)phdr[phx].p_paddr; +#endif len = phdr[phx].p_filesz; if ((unsigned long)addr < lowest_address) { lowest_address = (unsigned long)addr; @@ -379,6 +388,7 @@ offset++; } } + // Copy data into memory while (len-- > 0) { #ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS @@ -400,6 +410,7 @@ } } } + // Save load base/top and entry if (base) { load_address = base; Index: redboot/current/src/fs/fileio.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fs/fileio.c,v retrieving revision 1.4 diff -u -r1.4 fileio.c --- redboot/current/src/fs/fileio.c 23 Apr 2004 20:38:18 -0000 1.4 +++ redboot/current/src/fs/fileio.c 21 Aug 2004 12:41:25 -0000 @@ -159,6 +159,9 @@ } else { // diag_printf("Mount %s file system succeeded\n", type_str); fileio_mounted = 1; +#ifdef CYGBLD_REDBOOT_FILEIO_WITH_LS + chdir("/"); +#endif } } @@ -172,6 +175,89 @@ fileio_mounted = 0; } +#ifdef CYGBLD_REDBOOT_FILEIO_WITH_LS +#include + +static char rwx[8][4] = { "---", "r--", "-w-", "rw-", "--x", "r-x", "-wx", "rwx" }; + +static void +do_ls(int argc, char * argv[]) +{ + char * dir_str; + struct option_info opts[1]; + bool dir_set = false; + DIR *dirp; + char cwd[PATH_MAX]; + char filename[PATH_MAX]; + struct stat sbuf; + int err; + + init_opts(&opts[0], 'd', true, OPTION_ARG_TYPE_STR, + (void *)&dir_str, &dir_set, "directory"); + + if (!fileio_mounted) { + diag_printf("No filesystem mounted\n"); + return; + } + + if (!scan_opts(argc, argv, 1, opts, 1, NULL, 0, NULL)) + return; + + if (!dir_set) { + diag_printf("getcwd\n"); + + getcwd(cwd,sizeof(cwd)); + dir_str = cwd; + } + + diag_printf("directory %s\n",dir_str); + dirp = opendir(dir_str); + if (dirp==NULL) { + diag_printf("no such directory %s\n",dir_str); + return; + } + + for (;;) { + struct dirent *entry = readdir(dirp); + + if( entry == NULL ) + break; + + strcpy(filename, dir_str); + strcat(filename, "/"); + strcat(filename, entry->d_name); + + err = stat(filename, &sbuf); + if (err < 0) { + diag_printf("Unable to stat file %s\n", filename); + continue; + } + diag_printf("%4d ", sbuf.st_ino); + if (S_ISDIR(sbuf.st_mode)) diag_printf("d"); + if (S_ISCHR(sbuf.st_mode)) diag_printf("c"); + if (S_ISBLK(sbuf.st_mode)) diag_printf("b"); + if (S_ISREG(sbuf.st_mode)) diag_printf("-"); + if (S_ISLNK(sbuf.st_mode)) diag_printf("l"); + diag_printf("%s%s%s", // Ho, humm, have to hard code the shifts + rwx[(sbuf.st_mode & S_IRWXU) >> 16], + rwx[(sbuf.st_mode & S_IRWXG) >> 19], + rwx[(sbuf.st_mode & S_IRWXO) >> 22]); + diag_printf(" %2d size %6d %s\n", + sbuf.st_nlink,sbuf.st_size, + entry->d_name); + } + + closedir(dirp); + return; +} + +RedBoot_cmd("ls", + "list directory contents", + "[-d directory]", + do_ls + ); + +#endif // CYGBLD_REDBOOT_FILEIO_WITH_LS static int fd; externC int Index: redboot/current/src/net/net_io.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/net_io.c,v retrieving revision 1.39 diff -u -r1.39 net_io.c --- redboot/current/src/net/net_io.c 23 Apr 2004 20:38:18 -0000 1.39 +++ redboot/current/src/net/net_io.c 21 Aug 2004 12:41:26 -0000 @@ -91,11 +91,15 @@ // ordered, thus the peculiar naming. In this case, the 'use' option is // negated (if false, the others apply) which makes the names even more // confusing. + +#ifndef CYGSEM_REDBOOT_DEFAULT_NO_BOOTP +#define CYGSEM_REDBOOT_DEFAULT_NO_BOOTP 0 +#endif RedBoot_config_option("Use BOOTP for network configuration", bootp, ALWAYS_ENABLED, true, CONFIG_BOOL, - true + !CYGSEM_REDBOOT_DEFAULT_NO_BOOTP ); RedBoot_config_option("Local IP address", bootp_my_ip, @@ -672,6 +676,9 @@ char *default_devname; int default_index; #endif +#ifdef CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR + char ip_addr[16]; +#endif // Set defaults as appropriate #ifdef CYGSEM_REDBOOT_DEFAULT_NO_BOOTP @@ -762,7 +769,11 @@ } if (have_net) { show_eth_info(); - +#ifdef CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR + diag_sprintf(ip_addr, "%d.%d.%d.%d", + CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR); + inet_aton(ip_addr, &my_bootp_info.bp_siaddr); +#endif #ifdef CYGSEM_REDBOOT_FLASH_CONFIG flash_get_IP("bootp_server_ip", (ip_addr_t *)&my_bootp_info.bp_siaddr); #endif