Config.in 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. config BR2_TARGET_GRUB2
  2. bool "grub2"
  3. depends on BR2_i386 || BR2_x86_64
  4. help
  5. GNU GRUB is a Multiboot boot loader. It was derived from
  6. GRUB, the GRand Unified Bootloader, which was originally
  7. designed and implemented by Erich Stefan Boleyn. GRUB 2 has
  8. replaced what was formerly known as GRUB (i.e. version
  9. 0.9x), which has, in turn, become GRUB Legacy.
  10. Amongst others, GRUB2 offers EFI support, which GRUB Legacy
  11. doesn't provide.
  12. Notes on using Grub2 for BIOS-based platforms
  13. =============================================
  14. 1. Create a disk image
  15. dd if=/dev/zero of=disk.img bs=1M count=32
  16. 2. Partition it (either legacy or GPT style partitions work)
  17. cfdisk disk.img
  18. - Create one partition, type Linux, for the root
  19. filesystem. The only constraint is to make sure there
  20. is enough free space *before* the first partition to
  21. store Grub2. Leaving 1 MB of free space is safe.
  22. 3. Setup loop device and loop partitions
  23. sudo losetup -f disk.img
  24. sudo partx -a /dev/loop0
  25. 4. Prepare the root partition
  26. sudo mkfs.ext3 -L root /dev/loop0p1
  27. sudo mount /dev/loop0p1 /mnt
  28. sudo tar -C /mnt -xf output/images/rootfs.tar
  29. sudo umount /mnt
  30. 5. Install Grub2
  31. sudo ./output/host/usr/sbin/grub-bios-setup \
  32. -b ./output/host/usr/lib/grub/i386-pc/boot.img \
  33. -c ./output/images/grub.img -d . /dev/loop0
  34. 6. Cleanup loop device
  35. sudo partx -d /dev/loop0
  36. sudo losetup -d /dev/loop0
  37. 7. Your disk.img is ready!
  38. Using genimage
  39. --------------
  40. If you use genimage to generate your complete image,
  41. installing Grub can be tricky. Here is how to achieve Grub's
  42. installation with genimage:
  43. partition boot {
  44. in-partition-table = "no"
  45. image = "path_to_boot.img"
  46. offset = 0
  47. size = 512
  48. }
  49. partition grub {
  50. in-partition-table = "no"
  51. image = "path_to_grub.img"
  52. offset = 512
  53. }
  54. The result is not byte to byte identical to what
  55. grub-bios-setup does but it works anyway.
  56. To test your BIOS image in Qemu
  57. -------------------------------
  58. qemu-system-{i386,x86-64} -hda disk.img
  59. Notes on using Grub2 for EFI-based platforms
  60. ============================================
  61. 1. Create a disk image
  62. dd if=/dev/zero of=disk.img bs=1M count=32
  63. 2. Partition it with GPT partitions
  64. cgdisk disk.img
  65. - Create a first partition, type EF00, for the
  66. bootloader and kernel image
  67. - Create a second partition, type 8300, for the root
  68. filesystem.
  69. 3. Setup loop device and loop partitions
  70. sudo losetup -f disk.img
  71. sudo partx -a /dev/loop0
  72. 4. Prepare the boot partition
  73. sudo mkfs.vfat -n boot /dev/loop0p1
  74. sudo mount /dev/loop0p1 /mnt
  75. sudo cp -a output/images/efi-part/* /mnt/
  76. sudo cp output/images/bzImage /mnt/
  77. sudo umount /mnt
  78. 5. Prepare the root partition
  79. sudo mkfs.ext3 -L root /dev/loop0p2
  80. sudo mount /dev/loop0p2 /mnt
  81. sudo tar -C /mnt -xf output/images/rootfs.tar
  82. sudo umount /mnt
  83. 6 Cleanup loop device
  84. sudo partx -d /dev/loop0
  85. sudo losetup -d /dev/loop0
  86. 7. Your disk.img is ready!
  87. To test your EFI image in Qemu
  88. ------------------------------
  89. 1. Download the EFI BIOS for Qemu
  90. Version IA32 or X64 depending on the chosen Grub2
  91. platform (i386-efi vs. x86-64-efi)
  92. http://sourceforge.net/projects/edk2/files/OVMF/
  93. 2. Extract, and rename OVMF.fd to bios.bin and
  94. CirrusLogic5446.rom to vgabios-cirrus.bin.
  95. 3. qemu-system-{i386,x86-64} -L ovmf-dir/ -hda disk.img
  96. 4. Make sure to pass pci=nocrs to the kernel command line,
  97. to workaround a bug in the EFI BIOS regarding the
  98. EFI framebuffer.
  99. http://www.gnu.org/software/grub/
  100. if BR2_TARGET_GRUB2
  101. choice
  102. prompt "Platform"
  103. config BR2_TARGET_GRUB2_I386_PC
  104. bool "i386-pc"
  105. help
  106. Select this option if the platform you're targetting is a
  107. x86 or x86-64 legacy BIOS based platform.
  108. config BR2_TARGET_GRUB2_I386_EFI
  109. bool "i386-efi"
  110. help
  111. Select this option if the platform you're targetting has a
  112. 32 bits EFI BIOS. Note that some x86-64 platforms use a 32
  113. bits EFI BIOS, and this option should be used in this case.
  114. config BR2_TARGET_GRUB2_X86_64_EFI
  115. bool "x86-64-efi"
  116. depends on BR2_ARCH_IS_64
  117. help
  118. Select this option if the platform you're targetting has a
  119. 64 bits EFI BIOS.
  120. endchoice
  121. if BR2_TARGET_GRUB2_I386_PC
  122. config BR2_TARGET_GRUB2_BOOT_PARTITION
  123. string "boot partition"
  124. default "hd0,msdos1"
  125. help
  126. Specify the partition where the /boot/grub/grub.cfg file is
  127. located. Use 'hd0,msdos1' for the first partition of the
  128. first disk if using a legacy partition table, or 'hd0,gpt1'
  129. if using GPT partition table.
  130. endif # BR2_TARGET_GRUB2_I386_PC
  131. config BR2_TARGET_GRUB2_BUILTIN_MODULES
  132. string "builtin modules"
  133. default "boot linux ext2 fat squash4 part_msdos part_gpt normal biosdisk" if BR2_TARGET_GRUB2_I386_PC
  134. default "boot linux ext2 fat squash4 part_msdos part_gpt normal efi_gop" \
  135. if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI
  136. config BR2_TARGET_GRUB2_BUILTIN_CONFIG
  137. string "builtin config"
  138. help
  139. Path to a Grub 2 configuration file that will be embedded
  140. into the Grub image itself. This allows to set the root
  141. device and other configuration parameters, but however menu
  142. entries cannot be described in this embedded configuration.
  143. endif # BR2_TARGET_GRUB2