#include "localboot.h"
#include "bios.h"
+#include <syslinux/boot.h>
#include <syslinux/bootrm.h>
#include <syslinux/movebits.h>
#include <syslinux/config.h>
-void chainboot_file(const char *file, enum kernel_type type)
+void chainboot_file(const char *file, uint32_t type)
{
uint8_t keeppxe = 0;
const union syslinux_derivative_info *sdi;
* superblock.
*/
if (sdi->c.filesystem == SYSLINUX_FS_SYSLINUX &&
- type == KT_BSS && this_fs->fs_ops->copy_super(buf))
+ type == IMAGE_TYPE_BSS && this_fs->fs_ops->copy_super(buf))
goto bail;
if (sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
#include <syslinux/bootrm.h>
#include <syslinux/movebits.h>
#include <syslinux/config.h>
-
-/* Must match enum kernel_type */
-const char *const kernel_types[] = {
- "none",
- "localboot",
- "kernel",
- "linux",
- "boot",
- "bss",
- "pxe",
- "fdimage",
- "comboot",
- "com32",
- "config",
- NULL
+#include <syslinux/boot.h>
+
+const struct image_types image_boot_types[] = {
+ { "localboot", IMAGE_TYPE_LOCALBOOT },
+ { "kernel", IMAGE_TYPE_KERNEL },
+ { "linux", IMAGE_TYPE_LINUX },
+ { "boot", IMAGE_TYPE_BOOT },
+ { "bss", IMAGE_TYPE_BSS },
+ { "pxe", IMAGE_TYPE_PXE },
+ { "fdimage", IMAGE_TYPE_FDIMAGE },
+ { "comboot", IMAGE_TYPE_COMBOOT },
+ { "com32", IMAGE_TYPE_COM32 },
+ { "config", IMAGE_TYPE_CONFIG },
+ { NULL, 0 },
};
extern int create_args_and_load(char *);
-void execute(const char *cmdline, enum kernel_type type)
+void execute(const char *cmdline, uint32_t type)
{
- const char *p, *const *pp;
const char *kernel, *args;
+ const char *p;
com32sys_t ireg;
char *q;
dprintf("kernel is %s, args = %s type = %d \n", kernel, args, type);
- if (kernel[0] == '.' && type == KT_NONE) {
+ if (kernel[0] == '.') {
/* It might be a type specifier */
- enum kernel_type type = KT_NONE;
- for (pp = kernel_types; *pp; pp++, type++) {
- if (!strcmp(kernel + 1, *pp)) {
+ 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 */
- execute(p, type);
+ execute(p, t->type);
return;
}
}
}
- if (type == KT_COM32) {
+ if (type == IMAGE_TYPE_COM32) {
/* new entry for elf format c32 */
create_args_and_load((char *)cmdline);
- } else if (type == KT_CONFIG) {
+ } else if (type == IMAGE_TYPE_CONFIG) {
char *argv[] = { "ldlinux.c32", NULL };
/* kernel contains the config file name */
mangle_name(config_cwd, args);
start_ldlinux(argv);
- } else if (type == KT_LOCALBOOT) {
+ } else if (type == IMAGE_TYPE_LOCALBOOT) {
local_boot(strtoul(kernel, NULL, 0));
- } else if (type == KT_PXE || type == KT_BSS || type == KT_BOOT) {
+ } else if (type == IMAGE_TYPE_PXE || type == IMAGE_TYPE_BSS ||
+ type == IMAGE_TYPE_BOOT) {
chainboot_file(kernel, type);
} else {
/* Need add one item for kernel load, as we don't use
#include "menu.h"
#include "config.h"
#include "syslinux/adv.h"
+#include "syslinux/boot.h"
#include <sys/module.h>
};
static const struct file_ext file_extensions[] = {
- { ".com", KT_COMBOOT },
- { ".cbt", KT_COMBOOT },
- { ".c32", KT_COM32 },
- { ".img", KT_FDIMAGE },
- { ".bss", KT_BSS },
- { ".bin", KT_BOOT },
- { ".bs", KT_BOOT },
- { ".0", KT_PXE },
- { NULL, KT_NONE },
+ { ".com", IMAGE_TYPE_COMBOOT },
+ { ".cbt", IMAGE_TYPE_COMBOOT },
+ { ".c32", IMAGE_TYPE_COM32 },
+ { ".img", IMAGE_TYPE_FDIMAGE },
+ { ".bss", IMAGE_TYPE_BSS },
+ { ".bin", IMAGE_TYPE_BOOT },
+ { ".bs", IMAGE_TYPE_BOOT },
+ { ".0", IMAGE_TYPE_PXE },
+ { NULL, 0 },
};
/*
return p;
}
-enum kernel_type parse_kernel_type(const char *kernel)
+uint32_t parse_image_type(const char *kernel)
{
const struct file_ext *ext;
const char *p;
return ext->type;
}
- /* use KT_KERNEL as default */
- return KT_KERNEL;
+ /* use IMAGE_TYPE_KERNEL as default */
+ return IMAGE_TYPE_KERNEL;
}
/*
static void load_kernel(const char *command_line)
{
struct menu_entry *me;
- enum kernel_type type;
const char *cmdline;
const char *kernel;
+ uint32_t type;
kernel = strdup(command_line);
if (!kernel)
/* Virtual kernel? */
me = find_label(kernel);
if (me) {
- type = parse_kernel_type(me->cmdline);
-
- /* cmdline contains type specifier */
- if (me->cmdline[0] == '.')
- type = KT_NONE;
+ type = parse_image_type(me->cmdline);
execute(me->cmdline, type);
/* We shouldn't return */
*p = '\0';
}
- type = parse_kernel_type(kernel);
- if (type == KT_KERNEL) {
+ type = parse_image_type(kernel);
+ if (type == IMAGE_TYPE_KERNEL) {
const char *ext;
/*
free((void *)kernel);
kernel = k;
- type = parse_kernel_type(kernel);
+ type = parse_image_type(kernel);
}
}
*/
if (onerrorlen) {
rsprintf(&cmdline, "%s %s", onerror, default_cmd);
- execute(cmdline, KT_COM32);
+ execute(cmdline, IMAGE_TYPE_COM32);
}
}
[P_HIDDEN_ROW] = {"hiddenrow", -2},
};
+/* Must match enum kernel_type */
+static const char *const kernel_types[] = {
+ "none",
+ "localboot",
+ "kernel",
+ "linux",
+ "boot",
+ "bss",
+ "pxe",
+ "fdimage",
+ "comboot",
+ "com32",
+ "config",
+ NULL
+};
+
short uappendlen = 0; //bytes in append= command
short ontimeoutlen = 0; //bytes in ontimeout command
short onerrorlen = 0; //bytes in onerror command
KT_CONFIG, /* Configuration file */
};
-extern const char *const kernel_types[];
-
-extern enum kernel_type parse_kernel_type(const char *kernel);
-
/* Configurable integer parameters */
enum parameter_number {
P_WIDTH,
extern const char *current_background;
void set_background(const char *new_background);
-/* execute.c */
-void execute(const char *cmdline, enum kernel_type type);
-
/* drain.c */
void drain_keyboard(void);
uint32_t bootstrap_len, uint32_t edx,
uint32_t esi, uint16_t ds);
+struct image_types {
+ const char *name;
+ uint32_t type;
+};
+
+extern const struct image_types image_boot_types[];
+
#define IMAGE_TYPE_KERNEL 0
#define IMAGE_TYPE_LINUX 1
#define IMAGE_TYPE_BOOT 2
#define IMAGE_TYPE_COMBOOT 6
#define IMAGE_TYPE_COM32 7
#define IMAGE_TYPE_CONFIG 8
+#define IMAGE_TYPE_LOCALBOOT 9
+
+uint32_t parse_image_type(const char *cmdline);
void syslinux_run_kernel_image(const char *filename, const char *cmdline,
uint32_t ipappend_flags, uint32_t type);
#include <setjmp.h>
#include <limits.h>
#include <com32.h>
+#include <core.h>
#include <syslinux/adv.h>
+#include <syslinux/boot.h>
#include "menu.h"
printf("\033[?25h\033[%d;1H\033[0m", cursorrow);
if (cmdline) {
- enum kernel_type type = parse_kernel_type(cmdline);
+ uint32_t type = parse_image_type(cmdline);
execute(cmdline, type);
if (cm->onerror) {
- type = parse_kernel_type(cm->onerror);
+ type = parse_image_type(cm->onerror);
execute(cm->onerror, type);
}
} else {
__p; })
/* Must match enum kernel_type */
-const char *const kernel_types[] = {
+static const char *const kernel_types[] = {
"none",
"localboot",
"kernel",
extern void sirq_cleanup(void);
extern void adjust_screen(void);
+extern void execute(const char *cmdline, uint32_t type);
+
#endif /* CORE_H */