TL;DR For Grub Legacy, you want
multiboot_info.framebuffer_addr, while for GRUB 2 you want
multiboot_tag_framebuffer_common.framebuffer_addr.
Don't take this quite as gospel, as I haven't used it myself yet, but that should be in the right ballpark.
In more detail: the information you seek is in the Multiboot data structure(s) which [wiki]GRUB[wiki] passes to your kernel. However, the
multiboot_info structure you would get from a
MB v.1 boot loader is different from the set of structs passed by a
MB v.2 boot loader, so which you want depends on the version of GRUB you're using. GRUB Legacy (version 0.99 and earlier) implements MB v.1; GRUB 2.0 implements MB v.2.
For GRUB Legacy, the relevant part is at the end of the
multiboot_info struct definition in the
Multiboot 1.x struct definitions:
Code: Select all
multiboot_uint64_t framebuffer_addr;
multiboot_uint32_t framebuffer_pitch;
multiboot_uint32_t framebuffer_width;
multiboot_uint32_t framebuffer_height;
multiboot_uint8_t framebuffer_bpp;
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
multiboot_uint8_t framebuffer_type;
union
{
struct
{
multiboot_uint32_t framebuffer_palette_addr;
multiboot_uint16_t framebuffer_palette_num_colors;
};
struct
{
multiboot_uint8_t framebuffer_red_field_position;
multiboot_uint8_t framebuffer_red_mask_size;
multiboot_uint8_t framebuffer_green_field_position;
multiboot_uint8_t framebuffer_green_mask_size;
multiboot_uint8_t framebuffer_blue_field_position;
multiboot_uint8_t framebuffer_blue_mask_size;
};
};
There is more there, but you can look into it more at the link I gave above.
For GRUB 2, which uses the
Multiboot 2.x struct definitions, things are arranged differently, with the different sections defined as their own structures, but the basics are similar.
Code: Select all
struct multiboot_tag_framebuffer_common
{
multiboot_uint32_t type;
multiboot_uint32_t size;
multiboot_uint64_t framebuffer_addr;
multiboot_uint32_t framebuffer_pitch;
multiboot_uint32_t framebuffer_width;
multiboot_uint32_t framebuffer_height;
multiboot_uint8_t framebuffer_bpp;
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
multiboot_uint8_t framebuffer_type;
multiboot_uint16_t reserved;
};