From 932b57873db47db89989b86789b216e50a753478 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 13 Aug 2008 15:54:53 +0200 Subject: move several commands into extra files move false, true, help, insmod, lsmod, version into extra files Signed-off-by: Sascha Hauer --- commands/insmod.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 commands/insmod.c (limited to 'commands/insmod.c') diff --git a/commands/insmod.c b/commands/insmod.c new file mode 100644 index 0000000000..28a59ead56 --- /dev/null +++ b/commands/insmod.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include +#include + +static int do_insmod (cmd_tbl_t *cmdtp, int argc, char *argv[]) +{ + struct module *module; + void *buf; + int len; + + if (argc < 2) { + u_boot_cmd_usage(cmdtp); + return 1; + } + + buf = read_file(argv[1], &len); + if (!buf) { + perror("insmod"); + return 1; + } + + module = load_module(buf, len); + + free(buf); + + if (module) { + if (module->init) + module->init(); + } + + return 0; +} + +static const __maybe_unused char cmd_insmod_help[] = +"Usage: insmod \n"; + +U_BOOT_CMD_START(insmod) + .maxargs = 2, + .cmd = do_insmod, + .usage = "insert a module", + U_BOOT_CMD_HELP(cmd_insmod_help) +U_BOOT_CMD_END -- cgit v1.2.3