summaryrefslogtreecommitdiffstats
path: root/commands/linux16.c
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@pengutronix.de>2010-12-22 15:04:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-03-10 11:15:18 +0100
commit263635161cbdee49f6fa92bccf14de278ab40e3e (patch)
tree653d4c9159fc1fab7a682b06ff73d0281282aa4b /commands/linux16.c
parent6db768f0461de00bd2209941e5b94bb98dda1139 (diff)
downloadbarebox-263635161cbdee49f6fa92bccf14de278ab40e3e.tar.gz
barebox-263635161cbdee49f6fa92bccf14de278ab40e3e.tar.xz
LINUX16: Add selection of the VESA video mode
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Diffstat (limited to 'commands/linux16.c')
-rw-r--r--commands/linux16.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/commands/linux16.c b/commands/linux16.c
index 87245d4d2c..0cdb673646 100644
--- a/commands/linux16.c
+++ b/commands/linux16.c
@@ -141,6 +141,10 @@ struct linux_kernel_header {
#endif
} __attribute__ ((packed));
+/* This is -1. Keep this value in sync with the kernel */
+#define NORMAL_VGA 0xffff /* 80x25 mode */
+#define ASK_VGA 0xfffd /* ask for it at bootup */
+
/**
* Load an x86 Linux kernel bzImage and start it
* @param cmdtp FIXME
@@ -157,12 +161,24 @@ static int do_linux16(struct command *cmdtp, int argc, char *argv[])
int rc, opt;
unsigned setup_sects;
unsigned real_mode_size;
+ int vid_mode = NORMAL_VGA;
size_t image_size;
const char *cmdline = getenv("bootargs");
const char *kernel_file;
- while((opt = getopt(argc, argv, "")) > 0) {
+ while((opt = getopt(argc, argv, "v:")) > 0) {
switch(opt) {
+ case 'v':
+ vid_mode = simple_strtoul(optarg, NULL, 0);
+ if (vid_mode == 0) {
+ if (!strcmp(optarg, "ask"))
+ vid_mode = ASK_VGA;
+ else {
+ printf("Unknown video mode: %s\n", optarg);
+ return 1;
+ }
+ }
+ break;
}
}
@@ -227,6 +243,14 @@ static int do_linux16(struct command *cmdtp, int argc, char *argv[])
goto on_error;
}
+ /*
+ * The kernel does not check for the "vga=<val>" kernel command line
+ * parameter anymore. It expects this kind of information in the
+ * boot parameters instead.
+ */
+ if (vid_mode != NORMAL_VGA)
+ lh->vid_mode = vid_mode;
+
/* If SETUP_SECTS is not set, set it to the default. */
if (setup_sects == 0) {
printf("Fixing setup sector count\n");
@@ -297,16 +321,21 @@ on_error:
}
BAREBOX_CMD_HELP_START(linux16)
-BAREBOX_CMD_HELP_USAGE("linux16 <file>\n")
-BAREBOX_CMD_HELP_SHORT("Boot a kernel on x86 via real mode code.\n")
+BAREBOX_CMD_HELP_USAGE("linux16 <file> [-v <mode>]\n")
+BAREBOX_CMD_HELP_SHORT("Boot a kernel <file> on x86 via real mode code.\n")
+BAREBOX_CMD_HELP_OPT ("-v <mode>", "VESA video mode number or 'ask'\n")
BAREBOX_CMD_HELP_END
/**
* @page linux16_command
-<p> Only kernel images in bzImage format are supported by now. See \ref
+<p>Only kernel images in bzImage format are supported by now. See \ref
x86_boot_preparation for more info about how to use this command.</p>
+<p>For the video mode refer the Linux kernel documentation
+'Documentation/fb/vesafb.txt' for correct VESA mode numbers. If the keyword
+'ask' instead of a number is given, the starting kernel will ask for a number.
+</p>
*/
BAREBOX_CMD_START(linux16)