Config.in 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. To test your BIOS image in Qemu:
  39. qemu-system-{i386,x86-64} -hda disk.img
  40. Notes on using Grub2 for EFI-based platforms
  41. ============================================
  42. 1. Create a disk image
  43. dd if=/dev/zero of=disk.img bs=1M count=32
  44. 2. Partition it with GPT partitions
  45. cgdisk disk.img
  46. - Create a first partition, type EF00, for the
  47. bootloader and kernel image
  48. - Create a second partition, type 8300, for the root
  49. filesystem.
  50. 3. Setup loop device and loop partitions
  51. sudo losetup -f disk.img
  52. sudo partx -a /dev/loop0
  53. 4. Prepare the boot partition
  54. sudo mkfs.vfat -n boot /dev/loop0p1
  55. sudo mount /dev/loop0p1 /mnt
  56. sudo cp -a output/images/efi-part/* /mnt/
  57. sudo cp output/images/bzImage /mnt/
  58. sudo umount /mnt
  59. 5. Prepare the root partition
  60. sudo mkfs.ext3 -L root /dev/loop0p2
  61. sudo mount /dev/loop0p2 /mnt
  62. sudo tar -C /mnt -xf output/images/rootfs.tar
  63. sudo umount /mnt
  64. 6 Cleanup loop device
  65. sudo partx -d /dev/loop0
  66. sudo losetup -d /dev/loop0
  67. 7. Your disk.img is ready!
  68. To test your EFI image in Qemu:
  69. 1. Download the EFI BIOS for Qemu
  70. Version IA32 or X64 depending on the chosen Grub2
  71. platform (i386-efi vs. x86-64-efi)
  72. http://sourceforge.net/projects/edk2/files/OVMF/
  73. 2. Extract, and rename OVMF.fd to bios.bin and
  74. CirrusLogic5446.rom to vgabios-cirrus.bin.
  75. 3. qemu-system-{i386,x86-64} -L ovmf-dir/ -hda disk.img
  76. 4. Make sure to pass pci=nocrs to the kernel command line,
  77. to workaround a bug in the EFI BIOS regarding the
  78. EFI framebuffer.
  79. http://www.gnu.org/software/grub/
  80. if BR2_TARGET_GRUB2
  81. choice
  82. prompt "Platform"
  83. config BR2_TARGET_GRUB2_I386_PC
  84. bool "i386-pc"
  85. help
  86. Select this option if the platform you're targetting is a
  87. x86 or x86-64 legacy BIOS based platform.
  88. config BR2_TARGET_GRUB2_I386_EFI
  89. bool "i386-efi"
  90. help
  91. Select this option if the platform you're targetting has a
  92. 32 bits EFI BIOS. Note that some x86-64 platforms use a 32
  93. bits EFI BIOS, and this option should be used in this case.
  94. config BR2_TARGET_GRUB2_X86_64_EFI
  95. bool "x86-64-efi"
  96. help
  97. Select this option if the platform you're targetting has a
  98. 64 bits EFI BIOS.
  99. endchoice
  100. if BR2_TARGET_GRUB2_I386_PC
  101. config BR2_TARGET_GRUB2_BOOT_PARTITION
  102. string "boot partition"
  103. default "hd0,msdos1"
  104. help
  105. Specify the partition where the /boot/grub/grub.cfg file is
  106. located. Use 'hd0,msdos1' for the first partition of the
  107. first disk if using a legacy partition table, or 'hd0,gpt1'
  108. if using GPT partition table.
  109. endif # BR2_TARGET_GRUB2_I386_PC
  110. config BR2_TARGET_GRUB2_BUILTIN_MODULES
  111. string "builtin modules"
  112. default "boot linux ext2 fat part_msdos part_gpt normal biosdisk" if BR2_TARGET_GRUB2_I386_PC
  113. default "boot linux ext2 fat part_msdos part_gpt normal efi_gop" \
  114. if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI
  115. config BR2_TARGET_GRUB2_BUILTIN_CONFIG
  116. string "builtin config"
  117. help
  118. Path to a Grub 2 configuration file that will be embedded
  119. into the Grub image itself. This allows to set the root
  120. device and other configuration parameters, but however menu
  121. entries cannot be described in this embedded configuration.
  122. endif # BR2_TARGET_GRUB2