diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:02:13 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:02:13 +0200 |
commit | 4b07af6730d2811363f158f5175138116038f7b9 (patch) | |
tree | 206044270884f80204a2da69e02ca3b6f5803185 | |
parent | d08c60e9d77dc0f83946cd702d383451865e66dd (diff) | |
download | barebox-4b07af6730d2811363f158f5175138116038f7b9.tar.gz barebox-4b07af6730d2811363f158f5175138116038f7b9.tar.xz |
svn_rev_643
structure cleanup
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | arch/ppc/Kconfig | 2 | ||||
-rw-r--r-- | commands/Kconfig | 152 | ||||
-rw-r--r-- | commands/Makefile | 18 | ||||
-rw-r--r-- | commands/bootm.c (renamed from common/cmd_bootm.c) | 6 | ||||
-rw-r--r-- | commands/clear.c | 15 | ||||
-rw-r--r-- | commands/echo.c (renamed from common/cmd_echo.c) | 0 | ||||
-rw-r--r-- | commands/edit.c (renamed from common/cmd_edit.c) | 0 | ||||
-rw-r--r-- | commands/environment.c (renamed from common/environment.c) | 0 | ||||
-rw-r--r-- | commands/exec.c (renamed from common/cmd_exec.c) | 0 | ||||
-rw-r--r-- | commands/fs.c (renamed from common/cmd_fs.c) | 0 | ||||
-rw-r--r-- | commands/go.c (renamed from common/cmd_boot.c) | 18 | ||||
-rw-r--r-- | commands/loadb.c (renamed from common/cmd_loadb.c) | 0 | ||||
-rw-r--r-- | commands/loads.c (renamed from common/cmd_loads.c) | 0 | ||||
-rw-r--r-- | commands/mem.c (renamed from common/cmd_mem.c) | 0 | ||||
-rw-r--r-- | commands/meminfo.c | 15 | ||||
-rw-r--r-- | commands/memtest.c (renamed from common/cmd_memtest.c) | 0 | ||||
-rw-r--r-- | commands/reset.c | 16 | ||||
-rw-r--r-- | commands/sleep.c | 30 | ||||
-rw-r--r-- | common/Kconfig | 158 | ||||
-rw-r--r-- | common/Makefile | 26 | ||||
-rw-r--r-- | common/cmd_misc.c | 53 | ||||
-rw-r--r-- | lib/Kconfig | 19 | ||||
-rw-r--r-- | lib/Makefile | 12 | ||||
-rw-r--r-- | lib/crc16.c (renamed from common/crc16.c) | 0 | ||||
-rw-r--r-- | lib/getopt.c (renamed from common/getopt.c) | 0 | ||||
-rw-r--r-- | lib/readkey.c (renamed from common/readkey.c) | 0 | ||||
-rw-r--r-- | lib/readline.c (renamed from common/readline.c) | 0 | ||||
-rw-r--r-- | lib/readline_simple.c (renamed from common/readline_simple.c) | 0 | ||||
-rw-r--r-- | lib/xfuncs.c (renamed from common/xfuncs.c) | 0 | ||||
-rw-r--r-- | scripts/ubootenv.c | 2 |
31 files changed, 283 insertions, 261 deletions
@@ -411,7 +411,7 @@ scripts: scripts_basic include/config/auto.conf $(Q)$(MAKE) $(build)=$(@) # Objects we will link into uboot / subdirs we need to visit -common-y := common/ drivers/ lib/ net/ fs/ +common-y := common/ drivers/ commands/ lib/ net/ fs/ ifeq ($(dot-config),1) # Read in config diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 320f596a97..0a77d9110b 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -35,6 +35,8 @@ config MACH_PHYCORE_MPC5200B_TINY_REV_1 endchoice source common/Kconfig +source commands/Kconfig source net/Kconfig source drivers/Kconfig source fs/Kconfig +source lib/Kconfig diff --git a/commands/Kconfig b/commands/Kconfig new file mode 100644 index 0000000000..00127932be --- /dev/null +++ b/commands/Kconfig @@ -0,0 +1,152 @@ +menu "Commands " + +menu "scripting " + +config CMD_EDIT + bool + prompt "edit" + +config CMD_EXEC + bool + prompt "exec" + +config CMD_SLEEP + bool + prompt "sleep" + +config CMD_ENVIRONMENT + bool + prompt "saveenv / loadenv" + +config CMD_HELP + bool + default y + prompt "help" + +endmenu + + +menu "console " + +config CMD_CLEAR + bool + prompt "clear" + +config CMD_CONSOLE + bool + prompt "coninfo" + +config CMD_ECHO + bool + prompt "echo" + +config CMD_SPLASH + bool + prompt "splash" + +endmenu + + +menu "i2c " + +config CMD_I2C + bool + prompt "i2c" + +endmenu + + +menu "memory " + +config CMD_LOADB + select CRC16 + bool + prompt "loadb" + +config CMD_LOADS + bool + prompt "loads" + +config CMD_SAVES + bool + depends on CMD_LOADS + prompt "saves" + +config CMD_MEMINFO + bool + prompt "meminfo" + +config CMD_MEMORY + bool + prompt "md, mm, mw and several others" + +config CMD_MTEST + bool + prompt "mtest" + +config CMD_MTEST_ALTERNATIVE + bool + depends on CMD_MTEST + prompt "alternative mtest implementation" + +config CMD_MTEST_START + hex + depends on CMD_MTEST + prompt "mtest start address" + +config CMD_MTEST_END + hex + depends on CMD_MTEST + prompt "mtest end address" + +endmenu + + +menu "network " + +config CMD_MII + bool + prompt "mii" + +endmenu + + +menu "flash " + +config CMD_FLASH + bool + prompt "protect/erase/flinfo" + +endmenu + + +menu "booting " + +config CMD_BOOTM + bool + select CRC32 + prompt "bootm" + +config CMD_BOOTM_ZLIB + bool + depends on CMD_BOOTM + select ZLIB + prompt "bootm with zlib support" + +config CMD_BOOTM_BZLIB + bool + depends on CMD_BOOTM + select BZLIB + prompt "bootm with bzlib support" + +config CMD_RESET + bool + prompt "reset" + +config CMD_GO + bool + prompt "go" + +endmenu + +endmenu diff --git a/commands/Makefile b/commands/Makefile new file mode 100644 index 0000000000..9a60914103 --- /dev/null +++ b/commands/Makefile @@ -0,0 +1,18 @@ +obj-$(CONFIG_CMD_BOOTM) += bootm.o +obj-$(CONFIG_CMD_LOADB) += loadb.o xyzModem.o +obj-$(CONFIG_CMD_LOADS) += loads.o +obj-$(CONFIG_CMD_ECHO) += echo.o +#obj-$(CONFIG_CMD_FLASH) += flash.o +obj-$(CONFIG_CMD_MEMORY) += mem.o +obj-$(CONFIG_CMD_MII) += mii.o +obj-$(CONFIG_CMD_I2C) += i2c.o +obj-$(CONFIG_CMD_LOADS) += s_record.o +obj-$(CONFIG_CMD_SPLASH) += splash.o +obj-$(CONFIG_CMD_MTEST) += memtest.o +obj-$(CONFIG_CMD_EDIT) += edit.o +obj-$(CONFIG_CMD_EXEC) += exec.o +obj-$(CONFIG_CMD_SLEEP) += sleep.o +obj-$(CONFIG_CMD_RESET) += reset.o +obj-$(CONFIG_CMD_GO) += go.o +obj-$(CONFIG_CMD_ENVIRONMENT) += environment.o +obj-y += fs.o diff --git a/common/cmd_bootm.c b/commands/bootm.c index 0c91c0becb..02ddf20fdb 100644 --- a/common/cmd_bootm.c +++ b/commands/bootm.c @@ -140,6 +140,8 @@ int relocate_image(image_header_t *hdr, void *load_address) { unsigned long data = (unsigned long)(hdr + 1); unsigned long len = ntohl(hdr->ih_size); + int ret; + #if defined CONFIG_CMD_BOOTM_ZLIB || defined CONFIG_CMD_BOOTM_BZLIB uint unc_len = CFG_BOOTM_LEN; #endif @@ -168,10 +170,10 @@ int relocate_image(image_header_t *hdr, void *load_address) * use slower decompression algorithm which requires * at most 2300 KB of memory. */ - i = BZ2_bzBuffToBuffDecompress (load_address, + ret = BZ2_bzBuffToBuffDecompress (load_address, &unc_len, (char *)data, len, CFG_MALLOC_LEN < (4096 * 1024), 0); - if (i != BZ_OK) + if (ret != BZ_OK) return -1; break; #endif diff --git a/commands/clear.c b/commands/clear.c new file mode 100644 index 0000000000..ee7ab07c05 --- /dev/null +++ b/commands/clear.c @@ -0,0 +1,15 @@ +#include <common.h> +#include <command.h> + +int do_clear (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + printf(ANSI_CLEAR_SCREEN); + + return 0; +} + +U_BOOT_CMD_START(clear) + .maxargs = 1, + .cmd = do_clear, + .usage = "clear screen", +U_BOOT_CMD_END diff --git a/common/cmd_echo.c b/commands/echo.c index 1314f2d971..1314f2d971 100644 --- a/common/cmd_echo.c +++ b/commands/echo.c diff --git a/common/cmd_edit.c b/commands/edit.c index 902bce28fe..902bce28fe 100644 --- a/common/cmd_edit.c +++ b/commands/edit.c diff --git a/common/environment.c b/commands/environment.c index 148b6e9d6e..148b6e9d6e 100644 --- a/common/environment.c +++ b/commands/environment.c diff --git a/common/cmd_exec.c b/commands/exec.c index 2cba507519..2cba507519 100644 --- a/common/cmd_exec.c +++ b/commands/exec.c diff --git a/common/cmd_fs.c b/commands/fs.c index 2eca365016..2eca365016 100644 --- a/common/cmd_fs.c +++ b/commands/fs.c diff --git a/common/cmd_boot.c b/commands/go.c index 246d3e0265..accda18da1 100644 --- a/common/cmd_boot.c +++ b/commands/go.c @@ -24,13 +24,9 @@ /* * Misc boot support */ + #include <common.h> #include <command.h> -#include <net.h> - -#if defined(CONFIG_I386) -DECLARE_GLOBAL_DATA_PTR; -#endif int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -81,15 +77,3 @@ U_BOOT_CMD_START(go) "addr [arg ...]\n - start application at address 'addr'\n" " passing 'arg' as arguments\n") U_BOOT_CMD_END - -static int cmd_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - do_reset(); - return 1; -} - -U_BOOT_CMD_START(reset) - .maxargs = CONFIG_MAXARGS, - .cmd = do_reset, - .usage = "Perform RESET of the CPU", -U_BOOT_CMD_END diff --git a/common/cmd_loadb.c b/commands/loadb.c index 8da4b73574..8da4b73574 100644 --- a/common/cmd_loadb.c +++ b/commands/loadb.c diff --git a/common/cmd_loads.c b/commands/loads.c index f0254bcc20..f0254bcc20 100644 --- a/common/cmd_loads.c +++ b/commands/loads.c diff --git a/common/cmd_mem.c b/commands/mem.c index d7cd7fb96d..d7cd7fb96d 100644 --- a/common/cmd_mem.c +++ b/commands/mem.c diff --git a/commands/meminfo.c b/commands/meminfo.c new file mode 100644 index 0000000000..16b7a8f4cb --- /dev/null +++ b/commands/meminfo.c @@ -0,0 +1,15 @@ +#include <common.h> +#include <command.h> + +int do_meminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + malloc_stats(); + + return 0; +} + +U_BOOT_CMD_START(meminfo) + .maxargs = 1, + .cmd = do_meminfo, + .usage = "print info about memory usage", +U_BOOT_CMD_END diff --git a/common/cmd_memtest.c b/commands/memtest.c index 877e97a45c..877e97a45c 100644 --- a/common/cmd_memtest.c +++ b/commands/memtest.c diff --git a/commands/reset.c b/commands/reset.c new file mode 100644 index 0000000000..1cc3702ff9 --- /dev/null +++ b/commands/reset.c @@ -0,0 +1,16 @@ +#include <common.h> +#include <command.h> + +static int cmd_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + do_reset(); + + /* Not reached */ + return 1; +} + +U_BOOT_CMD_START(reset) + .maxargs = 1, + .cmd = cmd_reset, + .usage = "Perform RESET of the CPU", +U_BOOT_CMD_END diff --git a/commands/sleep.c b/commands/sleep.c new file mode 100644 index 0000000000..99afc5f9ba --- /dev/null +++ b/commands/sleep.c @@ -0,0 +1,30 @@ +#include <common.h> +#include <command.h> +#include <clock.h> + +int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + uint64_t start; + ulong delay; + + if (argc != 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + delay = simple_strtoul(argv[1], NULL, 10); + + start = get_time_ns(); + while (!is_timeout(start, delay * SECOND)) { + if (ctrlc()) + return 1; + } + + return 0; +} + +U_BOOT_CMD_START(sleep) + .maxargs = 2, + .cmd = do_sleep, + .usage = "delay execution for n seconds", +U_BOOT_CMD_END diff --git a/common/Kconfig b/common/Kconfig index fe3d9698d9..be6b31d5c3 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1,10 +1,4 @@ -config ZLIB - bool - -config BZLIB - bool - config GREGORIAN_CALENDER bool @@ -67,14 +61,6 @@ config ZERO_BOOTDELAY_CHECK prompt "Enable stop boot process with bootdelay = 0" default y -config DYNAMIC_CRC_TABLE - bool - prompt "Generate the crc32 table dynamically" - default y - help - Saying yes to this option saves around 800 bytes of binary size. - If unsure say yes. - config ERRNO_MESSAGES bool prompt "print error values as text" @@ -114,150 +100,6 @@ config OF_FLAT_TREE endmenu - -menu "Commands " - -menu "scripting " - -config CMD_EDIT - bool - prompt "edit" - -config CMD_EXEC - bool - prompt "exec" - -config CMD_SLEEP - bool - prompt "sleep" - -config CMD_ENVIRONMENT - bool - prompt "saveenv / loadenv" - -config CMD_HELP - bool - default y - prompt "help" - -endmenu - - -menu "console " - -config CMD_CLEAR - bool - prompt "clear" - -config CMD_CONSOLE - bool - prompt "coninfo" - -config CMD_ECHO - bool - prompt "echo" - -config CMD_SPLASH - bool - prompt "splash" - -endmenu - - -menu "i2c " - -config CMD_I2C - bool - prompt "i2c" - -endmenu - - -menu "memory " - -config CMD_LOADB - bool - prompt "loadb" - -config CMD_LOADS - bool - prompt "loads" - -config CMD_SAVES - bool - depends on CMD_LOADS - prompt "saves" - -config CMD_MEMINFO - bool - prompt "meminfo" - -config CMD_MEMORY - bool - prompt "md, mm, mw and several others" - -config CMD_MTEST - bool - prompt "mtest" - -config CMD_MTEST_ALTERNATIVE - bool - depends on CMD_MTEST - prompt "alternative mtest implementation" - -config CMD_MTEST_START - hex - depends on CMD_MTEST - prompt "mtest start address" - -config CMD_MTEST_END - hex - depends on CMD_MTEST - prompt "mtest end address" - -endmenu - - -menu "network " - -config CMD_MII - bool - prompt "mii" - -endmenu - - -menu "flash " - -config CMD_FLASH - bool - prompt "protect/erase/flinfo" - -endmenu - - -menu "booting " - -config CMD_BOOTM - bool - prompt "bootm" - -config CMD_BOOTM_ZLIB - bool - depends on CMD_BOOTM - select ZLIB - prompt "bootm with zlib support" - -config CMD_BOOTM_BZLIB - bool - depends on CMD_BOOTM - select BZLIB - prompt "bootm with bzlib support" - -endmenu - -endmenu - menu "Debugging " config SKIP_LOWLEVEL_INIT diff --git a/common/Makefile b/common/Makefile index fb6f2fb4c8..4cd6b1f3f4 100644 --- a/common/Makefile +++ b/common/Makefile @@ -1,30 +1,10 @@ -obj-$(CONFIG_CMD_BOOTM) += cmd_bootm.o obj-$(CONFIG_NET) += cmd_net.o -obj-$(CONFIG_CMD_LOADB) += cmd_loadb.o xyzModem.o crc16.o -obj-$(CONFIG_CMD_LOADS) += cmd_loads.o -obj-$(CONFIG_CMD_AUTOSCRIPT) += cmd_autoscript.o -obj-$(CONFIG_CMD_ECHO) += cmd_echo.o -obj-$(CONFIG_CMD_FLASH) += cmd_flash.o -obj-$(CONFIG_CMD_MEMORY) += cmd_mem.o -obj-$(CONFIG_CMD_MII) += cmd_mii.o -obj-$(CONFIG_CMD_I2C) += cmd_i2c.o -obj-$(CONFIG_CMD_LOADS) += s_record.o -obj-$(CONFIG_CMD_SPLASH) += cmd_splash.o -obj-$(CONFIG_CMD_MTEST) += cmd_memtest.o -obj-$(CONFIG_CMD_SLEEP) += cmd_misc.o -obj-$(CONFIG_CMD_EDIT) += cmd_edit.o -obj-$(CONFIG_CMD_EXEC) += cmd_exec.o obj-$(CONFIG_HUSH_PARSER) += hush.o obj-$(CONFIG_SIMPLE_PARSER) += parser.o -obj-$(CONFIG_CMDLINE_EDITING) += readline.o -obj-$(CONFIG_SIMPLE_READLINE) += readline_simple.o obj-$(CONFIG_GREGORIAN_CALENDER) += date.o -obj-y += cmd_fs.o obj-$(CONFIG_OF_FLAT_TREE) += ft_build.o -obj-y += exports.o obj-y += main.o -obj-y += cmd_boot.o obj-y += dlmalloc.o obj-y += clock.o # obj-y += flash.o @@ -34,11 +14,7 @@ obj-y += partition.o obj-y += env.o obj-y += startup.o obj-y += misc.o -obj-y += getopt.o -obj-y += xfuncs.o -obj-$(CONFIG_CMD_ENVIRONMENT) += environment.o - -obj-y += readkey.o +obj-y += misc.o #obj-y += cmd_elf.o #obj-y += cmd_itest.o diff --git a/common/cmd_misc.c b/common/cmd_misc.c index cd14dc0f6b..e73e614c74 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -24,70 +24,17 @@ /* * Misc functions */ -#include <common.h> -#include <command.h> -#include <clock.h> #include <malloc.h> #include <readkey.h> #ifdef CONFIG_CMD_SLEEP -int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - uint64_t start; - ulong delay; - - if (argc != 2) { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } - - delay = simple_strtoul(argv[1], NULL, 10); - - start = get_time_ns(); - while (!is_timeout(start, delay * SECOND)) { - if (ctrlc()) - return 1; - } - - return 0; -} - -U_BOOT_CMD_START(sleep) - .maxargs = 2, - .cmd = do_sleep, - .usage = "delay execution for n seconds", -U_BOOT_CMD_END #endif #ifdef CONFIG_CMD_CLEAR -int do_clear (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - printf(ANSI_CLEAR_SCREEN); - - return 0; -} - -U_BOOT_CMD_START(clear) - .maxargs = 1, - .cmd = do_clear, - .usage = "clear screen", -U_BOOT_CMD_END #endif #ifdef CONFIG_CMD_MEMINFO -int do_meminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - malloc_stats(); - - return 0; -} - -U_BOOT_CMD_START(meminfo) - .maxargs = 1, - .cmd = do_meminfo, - .usage = "print info about memory usage", -U_BOOT_CMD_END #endif /* Implemented in $(CPU)/interrupts.c */ diff --git a/lib/Kconfig b/lib/Kconfig new file mode 100644 index 0000000000..ac86758786 --- /dev/null +++ b/lib/Kconfig @@ -0,0 +1,19 @@ +config ZLIB + bool + +config BZLIB + bool + +config CRC32 + bool + +config DYNAMIC_CRC_TABLE + bool + prompt "Generate the crc32 table dynamically" + default y + help + Saying yes to this option saves around 800 bytes of binary size. + If unsure say yes. + +config CRC16 + bool diff --git a/lib/Makefile b/lib/Makefile index f42fcdb1de..3e11016668 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,3 @@ -obj-$(CONFIG_BZLIB) += bzlib.o bzlib_crctable.o bzlib_decompress.o bzlib_huffman.o bzlib_randtable.o -obj-$(CONFIG_ZLIB) += zlib.o -obj-y += crc32.o obj-y += ctype.o obj-y += display_options.o obj-y += ldiv.o @@ -11,4 +8,11 @@ obj-y += misc.o obj-y += driver.o obj-y += parameter.o obj-y += global.o - +obj-y += xfuncs.o +obj-y += getopt.o +obj-y += readkey.o +obj-$(CONFIG_BZLIB) += bzlib.o bzlib_crctable.o bzlib_decompress.o bzlib_huffman.o bzlib_randtable.o +obj-$(CONFIG_ZLIB) += zlib.o +obj-$(CONFIG_CRC32) += crc32.o +obj-$(CONFIG_CMDLINE_EDITING) += readline.o +obj-$(CONFIG_SIMPLE_READLINE) += readline_simple.o diff --git a/common/crc16.c b/lib/crc16.c index 6904365e59..6904365e59 100644 --- a/common/crc16.c +++ b/lib/crc16.c diff --git a/common/getopt.c b/lib/getopt.c index c054e1365f..c054e1365f 100644 --- a/common/getopt.c +++ b/lib/getopt.c diff --git a/common/readkey.c b/lib/readkey.c index d4e86ed3eb..d4e86ed3eb 100644 --- a/common/readkey.c +++ b/lib/readkey.c diff --git a/common/readline.c b/lib/readline.c index ab0a46a8c3..ab0a46a8c3 100644 --- a/common/readline.c +++ b/lib/readline.c diff --git a/common/readline_simple.c b/lib/readline_simple.c index 7675103ea1..7675103ea1 100644 --- a/common/readline_simple.c +++ b/lib/readline_simple.c diff --git a/common/xfuncs.c b/lib/xfuncs.c index 12b12e28f4..12b12e28f4 100644 --- a/common/xfuncs.c +++ b/lib/xfuncs.c diff --git a/scripts/ubootenv.c b/scripts/ubootenv.c index dda5c4cb26..80f2cdbc56 100644 --- a/scripts/ubootenv.c +++ b/scripts/ubootenv.c @@ -24,7 +24,7 @@ void *xmalloc(size_t size) } #include "../include/envfs.h" -#include "../common/environment.c" +#include "../commands/environment.c" void usage(char *prgname) { |