9
0
Fork 0
Commit Graph

891 Commits

Author SHA1 Message Date
Jean-Christophe PLAGNIOL-VILLARD 935cdf5a1e move barebox_default_env.h to include/generated/
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-17 10:56:24 +08:00
Jean-Christophe PLAGNIOL-VILLARD 93bd1526aa move utsrelease.h to include/generated/ instead of include/linux
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-17 10:56:24 +08:00
Sascha Hauer 0d35c3c8a0 menu: simplify usage for clients
Clients now only have to call menu_add_submenu or menu_add_command_entry
instead of allocating many strings.
This also fixes some problems in the menu code. The priv field in struct
menu_entry was a pointer to struct menu or a pointer to an allocated string.
It was never freed, only had to be freed when it was an allocated string.
The reference to a submenu is now kept as a string and not to the menu
itself. The code checked the existence of the submenu when creating it, but
crashed when the submenu was removed and referenced afterwards. Now the
code hapily allows references to nonexistant menus but complains during
runtime when the menu is not there.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 21:06:02 +02:00
Sascha Hauer f50d2063cb menu: use an initialized struct list as menu list
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer 417e2d45fe menu: use list_for_each_entry where appropriate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer b11b88de64 menu: remove superfluous struct menu_entry member from struct menu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer a75d6dacc3 menu: simplify menu_free with list_for_each_entry_safe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer 86086c5faa menu: initialize entries list in menu_alloc
Otherwise menu_free fails when menu_add failed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6ce1c664de Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link

as this

menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot

in C

struct menu m_boot = {
	.name = "boot",
	.display = "Boot Menu",
};

struct menu m_network = {
	.name = "network",
	.display = "Network settings",
};

struct menu_entry e_to_network = {
	.display = "Network settings ->",
	.action = menu_action_show,
	.priv = &m_network,
};

struct menu_entry e_to_boot = {
	.display = "Back",
	.action = menu_action_show,
	.priv = &m_boot,
};

struct menu_entry e_reset = {
	.display = "Reset",
	.action = menu_action_run,
	.priv = "reset",
};

struct menu_entry e_exit = {
	.display = "Exit",
	.action = menu_action_run,
	.non_re_ent = 1,
	.priv = "clear",
};

void menu_test(void)
{
	menu_add(&m_boot);
	menu_add(&m_network);
	menu_add_entry(&m_boot, &e_to_network);
	menu_add_entry(&m_boot, &e_reset);
	menu_add_entry(&m_boot, &e_exit);
	menu_add_entry(&m_network, &e_to_boot);
	menu_show(&m_boot);
}

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD b712b26632 Add Menu Framework
Introduce a menu framework that allow us to create list menu to simplify
barebox and make it more user-frendly

This kind of menu is very usefull when you do not have a keyboard or a
serial console attached to your board to allow you to interract with
barebox

For the develloper part,
The framework introduce two API

1) C
that allow you to create menu, submenu, entry and complex menu action

2) Command
that allow you as the C API to create menu, submenu, entry and complex
menu action but this time the actions will be store in a function and
then be evaluated and excecuted at runtime.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7167eb8c0b Kconfig: sync with linux kernel v2.6.36-rc1-168-ge36c886
this will add also the support of the new ncurse interface nconfig

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-08-22 13:12:27 +08:00
Jean-Christophe PLAGNIOL-VILLARD d879de38e8 barebox_default_env: fix out of tree build
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-22 15:49:02 +02:00
Sascha Hauer 600c0e987e Allow to merge default environment from more than one directory
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-22 15:44:40 +02:00
Sascha Hauer 56d0e7f274 errno: add strings for network related error messages
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:29 +02:00
Sascha Hauer c3789cd49b rework device parameters
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Luotao Fu f498576cb6 fix error return value while loading environment
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-05-03 15:01:28 +02:00
Uwe Kleine-König 3a1617d96f clock: fix possible error on overflow in is_timeout
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-04-22 13:29:22 +02:00
Sascha Hauer edf4e51a82 introduce a arch_shutdown call and call it from shutdown_barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer e723f79cb7 make panic and hang __noreturn functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 6eb741a2e1 hush: allow fancy prompts
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 66e4e9242b hush: only remove backslashes introduced from glob
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 2477fb12e9 hush: Fix return code when calling 'exit' inside loops
v2: Do not exit from all scripts but only the current one

This fixes the case:

barebox:/ cat /test
if [ 0 = 0 ]; then
	exit 1
fi
barebox:/ /test
barebox:/ echo $?
0
barebox:/

Also, remove code to not allow exit from main shell. The for(;;) loop
in common/startup.c will bring us back anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 12:51:44 +02:00
Sascha Hauer 922bb41a47 remove typedef cmd_tbl_t and replace it with struct command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer 085e30b4b0 remove unused file common/flash.c
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:31 +01:00
Robert P. J. Day 06c5d3d9fa Remove/adjust erroneous references to CONFIG_MODULE.
The correct config variable is CONFIG_MODULES, so tweak any references
to the incorrect CONFIG_MODULE.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-21 14:21:45 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
This has been done with the following script:

