1Bare PC sample config 2===================== 3 41. Build 5 6 First select the appropriate target you want. 7 8 For BIOS-based boot strategy: 9 10 $ make pc_x86_64_bios_defconfig 11 12 For EFI-based boot strategy on a GPT-partitioned disk: 13 14 $ make pc_x86_64_efi_defconfig 15 16 Add any additional packages required and build: 17 18 $ make 19 202. Write the pendrive 21 22 The build process will create a pendrive image called sdcard.img in 23 output/images. 24 25 Write the image to a pendrive: 26 27 $ dd if=output/images/disk.img of=/dev/sdc; sync 28 29 Once it's done insert it into the target PC and boot. 30 31 Remember that if said PC has another boot device you might need to 32 select this alternative for it to boot. 33 34 In the case of EFI boot you might need to disable Secure Boot from 35 the setup as well. 36 373. Enjoy 38 39Emulation in qemu (BIOS) 40======================== 41 421. Edit grub-bios.cfg 43 44 Since the driver will show up in the virtual machine as /dev/vda, 45 change board/pc/grub-bios.cfg to use root=/dev/vda2 instead of 46 root=/dev/sda2. Then rebuild grub2 and the image. 47 482. Run the emulation with: 49 50qemu-system-x86_64 \ 51 -M pc \ 52 -drive file=output/images/disk.img,if=virtio,format=raw \ 53 -net nic,model=virtio \ 54 -net user 55 56 57Emulation in qemu (UEFI) 58======================== 59 60Run the emulation with: 61 62qemu-system-x86_64 \ 63 -M pc \ 64 -bios </path/to/OVMF_CODE.fd> \ 65 -drive file=output/images/disk.img,if=virtio,format=raw \ 66 -net nic,model=virtio \ 67 -net user 68 69Note that </path/to/OVMF.fd> needs to point to a valid x86_64 UEFI 70firmware image for qemu. It may be provided by your distribution as a 71edk2 or OVMF package, in path such as 72/usr/share/edk2/ovmf/OVMF_CODE.fd . 73