xref: /openbmc/qemu/docs/system/guest-loader.rst (revision cc5ee50fff9dbac0aac32cd892a7163c7babcca1)
101460378SAlex Bennée..
201460378SAlex Bennée   Copyright (c) 2020, Linaro
301460378SAlex Bennée
401460378SAlex BennéeGuest Loader
501460378SAlex Bennée------------
601460378SAlex Bennée
76df743dcSPeter MaydellThe guest loader is similar to the ``generic-loader`` although it is
801460378SAlex Bennéeaimed at a particular use case of loading hypervisor guests. This is
901460378SAlex Bennéeuseful for debugging hypervisors without having to jump through the
1001460378SAlex Bennéehoops of firmware and boot-loaders.
1101460378SAlex Bennée
1201460378SAlex BennéeThe guest loader does two things:
1301460378SAlex Bennée
1401460378SAlex Bennée  - load blobs (kernels and initial ram disks) into memory
1501460378SAlex Bennée  - sets platform FDT data so hypervisors can find and boot them
1601460378SAlex Bennée
17*d035fb10SAlex BennéeThis is what is typically done by a boot-loader like grub using its
1801460378SAlex Bennéemulti-boot capability. A typical example would look like:
1901460378SAlex Bennée
2001460378SAlex Bennée.. parsed-literal::
2101460378SAlex Bennée
2201460378SAlex Bennée  |qemu_system| -kernel ~/xen.git/xen/xen \
2301460378SAlex Bennée    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
2401460378SAlex Bennée    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
2501460378SAlex Bennée    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
2601460378SAlex Bennée
2701460378SAlex BennéeIn the above example the Xen hypervisor is loaded by the -kernel
28*d035fb10SAlex Bennéeparameter and passed its boot arguments via -append. The Dom0 guest
2901460378SAlex Bennéeis loaded into the areas of memory. Each blob will get
30*d035fb10SAlex Bennée``/chosen/module@<addr>`` entry in the FDT to indicate its location and
3101460378SAlex Bennéesize. Additional information can be passed with by using additional
3201460378SAlex Bennéearguments.
3301460378SAlex Bennée
3401460378SAlex BennéeCurrently the only supported machines which use FDT data to boot are
356df743dcSPeter Maydellthe ARM and RiscV ``virt`` machines.
3601460378SAlex Bennée
3701460378SAlex BennéeArguments
3801460378SAlex Bennée^^^^^^^^^
3901460378SAlex Bennée
4001460378SAlex BennéeThe full syntax of the guest-loader is::
4101460378SAlex Bennée
4201460378SAlex Bennée  -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>]
4301460378SAlex Bennée
4401460378SAlex Bennée``addr=<addr>``
4501460378SAlex Bennée  This is mandatory and indicates the start address of the blob.
4601460378SAlex Bennée
4701460378SAlex Bennée``kernel|initrd=<file>``
4801460378SAlex Bennée  Indicates the filename of the kernel or initrd blob. Both blobs will
4901460378SAlex Bennée  have the "multiboot,module" compatibility string as well as
5001460378SAlex Bennée  "multiboot,kernel" or "multiboot,ramdisk" as appropriate.
5101460378SAlex Bennée
5201460378SAlex Bennée``bootargs=<args>``
5301460378SAlex Bennée  This is an optional field for kernel blobs which will pass command
54450e0f28SJohn Snow  like via the ``/chosen/module@<addr>/bootargs`` node.
55