GRUB-legacy configuration file support.
* Makefile.util.def (grub-menulst2cfg): New util. * docs/man/grub-menulst2cfg.h2m: New file. * grub-core/Makefile.core.def (legacycfg): New module. * grub-core/commands/legacycfg.c: New file. * grub-core/commands/menuentry.c (append_menu_entry): Rename to ... (grub_normal_add_menu_entry): ... this. * grub-core/commands/password.c (grub_cmd_password): Split main part to ... (grub_normal_set_password): ...this. * grub-core/commands/videoinfo.c (grub_cmd_videoinfo): Support MODE. * grub-core/loader/i386/linux.c (linux_vesafb_res): Move to .., * grub-core/lib/i386/pc/vesa_modes_table.c: ... here. * grub-core/lib/legacy_parse.c: New file. * grub-core/normal/auth.c (grub_cmd_authenticate): New command. * include/grub/i386/pc/vesa_modes_table.h: New file. * include/grub/legacy_parse.h: Likewise. * include/grub/normal.h (grub_normal_add_menu_entry): New proto. * util/grub-menulst2cfg.c: New file. * grub-core/Makefile.core.def (lsapm): New module. * grub-core/commands/i386/pc/lsapm.c: New file. * grub-core/loader/i386/multiboot_mbi.c (make_mbi) [GRUB_MACHINE_PCBIOS]: Pass APM info. * grub-core/loader/multiboot_mbi2.c (make_mbi) [GRUB_MACHINE_PCBIOS]: Likewise. * include/grub/i386/pc/apm.h: New file. * include/multiboot.h (multiboot_apm_info): New struct.
This commit is contained in:
commit
9696382e79
24 changed files with 2176 additions and 208 deletions
|
@ -35,6 +35,10 @@
|
|||
#include <grub/i386/relocator.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/i386/pc/vesa_modes_table.h>
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/efi.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
|
@ -89,175 +93,6 @@ static struct idt_descriptor idt_desc =
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
struct linux_vesafb_res
|
||||
{
|
||||
grub_uint16_t width;
|
||||
grub_uint16_t height;
|
||||
};
|
||||
|
||||
struct linux_vesafb_mode
|
||||
{
|
||||
grub_uint8_t res_index;
|
||||
grub_uint8_t depth;
|
||||
};
|
||||
|
||||
enum vga_modes
|
||||
{
|
||||
VGA_320_200,
|
||||
VGA_640_400,
|
||||
VGA_640_480,
|
||||
VGA_800_500,
|
||||
VGA_800_600,
|
||||
VGA_896_672,
|
||||
VGA_1024_640,
|
||||
VGA_1024_768,
|
||||
VGA_1152_720,
|
||||
VGA_1280_1024,
|
||||
VGA_1440_900,
|
||||
VGA_1600_1200,
|
||||
};
|
||||
|
||||
static struct linux_vesafb_res linux_vesafb_res[] =
|
||||
{
|
||||
{ 320, 200 },
|
||||
{ 640, 400 },
|
||||
{ 640, 480 },
|
||||
{ 800, 500 },
|
||||
{ 800, 600 },
|
||||
{ 896, 672 },
|
||||
{ 1024, 640 },
|
||||
{ 1024, 768 },
|
||||
{ 1152, 720 },
|
||||
{ 1280, 1024 },
|
||||
{ 1440, 900 },
|
||||
{ 1600, 1200 },
|
||||
};
|
||||
|
||||
/* This is the reverse of the table in [linux]/Documentation/fb/vesafb.txt
|
||||
plus a few more modes based on the table in
|
||||
http://en.wikipedia.org/wiki/VESA_BIOS_Extensions */
|
||||
struct linux_vesafb_mode linux_vesafb_modes[] =
|
||||
{
|
||||
{ VGA_640_400, 8 }, /* 0x300 */
|
||||
{ VGA_640_480, 8 }, /* 0x301 */
|
||||
{ VGA_800_600, 4 }, /* 0x302 */
|
||||
{ VGA_800_600, 8 }, /* 0x303 */
|
||||
{ VGA_1024_768, 4 }, /* 0x304 */
|
||||
{ VGA_1024_768, 8 }, /* 0x305 */
|
||||
{ VGA_1280_1024, 4 }, /* 0x306 */
|
||||
{ VGA_1280_1024, 8 }, /* 0x307 */
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ VGA_320_200, 15 }, /* 0x30d */
|
||||
{ VGA_320_200, 16 }, /* 0x30e */
|
||||
{ VGA_320_200, 24 }, /* 0x30f */
|
||||
{ VGA_640_480, 15 }, /* 0x310 */
|
||||
{ VGA_640_480, 16 }, /* 0x311 */
|
||||
{ VGA_640_480, 24 }, /* 0x312 */
|
||||
{ VGA_800_600, 15 }, /* 0x313 */
|
||||
{ VGA_800_600, 16 }, /* 0x314 */
|
||||
{ VGA_800_600, 24 }, /* 0x315 */
|
||||
{ VGA_1024_768, 15 }, /* 0x316 */
|
||||
{ VGA_1024_768, 16 }, /* 0x317 */
|
||||
{ VGA_1024_768, 24 }, /* 0x318 */
|
||||
{ VGA_1280_1024, 15 }, /* 0x319 */
|
||||
{ VGA_1280_1024, 16 }, /* 0x31a */
|
||||
{ VGA_1280_1024, 24 }, /* 0x31b */
|
||||
{ VGA_1600_1200, 8 }, /* 0x31c */
|
||||
{ VGA_1600_1200, 15 }, /* 0x31d */
|
||||
{ VGA_1600_1200, 16 }, /* 0x31e */
|
||||
{ VGA_1600_1200, 24 }, /* 0x31f */
|
||||
{ 0, 0 },
|
||||
{ VGA_640_400, 15 }, /* 0x321 */
|
||||
{ VGA_640_400, 16 }, /* 0x322 */
|
||||
{ VGA_640_400, 24 }, /* 0x323 */
|
||||
{ VGA_640_400, 32 }, /* 0x324 */
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ VGA_640_480, 32 }, /* 0x329 */
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ VGA_896_672, 8 }, /* 0x32f */
|
||||
{ VGA_896_672, 15 }, /* 0x330 */
|
||||
{ VGA_896_672, 16 }, /* 0x331 */
|
||||
{ VGA_896_672, 24 }, /* 0x332 */
|
||||
{ VGA_896_672, 32 }, /* 0x333 */
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ VGA_1600_1200, 32 }, /* 0x342 */
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ 0, 0 },
|
||||
{ VGA_1440_900, 8 }, /* 0x360 */
|
||||
{ VGA_1440_900, 15 }, /* 0x361 */
|
||||
{ VGA_1440_900, 16 }, /* 0x362 */
|
||||
{ VGA_1440_900, 24 }, /* 0x363 */
|
||||
{ VGA_1440_900, 32 }, /* 0x364 */
|
||||
{ VGA_1152_720, 8 }, /* 0x365 */
|
||||
{ VGA_1152_720, 15 }, /* 0x366 */
|
||||
{ VGA_1152_720, 16 }, /* 0x367 */
|
||||
{ VGA_1152_720, 24 }, /* 0x368 */
|
||||
{ VGA_1152_720, 32 }, /* 0x369 */
|
||||
{ VGA_1024_640, 8 }, /* 0x36a */
|
||||
{ VGA_1024_640, 15 }, /* 0x36b */
|
||||
{ VGA_1024_640, 16 }, /* 0x36c */
|
||||
{ VGA_1024_640, 24 }, /* 0x36d */
|
||||
{ VGA_1024_640, 32 }, /* 0x36e */
|
||||
{ VGA_800_500, 8 }, /* 0x36f */
|
||||
{ VGA_800_500, 15 }, /* 0x370 */
|
||||
{ VGA_800_500, 16 }, /* 0x371 */
|
||||
{ VGA_800_500, 24 }, /* 0x372 */
|
||||
{ VGA_800_500, 32 }, /* 0x373 */
|
||||
};
|
||||
#endif
|
||||
|
||||
static inline grub_size_t
|
||||
page_align (grub_size_t size)
|
||||
{
|
||||
|
@ -882,7 +717,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
/* Video mode selection support. */
|
||||
char *val = argv[i] + 4;
|
||||
unsigned vid_mode = GRUB_LINUX_VID_MODE_NORMAL;
|
||||
struct linux_vesafb_mode *linux_mode;
|
||||
struct grub_vesa_mode_table_entry *linux_mode;
|
||||
grub_err_t err;
|
||||
char *buf;
|
||||
|
||||
|
@ -925,9 +760,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
default:
|
||||
/* Ignore invalid values. */
|
||||
if (vid_mode < GRUB_LINUX_VID_MODE_VESA_START ||
|
||||
vid_mode >= GRUB_LINUX_VID_MODE_VESA_START +
|
||||
ARRAY_SIZE (linux_vesafb_modes))
|
||||
if (vid_mode < GRUB_VESA_MODE_TABLE_START ||
|
||||
vid_mode > GRUB_VESA_MODE_TABLE_END)
|
||||
{
|
||||
grub_env_set ("gfxpayload", "text");
|
||||
grub_printf ("%s is deprecated. Mode %d isn't recognized. "
|
||||
|
@ -941,15 +775,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
is built-in because `vga=' parameter was used. */
|
||||
params->have_vga = GRUB_VIDEO_LINUX_TYPE_VESA;
|
||||
|
||||
linux_mode
|
||||
= &linux_vesafb_modes[vid_mode - GRUB_LINUX_VID_MODE_VESA_START];
|
||||
linux_mode = &grub_vesa_mode_table[vid_mode
|
||||
- GRUB_VESA_MODE_TABLE_START];
|
||||
|
||||
buf = grub_xasprintf ("%ux%ux%u,%ux%u",
|
||||
linux_vesafb_res[linux_mode->res_index].width,
|
||||
linux_vesafb_res[linux_mode->res_index].height,
|
||||
linux_mode->width, linux_mode->height,
|
||||
linux_mode->depth,
|
||||
linux_vesafb_res[linux_mode->res_index].width,
|
||||
linux_vesafb_res[linux_mode->res_index].height);
|
||||
linux_mode->width, linux_mode->height);
|
||||
if (! buf)
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/memory.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#endif
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
|
@ -194,7 +195,8 @@ grub_multiboot_get_mbi_size (void)
|
|||
+ ALIGN_UP (sizeof(PACKAGE_STRING), 4)
|
||||
+ grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry)
|
||||
+ elf_sec_entsize * elf_sec_num
|
||||
+ 256 * sizeof (struct multiboot_color);
|
||||
+ 256 * sizeof (struct multiboot_color)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
}
|
||||
|
||||
/* Fill previously allocated Multiboot mmap. */
|
||||
|
@ -356,6 +358,29 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
ptrorig += ALIGN_UP (sizeof(PACKAGE_STRING), 4);
|
||||
ptrdest += ALIGN_UP (sizeof(PACKAGE_STRING), 4);
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
{
|
||||
struct grub_apm_info info;
|
||||
if (grub_apm_get_info (&info))
|
||||
{
|
||||
struct multiboot_apm_info *mbinfo = (void *) ptrorig;
|
||||
|
||||
mbinfo->cseg = info.cseg;
|
||||
mbinfo->offset = info.offset;
|
||||
mbinfo->cseg_16 = info.cseg_16;
|
||||
mbinfo->dseg = info.dseg;
|
||||
mbinfo->flags = info.flags;
|
||||
mbinfo->cseg_len = info.cseg_len;
|
||||
mbinfo->dseg_len = info.dseg_len;
|
||||
mbinfo->cseg_16_len = info.cseg_16_len;
|
||||
mbinfo->version = info.version;
|
||||
|
||||
ptrorig += ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
ptrdest += ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modcnt)
|
||||
{
|
||||
mbi->flags |= MULTIBOOT_INFO_MODS;
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
* FIXME: The following features from the Multiboot specification still
|
||||
* need to be implemented:
|
||||
* - VBE support
|
||||
* - symbol table
|
||||
* - drives table
|
||||
* - ROM configuration table
|
||||
* - APM table
|
||||
*/
|
||||
|
||||
#include <grub/loader.h>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/memory.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#endif
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/multiboot.h>
|
||||
|
@ -279,7 +280,8 @@ grub_multiboot_get_mbi_size (void)
|
|||
+ elf_sec_entsize * elf_sec_num
|
||||
+ (sizeof (struct multiboot_tag_mmap) + grub_get_multiboot_mmap_count ()
|
||||
* sizeof (struct multiboot_mmap_entry))
|
||||
+ sizeof (struct multiboot_tag_vbe) + MULTIBOOT_TAG_ALIGN - 1;
|
||||
+ sizeof (struct multiboot_tag_vbe) + MULTIBOOT_TAG_ALIGN - 1
|
||||
+ sizeof (struct multiboot_tag_apm) + MULTIBOOT_TAG_ALIGN - 1;
|
||||
}
|
||||
|
||||
/* Fill previously allocated Multiboot mmap. */
|
||||
|
@ -515,6 +517,31 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
{
|
||||
struct grub_apm_info info;
|
||||
if (grub_apm_get_info (&info))
|
||||
{
|
||||
struct multiboot_tag_apm *tag = (struct multiboot_tag_apm *) ptrorig;
|
||||
|
||||
tag->type = MULTIBOOT_TAG_TYPE_APM;
|
||||
tag->size = sizeof (struct multiboot_tag_apm);
|
||||
|
||||
tag->cseg = info.cseg;
|
||||
tag->offset = info.offset;
|
||||
tag->cseg_16 = info.cseg_16;
|
||||
tag->dseg = info.dseg;
|
||||
tag->flags = info.flags;
|
||||
tag->cseg_len = info.cseg_len;
|
||||
tag->dseg_len = info.dseg_len;
|
||||
tag->cseg_16_len = info.cseg_16_len;
|
||||
tag->version = info.version;
|
||||
|
||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
struct module *cur;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue