fee29b05bb
Since all EFI-based systems support GPT, this commit changes pc_x86_64_efi to use a GPT partition table. It shows an example of how to craft a disk image with GPT partitioning instead of MBR. This is achieved by means of a post-image script which uses mkdosfs+mcopy+sfdisk, since genimage is unable to deal with GPT. Long term, it would be ideal if genimage had GPT support, but until then, this script shows how to achieve creating a GPT-based disk image. The script was kept as simple as possible to make it easy to understand and adapt for other purposes. The root filesystem location is passed to the kernel by a partition UUID, so it is possible to boot on QEMU, directly from the disk image, or dump the image to a physical device. Signed-off-by: Carlos Santos <casantos@datacom.com.br> Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> |
||
---|---|---|
.. | ||
genimage-bios.cfg | ||
grub-bios.cfg | ||
grub-efi.cfg | ||
linux.config | ||
post-build.sh | ||
post-image-efi-gpt.sh | ||
readme.txt |
Bare PC sample config ===================== 1. Build First select the appropriate target you want. For BIOS-based boot strategy: $ make pc_x86_64_bios_defconfig For EFI-based boot strategy on a GPT-partitioned disk: $ make pc_x86_64_efi_defconfig Add any additional packages required and build: $ make 2. Write the pendrive The build process will create a pendrive image called sdcard.img in output/images. Write the image to a pendrive: $ dd if=output/images/disk.img of=/dev/sdc; sync Once it's done insert it into the target PC and boot. Remember that if said PC has another boot device you might need to select this alternative for it to boot. In the case of EFI boot you might need to disable Secure Boot from the setup as well. 3. Enjoy Emulation in qemu (BIOS) ======================== 1. Edit grub-bios.cfg Since the driver will show up in the virtual machine as /dev/vda, change board/pc/grub-bios.cfg to use root=/dev/vda2 instead of root=/dev/sda2. Then rebuild grub2 and the image. 2. Run the emulation with: qemu-system-x86_64 \ -M pc \ -drive file=output/images/disk.img,if=virtio,format=raw \ -net nic,model=virtio \ -net user Emulation in qemu (UEFI) ======================== 1. Edit grub-efi.cfg Since the driver will show up in the virtual machine as /dev/vda, change board/pc/grub-efi.cfg to use root=/dev/vda2 instead of root=/dev/sda2. Then rebuild grub2 and the image. 2. Run the emulation with: qemu-system-x86_64 \ -M pc \ -bios </path/to/OVMF_CODE.fd> \ -drive file=output/images/disk.img,if=virtio,format=raw \ -net nic,model=virtio \ -net user Note that </path/to/OVMF.fd> needs to point to a valid x86_64 UEFI firmware image for qemu. It may be provided by your distribution as a edk2 or OVMF package, in path such as /usr/share/edk2/ovmf/OVMF_CODE.fd .