aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-06-29 16:21:13 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2012-06-29 16:21:54 -0700
commit911b2fd754c0364487c92a2282a77b6812d7823e (patch)
treee1e014031682b1cd17e27dc92c3db280fc91af21 /com32/modules
parentfda6eb8480b797475f228325233c4f4931904bef (diff)
downloadsyslinux-911b2fd754c0364487c92a2282a77b6812d7823e.tar.gz
syslinux-911b2fd754c0364487c92a2282a77b6812d7823e.tar.xz
syslinux-911b2fd754c0364487c92a2282a77b6812d7823e.zip
linux.c32: allow loading arbitrary setup_data blobs
Allow loading arbitrary setup_data blobs via the syntax blob.NN=filename where NN is a decimal number. This also allows loading multiple device tree blobs. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'com32/modules')
-rw-r--r--com32/modules/linux.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/com32/modules/linux.c b/com32/modules/linux.c
index 10998753..a429537e 100644
--- a/com32/modules/linux.c
+++ b/com32/modules/linux.c
@@ -109,6 +109,26 @@ static char *make_cmdline(char **argv)
return cmdline;
}
+static int setup_data_file(struct setup_data *setup_data,
+ uint32_t type, const char *filename,
+ bool opt_quiet)
+{
+ if (!opt_quiet)
+ printf("Loading %s... ", filename);
+
+ if (setup_data_load(setup_data, type, filename)) {
+ if (opt_quiet)
+ printf("Loading %s ", filename);
+ printf("failed\n");
+ return -1;
+ }
+
+ if (!opt_quiet)
+ printf("ok\n");
+
+ return 0;
+}
+
int main(int argc, char *argv[])
{
const char *kernel_name;
@@ -122,7 +142,7 @@ int main(int argc, char *argv[])
bool opt_quiet = false;
void *dhcpdata;
size_t dhcplen;
- char **argp, *arg, *p;
+ char **argp, **argl, *arg, *p;
openconsole(&dev_null_r, &dev_stdcon_w);
@@ -228,19 +248,23 @@ int main(int argc, char *argv[])
if (!setup_data)
goto bail;
- if ((arg = find_argument(argp, "dtb="))) {
- if (!opt_quiet) {
- printf("Loading %s... ", arg);
+ for (argl = argv; (arg = *argl); argl++) {
+ if (!memcmp(arg, "dtb=", 4)) {
+ if (setup_data_file(setup_data, SETUP_DTB, arg+4, opt_quiet))
+ goto bail;
+ } else if (!memcmp(arg, "blob.", 5)) {
+ uint32_t type;
+ char *ep;
- if (setup_data_load(setup_data, SETUP_DTB, arg)) {
- if (opt_quiet)
- printf("Loading %s ", arg);
- printf("failed\n");
+ type = strtoul(arg + 5, &ep, 10);
+ if (ep[0] != '=' || !ep[1])
+ continue;
+
+ if (!type)
+ continue;
+
+ if (setup_data_file(setup_data, type, ep+1, opt_quiet))
goto bail;
- }
-
- if (!opt_quiet)
- printf("ok\n");
}
}