summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS10
-rw-r--r--Makefile2
-rw-r--r--README11
-rw-r--r--arch/openrisc/include/asm/bitops.h4
-rw-r--r--arch/openrisc/lib/timer.c10
-rw-r--r--board/amirix/ap1000/ap1000.c11
-rw-r--r--board/amirix/ap1000/ap1000.h1
-rw-r--r--board/tqc/tqm8xx/u-boot.lds2
-rw-r--r--common/Makefile1
-rw-r--r--common/cmd_cache.c49
-rw-r--r--common/cmd_echo.c28
-rw-r--r--common/cmd_ini.c247
-rw-r--r--common/cmd_md5sum.c142
-rw-r--r--common/cmd_misc.c27
-rw-r--r--common/cmd_sha1sum.c142
-rw-r--r--common/cmd_test.c6
-rw-r--r--common/main.c5
-rw-r--r--fs/ext4/ext4_common.c85
-rw-r--r--fs/ext4/ext4fs.c99
-rw-r--r--include/configs/motionpro.h44
-rw-r--r--include/ext4fs.h2
-rw-r--r--net/net.c2
22 files changed, 763 insertions, 167 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 200426e8ea..e91dd7f3fb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -78,10 +78,6 @@ Holger Brunck <holger.brunck@keymile.com>
tuge1 MPC8321
tuxx1 MPC8321
-Cyril Chemparathy <cyril@ti.com>
-
- tnetv107x_evm tnetv107x
-
Conn Clark <clark@esteem.com>
ESTEEM192E MPC8xx
@@ -367,6 +363,10 @@ Frank Panno <fpanno@delphintech.com>
ep8260 MPC8260
+Chan-Taek Park <c-park@ti.com>
+
+ tnetv107x_evm tnetv107x
+
Denis Peter <d.peter@mpl.ch>
MIP405 PPC4xx
@@ -731,7 +731,7 @@ Chander Kashyap <k.chander@samsung.com>
SMDKV310 ARM ARMV7 (EXYNOS4210 SoC)
SMDK5250 ARM ARMV7 (EXYNOS5250 SoC)
-Heungjun Kim <riverful.kim@samsung.com>
+Lukasz Majewski <l.majewski@samsung.com>
trats ARM ARMV7 (EXYNOS4210 SoC)
diff --git a/Makefile b/Makefile
index a40d4cc994..34d9075a3e 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@
VERSION = 2012
PATCHLEVEL = 10
SUBLEVEL =
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
ifneq "$(SUBLEVEL)" ""
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
else
diff --git a/README b/README
index af76b0ccbf..dd250a0fa8 100644
--- a/README
+++ b/README
@@ -704,6 +704,8 @@ The following options need to be configured:
- Boot Delay: CONFIG_BOOTDELAY - in seconds
Delay before automatically booting the default image;
set to -1 to disable autoboot.
+ set to -2 to autoboot with no delay and not check for abort
+ (even when CONFIG_ZERO_BOOTDELAY_CHECK is defined).
See doc/README.autoboot for these options that
work with CONFIG_BOOTDELAY. None are required.
@@ -814,6 +816,7 @@ The following options need to be configured:
CONFIG_CMD_IMLS List all found images
CONFIG_CMD_IMMAP * IMMR dump support
CONFIG_CMD_IMPORTENV * import an environment
+ CONFIG_CMD_INI * import data from an ini file into the env
CONFIG_CMD_IRQ * irqinfo
CONFIG_CMD_ITEST Integer/string test of 2 values
CONFIG_CMD_JFFS2 * JFFS2 Support
@@ -855,7 +858,8 @@ The following options need to be configured:
CONFIG_CMD_SPI * SPI serial bus support
CONFIG_CMD_TFTPSRV * TFTP transfer in server mode
CONFIG_CMD_TFTPPUT * TFTP put command (upload)
- CONFIG_CMD_TIME * run command and report execution time
+ CONFIG_CMD_TIME * run command and report execution time (ARM specific)
+ CONFIG_CMD_TIMER * access to the system tick timer
CONFIG_CMD_USB * USB support
CONFIG_CMD_CDP * Cisco Discover Protocol support
CONFIG_CMD_MFSL * Microblaze FSL support
@@ -4688,7 +4692,10 @@ Over time, many people have reported problems when trying to use the
consider minicom to be broken, and recommend not to use it. Under
Unix, I recommend to use C-Kermit for general purpose use (and
especially for kermit binary protocol download ("loadb" command), and
-use "cu" for S-Record download ("loads" command).
+use "cu" for S-Record download ("loads" command). See
+http://www.denx.de/wiki/view/DULG/SystemSetup#Section_4.3.
+for help with kermit.
+
Nevertheless, if you absolutely want to use it try adding this
configuration to your "File transfer protocols" section:
diff --git a/arch/openrisc/include/asm/bitops.h b/arch/openrisc/include/asm/bitops.h
index c001a5d1f6..c76a40901f 100644
--- a/arch/openrisc/include/asm/bitops.h
+++ b/arch/openrisc/include/asm/bitops.h
@@ -25,4 +25,8 @@
#define PLATFORM_FFS
#include <asm/bitops/ffs.h>
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/arch/openrisc/lib/timer.c b/arch/openrisc/lib/timer.c
index 4e92a31159..89e644bc47 100644
--- a/arch/openrisc/lib/timer.c
+++ b/arch/openrisc/lib/timer.c
@@ -86,6 +86,16 @@ void set_timer(ulong t)
timestamp = t;
}
+unsigned long long get_ticks(void)
+{
+ return get_timer(0);
+}
+
+ulong get_tbclk(void)
+{
+ return CONFIG_SYS_HZ;
+}
+
void __udelay(ulong usec)
{
ulong elapsed = 0;
diff --git a/board/amirix/ap1000/ap1000.c b/board/amirix/ap1000/ap1000.c
index 64de04ca29..dbcb34b8f0 100644
--- a/board/amirix/ap1000/ap1000.c
+++ b/board/amirix/ap1000/ap1000.c
@@ -43,11 +43,13 @@ int checkboard (void)
/* After a loadace command, the SystemAce control register is left in a wonky state. */
/* this code did not work in board_pre_init */
unsigned char *p = (unsigned char *) AP1000_SYSACE_REGBASE;
+ unsigned int *revision_reg_ptr = (unsigned int *) AP1xx_FPGA_REV_ADDR;
+ unsigned int device = (*revision_reg_ptr & AP1xx_TARGET_MASK);
p[SYSACE_CTRLREG0] = 0x0;
/* add platform and device to banner */
- switch (get_device ()) {
+ switch (device) {
case AP1xx_AP107_TARGET:
puts (AP1xx_AP107_TARGET_STR);
break;
@@ -160,13 +162,6 @@ unsigned int get_platform (void)
return (*revision_reg_ptr & AP1xx_PLATFORM_MASK);
}
-unsigned int get_device (void)
-{
- unsigned int *revision_reg_ptr = (unsigned int *) AP1xx_FPGA_REV_ADDR;
-
- return (*revision_reg_ptr & AP1xx_TARGET_MASK);
-}
-
#if 0 /* loadace is not working; it appears to be a hardware issue with the system ace. */
/*
This function loads FPGA configurations from the SystemACE CompactFlash
diff --git a/board/amirix/ap1000/ap1000.h b/board/amirix/ap1000/ap1000.h
index 118c4d1b9a..d294816d26 100644
--- a/board/amirix/ap1000/ap1000.h
+++ b/board/amirix/ap1000/ap1000.h
@@ -164,7 +164,6 @@
void set_eat_machine_checks(int a_flag);
int get_eat_machine_checks(void);
unsigned int get_platform(void);
-unsigned int get_device(void);
void* memcpyb(void * dest,const void *src,size_t count);
int process_bootflag(ulong bootflag);
void user_led_on(void);
diff --git a/board/tqc/tqm8xx/u-boot.lds b/board/tqc/tqm8xx/u-boot.lds
index 4f08be61f1..e905c26c6f 100644
--- a/board/tqc/tqm8xx/u-boot.lds
+++ b/board/tqc/tqm8xx/u-boot.lds
@@ -43,8 +43,6 @@ SECTIONS
drivers/pcmcia/libpcmcia.o (.text.pcmcia_hardware_enable)
drivers/rtc/librtc.o (.text*)
drivers/misc/libmisc.o (.text*)
- *(.text.print_buffer)
- *(.text.print_size)
. = DEFINED(env_offset) ? env_offset : .;
common/env_embedded.o (.ppcenv*)
diff --git a/common/Makefile b/common/Makefile
index 5442fbbc99..973f05a99f 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -107,6 +107,7 @@ COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
+COBJS-$(CONFIG_CMD_INI) += cmd_ini.o
COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 9c228e219d..5512f924b1 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -36,21 +36,24 @@ void __weak invalidate_icache_all(void)
puts("No arch specific invalidate_icache_all available!\n");
}
-int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
case 2: /* on / off */
switch (parse_argv(argv[1])) {
- case 0: icache_disable();
+ case 0:
+ icache_disable();
break;
- case 1: icache_enable ();
+ case 1:
+ icache_enable();
break;
- case 2: invalidate_icache_all();
+ case 2:
+ invalidate_icache_all();
break;
}
- /* FALL TROUGH */
+ break;
case 1: /* get status */
- printf ("Instruction Cache is %s\n",
+ printf("Instruction Cache is %s\n",
icache_status() ? "ON" : "OFF");
return 0;
default:
@@ -65,40 +68,42 @@ void __weak flush_dcache_all(void)
/* please define arch specific flush_dcache_all */
}
-int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
- case 2: /* on / off */
+ case 2: /* on / off */
switch (parse_argv(argv[1])) {
- case 0: dcache_disable();
+ case 0:
+ dcache_disable();
break;
- case 1: dcache_enable ();
+ case 1:
+ dcache_enable();
break;
- case 2: flush_dcache_all();
+ case 2:
+ flush_dcache_all();
break;
}
- /* FALL TROUGH */
+ break;
case 1: /* get status */
- printf ("Data (writethrough) Cache is %s\n",
+ printf("Data (writethrough) Cache is %s\n",
dcache_status() ? "ON" : "OFF");
return 0;
default:
return CMD_RET_USAGE;
}
return 0;
-
}
static int parse_argv(const char *s)
{
- if (strcmp(s, "flush") == 0) {
- return (2);
- } else if (strcmp(s, "on") == 0) {
- return (1);
- } else if (strcmp(s, "off") == 0) {
- return (0);
- }
- return (-1);
+ if (strcmp(s, "flush") == 0)
+ return 2;
+ else if (strcmp(s, "on") == 0)
+ return 1;
+ else if (strcmp(s, "off") == 0)
+ return 0;
+
+ return -1;
}
diff --git a/common/cmd_echo.c b/common/cmd_echo.c
index 43a6da5722..1e499fb0db 100644
--- a/common/cmd_echo.c
+++ b/common/cmd_echo.c
@@ -30,17 +30,31 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int putnl = 1;
for (i = 1; i < argc; i++) {
- char *p = argv[i], c;
+ char *p = argv[i];
+ char *nls; /* new-line suppression */
if (i > 1)
putc(' ');
- while ((c = *p++) != '\0') {
- if (c == '\\' && *p == 'c') {
- putnl = 0;
- p++;
- } else {
- putc(c);
+
+ nls = strstr(p, "\\c");
+ if (nls) {
+ char *prenls = p;
+
+ putnl = 0;
+ /*
+ * be paranoid and guess that someone might
+ * say \c more than once
+ */
+ while (nls) {
+ *nls = '\0';
+ puts(prenls);
+ *nls = '\\';
+ prenls = nls + 2;
+ nls = strstr(prenls, "\\c");
}
+ puts(prenls);
+ } else {
+ puts(p);
}
}
diff --git a/common/cmd_ini.c b/common/cmd_ini.c
new file mode 100644
index 0000000000..652e4f6077
--- /dev/null
+++ b/common/cmd_ini.c
@@ -0,0 +1,247 @@
+/*
+ * inih -- simple .INI file parser
+ *
+ * inih is released under the New BSD license (see LICENSE.txt). Go to the
+ * project home page for more info:
+ *
+ * http://code.google.com/p/inih/
+ */
+
+#include <common.h>
+#include <command.h>
+#include <environment.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+
+#ifdef CONFIG_INI_MAX_LINE
+#define MAX_LINE CONFIG_INI_MAX_LINE
+#else
+#define MAX_LINE 200
+#endif
+
+#ifdef CONFIG_INI_MAX_SECTION
+#define MAX_SECTION CONFIG_INI_MAX_SECTION
+#else
+#define MAX_SECTION 50
+#endif
+
+#ifdef CONFIG_INI_MAX_NAME
+#define MAX_NAME CONFIG_INI_MAX_NAME
+#else
+#define MAX_NAME 50
+#endif
+
+/* Strip whitespace chars off end of given string, in place. Return s. */
+static char *rstrip(char *s)
+{
+ char *p = s + strlen(s);
+
+ while (p > s && isspace(*--p))
+ *p = '\0';
+ return s;
+}
+
+/* Return pointer to first non-whitespace char in given string. */
+static char *lskip(const char *s)
+{
+ while (*s && isspace(*s))
+ s++;
+ return (char *)s;
+}
+
+/* Return pointer to first char c or ';' comment in given string, or pointer to
+ null at end of string if neither found. ';' must be prefixed by a whitespace
+ character to register as a comment. */
+static char *find_char_or_comment(const char *s, char c)
+{
+ int was_whitespace = 0;
+
+ while (*s && *s != c && !(was_whitespace && *s == ';')) {
+ was_whitespace = isspace(*s);
+ s++;
+ }
+ return (char *)s;
+}
+
+/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
+static char *strncpy0(char *dest, const char *src, size_t size)
+{
+ strncpy(dest, src, size);
+ dest[size - 1] = '\0';
+ return dest;
+}
+
+/* Emulate the behavior of fgets but on memory */
+static char *memgets(char *str, int num, char **mem, size_t *memsize)
+{
+ char *end;
+ int len;
+ int newline = 1;
+
+ end = memchr(*mem, '\n', *memsize);
+ if (end == NULL) {
+ if (*memsize == 0)
+ return NULL;
+ end = *mem + *memsize;
+ newline = 0;
+ }
+ len = min((end - *mem) + newline, num);
+ memcpy(str, *mem, len);
+ if (len < num)
+ str[len] = '\0';
+
+ /* prepare the mem vars for the next call */
+ *memsize -= (end - *mem) + newline;
+ *mem += (end - *mem) + newline;
+
+ return str;
+}
+
+/* Parse given INI-style file. May have [section]s, name=value pairs
+ (whitespace stripped), and comments starting with ';' (semicolon). Section
+ is "" if name=value pair parsed before any section heading. name:value
+ pairs are also supported as a concession to Python's ConfigParser.
+
+ For each name=value pair parsed, call handler function with given user
+ pointer as well as section, name, and value (data only valid for duration
+ of handler call). Handler should return nonzero on success, zero on error.
+
+ Returns 0 on success, line number of first error on parse error (doesn't
+ stop on first error).
+*/
+static int ini_parse(char *filestart, size_t filelen,
+ int (*handler)(void *, char *, char *, char *), void *user)
+{
+ /* Uses a fair bit of stack (use heap instead if you need to) */
+ char line[MAX_LINE];
+ char section[MAX_SECTION] = "";
+ char prev_name[MAX_NAME] = "";
+
+ char *curmem = filestart;
+ char *start;
+ char *end;
+ char *name;
+ char *value;
+ size_t memleft = filelen;
+ int lineno = 0;
+ int error = 0;
+
+ /* Scan through file line by line */
+ while (memgets(line, sizeof(line), &curmem, &memleft) != NULL) {
+ lineno++;
+ start = lskip(rstrip(line));
+
+ if (*start == ';' || *start == '#') {
+ /*
+ * Per Python ConfigParser, allow '#' comments at start
+ * of line
+ */
+ }
+#if CONFIG_INI_ALLOW_MULTILINE
+ else if (*prev_name && *start && start > line) {
+ /*
+ * Non-blank line with leading whitespace, treat as
+ * continuation of previous name's value (as per Python
+ * ConfigParser).
+ */
+ if (!handler(user, section, prev_name, start) && !error)
+ error = lineno;
+ }
+#endif
+ else if (*start == '[') {
+ /* A "[section]" line */
+ end = find_char_or_comment(start + 1, ']');
+ if (*end == ']') {
+ *end = '\0';
+ strncpy0(section, start + 1, sizeof(section));
+ *prev_name = '\0';
+ } else if (!error) {
+ /* No ']' found on section line */
+ error = lineno;
+ }
+ } else if (*start && *start != ';') {
+ /* Not a comment, must be a name[=:]value pair */
+ end = find_char_or_comment(start, '=');
+ if (*end != '=')
+ end = find_char_or_comment(start, ':');
+ if (*end == '=' || *end == ':') {
+ *end = '\0';
+ name = rstrip(start);
+ value = lskip(end + 1);
+ end = find_char_or_comment(value, '\0');
+ if (*end == ';')
+ *end = '\0';
+ rstrip(value);
+ /* Strip double-quotes */
+ if (value[0] == '"' &&
+ value[strlen(value)-1] == '"') {
+ value[strlen(value)-1] = '\0';
+ value += 1;
+ }
+
+ /*
+ * Valid name[=:]value pair found, call handler
+ */
+ strncpy0(prev_name, name, sizeof(prev_name));
+ if (!handler(user, section, name, value) &&
+ !error)
+ error = lineno;
+ } else if (!error)
+ /* No '=' or ':' found on name[=:]value line */
+ error = lineno;
+ }
+ }
+
+ return error;
+}
+
+static int ini_handler(void *user, char *section, char *name, char *value)
+{
+ char *requested_section = (char *)user;
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ int i;
+
+ for (i = 0; i < strlen(requested_section); i++)
+ requested_section[i] = tolower(requested_section[i]);
+ for (i = 0; i < strlen(section); i++)
+ section[i] = tolower(section[i]);
+#endif
+
+ if (!strcmp(section, requested_section)) {
+#ifdef CONFIG_INI_CASE_INSENSITIVE
+ for (i = 0; i < strlen(name); i++)
+ name[i] = tolower(name[i]);
+ for (i = 0; i < strlen(value); i++)
+ value[i] = tolower(value[i]);
+#endif
+ setenv(name, value);
+ printf("ini: Imported %s as %s\n", name, value);
+ }
+
+ /* success */
+ return 1;
+}
+
+static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ const char *section;
+ char *file_address;
+ size_t file_size;
+
+ if (argc == 1)
+ return CMD_RET_USAGE;
+
+ section = argv[1];
+ file_address = (char *)simple_strtoul(
+ argc < 3 ? getenv("loadaddr") : argv[2], NULL, 16);
+ file_size = (size_t)simple_strtoul(
+ argc < 4 ? getenv("filesize") : argv[3], NULL, 16);
+
+ return ini_parse(file_address, file_size, ini_handler, (void *)section);
+}
+
+U_BOOT_CMD(
+ ini, 4, 0, do_ini,
+ "parse an ini file in memory and merge the specified section into the env",
+ "section [[file-address] file-size]"
+);
diff --git a/common/cmd_md5sum.c b/common/cmd_md5sum.c
index b93dd9b440..3f81fdf6ef 100644
--- a/common/cmd_md5sum.c
+++ b/common/cmd_md5sum.c
@@ -1,4 +1,7 @@
/*
+ * (C) Copyright 2011
+ * Joe Hershberger, National Instruments, joe.hershberger@ni.com
+ *
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
@@ -25,6 +28,125 @@
#include <command.h>
#include <u-boot/md5.h>
+/*
+ * Store the resulting sum to an address or variable
+ */
+static void store_result(const u8 *sum, const char *dest)
+{
+ unsigned int i;
+
+ if (*dest == '*') {
+ u8 *ptr;
+
+ ptr = (u8 *)simple_strtoul(dest + 1, NULL, 16);
+ for (i = 0; i < 16; i++)
+ *ptr++ = sum[i];
+ } else {
+ char str_output[33];
+ char *str_ptr = str_output;
+
+ for (i = 0; i < 16; i++) {
+ sprintf(str_ptr, "%02x", sum[i]);
+ str_ptr += 2;
+ }
+ str_ptr = '\0';
+ setenv(dest, str_output);
+ }
+}
+
+#ifdef CONFIG_MD5SUM_VERIFY
+static int parse_verify_sum(char *verify_str, u8 *vsum)
+{
+ if (*verify_str == '*') {
+ u8 *ptr;
+
+ ptr = (u8 *)simple_strtoul(verify_str + 1, NULL, 16);
+ memcpy(vsum, ptr, 16);
+ } else {
+ unsigned int i;
+ char *vsum_str;
+
+ if (strlen(verify_str) == 32)
+ vsum_str = verify_str;
+ else {
+ vsum_str = getenv(verify_str);
+ if (vsum_str == NULL || strlen(vsum_str) != 32)
+ return 1;
+ }
+
+ for (i = 0; i < 16; i++) {
+ char *nullp = vsum_str + (i + 1) * 2;
+ char end = *nullp;
+
+ *nullp = '\0';
+ *(u8 *)(vsum + i) =
+ simple_strtoul(vsum_str + (i * 2), NULL, 16);
+ *nullp = end;
+ }
+ }
+ return 0;
+}
+
+int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong addr, len;
+ unsigned int i;
+ u8 output[16];
+ u8 vsum[16];
+ int verify = 0;
+ int ac;
+ char * const *av;
+
+ if (argc < 3)
+ return CMD_RET_USAGE;
+
+ av = argv + 1;
+ ac = argc - 1;
+ if (strcmp(*av, "-v") == 0) {
+ verify = 1;
+ av++;
+ ac--;
+ if (ac < 3)
+ return CMD_RET_USAGE;
+ }
+
+ addr = simple_strtoul(*av++, NULL, 16);
+ len = simple_strtoul(*av++, NULL, 16);
+
+ md5_wd((unsigned char *) addr, len, output, CHUNKSZ_MD5);
+
+ if (!verify) {
+ printf("md5 for %08lx ... %08lx ==> ", addr, addr + len - 1);
+ for (i = 0; i < 16; i++)
+ printf("%02x", output[i]);
+ printf("\n");
+
+ if (ac > 2)
+ store_result(output, *av);
+ } else {
+ char *verify_str = *av++;
+
+ if (parse_verify_sum(verify_str, vsum)) {
+ printf("ERROR: %s does not contain a valid md5 sum\n",
+ verify_str);
+ return 1;
+ }
+ if (memcmp(output, vsum, 16) != 0) {
+ printf("md5 for %08lx ... %08lx ==> ", addr,
+ addr + len - 1);
+ for (i = 0; i < 16; i++)
+ printf("%02x", output[i]);
+ printf(" != ");
+ for (i = 0; i < 16; i++)
+ printf("%02x", vsum[i]);
+ printf(" ** ERROR **\n");
+ return 1;
+ }
+ }
+
+ return 0;
+}
+#else
static int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr, len;
@@ -43,11 +165,27 @@ static int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("%02x", output[i]);
printf("\n");
+ if (argc > 3)
+ store_result(output, argv[3]);
+
return 0;
}
+#endif
+#ifdef CONFIG_MD5SUM_VERIFY
+U_BOOT_CMD(
+ md5sum, 5, 1, do_md5sum,
+ "compute MD5 message digest",
+ "address count [[*]sum]\n"
+ " - compute MD5 message digest [save to sum]\n"
+ "md5sum -v address count [*]sum\n"
+ " - verify md5sum of memory area"
+);
+#else
U_BOOT_CMD(
- md5sum, 3, 1, do_md5sum,
+ md5sum, 4, 1, do_md5sum,
"compute MD5 message digest",
- "address count"
+ "address count [[*]sum]\n"
+ " - compute MD5 message digest [save to sum]"
);
+#endif
diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 973b1c2082..3b47a0c095 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -53,3 +53,30 @@ U_BOOT_CMD(
"N\n"
" - delay execution for N seconds (N is _decimal_ !!!)"
);
+
+#ifdef CONFIG_CMD_TIMER
+static int do_timer(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ static ulong start;
+
+ if (argc != 2)
+ return CMD_RET_USAGE;
+
+ if (!strcmp(argv[1], "start"))
+ start = get_timer(0);
+
+ if (!strcmp(argv[1], "get")) {
+ ulong msecs = get_timer(start) * 1000 / CONFIG_SYS_HZ;
+ printf("%ld.%03d\n", msecs / 1000, (int)(msecs % 1000));
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ timer, 2, 1, do_timer,
+ "access the system timer",
+ "start - Reset the timer reference.\n"
+ "timer get - Print the time since 'start'."
+);
+#endif
diff --git a/common/cmd_sha1sum.c b/common/cmd_sha1sum.c
index 2713a14f1f..8db5456c95 100644
--- a/common/cmd_sha1sum.c
+++ b/common/cmd_sha1sum.c
@@ -1,4 +1,7 @@
/*
+ * (C) Copyright 2011
+ * Joe Hershberger, National Instruments, joe.hershberger@ni.com
+ *
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
@@ -25,6 +28,125 @@
#include <command.h>
#include <sha1.h>
+/*
+ * Store the resulting sum to an address or variable
+ */
+static void store_result(const u8 *sum, const char *dest)
+{
+ unsigned int i;
+
+ if (*dest == '*') {
+ u8 *ptr;
+
+ ptr = (u8 *)simple_strtoul(dest + 1, NULL, 16);
+ for (i = 0; i < 20; i++)
+ *ptr++ = sum[i];
+ } else {
+ char str_output[41];
+ char *str_ptr = str_output;
+
+ for (i = 0; i < 20; i++) {
+ sprintf(str_ptr, "%02x", sum[i]);
+ str_ptr += 2;
+ }
+ str_ptr = '\0';
+ setenv(dest, str_output);
+ }
+}
+
+#ifdef CONFIG_SHA1SUM_VERIFY
+static int parse_verify_sum(char *verify_str, u8 *vsum)
+{
+ if (*verify_str == '*') {
+ u8 *ptr;
+
+ ptr = (u8 *)simple_strtoul(verify_str + 1, NULL, 16);
+ memcpy(vsum, ptr, 20);
+ } else {
+ unsigned int i;
+ char *vsum_str;
+
+ if (strlen(verify_str) == 40)
+ vsum_str = verify_str;
+ else {
+ vsum_str = getenv(verify_str);
+ if (vsum_str == NULL || strlen(vsum_str) != 40)
+ return 1;
+ }
+
+ for (i = 0; i < 20; i++) {
+ char *nullp = vsum_str + (i + 1) * 2;
+ char end = *nullp;
+
+ *nullp = '\0';
+ *(u8 *)(vsum + i) =
+ simple_strtoul(vsum_str + (i * 2), NULL, 16);
+ *nullp = end;
+ }
+ }
+ return 0;
+}
+
+int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong addr, len;
+ unsigned int i;
+ u8 output[20];
+ u8 vsum[20];
+ int verify = 0;
+ int ac;
+ char * const *av;
+
+ if (argc < 3)
+ return CMD_RET_USAGE;
+
+ av = argv + 1;
+ ac = argc - 1;
+ if (strcmp(*av, "-v") == 0) {
+ verify = 1;
+ av++;
+ ac--;
+ if (ac < 3)
+ return CMD_RET_USAGE;
+ }
+
+ addr = simple_strtoul(*av++, NULL, 16);
+ len = simple_strtoul(*av++, NULL, 16);
+
+ sha1_csum_wd((unsigned char *) addr, len, output, CHUNKSZ_SHA1);
+
+ if (!verify) {
+ printf("SHA1 for %08lx ... %08lx ==> ", addr, addr + len - 1);
+ for (i = 0; i < 20; i++)
+ printf("%02x", output[i]);
+ printf("\n");
+
+ if (ac > 2)
+ store_result(output, *av);
+ } else {
+ char *verify_str = *av++;
+
+ if (parse_verify_sum(verify_str, vsum)) {
+ printf("ERROR: %s does not contain a valid SHA1 sum\n",
+ verify_str);
+ return 1;
+ }
+ if (memcmp(output, vsum, 20) != 0) {
+ printf("SHA1 for %08lx ... %08lx ==> ", addr,
+ addr + len - 1);
+ for (i = 0; i < 20; i++)
+ printf("%02x", output[i]);
+ printf(" != ");
+ for (i = 0; i < 20; i++)
+ printf("%02x", vsum[i]);
+ printf(" ** ERROR **\n");
+ return 1;
+ }
+ }
+
+ return 0;
+}
+#else
static int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr, len;
@@ -43,11 +165,27 @@ static int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("%02x", output[i]);
printf("\n");
+ if (argc > 3)
+ store_result(output, argv[3]);
+
return 0;
}
+#endif
+#ifdef CONFIG_SHA1SUM_VERIFY
+U_BOOT_CMD(
+ sha1sum, 5, 1, do_sha1sum,
+ "compute SHA1 message digest",
+ "address count [[*]sum]\n"
+ " - compute SHA1 message digest [save to sum]\n"
+ "sha1sum -v address count [*]sum\n"
+ " - verify sha1sum of memory area"
+);
+#else
U_BOOT_CMD(
- sha1sum, 3, 1, do_sha1sum,
+ sha1sum, 4, 1, do_sha1sum,
"compute SHA1 message digest",
- "address count"
+ "address count [[*]sum]\n"
+ " - compute SHA1 message digest [save to sum]"
);
+#endif
diff --git a/common/cmd_test.c b/common/cmd_test.c
index fcb5ef2f71..6da06b9f78 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -33,12 +33,12 @@ int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc < 3)
return 1;
-#if 0
+#ifdef DEBUG
{
- printf("test:");
+ debug("test(%d):", argc);
left = 1;
while (argv[left])
- printf(" %s", argv[left++]);
+ debug(" '%s'", argv[left++]);
}
#endif
diff --git a/common/main.c b/common/main.c
index 81984acb00..9507cec88b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -222,7 +222,8 @@ int abortboot(int bootdelay)
#ifdef CONFIG_MENUPROMPT
printf(CONFIG_MENUPROMPT);
#else
- printf("Hit any key to stop autoboot: %2d ", bootdelay);
+ if (bootdelay >= 0)
+ printf("Hit any key to stop autoboot: %2d ", bootdelay);
#endif
#if defined CONFIG_ZERO_BOOTDELAY_CHECK
@@ -382,7 +383,7 @@ void main_loop (void)
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
- if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
+ if (bootdelay != -1 && s && !abortboot(bootdelay)) {
# ifdef CONFIG_AUTOBOOT_KEYED
int prev = disable_ctrlc(1); /* disable Control C checking */
# endif
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 3deffd523e..d6d55b9fff 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -314,7 +314,7 @@ int ext4fs_checksum_update(unsigned int i)
struct ext_filesystem *fs = get_fs();
__u16 crc = 0;
- desc = (struct ext2_block_group *)&fs->gd[i];
+ desc = (struct ext2_block_group *)&fs->bgd[i];
if (fs->sb->feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) {
int offset = offsetof(struct ext2_block_group, bg_checksum);
@@ -874,17 +874,17 @@ long int ext4fs_get_new_blk_no(void)
char *zero_buffer = zalloc(fs->blksz);
if (!journal_buffer || !zero_buffer)
goto fail;
- struct ext2_block_group *gd = (struct ext2_block_group *)fs->gdtable;
+ struct ext2_block_group *bgd = (struct ext2_block_group *)fs->gdtable;
if (fs->first_pass_bbmap == 0) {
for (i = 0; i < fs->no_blkgrp; i++) {
- if (gd[i].free_blocks) {
- if (gd[i].bg_flags & EXT4_BG_BLOCK_UNINIT) {
- put_ext4(((uint64_t) (gd[i].block_id *
+ if (bgd[i].free_blocks) {
+ if (bgd[i].bg_flags & EXT4_BG_BLOCK_UNINIT) {
+ put_ext4(((uint64_t) (bgd[i].block_id *
fs->blksz)),
zero_buffer, fs->blksz);
- gd[i].bg_flags =
- gd[i].
+ bgd[i].bg_flags =
+ bgd[i].
bg_flags & ~EXT4_BG_BLOCK_UNINIT;
memcpy(fs->blk_bmaps[i], zero_buffer,
fs->blksz);
@@ -897,16 +897,16 @@ long int ext4fs_get_new_blk_no(void)
fs->curr_blkno = fs->curr_blkno +
(i * fs->blksz * 8);
fs->first_pass_bbmap++;
- gd[i].free_blocks--;
+ bgd[i].free_blocks--;
fs->sb->free_blocks--;
- status = ext4fs_devread(gd[i].block_id *
+ status = ext4fs_devread(bgd[i].block_id *
fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[i].block_id))
+ bgd[i].block_id))
goto fail;
goto success;
} else {
@@ -935,19 +935,19 @@ restart:
if (bg_idx >= fs->no_blkgrp)
goto fail;
- if (gd[bg_idx].free_blocks == 0) {
+ if (bgd[bg_idx].free_blocks == 0) {
debug("block group %u is full. Skipping\n", bg_idx);
fs->curr_blkno = fs->curr_blkno + blk_per_grp;
fs->curr_blkno--;
goto restart;
}
- if (gd[bg_idx].bg_flags & EXT4_BG_BLOCK_UNINIT) {
+ if (bgd[bg_idx].bg_flags & EXT4_BG_BLOCK_UNINIT) {
memset(zero_buffer, '\0', fs->blksz);
- put_ext4(((uint64_t) (gd[bg_idx].block_id * fs->blksz)),
- zero_buffer, fs->blksz);
+ put_ext4(((uint64_t) (bgd[bg_idx].block_id *
+ fs->blksz)), zero_buffer, fs->blksz);
memcpy(fs->blk_bmaps[bg_idx], zero_buffer, fs->blksz);
- gd[bg_idx].bg_flags = gd[bg_idx].bg_flags &
+ bgd[bg_idx].bg_flags = bgd[bg_idx].bg_flags &
~EXT4_BG_BLOCK_UNINIT;
}
@@ -961,18 +961,18 @@ restart:
/* journal backup */
if (prev_bg_bitmap_index != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk,
0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bitmap_index = bg_idx;
}
- gd[bg_idx].free_blocks--;
+ bgd[bg_idx].free_blocks--;
fs->sb->free_blocks--;
goto success;
}
@@ -1000,19 +1000,21 @@ int ext4fs_get_new_inode_no(void)
char *zero_buffer = zalloc(fs->blksz);
if (!journal_buffer || !zero_buffer)
goto fail;
- struct ext2_block_group *gd = (struct ext2_block_group *)fs->gdtable;
+ struct ext2_block_group *bgd = (struct ext2_block_group *)fs->gdtable;
if (fs->first_pass_ibmap == 0) {
for (i = 0; i < fs->no_blkgrp; i++) {
- if (gd[i].free_inodes) {
- if (gd[i].bg_itable_unused != gd[i].free_inodes)
- gd[i].bg_itable_unused =
- gd[i].free_inodes;
- if (gd[i].bg_flags & EXT4_BG_INODE_UNINIT) {
+ if (bgd[i].free_inodes) {
+ if (bgd[i].bg_itable_unused !=
+ bgd[i].free_inodes)
+ bgd[i].bg_itable_unused =
+ bgd[i].free_inodes;
+ if (bgd[i].bg_flags & EXT4_BG_INODE_UNINIT) {
put_ext4(((uint64_t)
- (gd[i].inode_id * fs->blksz)),
+ (bgd[i].inode_id *
+ fs->blksz)),
zero_buffer, fs->blksz);
- gd[i].bg_flags = gd[i].bg_flags &
+ bgd[i].bg_flags = bgd[i].bg_flags &
~EXT4_BG_INODE_UNINIT;
memcpy(fs->inode_bmaps[i],
zero_buffer, fs->blksz);
@@ -1025,17 +1027,17 @@ int ext4fs_get_new_inode_no(void)
fs->curr_inode_no = fs->curr_inode_no +
(i * inodes_per_grp);
fs->first_pass_ibmap++;
- gd[i].free_inodes--;
- gd[i].bg_itable_unused--;
+ bgd[i].free_inodes--;
+ bgd[i].bg_itable_unused--;
fs->sb->free_inodes--;
- status = ext4fs_devread(gd[i].inode_id *
+ status = ext4fs_devread(bgd[i].inode_id *
fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[i].inode_id))
+ bgd[i].inode_id))
goto fail;
goto success;
} else
@@ -1047,13 +1049,13 @@ restart:
fs->curr_inode_no++;
/* get the blockbitmap index respective to blockno */
ibmap_idx = fs->curr_inode_no / inodes_per_grp;
- if (gd[ibmap_idx].bg_flags & EXT4_BG_INODE_UNINIT) {
+ if (bgd[ibmap_idx].bg_flags & EXT4_BG_INODE_UNINIT) {
memset(zero_buffer, '\0', fs->blksz);
- put_ext4(((uint64_t) (gd[ibmap_idx].inode_id *
+ put_ext4(((uint64_t) (bgd[ibmap_idx].inode_id *
fs->blksz)), zero_buffer,
fs->blksz);
- gd[ibmap_idx].bg_flags =
- gd[ibmap_idx].bg_flags & ~EXT4_BG_INODE_UNINIT;
+ bgd[ibmap_idx].bg_flags =
+ bgd[ibmap_idx].bg_flags & ~EXT4_BG_INODE_UNINIT;
memcpy(fs->inode_bmaps[ibmap_idx], zero_buffer,
fs->blksz);
}
@@ -1069,21 +1071,22 @@ restart:
/* journal backup */
if (prev_inode_bitmap_index != ibmap_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[ibmap_idx].inode_id
+ status = ext4fs_devread(bgd[ibmap_idx].inode_id
* fs->sect_perblk,
0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[ibmap_idx].inode_id))
+ bgd[ibmap_idx].inode_id))
goto fail;
prev_inode_bitmap_index = ibmap_idx;
}
- if (gd[ibmap_idx].bg_itable_unused != gd[ibmap_idx].free_inodes)
- gd[ibmap_idx].bg_itable_unused =
- gd[ibmap_idx].free_inodes;
- gd[ibmap_idx].free_inodes--;
- gd[ibmap_idx].bg_itable_unused--;
+ if (bgd[ibmap_idx].bg_itable_unused !=
+ bgd[ibmap_idx].free_inodes)
+ bgd[ibmap_idx].bg_itable_unused =
+ bgd[ibmap_idx].free_inodes;
+ bgd[ibmap_idx].free_inodes--;
+ bgd[ibmap_idx].bg_itable_unused--;
fs->sb->free_inodes--;
goto success;
}
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 93dcb7e8fa..3a5ef20a4b 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -209,14 +209,14 @@ static void ext4fs_update(void)
/* update block groups */
for (i = 0; i < fs->no_blkgrp; i++) {
- fs->gd[i].bg_checksum = ext4fs_checksum_update(i);
- put_ext4((uint64_t)(fs->gd[i].block_id * fs->blksz),
+ fs->bgd[i].bg_checksum = ext4fs_checksum_update(i);
+ put_ext4((uint64_t)(fs->bgd[i].block_id * fs->blksz),
fs->blk_bmaps[i], fs->blksz);
}
/* update inode table groups */
for (i = 0; i < fs->no_blkgrp; i++) {
- put_ext4((uint64_t) (fs->gd[i].inode_id * fs->blksz),
+ put_ext4((uint64_t) (fs->bgd[i].inode_id * fs->blksz),
fs->inode_bmaps[i], fs->blksz);
}
@@ -266,7 +266,7 @@ fail:
static void delete_single_indirect_block(struct ext2_inode *inode)
{
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
static int prev_bg_bmap_idx = -1;
long int blknr;
int remainder;
@@ -280,7 +280,7 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
return;
}
/* get block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
/* deleting the single indirect block associated with inode */
if (inode->b.blocks.indir_block != 0) {
@@ -295,18 +295,18 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal
- (journal_buffer, gd[bg_idx].block_id))
+ (journal_buffer, bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -326,7 +326,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
unsigned int blk_per_grp = ext4fs_root->sblock.blocks_per_group;
unsigned int *di_buffer = NULL;
unsigned int *DIB_start_addr = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer) {
@@ -334,7 +334,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
return;
}
/* get the block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
if (inode->b.blocks.double_indir_block != 0) {
di_buffer = zalloc(fs->blksz);
@@ -362,11 +362,11 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
ext4fs_reset_block_bmap(*di_buffer,
fs->blk_bmaps[bg_idx], bg_idx);
di_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk, 0,
fs->blksz,
journal_buffer);
@@ -374,7 +374,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -391,19 +391,19 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id *
+ status = ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -427,7 +427,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
unsigned int *tib_start_addr = NULL;
unsigned int *tip_buffer = NULL;
unsigned int *tipb_start_addr = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer) {
@@ -435,7 +435,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
return;
}
/* get block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
if (inode->b.blocks.triple_indir_block != 0) {
tigp_buffer = zalloc(fs->blksz);
@@ -477,20 +477,21 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
bg_idx);
tip_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
- fs->sect_perblk, 0,
- fs->blksz,
- journal_buffer);
+ ext4fs_devread(
+ bgd[bg_idx].block_id *
+ fs->sect_perblk, 0,
+ fs->blksz,
+ journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].
+ bgd[bg_idx].
block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
@@ -516,20 +517,20 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
fs->blk_bmaps[bg_idx], bg_idx);
tigp_buffer++;
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0,
fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -546,19 +547,19 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
bg_idx--;
}
ext4fs_reset_block_bmap(blknr, fs->blk_bmaps[bg_idx], bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id *
+ status = ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -590,13 +591,13 @@ static int ext4fs_delete_file(int inodeno)
unsigned int blk_per_grp = ext4fs_root->sblock.blocks_per_group;
unsigned int inode_per_grp = ext4fs_root->sblock.inodes_per_group;
struct ext2_inode *inode_buffer = NULL;
- struct ext2_block_group *gd = NULL;
+ struct ext2_block_group *bgd = NULL;
struct ext_filesystem *fs = get_fs();
char *journal_buffer = zalloc(fs->blksz);
if (!journal_buffer)
return -ENOMEM;
/* get the block group descriptor table */
- gd = (struct ext2_block_group *)fs->gdtable;
+ bgd = (struct ext2_block_group *)fs->gdtable;
status = ext4fs_read_inode(ext4fs_root, inodeno, &inode);
if (status == 0)
goto fail;
@@ -631,19 +632,19 @@ static int ext4fs_delete_file(int inodeno)
debug("EXT4_EXTENTS Block releasing %ld: %d\n",
blknr, bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
status =
- ext4fs_devread(gd[bg_idx].block_id *
+ ext4fs_devread(bgd[bg_idx].block_id *
fs->sect_perblk, 0,
fs->blksz, journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -676,19 +677,19 @@ static int ext4fs_delete_file(int inodeno)
bg_idx);
debug("ActualB releasing %ld: %d\n", blknr, bg_idx);
- gd[bg_idx].free_blocks++;
+ bgd[bg_idx].free_blocks++;
fs->sb->free_blocks++;
/* journal backup */
if (prev_bg_bmap_idx != bg_idx) {
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[bg_idx].block_id
+ status = ext4fs_devread(bgd[bg_idx].block_id
* fs->sect_perblk,
0, fs->blksz,
journal_buffer);
if (status == 0)
goto fail;
if (ext4fs_log_journal(journal_buffer,
- gd[bg_idx].block_id))
+ bgd[bg_idx].block_id))
goto fail;
prev_bg_bmap_idx = bg_idx;
}
@@ -701,7 +702,7 @@ static int ext4fs_delete_file(int inodeno)
/* get the block no */
inodeno--;
- blkno = __le32_to_cpu(gd[ibmap_idx].inode_table_id) +
+ blkno = __le32_to_cpu(bgd[ibmap_idx].inode_table_id) +
(inodeno % __le32_to_cpu(inode_per_grp)) / inodes_per_block;
/* get the offset of the inode */
@@ -731,15 +732,15 @@ static int ext4fs_delete_file(int inodeno)
/* update the respective inode bitmaps */
inodeno++;
ext4fs_reset_inode_bmap(inodeno, fs->inode_bmaps[ibmap_idx], ibmap_idx);
- gd[ibmap_idx].free_inodes++;
+ bgd[ibmap_idx].free_inodes++;
fs->sb->free_inodes++;
/* journal backup */
memset(journal_buffer, '\0', fs->blksz);
- status = ext4fs_devread(gd[ibmap_idx].inode_id *
+ status = ext4fs_devread(bgd[ibmap_idx].inode_id *
fs->sect_perblk, 0, fs->blksz, journal_buffer);
if (status == 0)
goto fail;
- if (ext4fs_log_journal(journal_buffer, gd[ibmap_idx].inode_id))
+ if (ext4fs_log_journal(journal_buffer, bgd[ibmap_idx].inode_id))
goto fail;
ext4fs_update();
@@ -797,7 +798,7 @@ int ext4fs_init(void)
printf("Error in getting the block group descriptor table\n");
goto fail;
}
- fs->gd = (struct ext2_block_group *)fs->gdtable;
+ fs->bgd = (struct ext2_block_group *)fs->gdtable;
/* load all the available bitmap block of the partition */
fs->blk_bmaps = zalloc(fs->no_blkgrp * sizeof(char *));
@@ -811,7 +812,7 @@ int ext4fs_init(void)
for (i = 0; i < fs->no_blkgrp; i++) {
status =
- ext4fs_devread(fs->gd[i].block_id * fs->sect_perblk, 0,
+ ext4fs_devread(fs->bgd[i].block_id * fs->sect_perblk, 0,
fs->blksz, (char *)fs->blk_bmaps[i]);
if (status == 0)
goto fail;
@@ -828,7 +829,7 @@ int ext4fs_init(void)
}
for (i = 0; i < fs->no_blkgrp; i++) {
- status = ext4fs_devread(fs->gd[i].inode_id * fs->sect_perblk,
+ status = ext4fs_devread(fs->bgd[i].inode_id * fs->sect_perblk,
0, fs->blksz,
(char *)fs->inode_bmaps[i]);
if (status == 0)
@@ -842,7 +843,7 @@ int ext4fs_init(void)
* reboot of a linux kernel
*/
for (i = 0; i < fs->no_blkgrp; i++)
- real_free_blocks = real_free_blocks + fs->gd[i].free_blocks;
+ real_free_blocks = real_free_blocks + fs->bgd[i].free_blocks;
if (real_free_blocks != fs->sb->free_blocks)
fs->sb->free_blocks = real_free_blocks;
@@ -907,7 +908,7 @@ void ext4fs_deinit(void)
free(fs->gdtable);
fs->gdtable = NULL;
- fs->gd = NULL;
+ fs->bgd = NULL;
/*
* reinitiliazed the global inode and
* block bitmap first execution check variables
@@ -1087,7 +1088,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
goto fail;
ibmap_idx = inodeno / ext4fs_root->sblock.inodes_per_group;
inodeno--;
- itable_blkno = __le32_to_cpu(fs->gd[ibmap_idx].inode_table_id) +
+ itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
(inodeno % __le32_to_cpu(sblock->inodes_per_group)) /
inodes_per_block;
blkoff = (inodeno % inodes_per_block) * fs->inodesz;
@@ -1105,7 +1106,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
}
ibmap_idx = parent_inodeno / ext4fs_root->sblock.inodes_per_group;
parent_inodeno--;
- parent_itable_blkno = __le32_to_cpu(fs->gd[ibmap_idx].inode_table_id) +
+ parent_itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
(parent_inodeno %
__le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
blkoff = (parent_inodeno % inodes_per_block) * fs->inodesz;
diff --git a/include/configs/motionpro.h b/include/configs/motionpro.h
index f6a44976fb..1e19ffae0e 100644
--- a/include/configs/motionpro.h
+++ b/include/configs/motionpro.h
@@ -2,7 +2,7 @@
* (C) Copyright 2003-2007
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
- * Based on PRO Motion board config file by Andy Joseph, andy@promessdev.com
+ * Based on Motion-PRO board config file by Robert McCullough, rob@promessinc.com
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -100,6 +100,7 @@
#define CONFIG_CMDLINE_EDITING 1 /* add command line history */
#define CONFIG_SYS_HUSH_PARSER 1 /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_ETHADDR 00:50:C2:40:10:00
#define CONFIG_OVERWRITE_ETHADDR_ONCE 1
@@ -111,21 +112,21 @@
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"hostname=motionpro\0" \
- "netmask=255.255.0.0\0" \
- "ipaddr=192.168.160.22\0" \
- "serverip=192.168.1.1\0" \
- "gatewayip=192.168.1.1\0" \
+ "netmask=255.255.255.0\0" \
+ "ipaddr=192.168.1.106\0" \
+ "serverip=192.168.1.100\0" \
+ "gatewayip=192.168.1.100\0" \
"console=ttyPSC0,115200\0" \
"u-boot_addr=400000\0" \
"kernel_addr=400000\0" \
"fdt_addr=700000\0" \
"ramdisk_addr=800000\0" \
"multi_image_addr=800000\0" \
- "rootpath=/opt/eldk/ppc_6xx\0" \
- "u-boot=motionpro/u-boot.bin\0" \
- "bootfile=motionpro/uImage\0" \
- "fdt_file=motionpro/motionpro.dtb\0" \
- "ramdisk_file=motionpro/uRamdisk\0" \
+ "rootpath=/opt/eldk-4.2/ppc_6xx\0" \
+ "u-boot=/tftpboot/motionpro/u-boot.bin\0" \
+ "bootfile=/tftpboot/motionpro/uImage\0" \
+ "fdt_file=/tftpboot/motionpro/motionpro.dtb\0" \
+ "ramdisk_file=/tftpboot/motionpro/uRamdisk\0" \
"multi_image_file=kernel+initrd+dtb.img\0" \
"load=tftp ${u-boot_addr} ${u-boot}\0" \
"update=prot off fff00000 +${filesize};" \
@@ -135,25 +136,32 @@
"ramargs=setenv bootargs root=/dev/ram rw\0" \
"nfsargs=setenv bootargs root=/dev/nfs rw " \
"nfsroot=${serverip}:${rootpath}\0" \
- "fat_args=setenv bootargs rw\0" \
- "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
+ "fat_args=setenv bootargs root=/dev/sda rw\0" \
+ "mtdids=nor0=ff000000.flash\0" \
+ "mtdparts=ff000000.flash:13m(fs),2m(kernel),384k(uboot)," \
+ "128k(env),128k(redund_env)," \
+ "128k(dtb),128k(user_data)\0" \
+ "addcons=setenv bootargs ${bootargs} console=${console}\0" \
+ "addmtd=setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
"addip=setenv bootargs ${bootargs} " \
"ip=${ipaddr}:${serverip}:${gatewayip}:" \
"${netmask}:${hostname}:${netdev}:off panic=1 " \
"console=${console}\0" \
"net_nfs=tftp ${kernel_addr} ${bootfile}; " \
- "tftp ${fdt_addr} ${fdt_file}; run nfsargs addip; " \
+ "tftp ${fdt_addr} ${fdt_file}; " \
+ "run nfsargs addip addmtd; " \
"bootm ${kernel_addr} - ${fdt_addr}\0" \
"net_self=tftp ${kernel_addr} ${bootfile}; " \
"tftp ${fdt_addr} ${fdt_file}; " \
"tftp ${ramdisk_addr} ${ramdisk_file}; " \
- "run ramargs addip; " \
+ "nfs ${ramdisk_addr} ${serverip}:${rootpath}/images/uRamdisk; " \
+ "run ramargs addip addcons addmtd; " \
"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
- "fat_multi=run fat_args addip; fatload ide 0:1 " \
+ "fat_multi=run fat_args addip addmtd; fatload ide 0:1 " \
"${multi_image_addr} ${multi_image_file}; " \
"bootm ${multi_image_addr}\0" \
""
-#define CONFIG_BOOTCOMMAND "run net_nfs"
+#define CONFIG_BOOTCOMMAND "run fat_multi"
/*
* do board-specific init
@@ -209,7 +217,7 @@
#define CONFIG_SYS_RAMBOOT 1
#endif
-#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* 256 kB for Monitor */
+#define CONFIG_SYS_MONITOR_LEN (384 << 10) /* 384 kB for Monitor */
#define CONFIG_SYS_MALLOC_LEN (1024 << 10) /* 1 MiB for malloc() */
#define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* initial mem map for Linux */
@@ -274,7 +282,7 @@
#define CONFIG_FLASH_CFI_MTD
#define MTDIDS_DEFAULT "nor0=motionpro-0"
#define MTDPARTS_DEFAULT "mtdparts=motionpro-0:" \
- "13m(fs),2m(kernel),256k(uboot)," \
+ "13m(fs),2m(kernel),384k(uboot)," \
"128k(env),128k(redund_env)," \
"128k(dtb),-(user_data)"
diff --git a/include/ext4fs.h b/include/ext4fs.h
index b6eedde318..23298fcd7d 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -94,7 +94,7 @@ struct ext_filesystem {
/* Superblock */
struct ext2_sblock *sb;
/* Block group descritpor table */
- struct ext2_block_group *gd;
+ struct ext2_block_group *bgd;
char *gdtable;
/* Block Bitmap Related */
diff --git a/net/net.c b/net/net.c
index 809fb14c79..569fec41e7 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1161,7 +1161,7 @@ NetReceive(uchar *inpkt, int len)
#ifdef CONFIG_NETCONSOLE
nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE,
- ntohl(ip->ip_src),
+ src_ip,
ntohs(ip->udp_dst),
ntohs(ip->udp_src),
ntohs(ip->udp_len) - UDP_HDR_SIZE);
OpenPOWER on IntegriCloud