find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \
	-e 's/u2boot/barebox/g' \
	-e 's/U2Boot/barebox/g' \
	-e 's/U-boot V2/barebox/g' \
	-e 's/u-boot v2/barebox/g' \
	-e 's/U-Boot V2/barebox/g' \
	-e 's/U-Boot-v2/barebox/g' \
	-e 's/U_BOOT/BAREBOX/g' \
	-e 's/UBOOT/BAREBOX/g' \
	-e 's/uboot/barebox/g' \
	-e 's/u-boot/barebox/g' \
	-e 's/u_boot/barebox/g' \
	-e 's/U-Boot/barebox/g' \
	-e 's/U-boot/barebox/g' \
	-e 's/U-BOOT/barebox/g'

find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \
	xargs -0 -r rename 's/u[-_]?boot/barebox/'

It needs some manual fixup following in the next patch

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:18:30 +01:00
Juergen Beisert 8c187839ee Re-format the file
Re-format the file with 'indent' and some manual corrections.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 5ed894e9a6 Combine memory initialization with the main memory functions.
Memory allocation is very simple in u-boot-v2. So, it makes also sense to
add the "operating system" emulation layer into the main memory management
source file, to keep them at one place and simple.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e0a2f39561 Use the global string functions
Don't try to be smarter than GCC. There are various better optimizations
available than to write our own. So, use the globaly available string
functions instead.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert a9dda0de1e Remove win32 support
Remove never used code.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e70f5a92a9 Remove debug code
When assert() is always defined to do nothing, the debug functions makes no
sense, because they also do nothing. Removing them shrinks the code.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 86e3217dde Use nowadays function prototypes
Use a function prototype style as used in all other u-boot-v2 sources, too.
Also remove C++ support. We do not use C++ in this project.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 7fd641558b After moving all declarations to the C source, do the same with the doc
Done in preparation to provide this documentation for doxygen.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e954ee0647 Remove confusing macros that hide the real functions names
This feature is provided, to support more than u-boot-v2. But its more
confusing than helpful. Remove it and do it straight forward like all other
sources in this tree, too.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert c35e17dc26 Use the native 'void' instead of 'Void_t'
We are in the *NIX world, so keep a 'void' as is.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 6f1327ad3f Move private settings and configuration into the C source
Include the board config first to be able to configure the memory management
in the documented way. If not used, the defaults are used.
On the other hand, there is no need to pollute the other source files with
these local management settings. So, move them from the header into the
C source file.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert bbc84cabe8 Move variables to bss
There is no need to init variables with 0. So, move them to the bss and let
the C runtime does this job for us.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Sascha Hauer 8ad5fe6ca4 introduce GENERIC_GPIO label
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-10 12:15:01 +01:00
Marc Kleine-Budde c762cdbb02 clock.c: use USECOND and MSECOND
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-03 11:12:46 +01:00
Juergen Beisert b00a6d357e Remove deadlock message
Any wrong or unknown command will result into the output:

 Unknown command '<some text>' - try 'help'

If the command 'help' is disabled, this will end up in:

 Unknown command 'help' - try 'help'

which is for blondes. Suppress the "try 'help'" for the case the 'help'
command is disabled.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-19 09:41:44 +01:00
Juergen Beisert fc0bb9ea2d ENV_HANDLING requires CRC32
ENV_HANDLUNG requires CRC32 to make the linker happy.

Signed-off by: Juergen Beisert <jbe@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-19 09:41:19 +01:00
Sascha Hauer 73d57b1d35 list: remove duplicated list.h
We accidently have two list implementations in the tree:
include/list.h and include/linux/list.h. This patch moves
the latter (newer one) to include/linux/list.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-03 09:48:53 +01:00
Sascha Hauer 14eb082606 hush: remove include/hush.h
Everything in include/hush.h is only used in hush.c, so remove
the header file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-22 11:17:25 +02:00
Jean-Christophe PLAGNIOL-VILLARD 998f9ee2f3 uboot_default_env: fix out of tree build
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-10-20 15:02:30 +02:00
Sascha Hauer 420a3173f0 commands: remove maxargs
No need to check for maximum argument counts. The commands are
safe to be called with more arguments, so lets safe some bytes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-19 16:18:33 +02:00
Sascha Hauer 63e01b4969 call getopt_reset only once
instead of calling getopt_reset in each command,
call it only once before calling the command.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:52 +02:00
Sascha Hauer 87e01f28cc commands: return COMMAND_ERROR_USAGE
instead of calling u_boot_cmd_usage in each command to safe
space.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:52 +02:00
Sascha Hauer 0ecf7f1aeb commands: add defines for command errors/success
This allows us to return COMMAND_ERROR_USAGE for
a failed command which will then print the usage,
a very common case for commands.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:52 +02:00
Sascha Hauer ef7ff70ca4 consolidate command calling in execute_command
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:51 +02:00
Sascha Hauer 0217e514cf console: partly revert 84688dfdb4
Some unrelated code leaked in in this commit

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-09-25 14:13:17 +02:00