merge mainline to ia64
This commit is contained in:
commit
0f35c665e6
595 changed files with 62746 additions and 9109 deletions
|
@ -19,8 +19,8 @@
|
|||
#include <grub/loader.h>
|
||||
#include <grub/i386/bsd.h>
|
||||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i386/memory.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
|
@ -28,7 +28,6 @@
|
|||
#include <grub/elfload.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/aout.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
|
@ -262,37 +261,30 @@ generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf)
|
|||
struct grub_e820_mmap *mmap = buf;
|
||||
struct grub_e820_mmap prev, cur;
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_uint32_t type)
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
cur.addr = addr;
|
||||
cur.size = size;
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
cur.type = GRUB_E820_RAM;
|
||||
break;
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_ACPI
|
||||
case GRUB_MACHINE_MEMORY_ACPI:
|
||||
case GRUB_MEMORY_ACPI:
|
||||
cur.type = GRUB_E820_ACPI;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_NVS
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
case GRUB_MEMORY_NVS:
|
||||
cur.type = GRUB_E820_NVS;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
#ifdef GRUB_MACHINE_MEMORY_CODE
|
||||
case GRUB_MACHINE_MEMORY_CODE:
|
||||
#endif
|
||||
#ifdef GRUB_MACHINE_MEMORY_RESERVED
|
||||
case GRUB_MACHINE_MEMORY_RESERVED:
|
||||
#endif
|
||||
case GRUB_MEMORY_CODE:
|
||||
case GRUB_MEMORY_RESERVED:
|
||||
cur.type = GRUB_E820_RESERVED;
|
||||
break;
|
||||
}
|
||||
|
@ -529,6 +521,8 @@ grub_netbsd_list_modules (void)
|
|||
/* This function would be here but it's under different license. */
|
||||
#include "bsd_pagetable.c"
|
||||
|
||||
static grub_uint32_t freebsd_bootdev, freebsd_biosdev;
|
||||
|
||||
static grub_err_t
|
||||
grub_freebsd_boot (void)
|
||||
{
|
||||
|
@ -536,7 +530,6 @@ grub_freebsd_boot (void)
|
|||
grub_uint8_t *p, *p0;
|
||||
grub_addr_t p_target;
|
||||
grub_size_t p_size = 0;
|
||||
grub_uint32_t bootdev, biosdev, unit, slice, part;
|
||||
grub_err_t err;
|
||||
grub_size_t tag_buf_len = 0;
|
||||
|
||||
|
@ -572,11 +565,7 @@ grub_freebsd_boot (void)
|
|||
bi.version = FREEBSD_BOOTINFO_VERSION;
|
||||
bi.length = sizeof (bi);
|
||||
|
||||
grub_bsd_get_device (&biosdev, &unit, &slice, &part);
|
||||
bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
|
||||
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
|
||||
|
||||
bi.boot_device = biosdev;
|
||||
bi.boot_device = freebsd_biosdev;
|
||||
|
||||
p_size = 0;
|
||||
grub_env_iterate (iterate_env_count);
|
||||
|
@ -749,7 +738,7 @@ grub_freebsd_boot (void)
|
|||
state.ebp = stack_target;
|
||||
stack[0] = entry; /* "Return" address. */
|
||||
stack[1] = bootflags | FREEBSD_RB_BOOTINFO;
|
||||
stack[2] = bootdev;
|
||||
stack[2] = freebsd_bootdev;
|
||||
stack[3] = 0;
|
||||
stack[4] = 0;
|
||||
stack[5] = 0;
|
||||
|
@ -1326,7 +1315,7 @@ grub_bsd_load (int argc, char *argv[])
|
|||
goto fail;
|
||||
}
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (!file)
|
||||
goto fail;
|
||||
|
||||
|
@ -1372,13 +1361,15 @@ grub_bsd_parse_flags (const struct grub_arg_list *state,
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
||||
{
|
||||
kernel_type = KERNEL_TYPE_FREEBSD;
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, freebsd_flags);
|
||||
bootflags = grub_bsd_parse_flags (ctxt->state, freebsd_flags);
|
||||
|
||||
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
|
||||
{
|
||||
grub_uint32_t unit, slice, part;
|
||||
|
||||
kern_end = ALIGN_PAGE (kern_end);
|
||||
if (is_elf_kernel)
|
||||
{
|
||||
|
@ -1396,7 +1387,7 @@ grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -1422,6 +1413,10 @@ grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
if (err)
|
||||
return err;
|
||||
}
|
||||
grub_bsd_get_device (&freebsd_biosdev, &unit, &slice, &part);
|
||||
freebsd_bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
|
||||
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
|
||||
|
||||
grub_loader_set (grub_freebsd_boot, grub_bsd_unload, 0);
|
||||
}
|
||||
|
||||
|
@ -1429,16 +1424,16 @@ grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
||||
{
|
||||
grub_uint32_t bootdev;
|
||||
|
||||
kernel_type = KERNEL_TYPE_OPENBSD;
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, openbsd_flags);
|
||||
bootflags = grub_bsd_parse_flags (ctxt->state, openbsd_flags);
|
||||
|
||||
if (cmd->state[OPENBSD_ROOT_ARG].set)
|
||||
if (ctxt->state[OPENBSD_ROOT_ARG].set)
|
||||
{
|
||||
const char *arg = cmd->state[OPENBSD_ROOT_ARG].arg;
|
||||
const char *arg = ctxt->state[OPENBSD_ROOT_ARG].arg;
|
||||
int unit, part;
|
||||
if (*(arg++) != 'w' || *(arg++) != 'd')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
|
@ -1459,7 +1454,7 @@ grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
else
|
||||
bootdev = 0;
|
||||
|
||||
if (cmd->state[OPENBSD_SERIAL_ARG].set)
|
||||
if (ctxt->state[OPENBSD_SERIAL_ARG].set)
|
||||
{
|
||||
struct grub_openbsd_bootarg_console serial;
|
||||
char *ptr;
|
||||
|
@ -1468,9 +1463,9 @@ grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
|
||||
grub_memset (&serial, 0, sizeof (serial));
|
||||
|
||||
if (cmd->state[OPENBSD_SERIAL_ARG].arg)
|
||||
if (ctxt->state[OPENBSD_SERIAL_ARG].arg)
|
||||
{
|
||||
ptr = cmd->state[OPENBSD_SERIAL_ARG].arg;
|
||||
ptr = ctxt->state[OPENBSD_SERIAL_ARG].arg;
|
||||
if (grub_memcmp (ptr, "com", sizeof ("com") - 1) != 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only com0-com3 are supported");
|
||||
|
@ -1514,11 +1509,11 @@ grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
||||
{
|
||||
grub_err_t err;
|
||||
kernel_type = KERNEL_TYPE_NETBSD;
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, netbsd_flags);
|
||||
bootflags = grub_bsd_parse_flags (ctxt->state, netbsd_flags);
|
||||
|
||||
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
|
||||
{
|
||||
|
@ -1526,7 +1521,7 @@ grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
{
|
||||
grub_file_t file;
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -1551,15 +1546,15 @@ grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
grub_bsd_add_meta (NETBSD_BTINFO_BOOTPATH, bootpath, sizeof (bootpath));
|
||||
}
|
||||
|
||||
if (cmd->state[NETBSD_ROOT_ARG].set)
|
||||
if (ctxt->state[NETBSD_ROOT_ARG].set)
|
||||
{
|
||||
char root[GRUB_NETBSD_MAX_ROOTDEVICE_LEN];
|
||||
grub_memset (root, 0, sizeof (root));
|
||||
grub_strncpy (root, cmd->state[NETBSD_ROOT_ARG].arg,
|
||||
grub_strncpy (root, ctxt->state[NETBSD_ROOT_ARG].arg,
|
||||
sizeof (root) - 1);
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_ROOTDEVICE, root, sizeof (root));
|
||||
}
|
||||
if (cmd->state[NETBSD_SERIAL_ARG].set)
|
||||
if (ctxt->state[NETBSD_SERIAL_ARG].set)
|
||||
{
|
||||
struct grub_netbsd_btinfo_serial serial;
|
||||
char *ptr;
|
||||
|
@ -1567,9 +1562,12 @@ grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
grub_memset (&serial, 0, sizeof (serial));
|
||||
grub_strcpy (serial.devname, "com");
|
||||
|
||||
if (cmd->state[NETBSD_SERIAL_ARG].arg)
|
||||
serial.addr = grub_ns8250_hw_get_port (0);
|
||||
serial.speed = 9600;
|
||||
|
||||
if (ctxt->state[NETBSD_SERIAL_ARG].arg)
|
||||
{
|
||||
ptr = cmd->state[NETBSD_SERIAL_ARG].arg;
|
||||
ptr = ctxt->state[NETBSD_SERIAL_ARG].arg;
|
||||
if (grub_memcmp (ptr, "com", sizeof ("com") - 1) == 0)
|
||||
{
|
||||
ptr += sizeof ("com") - 1;
|
||||
|
@ -1589,7 +1587,7 @@ grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
|||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_CONSOLE, &serial, sizeof (serial));
|
||||
}
|
||||
else
|
||||
|
@ -1616,7 +1614,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
|
|||
char *buf = 0, *curr, *next;
|
||||
int len;
|
||||
|
||||
if (kernel_type == KERNEL_TYPE_NONE)
|
||||
if (! grub_loader_is_loaded ())
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"you need to load the kernel first");
|
||||
|
||||
|
@ -1630,7 +1628,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if ((!file) || (!file->size))
|
||||
goto fail;
|
||||
|
||||
|
@ -1731,7 +1729,7 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if ((!file) || (!file->size))
|
||||
goto fail;
|
||||
|
||||
|
@ -1782,7 +1780,7 @@ grub_netbsd_module_load (char *filename, grub_uint32_t type)
|
|||
void *src;
|
||||
grub_err_t err;
|
||||
|
||||
file = grub_gzfile_open (filename, 1);
|
||||
file = grub_file_open (filename);
|
||||
if ((!file) || (!file->size))
|
||||
goto fail;
|
||||
|
||||
|
@ -1849,7 +1847,7 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_file_t file = 0;
|
||||
grub_err_t err;
|
||||
|
||||
if (kernel_type == KERNEL_TYPE_NONE)
|
||||
if (! grub_loader_is_loaded ())
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"you need to load the kernel first");
|
||||
|
||||
|
@ -1868,7 +1866,7 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (!file)
|
||||
return grub_errno;
|
||||
if (!file->size)
|
||||
|
@ -1904,7 +1902,7 @@ grub_cmd_openbsd_ramdisk (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (!openbsd_ramdisk.max_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "your kOpenBSD doesn't support ramdisk");
|
||||
|
||||
file = grub_gzfile_open (args[0], 1);
|
||||
file = grub_file_open (args[0]);
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"couldn't load ramdisk");
|
||||
|
@ -1940,16 +1938,16 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk;
|
|||
|
||||
GRUB_MOD_INIT (bsd)
|
||||
{
|
||||
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
/* Net and OpenBSD kernels are often compressed. */
|
||||
grub_dl_load ("gzio");
|
||||
|
||||
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd, 0,
|
||||
N_("FILE"), N_("Load kernel of FreeBSD."),
|
||||
freebsd_opts);
|
||||
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd, 0,
|
||||
N_("FILE"), N_("Load kernel of OpenBSD."),
|
||||
openbsd_opts);
|
||||
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd, 0,
|
||||
N_("FILE"), N_("Load kernel of NetBSD."),
|
||||
netbsd_opts);
|
||||
cmd_freebsd_loadenv =
|
||||
|
|
|
@ -396,10 +396,8 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
Elf_Shdr *s, *symsh, *strsh;
|
||||
char *shdr;
|
||||
unsigned symsize, strsize;
|
||||
Elf_Sym *sym;
|
||||
void *sym_chunk;
|
||||
grub_uint8_t *curload;
|
||||
const char *str;
|
||||
grub_size_t chunk_size;
|
||||
Elf_Ehdr *e2;
|
||||
struct grub_netbsd_btinfo_symtab symtab;
|
||||
|
@ -473,7 +471,6 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
|
||||
if (grub_file_seek (file, symsh->sh_offset) == (grub_off_t) -1)
|
||||
return grub_errno;
|
||||
sym = (Elf_Sym *) curload;
|
||||
if (grub_file_read (file, curload, symsize) != (grub_ssize_t) symsize)
|
||||
{
|
||||
if (! grub_errno)
|
||||
|
@ -484,7 +481,6 @@ SUFFIX (grub_netbsd_load_elf_meta) (struct grub_relocator *relocator,
|
|||
|
||||
if (grub_file_seek (file, strsh->sh_offset) == (grub_off_t) -1)
|
||||
return grub_errno;
|
||||
str = (char *) curload;
|
||||
if (grub_file_read (file, curload, strsize) != (grub_ssize_t) strsize)
|
||||
{
|
||||
if (! grub_errno)
|
||||
|
@ -515,7 +511,7 @@ SUFFIX(grub_openbsd_find_ramdisk) (grub_file_t file,
|
|||
grub_err_t err;
|
||||
Elf_Ehdr e;
|
||||
Elf_Shdr *s;
|
||||
char *shdr;
|
||||
char *shdr = NULL;
|
||||
|
||||
err = read_headers (file, &e, &shdr);
|
||||
if (err)
|
||||
|
|
|
@ -53,7 +53,7 @@ static void
|
|||
fill_bsd64_pagetable (grub_uint8_t *src, grub_addr_t target)
|
||||
{
|
||||
grub_uint64_t *pt2, *pt3, *pt4;
|
||||
grub_addr_t pt2t, pt3t, pt4t;
|
||||
grub_addr_t pt2t, pt3t;
|
||||
int i;
|
||||
|
||||
#define PG_V 0x001
|
||||
|
@ -65,7 +65,6 @@ fill_bsd64_pagetable (grub_uint8_t *src, grub_addr_t target)
|
|||
pt3 = (grub_uint64_t *) (src + 4096);
|
||||
pt2 = (grub_uint64_t *) (src + 8192);
|
||||
|
||||
pt4t = target;
|
||||
pt3t = target + 4096;
|
||||
pt2t = target + 8192;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
|
||||
#include <grub/loader.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/file.h>
|
||||
|
@ -35,10 +34,14 @@
|
|||
#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
|
||||
#define DEFAULT_VIDEO_MODE "800x600"
|
||||
#define DEFAULT_VIDEO_MODE "auto"
|
||||
#elif defined (GRUB_MACHINE_IEEE1275)
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#define HAS_VGA_TEXT 0
|
||||
|
@ -89,175 +92,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)
|
||||
{
|
||||
|
@ -312,10 +146,11 @@ find_mmap_size (void)
|
|||
{
|
||||
grub_size_t count = 0, mmap_size;
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
grub_uint32_t type __attribute__ ((unused)))
|
||||
grub_memory_type_t type __attribute__ ((unused)))
|
||||
{
|
||||
count++;
|
||||
return 0;
|
||||
|
@ -379,12 +214,14 @@ allocate_pages (grub_size_t prot_size)
|
|||
/* FIXME: Should request low memory from the heap when this feature is
|
||||
implemented. */
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
/* We must put real mode code in the traditional space. */
|
||||
|
||||
if (type == GRUB_MACHINE_MEMORY_AVAILABLE
|
||||
if (type == GRUB_MEMORY_AVAILABLE
|
||||
&& addr <= 0x90000)
|
||||
{
|
||||
if (addr < 0x10000)
|
||||
|
@ -559,36 +396,32 @@ grub_linux_boot (void)
|
|||
grub_dprintf ("linux", "code32_start = %x\n",
|
||||
(unsigned) params->code32_start);
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_RAM);
|
||||
break;
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_ACPI
|
||||
case GRUB_MACHINE_MEMORY_ACPI:
|
||||
case GRUB_MEMORY_ACPI:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_ACPI);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_NVS
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
case GRUB_MEMORY_NVS:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_NVS);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_CODE
|
||||
case GRUB_MACHINE_MEMORY_CODE:
|
||||
case GRUB_MEMORY_CODE:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
addr, size, GRUB_E820_EXEC_CODE);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
grub_e820_add_region (params->e820_map, &e820_num,
|
||||
|
@ -822,7 +655,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
params->type_of_loader = (LINUX_LOADER_ID_GRUB << 4);
|
||||
params->type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
|
||||
|
||||
/* These two are used (instead of cmd_line_ptr) by older versions of Linux,
|
||||
and otherwise ignored. */
|
||||
|
@ -882,10 +715,12 @@ 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;
|
||||
|
||||
grub_dl_load ("vbe");
|
||||
|
||||
if (grub_strcmp (val, "normal") == 0)
|
||||
vid_mode = GRUB_LINUX_VID_MODE_NORMAL;
|
||||
else if (grub_strcmp (val, "ext") == 0)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1069,6 +901,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#endif
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
|
@ -140,7 +141,7 @@ grub_multiboot_load (grub_file_t file)
|
|||
}
|
||||
|
||||
if (header->bss_end_addr)
|
||||
grub_memset ((grub_uint32_t *) source + load_size, 0,
|
||||
grub_memset ((grub_uint8_t *) source + load_size, 0,
|
||||
header->bss_end_addr - header->load_addr - load_size);
|
||||
|
||||
grub_multiboot_payload_eip = header->entry_addr;
|
||||
|
@ -186,6 +187,10 @@ grub_multiboot_load (grub_file_t file)
|
|||
return err;
|
||||
}
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
#endif
|
||||
|
||||
static grub_size_t
|
||||
grub_multiboot_get_mbi_size (void)
|
||||
{
|
||||
|
@ -194,7 +199,12 @@ 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)
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
+ sizeof (struct grub_vbe_info_block)
|
||||
+ sizeof (struct grub_vbe_mode_info_block)
|
||||
#endif
|
||||
+ ALIGN_UP (sizeof (struct multiboot_apm_info), 4);
|
||||
}
|
||||
|
||||
/* Fill previously allocated Multiboot mmap. */
|
||||
|
@ -203,28 +213,30 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
|||
{
|
||||
struct multiboot_mmap_entry *mmap_entry = (struct multiboot_mmap_entry *) first_entry;
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
mmap_entry->addr = addr;
|
||||
mmap_entry->len = size;
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_AVAILABLE;
|
||||
break;
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE
|
||||
case GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE:
|
||||
case GRUB_MEMORY_ACPI:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_ACPI_RECLAIMABLE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_NVS
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
case GRUB_MEMORY_NVS:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_NVS;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case GRUB_MEMORY_BADRAM:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_BADRAM;
|
||||
break;
|
||||
|
||||
default:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_RESERVED;
|
||||
|
@ -239,6 +251,90 @@ grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
|||
grub_mmap_iterate (hook);
|
||||
}
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT
|
||||
|
||||
static grub_err_t
|
||||
fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig,
|
||||
grub_uint32_t ptrdest, int fill_generic)
|
||||
{
|
||||
grub_uint32_t vbe_mode;
|
||||
struct grub_vbe_mode_info_block *mode_info;
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
grub_vbe_status_t status;
|
||||
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "Can't get controller info.");
|
||||
|
||||
mbi->vbe_control_info = ptrdest;
|
||||
grub_memcpy (ptrorig, scratch, sizeof (struct grub_vbe_info_block));
|
||||
ptrorig += sizeof (struct grub_vbe_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_info_block);
|
||||
#else
|
||||
mbi->vbe_control_info = 0;
|
||||
#endif
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
status = grub_vbe_bios_get_mode (scratch);
|
||||
vbe_mode = *(grub_uint32_t *) scratch;
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get VBE mode");
|
||||
#else
|
||||
vbe_mode = 3;
|
||||
#endif
|
||||
mbi->vbe_mode = vbe_mode;
|
||||
|
||||
mode_info = (struct grub_vbe_mode_info_block *) ptrorig;
|
||||
mbi->vbe_mode_info = ptrdest;
|
||||
/* get_mode_info isn't available for mode 3. */
|
||||
if (vbe_mode == 3)
|
||||
{
|
||||
grub_memset (mode_info, 0, sizeof (struct grub_vbe_mode_info_block));
|
||||
mode_info->memory_model = GRUB_VBE_MEMORY_MODEL_TEXT;
|
||||
mode_info->x_resolution = 80;
|
||||
mode_info->y_resolution = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
status = grub_vbe_bios_get_mode_info (vbe_mode, scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return grub_error (GRUB_ERR_IO, "can't get mode info");
|
||||
grub_memcpy (mode_info, scratch,
|
||||
sizeof (struct grub_vbe_mode_info_block));
|
||||
#endif
|
||||
}
|
||||
ptrorig += sizeof (struct grub_vbe_mode_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_mode_info_block);
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
grub_vbe_bios_get_pm_interface (&mbi->vbe_interface_seg,
|
||||
&mbi->vbe_interface_off,
|
||||
&mbi->vbe_interface_len);
|
||||
#endif
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_VBE_INFO;
|
||||
|
||||
if (fill_generic && mode_info->memory_model == GRUB_VBE_MEMORY_MODEL_TEXT)
|
||||
{
|
||||
mbi->framebuffer_addr = 0xb8000;
|
||||
|
||||
mbi->framebuffer_pitch = 2 * mode_info->x_resolution;
|
||||
mbi->framebuffer_width = mode_info->x_resolution;
|
||||
mbi->framebuffer_height = mode_info->y_resolution;
|
||||
|
||||
mbi->framebuffer_bpp = 16;
|
||||
|
||||
mbi->framebuffer_type = MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT;
|
||||
|
||||
mbi->flags |= MULTIBOOT_INFO_FRAMEBUFFER_INFO;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
retrieve_video_parameters (struct multiboot_info *mbi,
|
||||
grub_uint8_t *ptrorig, grub_uint32_t ptrdest)
|
||||
|
@ -259,8 +355,13 @@ retrieve_video_parameters (struct multiboot_info *mbi,
|
|||
grub_video_get_palette (0, ARRAY_SIZE (palette), palette);
|
||||
|
||||
driv_id = grub_video_get_driver_id ();
|
||||
#if GRUB_MACHINE_HAS_VGA_TEXT
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_NONE)
|
||||
return fill_vbe_info (mbi, ptrorig, ptrdest, 1);
|
||||
#else
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_NONE)
|
||||
return GRUB_ERR_NONE;
|
||||
#endif
|
||||
|
||||
err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
if (err)
|
||||
|
@ -308,6 +409,11 @@ retrieve_video_parameters (struct multiboot_info *mbi,
|
|||
|
||||
mbi->flags |= MULTIBOOT_INFO_FRAMEBUFFER_INFO;
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
if (driv_id == GRUB_VIDEO_DRIVER_VBE)
|
||||
return fill_vbe_info (mbi, ptrorig, ptrdest, 0);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -335,7 +441,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
if (err)
|
||||
return err;
|
||||
ptrorig = get_virtual_current_address (ch);
|
||||
ptrdest = (grub_addr_t) get_virtual_current_address (ch);
|
||||
ptrdest = get_physical_target_address (ch);
|
||||
|
||||
*target = ptrdest;
|
||||
|
||||
|
@ -356,6 +462,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;
|
||||
|
@ -418,6 +547,12 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
ptrorig += sizeof (struct grub_vbe_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_info_block);
|
||||
ptrorig += sizeof (struct grub_vbe_mode_info_block);
|
||||
ptrdest += sizeof (struct grub_vbe_mode_info_block);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -506,6 +641,7 @@ grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
|
|||
return grub_errno;
|
||||
newmod->start = start;
|
||||
newmod->size = size;
|
||||
newmod->next = 0;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
len += grub_strlen (argv[i]) + 1;
|
||||
|
|
|
@ -20,19 +20,20 @@
|
|||
#include <grub/loader.h>
|
||||
#include <grub/machine/loader.h>
|
||||
#include <grub/machine/chainloader.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/cpu/floppy.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/mm.h>
|
||||
|
@ -69,6 +70,7 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
|
|||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (filename);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
#include <grub/command.h>
|
||||
|
@ -401,6 +400,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
addr_min = GRUB_LINUX_BZIMAGE_ADDR + grub_linux16_prot_size;
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (argv[0]);
|
||||
if (!file)
|
||||
goto fail;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <grub/charset.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/bitmap_scale.h>
|
||||
|
||||
|
@ -535,7 +534,7 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
|
||||
file = grub_gzfile_open (args[0], 1);
|
||||
file = grub_file_open (args[0]);
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"couldn't load device-propertie dump");
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <grub/cpu/macho.h>
|
||||
#include <grub/machoload.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
|
@ -149,7 +148,7 @@ grub_macho_open (const char *name)
|
|||
grub_file_t file;
|
||||
grub_macho_t macho;
|
||||
|
||||
file = grub_gzfile_open (name, 1);
|
||||
file = grub_file_open (name);
|
||||
if (! file)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -25,13 +25,21 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/mips/relocator.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* For frequencies. */
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/time.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
/* This can be detected on runtime from PMON, but:
|
||||
a) it wouldn't work when GRUB is the firmware
|
||||
and
|
||||
b) for now we only support Yeeloong anyway. */
|
||||
#define LOONGSON_MACHTYPE "machtype=lemote-yeeloong-2f-8.9inches"
|
||||
#endif
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
static int loaded;
|
||||
|
@ -83,7 +91,7 @@ grub_linux_load32 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
|
|||
/* Linux's entry point incorrectly contains a virtual address. */
|
||||
entry_addr = elf->ehdr.ehdr32.e_entry;
|
||||
|
||||
linux_size = grub_elf32_size (elf, &base);
|
||||
linux_size = grub_elf32_size (elf, &base, 0);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
target_addr = base;
|
||||
|
@ -138,7 +146,7 @@ grub_linux_load64 (grub_elf_t elf, void **extra_mem, grub_size_t extra_size)
|
|||
/* Linux's entry point incorrectly contains a virtual address. */
|
||||
entry_addr = elf->ehdr.ehdr64.e_entry;
|
||||
|
||||
linux_size = grub_elf64_size (elf, &base);
|
||||
linux_size = grub_elf64_size (elf, &base, 0);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
target_addr = base;
|
||||
|
@ -214,6 +222,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
/* For arguments. */
|
||||
linux_argc = argc;
|
||||
#ifdef LOONGSON_MACHTYPE
|
||||
linux_argc++;
|
||||
#endif
|
||||
/* Main arguments. */
|
||||
size = (linux_argc) * sizeof (grub_uint32_t);
|
||||
/* Initrd address and size. */
|
||||
|
@ -226,7 +237,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
/* Normal arguments. */
|
||||
for (i = 1; i < argc; i++)
|
||||
size += ALIGN_UP (grub_strlen (argv[i]) + 1, 4);
|
||||
|
||||
#ifdef LOONGSON_MACHTYPE
|
||||
size += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4);
|
||||
#endif
|
||||
|
||||
/* rd arguments. */
|
||||
size += ALIGN_UP (sizeof ("rd_start=0xXXXXXXXXXXXXXXXX"), 4);
|
||||
size += ALIGN_UP (sizeof ("rd_size=0xXXXXXXXXXXXXXXXX"), 4);
|
||||
|
@ -263,6 +277,16 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
linux_argv++;
|
||||
linux_args += ALIGN_UP (sizeof ("a0"), 4);
|
||||
|
||||
#ifdef LOONGSON_MACHTYPE
|
||||
/* In Loongson platform, it is the responsibility of the bootloader/firmware
|
||||
to supply the OS kernel with machine type information. */
|
||||
grub_memcpy (linux_args, LOONGSON_MACHTYPE, sizeof (LOONGSON_MACHTYPE));
|
||||
*linux_argv = (grub_uint8_t *) linux_args - (grub_uint8_t *) playground
|
||||
+ target_addr;
|
||||
linux_argv++;
|
||||
linux_args += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4);
|
||||
#endif
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
grub_memcpy (linux_args, argv[i], grub_strlen (argv[i]) + 1);
|
||||
|
@ -344,6 +368,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (initrd_loaded)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one initrd can be loaded.");
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
|
|
@ -20,18 +20,16 @@
|
|||
/*
|
||||
* FIXME: The following features from the Multiboot specification still
|
||||
* need to be implemented:
|
||||
* - VBE support
|
||||
* - symbol table
|
||||
* - drives table
|
||||
* - ROM configuration table
|
||||
* - APM table
|
||||
* - SMBIOS tables
|
||||
* - Networking information
|
||||
*/
|
||||
|
||||
#include <grub/loader.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/multiboot.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/aout.h>
|
||||
#include <grub/file.h>
|
||||
|
@ -39,7 +37,6 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/relocator.h>
|
||||
#include <grub/video.h>
|
||||
|
@ -74,7 +71,7 @@ grub_get_multiboot_mmap_count (void)
|
|||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
grub_uint32_t type __attribute__ ((unused)))
|
||||
grub_memory_type_t type __attribute__ ((unused)))
|
||||
{
|
||||
count++;
|
||||
return 0;
|
||||
|
@ -225,7 +222,7 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "couldn't open file");
|
||||
|
||||
|
@ -291,9 +288,9 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
|
|||
"you need to load the multiboot kernel first");
|
||||
|
||||
if (nounzip)
|
||||
file = grub_file_open (argv[0]);
|
||||
else
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
grub_file_filter_disable_compression ();
|
||||
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#endif
|
||||
#include <grub/multiboot.h>
|
||||
#include <grub/cpu/multiboot.h>
|
||||
|
@ -31,6 +32,11 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/acpi.h>
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI)
|
||||
#include <grub/efi/efi.h>
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
|
@ -138,11 +144,15 @@ grub_multiboot_load (grub_file_t file)
|
|||
case MULTIBOOT_TAG_TYPE_BOOTDEV:
|
||||
case MULTIBOOT_TAG_TYPE_MMAP:
|
||||
case MULTIBOOT_TAG_TYPE_FRAMEBUFFER:
|
||||
break;
|
||||
|
||||
case MULTIBOOT_TAG_TYPE_VBE:
|
||||
case MULTIBOOT_TAG_TYPE_ELF_SECTIONS:
|
||||
case MULTIBOOT_TAG_TYPE_APM:
|
||||
case MULTIBOOT_TAG_TYPE_EFI32:
|
||||
case MULTIBOOT_TAG_TYPE_EFI64:
|
||||
case MULTIBOOT_TAG_TYPE_ACPI_OLD:
|
||||
case MULTIBOOT_TAG_TYPE_ACPI_NEW:
|
||||
break;
|
||||
|
||||
default:
|
||||
grub_free (buffer);
|
||||
return grub_error (GRUB_ERR_UNKNOWN_OS,
|
||||
|
@ -264,6 +274,22 @@ grub_multiboot_load (grub_file_t file)
|
|||
return err;
|
||||
}
|
||||
|
||||
static grub_size_t
|
||||
acpiv2_size (void)
|
||||
{
|
||||
#if GRUB_MACHINE_HAS_ACPI
|
||||
struct grub_acpi_rsdp_v20 *p = grub_acpi_get_rsdpv2 ();
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
return ALIGN_UP (sizeof (struct multiboot_tag_old_acpi)
|
||||
+ p->length, MULTIBOOT_TAG_ALIGN);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static grub_size_t
|
||||
grub_multiboot_get_mbi_size (void)
|
||||
{
|
||||
|
@ -273,13 +299,22 @@ grub_multiboot_get_mbi_size (void)
|
|||
+ (sizeof (struct multiboot_tag_string)
|
||||
+ ALIGN_UP (sizeof (PACKAGE_STRING), MULTIBOOT_TAG_ALIGN))
|
||||
+ (modcnt * sizeof (struct multiboot_tag_module) + total_modcmd)
|
||||
+ sizeof (struct multiboot_tag_basic_meminfo)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_basic_meminfo),
|
||||
MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_bootdev), MULTIBOOT_TAG_ALIGN)
|
||||
+ sizeof (struct multiboot_tag_elf_sections)
|
||||
+ 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;
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_elf_sections), MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (elf_sec_entsize * elf_sec_num, MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP ((sizeof (struct multiboot_tag_mmap)
|
||||
+ grub_get_multiboot_mmap_count ()
|
||||
* sizeof (struct multiboot_mmap_entry)), MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_framebuffer), MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_efi32), MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_efi64), MULTIBOOT_TAG_ALIGN)
|
||||
+ ALIGN_UP (sizeof (struct multiboot_tag_old_acpi)
|
||||
+ sizeof (struct grub_acpi_rsdp_v10), MULTIBOOT_TAG_ALIGN)
|
||||
+ acpiv2_size ()
|
||||
+ sizeof (struct multiboot_tag_vbe) + MULTIBOOT_TAG_ALIGN - 1
|
||||
+ sizeof (struct multiboot_tag_apm) + MULTIBOOT_TAG_ALIGN - 1;
|
||||
}
|
||||
|
||||
/* Fill previously allocated Multiboot mmap. */
|
||||
|
@ -288,29 +323,31 @@ grub_fill_multiboot_mmap (struct multiboot_tag_mmap *tag)
|
|||
{
|
||||
struct multiboot_mmap_entry *mmap_entry = tag->entries;
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
mmap_entry->addr = addr;
|
||||
mmap_entry->len = size;
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
case GRUB_MEMORY_AVAILABLE:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_AVAILABLE;
|
||||
break;
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE
|
||||
case GRUB_MACHINE_MEMORY_ACPI_RECLAIMABLE:
|
||||
case GRUB_MEMORY_ACPI:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_ACPI_RECLAIMABLE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MEMORY_NVS
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
case GRUB_MEMORY_NVS:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_NVS;
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
case GRUB_MEMORY_BADRAM:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_BADRAM;
|
||||
break;
|
||||
|
||||
default:
|
||||
mmap_entry->type = MULTIBOOT_MEMORY_RESERVED;
|
||||
break;
|
||||
|
@ -329,6 +366,54 @@ grub_fill_multiboot_mmap (struct multiboot_tag_mmap *tag)
|
|||
grub_mmap_iterate (hook);
|
||||
}
|
||||
|
||||
#if defined (GRUB_MACHINE_PCBIOS)
|
||||
static void
|
||||
fill_vbe_tag (struct multiboot_tag_vbe *tag)
|
||||
{
|
||||
grub_vbe_status_t status;
|
||||
void *scratch = (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
|
||||
tag->type = MULTIBOOT_TAG_TYPE_VBE;
|
||||
tag->size = 0;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return;
|
||||
|
||||
grub_memcpy (&tag->vbe_control_info, scratch,
|
||||
sizeof (struct grub_vbe_info_block));
|
||||
|
||||
status = grub_vbe_bios_get_mode (scratch);
|
||||
tag->vbe_mode = *(grub_uint32_t *) scratch;
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return;
|
||||
|
||||
/* get_mode_info isn't available for mode 3. */
|
||||
if (tag->vbe_mode == 3)
|
||||
{
|
||||
struct grub_vbe_mode_info_block *mode_info = (void *) &tag->vbe_mode_info;
|
||||
grub_memset (mode_info, 0,
|
||||
sizeof (struct grub_vbe_mode_info_block));
|
||||
mode_info->memory_model = GRUB_VBE_MEMORY_MODEL_TEXT;
|
||||
mode_info->x_resolution = 80;
|
||||
mode_info->y_resolution = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = grub_vbe_bios_get_mode_info (tag->vbe_mode, scratch);
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
return;
|
||||
grub_memcpy (&tag->vbe_mode_info, scratch,
|
||||
sizeof (struct grub_vbe_mode_info_block));
|
||||
}
|
||||
grub_vbe_bios_get_pm_interface (&tag->vbe_interface_seg,
|
||||
&tag->vbe_interface_off,
|
||||
&tag->vbe_interface_len);
|
||||
|
||||
tag->size = sizeof (*tag);
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
retrieve_video_parameters (grub_uint8_t **ptrorig)
|
||||
{
|
||||
|
@ -417,6 +502,16 @@ retrieve_video_parameters (grub_uint8_t **ptrorig)
|
|||
return GRUB_ERR_NONE;
|
||||
#endif
|
||||
|
||||
#if GRUB_MACHINE_HAS_VBE
|
||||
{
|
||||
struct multiboot_tag_vbe *tag_vbe = (struct multiboot_tag_vbe *) *ptrorig;
|
||||
|
||||
fill_vbe_tag (tag_vbe);
|
||||
|
||||
*ptrorig += ALIGN_UP (tag_vbe->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
#endif
|
||||
|
||||
err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -482,7 +577,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
|
||||
err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
|
||||
0, 0xffffffff - bufsize,
|
||||
bufsize, 4,
|
||||
bufsize, MULTIBOOT_TAG_ALIGN,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -515,6 +610,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;
|
||||
|
@ -584,7 +704,55 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) && defined (__x86_64__)
|
||||
{
|
||||
struct multiboot_tag_efi64 *tag = (struct multiboot_tag_efi64 *) ptrorig;
|
||||
tag->type = MULTIBOOT_TAG_TYPE_EFI64;
|
||||
tag->size = sizeof (*tag);
|
||||
tag->pointer = (grub_addr_t) grub_efi_system_table;
|
||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) && defined (__i386__)
|
||||
{
|
||||
struct multiboot_tag_efi32 *tag = (struct multiboot_tag_efi32 *) ptrorig;
|
||||
tag->type = MULTIBOOT_TAG_TYPE_EFI32;
|
||||
tag->size = sizeof (*tag);
|
||||
tag->pointer = (grub_addr_t) grub_efi_system_table;
|
||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GRUB_MACHINE_HAS_ACPI
|
||||
{
|
||||
struct multiboot_tag_old_acpi *tag = (struct multiboot_tag_old_acpi *)
|
||||
ptrorig;
|
||||
struct grub_acpi_rsdp_v10 *a = grub_acpi_get_rsdpv1 ();
|
||||
if (a)
|
||||
{
|
||||
tag->type = MULTIBOOT_TAG_TYPE_ACPI_OLD;
|
||||
tag->size = sizeof (*tag) + sizeof (*a);
|
||||
grub_memcpy (tag->rsdp, a, sizeof (*a));
|
||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
struct multiboot_tag_new_acpi *tag = (struct multiboot_tag_new_acpi *)
|
||||
ptrorig;
|
||||
struct grub_acpi_rsdp_v20 *a = grub_acpi_get_rsdpv2 ();
|
||||
if (a)
|
||||
{
|
||||
tag->type = MULTIBOOT_TAG_TYPE_ACPI_NEW;
|
||||
tag->size = sizeof (*tag) + a->length;
|
||||
grub_memcpy (tag->rsdp, a, a->length);
|
||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
struct multiboot_tag *tag = (struct multiboot_tag *) ptrorig;
|
||||
tag->type = MULTIBOOT_TAG_TYPE_END;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
#define ELF32_LOADMASK (0xc0000000UL)
|
||||
#define ELF64_LOADMASK (0xc000000000000000ULL)
|
||||
|
@ -45,6 +46,51 @@ static char *linux_args;
|
|||
typedef void (*kernel_entry_t) (void *, unsigned long, int (void *),
|
||||
unsigned long, unsigned long);
|
||||
|
||||
static grub_addr_t
|
||||
grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
|
||||
grub_size_t align)
|
||||
{
|
||||
grub_addr_t found_addr = (grub_addr_t) -1;
|
||||
|
||||
auto int NESTED_FUNC_ATTR alloc_mem (grub_uint64_t addr, grub_uint64_t len,
|
||||
grub_memory_type_t type);
|
||||
int NESTED_FUNC_ATTR alloc_mem (grub_uint64_t addr, grub_uint64_t len,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
grub_uint64_t end = addr + len;
|
||||
addr = ALIGN_UP (addr, align);
|
||||
target = ALIGN_UP (target, align);
|
||||
|
||||
/* Target above the memory chunk. */
|
||||
if (type != GRUB_MEMORY_AVAILABLE || target > end)
|
||||
return 0;
|
||||
|
||||
/* Target inside the memory chunk. */
|
||||
if (target >= addr && target < end && size <= end - target)
|
||||
{
|
||||
if (grub_claimmap (target, size) == GRUB_ERR_NONE)
|
||||
{
|
||||
found_addr = target;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Target below the memory chunk. */
|
||||
if (target < addr && addr + size <= end)
|
||||
{
|
||||
if (grub_claimmap (addr, size) == GRUB_ERR_NONE)
|
||||
{
|
||||
found_addr = addr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_machine_mmap_iterate (alloc_mem);
|
||||
|
||||
return found_addr;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_linux_boot (void)
|
||||
{
|
||||
|
@ -102,34 +148,30 @@ grub_linux_unload (void)
|
|||
static grub_err_t
|
||||
grub_linux_load32 (grub_elf_t elf)
|
||||
{
|
||||
Elf32_Addr entry;
|
||||
int found_addr = 0;
|
||||
Elf32_Addr base_addr;
|
||||
grub_addr_t seg_addr;
|
||||
grub_uint32_t align;
|
||||
int offset;
|
||||
|
||||
/* Linux's entry point incorrectly contains a virtual address. */
|
||||
entry = elf->ehdr.ehdr32.e_entry & ~ELF32_LOADMASK;
|
||||
if (entry == 0)
|
||||
entry = 0x01400000;
|
||||
|
||||
linux_size = grub_elf32_size (elf, 0);
|
||||
linux_size = grub_elf32_size (elf, &base_addr, &align);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
||||
linux_size += 0x100000;
|
||||
|
||||
offset = elf->ehdr.ehdr32.e_entry - base_addr;
|
||||
/* Linux's incorrectly contains a virtual address. */
|
||||
base_addr &= ~ELF32_LOADMASK;
|
||||
|
||||
/* On some systems, firmware occupies the memory we're trying to use.
|
||||
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate
|
||||
* until we find an open area. */
|
||||
for (linux_addr = entry; linux_addr < entry + 200 * 0x100000; linux_addr += 0x100000)
|
||||
{
|
||||
grub_dprintf ("loader", "Attempting to claim at 0x%x, size 0x%x.\n",
|
||||
linux_addr, linux_size);
|
||||
found_addr = grub_claimmap (linux_addr, linux_size);
|
||||
if (found_addr != -1)
|
||||
break;
|
||||
}
|
||||
if (found_addr == -1)
|
||||
seg_addr = grub_linux_claimmap_iterate (base_addr & ~ELF32_LOADMASK, linux_size, align);
|
||||
if (seg_addr == (grub_addr_t) -1)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
|
||||
|
||||
linux_addr = seg_addr + offset;
|
||||
|
||||
/* Now load the segments into the area we claimed. */
|
||||
auto grub_err_t offset_phdr (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
|
||||
grub_err_t offset_phdr (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load)
|
||||
|
@ -141,9 +183,7 @@ grub_linux_load32 (grub_elf_t elf)
|
|||
}
|
||||
*do_load = 1;
|
||||
|
||||
/* Linux's program headers incorrectly contain virtual addresses.
|
||||
* Translate those to physical, and offset to the area we claimed. */
|
||||
*addr = (phdr->p_paddr & ~ELF32_LOADMASK) + linux_addr;
|
||||
*addr = (phdr->p_paddr - base_addr) + seg_addr;
|
||||
return 0;
|
||||
}
|
||||
return grub_elf32_load (elf, offset_phdr, 0, 0);
|
||||
|
@ -152,34 +192,30 @@ grub_linux_load32 (grub_elf_t elf)
|
|||
static grub_err_t
|
||||
grub_linux_load64 (grub_elf_t elf)
|
||||
{
|
||||
Elf64_Addr entry;
|
||||
int found_addr = 0;
|
||||
Elf64_Addr base_addr;
|
||||
grub_addr_t seg_addr;
|
||||
grub_uint64_t align;
|
||||
int offset;
|
||||
|
||||
/* Linux's entry point incorrectly contains a virtual address. */
|
||||
entry = elf->ehdr.ehdr64.e_entry & ~ELF64_LOADMASK;
|
||||
if (entry == 0)
|
||||
entry = 0x01400000;
|
||||
|
||||
linux_size = grub_elf64_size (elf, 0);
|
||||
linux_size = grub_elf64_size (elf, &base_addr, &align);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
||||
linux_size += 0x100000;
|
||||
|
||||
offset = elf->ehdr.ehdr64.e_entry - base_addr;
|
||||
/* Linux's incorrectly contains a virtual address. */
|
||||
base_addr &= ~ELF64_LOADMASK;
|
||||
|
||||
/* On some systems, firmware occupies the memory we're trying to use.
|
||||
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate
|
||||
* until we find an open area. */
|
||||
for (linux_addr = entry; linux_addr < entry + 200 * 0x100000; linux_addr += 0x100000)
|
||||
{
|
||||
grub_dprintf ("loader", "Attempting to claim at 0x%x, size 0x%x.\n",
|
||||
linux_addr, linux_size);
|
||||
found_addr = grub_claimmap (linux_addr, linux_size);
|
||||
if (found_addr != -1)
|
||||
break;
|
||||
}
|
||||
if (found_addr == -1)
|
||||
seg_addr = grub_linux_claimmap_iterate (base_addr & ~ELF64_LOADMASK, linux_size, align);
|
||||
if (seg_addr == (grub_addr_t) -1)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
|
||||
|
||||
linux_addr = seg_addr + offset;
|
||||
|
||||
/* Now load the segments into the area we claimed. */
|
||||
auto grub_err_t offset_phdr (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load);
|
||||
grub_err_t offset_phdr (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load)
|
||||
|
@ -190,9 +226,8 @@ grub_linux_load64 (grub_elf_t elf)
|
|||
return 0;
|
||||
}
|
||||
*do_load = 1;
|
||||
/* Linux's program headers incorrectly contain virtual addresses.
|
||||
* Translate those to physical, and offset to the area we claimed. */
|
||||
*addr = (phdr->p_paddr & ~ELF64_LOADMASK) + linux_addr;
|
||||
|
||||
*addr = (phdr->p_paddr - base_addr) + seg_addr;
|
||||
return 0;
|
||||
}
|
||||
return grub_elf64_load (elf, offset_phdr, 0, 0);
|
||||
|
@ -287,7 +322,6 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_ssize_t size;
|
||||
grub_addr_t first_addr;
|
||||
grub_addr_t addr;
|
||||
int found_addr = 0;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
|
@ -301,6 +335,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
@ -310,20 +345,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
/* Attempt to claim at a series of addresses until successful in
|
||||
the same way that grub_rescue_cmd_linux does. */
|
||||
for (addr = first_addr; addr < first_addr + 200 * 0x100000; addr += 0x100000)
|
||||
{
|
||||
grub_dprintf ("loader", "Attempting to claim at 0x%x, size 0x%x.\n",
|
||||
addr, size);
|
||||
found_addr = grub_claimmap (addr, size);
|
||||
if (found_addr != -1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (found_addr == -1)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot claim memory");
|
||||
goto fail;
|
||||
}
|
||||
addr = grub_linux_claimmap_iterate (first_addr, size, 0x100000);
|
||||
if (addr == (grub_addr_t) -1)
|
||||
goto fail;
|
||||
|
||||
grub_dprintf ("loader", "Loading initrd at 0x%x, size 0x%x\n", addr, size);
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
@ -182,8 +182,10 @@ alloc_phys (grub_addr_t size)
|
|||
{
|
||||
grub_addr_t ret = (grub_addr_t) -1;
|
||||
|
||||
auto int NESTED_FUNC_ATTR choose (grub_uint64_t addr, grub_uint64_t len __attribute__((unused)), grub_uint32_t type);
|
||||
int NESTED_FUNC_ATTR choose (grub_uint64_t addr, grub_uint64_t len __attribute__((unused)), grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR choose (grub_uint64_t addr, grub_uint64_t len,
|
||||
grub_memory_type_t type);
|
||||
int NESTED_FUNC_ATTR choose (grub_uint64_t addr, grub_uint64_t len,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
grub_addr_t end = addr + len;
|
||||
|
||||
|
@ -245,7 +247,7 @@ grub_linux_load64 (grub_elf_t elf)
|
|||
linux_entry = elf->ehdr.ehdr64.e_entry;
|
||||
linux_addr = 0x40004000;
|
||||
off = 0x4000;
|
||||
linux_size = grub_elf64_size (elf, 0);
|
||||
linux_size = grub_elf64_size (elf, 0, 0);
|
||||
if (linux_size == 0)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -305,7 +307,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto out;
|
||||
}
|
||||
|
||||
file = grub_gzfile_open (argv[0], 1);
|
||||
file = grub_file_open (argv[0]);
|
||||
if (!file)
|
||||
goto out;
|
||||
|
||||
|
@ -393,6 +395,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (argv[0]);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
|
|
@ -28,13 +28,16 @@
|
|||
#include <grub/machoload.h>
|
||||
#include <grub/macho.h>
|
||||
#include <grub/cpu/macho.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
|
||||
#include <grub/autoefi.h>
|
||||
#endif
|
||||
|
||||
struct grub_xnu_devtree_key *grub_xnu_devtree_root = 0;
|
||||
static int driverspackagenum = 0;
|
||||
static int driversnum = 0;
|
||||
|
@ -425,6 +428,12 @@ grub_cmd_xnu_kernel (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (ptr != grub_xnu_cmdline)
|
||||
*(ptr - 1) = 0;
|
||||
|
||||
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
|
||||
err = grub_efiemu_autocore ();
|
||||
if (err)
|
||||
return err;
|
||||
#endif
|
||||
|
||||
grub_loader_set (grub_xnu_boot, grub_xnu_unload, 0);
|
||||
|
||||
grub_xnu_lock ();
|
||||
|
@ -530,6 +539,12 @@ grub_cmd_xnu_kernel64 (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (ptr != grub_xnu_cmdline)
|
||||
*(ptr - 1) = 0;
|
||||
|
||||
#if defined (__i386) && !defined (GRUB_MACHINE_EFI)
|
||||
err = grub_efiemu_autocore ();
|
||||
if (err)
|
||||
return err;
|
||||
#endif
|
||||
|
||||
grub_loader_set (grub_xnu_boot, grub_xnu_unload, 0);
|
||||
|
||||
grub_xnu_lock ();
|
||||
|
@ -661,7 +676,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
|
|||
macho = 0;
|
||||
|
||||
if (infoplistname)
|
||||
infoplist = grub_gzfile_open (infoplistname, 1);
|
||||
infoplist = grub_file_open (infoplistname);
|
||||
else
|
||||
infoplist = 0;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
@ -756,7 +771,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! grub_xnu_heap_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
|
||||
|
||||
file = grub_gzfile_open (args[0], 1);
|
||||
file = grub_file_open (args[0]);
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"couldn't load driver package");
|
||||
|
@ -869,7 +884,7 @@ grub_cmd_xnu_ramdisk (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! grub_xnu_heap_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
|
||||
|
||||
file = grub_gzfile_open (args[0], 1);
|
||||
file = grub_file_open (args[0]);
|
||||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"couldn't load ramdisk");
|
||||
|
@ -909,7 +924,7 @@ grub_xnu_check_os_bundle_required (char *plistname, char *osbundlereq,
|
|||
if (binname)
|
||||
*binname = 0;
|
||||
|
||||
file = grub_gzfile_open (plistname, 1);
|
||||
file = grub_file_open (plistname);
|
||||
if (! file)
|
||||
{
|
||||
grub_file_close (file);
|
||||
|
@ -1166,7 +1181,7 @@ grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
|
|||
grub_strcpy (binname + grub_strlen (binname), "/");
|
||||
grub_strcpy (binname + grub_strlen (binname), binsuffix);
|
||||
grub_dprintf ("xnu", "%s:%s\n", plistname, binname);
|
||||
binfile = grub_gzfile_open (binname, 1);
|
||||
binfile = grub_file_open (binname);
|
||||
if (! binfile)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
|
@ -1199,12 +1214,16 @@ grub_cmd_xnu_kext (grub_command_t cmd __attribute__ ((unused)),
|
|||
int argc, char *args[])
|
||||
{
|
||||
grub_file_t binfile = 0;
|
||||
|
||||
if (! grub_xnu_heap_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
/* User explicitly specified plist and binary. */
|
||||
if (grub_strcmp (args[1], "-") != 0)
|
||||
{
|
||||
binfile = grub_gzfile_open (args[1], 1);
|
||||
binfile = grub_file_open (args[1]);
|
||||
if (! binfile)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_OS, "can't open file");
|
||||
|
@ -1230,6 +1249,9 @@ grub_cmd_xnu_kextdir (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (argc != 1 && argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "directory name required");
|
||||
|
||||
if (! grub_xnu_heap_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
|
||||
|
||||
if (argc == 1)
|
||||
return grub_xnu_scan_dir_for_kexts (args[0],
|
||||
"console,root,local-root,network-root",
|
||||
|
@ -1364,15 +1386,18 @@ static const struct grub_arg_option xnu_splash_cmd_options[] =
|
|||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_xnu_splash (grub_extcmd_t cmd,
|
||||
grub_cmd_xnu_splash (grub_extcmd_context_t ctxt,
|
||||
int argc, char *args[])
|
||||
{
|
||||
grub_err_t err;
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
|
||||
if (cmd->state[XNU_SPLASH_CMD_ARGINDEX_MODE].set &&
|
||||
grub_strcmp (cmd->state[XNU_SPLASH_CMD_ARGINDEX_MODE].arg,
|
||||
if (! grub_xnu_heap_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "no xnu kernel loaded");
|
||||
|
||||
if (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].set &&
|
||||
grub_strcmp (ctxt->state[XNU_SPLASH_CMD_ARGINDEX_MODE].arg,
|
||||
"stretch") == 0)
|
||||
grub_xnu_bitmap_mode = GRUB_XNU_BITMAP_STRETCH;
|
||||
else
|
||||
|
@ -1435,8 +1460,7 @@ GRUB_MOD_INIT(xnu)
|
|||
"Load XNU ramdisk. "
|
||||
"It will be seen as md0.");
|
||||
cmd_splash = grub_register_extcmd ("xnu_splash",
|
||||
grub_cmd_xnu_splash,
|
||||
GRUB_COMMAND_FLAG_BOTH, 0,
|
||||
grub_cmd_xnu_splash, 0, 0,
|
||||
N_("Load a splash image for XNU."),
|
||||
xnu_splash_cmd_options);
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ grub_xnu_resume (char *imagename)
|
|||
grub_addr_t target_image;
|
||||
grub_err_t err;
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (imagename);
|
||||
if (! file)
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue