OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Dec 12, 2019 11:50 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Where is framebuffer in GRUB?
PostPosted: Thu Feb 14, 2019 9:15 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 142
Good day!
I am use GRUB to set graphic mode, but I dont know where is framebuffer. I am search on wiki, but I dont find anything. Please, where is it?


Top
 Profile  
 
 Post subject: Re: Where is framebuffer in GRUB?
PostPosted: Thu Feb 14, 2019 9:54 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3593
Location: Chichester, UK
It's in the Multiboot boot information structure: https://www.gnu.org/software/grub/manua ... ion-format


Top
 Profile  
 
 Post subject: Re: Where is framebuffer in GRUB?
PostPosted: Thu Feb 14, 2019 10:30 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1521
Location: Athens, GA, USA
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:
   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:
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;
};

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Tue Nov 26, 2019 10:31 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Where is framebuffer in GRUB?
PostPosted: Sat Feb 16, 2019 9:26 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 142
Thank you for answers!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], ndke and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group