xref: /qemu/docs/system/guest-loader.rst (revision 0146037807831ff6424e5b8be66532ce39f0eb13)
1*01460378SAlex Bennée..
2*01460378SAlex Bennée   Copyright (c) 2020, Linaro
3*01460378SAlex Bennée
4*01460378SAlex BennéeGuest Loader
5*01460378SAlex Bennée------------
6*01460378SAlex Bennée
7*01460378SAlex BennéeThe guest loader is similar to the `generic-loader` although it is
8*01460378SAlex Bennéeaimed at a particular use case of loading hypervisor guests. This is
9*01460378SAlex Bennéeuseful for debugging hypervisors without having to jump through the
10*01460378SAlex Bennéehoops of firmware and boot-loaders.
11*01460378SAlex Bennée
12*01460378SAlex BennéeThe guest loader does two things:
13*01460378SAlex Bennée
14*01460378SAlex Bennée  - load blobs (kernels and initial ram disks) into memory
15*01460378SAlex Bennée  - sets platform FDT data so hypervisors can find and boot them
16*01460378SAlex Bennée
17*01460378SAlex BennéeThis is what is typically done by a boot-loader like grub using it's
18*01460378SAlex Bennéemulti-boot capability. A typical example would look like:
19*01460378SAlex Bennée
20*01460378SAlex Bennée.. parsed-literal::
21*01460378SAlex Bennée
22*01460378SAlex Bennée  |qemu_system| -kernel ~/xen.git/xen/xen \
23*01460378SAlex Bennée    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
24*01460378SAlex Bennée    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
25*01460378SAlex Bennée    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
26*01460378SAlex Bennée
27*01460378SAlex BennéeIn the above example the Xen hypervisor is loaded by the -kernel
28*01460378SAlex Bennéeparameter and passed it's boot arguments via -append. The Dom0 guest
29*01460378SAlex Bennéeis loaded into the areas of memory. Each blob will get
30*01460378SAlex Bennée`/chosen/module@<addr>` entry in the FDT to indicate it's location and
31*01460378SAlex Bennéesize. Additional information can be passed with by using additional
32*01460378SAlex Bennéearguments.
33*01460378SAlex Bennée
34*01460378SAlex BennéeCurrently the only supported machines which use FDT data to boot are
35*01460378SAlex Bennéethe ARM and RiscV `virt` machines.
36*01460378SAlex Bennée
37*01460378SAlex BennéeArguments
38*01460378SAlex Bennée^^^^^^^^^
39*01460378SAlex Bennée
40*01460378SAlex BennéeThe full syntax of the guest-loader is::
41*01460378SAlex Bennée
42*01460378SAlex Bennée  -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>]
43*01460378SAlex Bennée
44*01460378SAlex Bennée``addr=<addr>``
45*01460378SAlex Bennée  This is mandatory and indicates the start address of the blob.
46*01460378SAlex Bennée
47*01460378SAlex Bennée``kernel|initrd=<file>``
48*01460378SAlex Bennée  Indicates the filename of the kernel or initrd blob. Both blobs will
49*01460378SAlex Bennée  have the "multiboot,module" compatibility string as well as
50*01460378SAlex Bennée  "multiboot,kernel" or "multiboot,ramdisk" as appropriate.
51*01460378SAlex Bennée
52*01460378SAlex Bennée``bootargs=<args>``
53*01460378SAlex Bennée  This is an optional field for kernel blobs which will pass command
54*01460378SAlex Bennée  like via the `/chosen/module@<addr>/bootargs` node.
55