]> Git Repo - J-u-boot.git/blame - cmd/source.c
rockchip: rk3399-gru: Include pinctrl and regulators in SPL
[J-u-boot.git] / cmd / source.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
d0dd1077
WD
2/*
3 * (C) Copyright 2001
4 * Kyle Harris, [email protected]
d0dd1077
WD
5 */
6
7/*
74de7aef
WD
8 * The "source" command allows to define "script images", i. e. files
9 * that contain command sequences that can be executed by the command
10 * interpreter. It returns the exit status of the last command
11 * executed from the script. This is very similar to running a shell
12 * script in a UNIX shell, hence the name for the command.
d0dd1077
WD
13 */
14
15/* #define DEBUG */
16
d0dd1077 17#include <command.h>
6bf6dbee 18#include <env.h>
d0dd1077 19#include <image.h>
f7ae49fc 20#include <log.h>
d0dd1077 21#include <malloc.h>
0eb25b61 22#include <mapmem.h>
d0dd1077 23#include <asm/byteorder.h>
4ca30d60 24#include <asm/io.h>
d0dd1077 25
09140113
SG
26static int do_source(struct cmd_tbl *cmdtp, int flag, int argc,
27 char *const argv[])
d0dd1077
WD
28{
29 ulong addr;
30 int rcode;
bcc85b96 31 const char *fit_uname = NULL, *confname = NULL;
d0dd1077 32
424c4abd 33 /* Find script image */
d0dd1077 34 if (argc < 2) {
6d0f6bcf 35 addr = CONFIG_SYS_LOAD_ADDR;
3c7dded8 36 debug("* source: default load address = 0x%08lx\n", addr);
424c4abd 37#if defined(CONFIG_FIT)
bb872dd9
SG
38 } else if (fit_parse_subimage(argv[1], image_load_addr, &addr,
39 &fit_uname)) {
3c7dded8
SG
40 debug("* source: subimage '%s' from FIT image at 0x%08lx\n",
41 fit_uname, addr);
bcc85b96
SA
42 } else if (fit_parse_conf(argv[1], image_load_addr, &addr, &confname)) {
43 debug("* source: config '%s' from FIT image at 0x%08lx\n",
44 confname, addr);
424c4abd 45#endif
d0dd1077 46 } else {
7e5f460e 47 addr = hextoul(argv[1], NULL);
3c7dded8 48 debug("* source: cmdline image address = 0x%08lx\n", addr);
d0dd1077
WD
49 }
50
424c4abd 51 printf ("## Executing script at %08lx\n", addr);
30f3333d 52 rcode = cmd_source_script(addr, fit_uname, confname);
d0dd1077
WD
53 return rcode;
54}
8bde7f77 55
3616218b 56U_BOOT_LONGHELP(source,
424c4abd 57#if defined(CONFIG_FIT)
bcc85b96
SA
58 "[<addr>][:[<image>]|#[<config>]]\n"
59 "\t- Run script starting at addr\n"
60 "\t- A FIT config name or subimage name may be specified with : or #\n"
61 "\t (like bootm). If the image or config name is omitted, the\n"
3616218b 62 "\t default is used."
bcc85b96
SA
63#else
64 "[<addr>]\n"
3616218b 65 "\t- Run script starting at addr"
088f1b19 66#endif
3616218b 67 );
088f1b19
KP
68
69U_BOOT_CMD(
70 source, 2, 0, do_source,
71 "run script from memory", source_help_text
424c4abd 72);
This page took 0.64478 seconds and 4 git commands to generate.