summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-04-01 23:34:12 +0200
committerWolfgang Denk <wd@denx.de>2009-04-03 22:01:42 +0200
commit74de7aefd79690bae8cf5a5120f5962d444be089 (patch)
tree18d3638b971717b3bafbb31f6b5cbf43f8a41457 /common
parent78237df55248034a2d7c2daea992b9dbe7ca8e96 (diff)
Add "source" command; prepare removal of "autoscr" command
According to the doc/feature-removal-schedule.txt, the "autoscr" command will be replaced by the "source" command in approximately 6 months from now. This patch prepares this change and starts a 6 month transition period as follows: - The new "source" command has been added, which implements exactly the same functionlaity as the old "autoscr" command before - The old "autoscr" command name is kept as an alias for compatibility - Command sequences, script files atc. have been adapted to use the new "source" command - Related environment variables ("autoscript", "autoscript_uname") have *not* been adapted yet; these will be renamed resp. removed in a separate patch when the support for the "autoscr" command get's finally dropped. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/Makefile4
-rw-r--r--common/cmd_load.c7
-rw-r--r--common/cmd_net.c7
-rw-r--r--common/cmd_source.c (renamed from common/cmd_autoscript.c)55
4 files changed, 45 insertions, 28 deletions
diff --git a/common/Makefile b/common/Makefile
index 23171ca55..eb8e283a6 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -61,8 +61,8 @@ COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
# command
COBJS-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o
-COBJS-$(CONFIG_AUTOSCRIPT) += cmd_autoscript.o
-COBJS-$(CONFIG_CMD_AUTOSCRIPT) += cmd_autoscript.o
+COBJS-$(CONFIG_SOURCE) += cmd_source.o
+COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o
COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 88fba8899..d5eaac735 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -513,12 +513,13 @@ int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
}
-#ifdef CONFIG_AUTOSCRIPT
+#ifdef CONFIG_SOURCE
if (load_addr) {
char *s;
if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
- printf ("Running autoscript at addr 0x%08lX", load_addr);
+ printf ("Running "source" command at addr 0x%08lX",
+ load_addr);
s = getenv ("autoscript_uname");
if (s)
@@ -526,7 +527,7 @@ int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
else
puts (" ...\n");
- rcode = autoscript (load_addr, s);
+ rcode = source (load_addr, s);
}
}
#endif
diff --git a/common/cmd_net.c b/common/cmd_net.c
index a68784919..9bef7a204 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -222,9 +222,10 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
rcode = do_bootm (cmdtp, 0, 1, local_args);
}
-#ifdef CONFIG_AUTOSCRIPT
+#ifdef CONFIG_SOURCE
if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
- printf ("Running autoscript at addr 0x%08lX", load_addr);
+ printf ("Running "source" command at addr 0x%08lX",
+ load_addr);
s = getenv ("autoscript_uname");
if (s)
@@ -233,7 +234,7 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
puts (" ...\n");
show_boot_progress (83);
- rcode = autoscript (load_addr, s);
+ rcode = source (load_addr, s);
}
#endif
if (rcode < 0)
diff --git a/common/cmd_autoscript.c b/common/cmd_source.c
index e5a9bc02d..43e131592 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_source.c
@@ -22,15 +22,11 @@
*/
/*
- * autoscript allows a remote host to download a command file and,
- * optionally, binary data for automatically updating the target. For
- * example, you create a new kernel image and want the user to be
- * able to simply download the image and the machine does the rest.
- * The kernel image is postprocessed with mkimage, which creates an
- * image with a script file prepended. If enabled, autoscript will
- * verify the script and contents of the download and execute the
- * script portion. This would be responsible for erasing flash,
- * copying the new image, and rebooting the machine.
+ * The "source" command allows to define "script images", i. e. files
+ * that contain command sequences that can be executed by the command
+ * interpreter. It returns the exit status of the last command
+ * executed from the script. This is very similar to running a shell
+ * script in a UNIX shell, hence the name for the command.
*/
/* #define DEBUG */
@@ -48,7 +44,7 @@
#endif
int
-autoscript (ulong addr, const char *fit_uname)
+source (ulong addr, const char *fit_uname)
{
ulong len;
image_header_t *hdr;
@@ -150,7 +146,7 @@ autoscript (ulong addr, const char *fit_uname)
break;
#endif
default:
- puts ("Wrong image format for autoscript\n");
+ puts ("Wrong image format for \"source\" command\n");
return 1;
}
@@ -201,9 +197,9 @@ autoscript (ulong addr, const char *fit_uname)
}
/**************************************************/
-#if defined(CONFIG_CMD_AUTOSCRIPT)
+#if defined(CONFIG_CMD_SOURCE)
int
-do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+do_source (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr;
int rcode;
@@ -212,30 +208,49 @@ do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Find script image */
if (argc < 2) {
addr = CONFIG_SYS_LOAD_ADDR;
- debug ("* autoscr: default load address = 0x%08lx\n", addr);
+ debug ("* source: default load address = 0x%08lx\n", addr);
#if defined(CONFIG_FIT)
} else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) {
- debug ("* autoscr: subimage '%s' from FIT image at 0x%08lx\n",
+ debug ("* source: subimage '%s' from FIT image at 0x%08lx\n",
fit_uname, addr);
#endif
} else {
addr = simple_strtoul(argv[1], NULL, 16);
- debug ("* autoscr: cmdline image address = 0x%08lx\n", addr);
+ debug ("* source: cmdline image address = 0x%08lx\n", addr);
}
printf ("## Executing script at %08lx\n", addr);
- rcode = autoscript (addr, fit_uname);
+ rcode = source (addr, fit_uname);
return rcode;
}
U_BOOT_CMD(
- autoscr, 2, 0, do_autoscript,
+ source, 2, 0, do_source,
"run script from memory",
- "[addr] - run script starting at addr"
- " - A valid autoscr header must be present\n"
+ "[addr]\n"
+ "\t- run script starting at addr\n"
+ "\t- A valid image header must be present\n"
#if defined(CONFIG_FIT)
"For FIT format uImage addr must include subimage\n"
"unit name in the form of addr:<subimg_uname>\n"
#endif
);
+
+/*
+ * Keep for now for backward compatibility;
+ * remove later when support for "autoscr" goes away.
+ */
+static int
+do_autoscr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ printf ("\n### WARNING ### "
+ "\"autoscr\" is deprecated, use \"source\" instead ###\n\n");
+ return do_source (cmdtp, flag, argc, argv);
+}
+
+U_BOOT_CMD(
+ autoscr, 2, 0, do_autoscr,
+ "DEPRECATED - use \"source\" command instead",
+ "DEPRECATED - use \"source\" command instead\n"
+);
#endif