Config.in 4.2 KB

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