From 390ec0fa8881da48852e6693df6d5cada6031235 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Mon, 26 Nov 2012 13:08:06 +0000 Subject: [PATCH] ldlinux: Automatically apply ".c32" extension for COM32 files If a type-specifier is used on the command line, e.g. .com32 pwd we should apply the ".c32" filename extension automatically as this works elsewhere and this behaviour was present in 4.0x. Signed-off-by: Matt Fleming --- com32/elflink/ldlinux/config.h | 1 + com32/elflink/ldlinux/execute.c | 12 +++++++++++- com32/elflink/ldlinux/ldlinux.c | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h index 63e33b6..9b7ce4a 100644 --- a/com32/elflink/ldlinux/config.h +++ b/com32/elflink/ldlinux/config.h @@ -48,5 +48,6 @@ extern int new_linux_kernel(char *okernel, char *ocmdline); extern void pm_load_high(com32sys_t *regs); extern void ldlinux_enter_command(void); +extern const char *apply_extension(const char *kernel, const char *ext); #endif /* __CONFIG_H__ */ diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c index 6ccde49..e06192e 100644 --- a/com32/elflink/ldlinux/execute.c +++ b/com32/elflink/ldlinux/execute.c @@ -84,7 +84,17 @@ void execute(const char *cmdline, uint32_t type) const struct image_types *t; for (t = image_boot_types; t->name; t++) { if (!strcmp(kernel + 1, t->name)) { - /* Strip the type specifier and retry */ + /* + * Strip the type specifier, apply the + * filename extension if COM32 and + * retry. + */ + if (t->type == IMAGE_TYPE_COM32) { + p = apply_extension(p, ".c32"); + if (!p) + return; + } + execute(p, t->type); return; } diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index 004769c..d3f8e62 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -102,7 +102,7 @@ static const char *get_extension(const char *kernel) return NULL; } -static const char *apply_extension(const char *kernel, const char *ext) +const char *apply_extension(const char *kernel, const char *ext) { const char *p; char *k; -- 2.7.4