multiboot.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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_MULTIBOOT_HEADER
  20. #define GRUB_MULTIBOOT_HEADER 1
  21. #include <grub/file.h>
  22. #include <multiboot.h>
  23. #include <grub/types.h>
  24. #include <grub/err.h>
  25. typedef enum
  26. {
  27. GRUB_MULTIBOOT_QUIRKS_NONE = 0,
  28. GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE = 1,
  29. GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL = 2
  30. } grub_multiboot_quirks_t;
  31. extern grub_multiboot_quirks_t grub_multiboot_quirks;
  32. extern struct grub_relocator *grub_multiboot_relocator;
  33. void grub_multiboot (int argc, char *argv[]);
  34. void grub_module (int argc, char *argv[]);
  35. void grub_multiboot_set_accepts_video (int val);
  36. grub_err_t grub_multiboot_make_mbi (grub_uint32_t *target);
  37. void grub_multiboot_free_mbi (void);
  38. grub_err_t grub_multiboot_init_mbi (int argc, char *argv[]);
  39. grub_err_t grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
  40. int argc, char *argv[]);
  41. void grub_multiboot_set_bootdev (void);
  42. void
  43. grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
  44. unsigned shndx, void *data);
  45. grub_uint32_t grub_multiboot_get_mmap_count (void);
  46. grub_err_t grub_multiboot_set_video_mode (void);
  47. /* FIXME: support coreboot as well. */
  48. #if defined (GRUB_MACHINE_PCBIOS)
  49. #define GRUB_MACHINE_HAS_VBE 1
  50. #else
  51. #define GRUB_MACHINE_HAS_VBE 0
  52. #endif
  53. #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
  54. #define GRUB_MACHINE_HAS_VGA_TEXT 1
  55. #else
  56. #define GRUB_MACHINE_HAS_VGA_TEXT 0
  57. #endif
  58. #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
  59. #define GRUB_MACHINE_HAS_ACPI 1
  60. #else
  61. #define GRUB_MACHINE_HAS_ACPI 0
  62. #endif
  63. #define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1
  64. #define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER 2
  65. grub_err_t
  66. grub_multiboot_set_console (int console_type, int accepted_consoles,
  67. int width, int height, int depth,
  68. int console_required);
  69. grub_err_t
  70. grub_multiboot_load (grub_file_t file, const char *filename);
  71. struct mbi_load_data
  72. {
  73. grub_file_t file;
  74. const char *filename;
  75. void *buffer;
  76. unsigned int mbi_ver;
  77. int relocatable;
  78. grub_uint32_t min_addr;
  79. grub_uint32_t max_addr;
  80. grub_size_t align;
  81. grub_uint32_t preference;
  82. grub_uint32_t link_base_addr;
  83. grub_uint32_t load_base_addr;
  84. int avoid_efi_boot_services;
  85. };
  86. typedef struct mbi_load_data mbi_load_data_t;
  87. /* Load ELF32 or ELF64. */
  88. grub_err_t
  89. grub_multiboot_load_elf (mbi_load_data_t *mld);
  90. extern grub_size_t grub_multiboot_pure_size;
  91. extern grub_size_t grub_multiboot_alloc_mbi;
  92. extern grub_uint32_t grub_multiboot_payload_eip;
  93. #endif /* ! GRUB_MULTIBOOT_HEADER */