multiboot2.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* multiboot.h - multiboot header file with grub definitions. */
  2. /*
  3. * GRUB -- GRand Unified Bootloader
  4. * Copyright (C) 2003,2007,2008,2010 Free Software Foundation, Inc.
  5. *
  6. * GRUB is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * GRUB is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef GRUB_MULTIBOOT2_HEADER
  20. #define GRUB_MULTIBOOT2_HEADER 1
  21. #include <grub/file.h>
  22. #include <multiboot2.h>
  23. #include <grub/types.h>
  24. #include <grub/err.h>
  25. extern struct grub_relocator *grub_multiboot2_relocator;
  26. void grub_multiboot2 (int argc, char *argv[]);
  27. void grub_module2 (int argc, char *argv[]);
  28. void grub_multiboot2_set_accepts_video (int val);
  29. grub_err_t grub_multiboot2_make_mbi (grub_uint32_t *target);
  30. void grub_multiboot2_free_mbi (void);
  31. grub_err_t grub_multiboot2_init_mbi (int argc, char *argv[]);
  32. grub_err_t grub_multiboot2_add_module (grub_addr_t start, grub_size_t size,
  33. int argc, char *argv[]);
  34. void grub_multiboot2_set_bootdev (void);
  35. void
  36. grub_multiboot2_add_elfsyms (grub_size_t num, grub_size_t entsize,
  37. unsigned shndx, void *data);
  38. grub_uint32_t grub_multiboot2_get_mmap_count (void);
  39. grub_err_t grub_multiboot2_set_video_mode (void);
  40. /* FIXME: support coreboot as well. */
  41. #if defined (GRUB_MACHINE_PCBIOS)
  42. #define GRUB_MACHINE_HAS_VBE 1
  43. #else
  44. #define GRUB_MACHINE_HAS_VBE 0
  45. #endif
  46. #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
  47. #define GRUB_MACHINE_HAS_VGA_TEXT 1
  48. #else
  49. #define GRUB_MACHINE_HAS_VGA_TEXT 0
  50. #endif
  51. #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
  52. #define GRUB_MACHINE_HAS_ACPI 1
  53. #else
  54. #define GRUB_MACHINE_HAS_ACPI 0
  55. #endif
  56. #define GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT 1
  57. #define GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER 2
  58. grub_err_t
  59. grub_multiboot2_set_console (int console_type, int accepted_consoles,
  60. int width, int height, int depth,
  61. int console_required);
  62. grub_err_t
  63. grub_multiboot2_load (grub_file_t file, const char *filename);
  64. struct mbi_load_data
  65. {
  66. grub_file_t file;
  67. const char *filename;
  68. void *buffer;
  69. unsigned int mbi_ver;
  70. int relocatable;
  71. grub_uint32_t min_addr;
  72. grub_uint32_t max_addr;
  73. grub_size_t align;
  74. grub_uint32_t preference;
  75. grub_uint32_t link_base_addr;
  76. grub_uint32_t load_base_addr;
  77. int avoid_efi_boot_services;
  78. };
  79. typedef struct mbi_load_data mbi_load_data_t;
  80. /* Load ELF32 or ELF64. */
  81. grub_err_t
  82. grub_multiboot2_load_elf (mbi_load_data_t *mld);
  83. extern grub_size_t grub_multiboot2_pure_size;
  84. extern grub_size_t grub_multiboot2_alloc_mbi;
  85. extern grub_uint32_t grub_multiboot2_payload_eip;
  86. #endif /* ! GRUB_MULTIBOOT_HEADER */