doc added and some reorganised
This commit is contained in:
parent
18690c9c23
commit
afe73cff56
|
@ -2,12 +2,9 @@
|
||||||
|
|
||||||
FIXME: Hints and tips for simply adapting UBootv2
|
FIXME: Hints and tips for simply adapting UBootv2
|
||||||
|
|
||||||
@subpage dev_board
|
- @subpage dev_board
|
||||||
|
- @subpage dev_cpu
|
||||||
@subpage dev_cpu
|
- @subpage dev_architecture
|
||||||
|
- @subpage dev_params
|
||||||
@subpage dev_architecture
|
|
||||||
|
|
||||||
@subpage dev_params
|
|
||||||
|
|
||||||
*/
|
*/
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
FIXME: Hints and tips for simply using UBootv2
|
FIXME: Hints and tips for simply using UBootv2
|
||||||
|
|
||||||
@subpage command_reference
|
- @subpage command_reference
|
||||||
@subpage partitions
|
- @subpage partitions
|
||||||
|
|
||||||
*/
|
*/
|
|
@ -8,8 +8,8 @@ Friesel
|
||||||
|
|
||||||
Frasel
|
Frasel
|
||||||
|
|
||||||
@subpage dev_arm_mach
|
- @subpage dev_arm_mach
|
||||||
@subpage dev_bf_mach
|
- @subpage dev_bf_mach
|
||||||
@subpage dev_ppc_mach
|
- @subpage dev_ppc_mach
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* cat.c - conacatenate files
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
|
* Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
|
||||||
*
|
*
|
||||||
* See file CREDITS for list of people who contributed to this
|
* See file CREDITS for list of people who contributed to this
|
||||||
|
@ -20,6 +18,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Concatenate files to stdout command
|
||||||
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
@ -29,6 +32,11 @@
|
||||||
#include <xfuncs.h>
|
#include <xfuncs.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] cmdtp FIXME
|
||||||
|
* @param[in] argc Argument count from command line
|
||||||
|
* @param[in] argv List of input arguments
|
||||||
|
*/
|
||||||
static int do_cat(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
static int do_cat(cmd_tbl_t *cmdtp, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -85,3 +93,12 @@ U_BOOT_CMD_START(cat)
|
||||||
.usage = "concatenate file(s)",
|
.usage = "concatenate file(s)",
|
||||||
U_BOOT_CMD_HELP(cmd_cat_help)
|
U_BOOT_CMD_HELP(cmd_cat_help)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page cat_command cat (concatenate)
|
||||||
|
*
|
||||||
|
* Usage is: cat <file> [<file> ...]
|
||||||
|
*
|
||||||
|
* Concatenate files to stdout. Currently only printable characters
|
||||||
|
* and \\n and \\t are printed, but this should be optional
|
||||||
|
*/
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Change working directory
|
||||||
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
@ -52,3 +57,11 @@ U_BOOT_CMD_START(cd)
|
||||||
.usage = "change working directory",
|
.usage = "change working directory",
|
||||||
U_BOOT_CMD_HELP(cmd_cd_help)
|
U_BOOT_CMD_HELP(cmd_cd_help)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page cd_command cd (change working directory)
|
||||||
|
*
|
||||||
|
* Usage is: cd [<directory name>]
|
||||||
|
*
|
||||||
|
* Change to <directory name>. If called without argument, change to / (root)
|
||||||
|
*/
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief "cp" command implementation
|
||||||
|
*/
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
@ -32,6 +36,10 @@
|
||||||
|
|
||||||
#define RW_BUF_SIZE (ulong)4096
|
#define RW_BUF_SIZE (ulong)4096
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] src FIXME
|
||||||
|
* @param[out] dst FIXME
|
||||||
|
*/
|
||||||
static int copy_file(const char *src, const char *dst)
|
static int copy_file(const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
char *rw_buf = NULL;
|
char *rw_buf = NULL;
|
||||||
|
@ -79,6 +87,11 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] cmdtp FIXME
|
||||||
|
* @param[in] argc Argument count from command line
|
||||||
|
* @param[in] argv List of input arguments
|
||||||
|
*/
|
||||||
static int do_cp ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
static int do_cp ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
@ -134,3 +147,11 @@ U_BOOT_CMD_START(cp)
|
||||||
.usage = "copy files",
|
.usage = "copy files",
|
||||||
U_BOOT_CMD_HELP(cmd_cp_help)
|
U_BOOT_CMD_HELP(cmd_cp_help)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page cp_command cp (copy)
|
||||||
|
*
|
||||||
|
* Usage: cp <source> [<source>] <destination>
|
||||||
|
*
|
||||||
|
* FIXME
|
||||||
|
*/
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Managing environment and environment variables
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __U_BOOT__
|
#ifdef __U_BOOT__
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
|
@ -205,7 +210,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static __maybe_unused char cmd_saveenv_help[] =
|
static __maybe_unused char cmd_saveenv_help[] =
|
||||||
"Usage: saveenv [DIRECTORY] [ENVFS]\n"
|
"Usage: saveenv [<envfs>] [<directory>]\n"
|
||||||
"Save the files in <directory> to the persistent storage device <envfs>.\n"
|
"Save the files in <directory> to the persistent storage device <envfs>.\n"
|
||||||
"<envfs> is normally a block in flash, but could be any other file.\n"
|
"<envfs> is normally a block in flash, but could be any other file.\n"
|
||||||
"If ommitted <directory> defaults to /env and <envfs> defaults to /dev/env0.\n"
|
"If ommitted <directory> defaults to /env and <envfs> defaults to /dev/env0.\n"
|
||||||
|
@ -219,6 +224,20 @@ U_BOOT_CMD_START(saveenv)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
#endif /* __U_BOOT__ */
|
#endif /* __U_BOOT__ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page saveenv_command saveenv
|
||||||
|
*
|
||||||
|
* Usage: saveenv [<envfs>] [<directory>]
|
||||||
|
*
|
||||||
|
* Save the files in <directory> to the persistent storage device <envfs>.
|
||||||
|
* <envfs> is normally a block in flash, but could be any other file.
|
||||||
|
*
|
||||||
|
* If ommitted <directory> defaults to /env and <envfs> defaults to
|
||||||
|
* /dev/env0.
|
||||||
|
*
|
||||||
|
* @note envfs can only handle files. Directories are skipped silently.
|
||||||
|
*/
|
||||||
|
|
||||||
int envfs_load(char *filename, char *dir)
|
int envfs_load(char *filename, char *dir)
|
||||||
{
|
{
|
||||||
struct envfs_super super;
|
struct envfs_super super;
|
||||||
|
@ -349,3 +368,16 @@ U_BOOT_CMD_START(loadenv)
|
||||||
U_BOOT_CMD_HELP(cmd_loadenv_help)
|
U_BOOT_CMD_HELP(cmd_loadenv_help)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
#endif /* __U_BOOT__ */
|
#endif /* __U_BOOT__ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page loadenv_command loadenv
|
||||||
|
*
|
||||||
|
* Usage: loadenv [<directory>] [<envfs>]
|
||||||
|
*
|
||||||
|
* Load the persistent storage contained in <envfs> to the directory <directory>.
|
||||||
|
*
|
||||||
|
* If ommitted <directory> defaults to /env and <envfs> defaults to
|
||||||
|
* /dev/env0.
|
||||||
|
*
|
||||||
|
* @note envfs can only handle files. Directories are skipped silently.
|
||||||
|
*/
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
* MA 02111-1307 USA
|
* MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Date & Time support for Philips PCF8563 RTC
|
* @file
|
||||||
|
* @brief Date & Time support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
68
common/env.c
68
common/env.c
|
@ -20,6 +20,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Environment support
|
||||||
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <driver.h>
|
#include <driver.h>
|
||||||
|
@ -28,21 +33,36 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Managment of a environment variable
|
||||||
|
*/
|
||||||
struct variable_d {
|
struct variable_d {
|
||||||
|
/*! List management */
|
||||||
struct variable_d *next;
|
struct variable_d *next;
|
||||||
|
/*! variable length data */
|
||||||
char data[0];
|
char data[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VARIABLE_D_SIZE(name, value) (sizeof(struct variable_d) + strlen(name) + strlen(value) + 2)
|
#define VARIABLE_D_SIZE(name, value) (sizeof(struct variable_d) + strlen(name) + strlen(value) + 2)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME
|
||||||
|
*/
|
||||||
struct env_context {
|
struct env_context {
|
||||||
|
/*! FIXME */
|
||||||
struct env_context *parent;
|
struct env_context *parent;
|
||||||
|
/*! FIXME */
|
||||||
struct variable_d *local;
|
struct variable_d *local;
|
||||||
|
/*! FIXME */
|
||||||
struct variable_d *global;
|
struct variable_d *global;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct env_context *context;
|
static struct env_context *context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a list of environment variables
|
||||||
|
* @param[inout] v Variable anchor to remove
|
||||||
|
*/
|
||||||
static void free_variables(struct variable_d *v)
|
static void free_variables(struct variable_d *v)
|
||||||
{
|
{
|
||||||
struct variable_d *next;
|
struct variable_d *next;
|
||||||
|
@ -54,6 +74,9 @@ static void free_variables(struct variable_d *v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME
|
||||||
|
*/
|
||||||
int env_push_context(void)
|
int env_push_context(void)
|
||||||
{
|
{
|
||||||
struct env_context *c = xzalloc(sizeof(struct env_context));
|
struct env_context *c = xzalloc(sizeof(struct env_context));
|
||||||
|
@ -74,6 +97,9 @@ int env_push_context(void)
|
||||||
|
|
||||||
late_initcall(env_push_context);
|
late_initcall(env_push_context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME
|
||||||
|
*/
|
||||||
int env_pop_context(void)
|
int env_pop_context(void)
|
||||||
{
|
{
|
||||||
struct env_context *c = context;
|
struct env_context *c = context;
|
||||||
|
@ -89,11 +115,21 @@ int env_pop_context(void)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return variable's value
|
||||||
|
* @param[in] var Variable of interest
|
||||||
|
* @return Value as text
|
||||||
|
*/
|
||||||
static char *var_val(struct variable_d *var)
|
static char *var_val(struct variable_d *var)
|
||||||
{
|
{
|
||||||
return &var->data[strlen(var->data) + 1];
|
return &var->data[strlen(var->data) + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return variable's name
|
||||||
|
* @param[in] var Variable of interest
|
||||||
|
* @return Name as text
|
||||||
|
*/
|
||||||
static char *var_name(struct variable_d *var)
|
static char *var_name(struct variable_d *var)
|
||||||
{
|
{
|
||||||
return var->data;
|
return var->data;
|
||||||
|
@ -267,6 +303,17 @@ U_BOOT_CMD_START(printenv)
|
||||||
" - print value of environment variable 'name'\n")
|
" - print value of environment variable 'name'\n")
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page printenv_command printenv
|
||||||
|
*
|
||||||
|
* Usage: printenv [<name>]
|
||||||
|
*
|
||||||
|
* Print environment variables.
|
||||||
|
* If <name> was given, it prints out its content if the environment variable
|
||||||
|
* <name> exists.
|
||||||
|
* Without the <name> argument all current environment variables are printed.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SIMPLE_PARSER
|
#ifdef CONFIG_SIMPLE_PARSER
|
||||||
static int do_setenv ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
static int do_setenv ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -291,6 +338,19 @@ U_BOOT_CMD_START(setenv)
|
||||||
" - delete environment variable 'name'\n")
|
" - delete environment variable 'name'\n")
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page setenv_command setenv
|
||||||
|
*
|
||||||
|
* Usage: setenv <name> [<value>]
|
||||||
|
*
|
||||||
|
* Set environment variable <name> to <value ...>
|
||||||
|
* If no <value> was given, the variable <name> will be removed.
|
||||||
|
*
|
||||||
|
* This command can be replaced by using the simpler form:
|
||||||
|
*
|
||||||
|
* <name> = <value>
|
||||||
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int do_export ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
static int do_export ( cmd_tbl_t *cmdtp, int argc, char *argv[])
|
||||||
|
@ -329,3 +389,11 @@ U_BOOT_CMD_START(export)
|
||||||
U_BOOT_CMD_HELP(cmd_export_help)
|
U_BOOT_CMD_HELP(cmd_export_help)
|
||||||
U_BOOT_CMD_END
|
U_BOOT_CMD_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @page export_command export
|
||||||
|
*
|
||||||
|
* Usage: export <var>[=value]...
|
||||||
|
*
|
||||||
|
* Export an environment variable to subsequently executed scripts
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue