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