ImageBuilder: Difference between revisions

From Xen
Jump to navigationJump to search
(Created page with "Booting Xen from U-Boot requires: - loading all the required binaries, manually specifying the loading address for each of them making sure they don't overlap - Xen, Dom0 k...")
 
No edit summary
Line 1: Line 1:
Booting Xen from U-Boot requires:
Booting Xen from U-Boot requires:


- loading all the required binaries, manually specifying the loading address for each of them making sure they don't overlap
* loading all the required binaries, manually specifying the loading address for each of them making sure they don't overlap
- Xen, Dom0 kernel, Dom0 ramdisk, device tree binary, any Dom0-less DomUs kernels, ramdisk and partial dtbs for passthrough
** Xen, Dom0 kernel, Dom0 ramdisk, device tree binary, any Dom0-less DomUs kernels, ramdisk and partial dtbs for passthrough


- adding relevant nodes to device tree
* adding relevant nodes to device tree
- the Dom0 kernel and ramdisk loading addresses need to be specified in device tree under /chosen
** the Dom0 kernel and ramdisk loading addresses need to be specified in device tree under /chosen


See [https://xenbits.xenproject.org/docs/unstable/misc/arm/device-tree/booting.txt booting.txt] as a reference.
See [https://xenbits.xenproject.org/docs/unstable/misc/arm/device-tree/booting.txt booting.txt] as a reference.
Line 13: Line 13:
[https://gitlab.com/ViryaOS/imagebuilder https://gitlab.com/ViryaOS/imagebuilder]
[https://gitlab.com/ViryaOS/imagebuilder https://gitlab.com/ViryaOS/imagebuilder]


ImageBuilder can be invoked as a container for build automation, but its useful scripts can also be called manually. Specifically, *script/uboot-script-gen* to generate a U-Boot script that loads all the necessary binaries and automatically adds the required entries to device tree at boot time.
ImageBuilder can be invoked as a container for build automation, but its useful scripts can also be called manually. Specifically, '''script/uboot-script-gen''' generates a U-Boot script that loads all the necessary binaries and automatically adds the required entries to device tree at boot time.


First write a config file, like the following:
First write a config file, like the following:


<nowiki>
<nowiki>
MEMORY_START="0x0"
MEMORY_START="0x0"
MEMORY_END="0x80000000"
MEMORY_END="0x80000000"
Line 39: Line 39:
</nowiki>
</nowiki>


The fields are self explanatory but you can find more detailed information on the [https://gitlab.com/ViryaOS/imagebuilder/blob/master/README.md readme]. Make sure to use raw binaries for Xen, all the kernels and rootfs's, not U-Boot binaries (do *not* use the output of mkimage).
The fields are self explanatory but you can find more detailed information on the [https://gitlab.com/ViryaOS/imagebuilder/blob/master/README.md readme]. Make sure to use raw binaries for Xen, all the kernels and rootfs's, not U-Boot binaries (do '''not''' use the output of mkimage).


Then you can call uboot-script-gen as follows:
Then you can call uboot-script-gen as follows:


<nowiki>
<nowiki>
$ export LOAD_CMD="tftpb"
$ export LOAD_CMD="tftpb"
$ bash ./scripts/uboot-script-gen /path/to/config
$ bash ./scripts/uboot-script-gen /path/to/config
Line 50: Line 50:
to generate a U-Boot script named *boot.scr* that will load all your binaries automatically using tftp, you just need to load boot.scr and source it.
to generate a U-Boot script named *boot.scr* that will load all your binaries automatically using tftp, you just need to load boot.scr and source it.


<nowiki>
<nowiki>
$ tftpb 0xC00000 boot.scr; source 0xC00000
$ tftpb 0xC00000 boot.scr; source 0xC00000
</nowiki>
</nowiki>
Line 56: Line 56:
The command used to load the binaries can be customized, for instance you can have uboot-script-gen generate a U-Boot script that loads binaries from an SD card changing LOAD_CMD to "load scsi 0:1":
The command used to load the binaries can be customized, for instance you can have uboot-script-gen generate a U-Boot script that loads binaries from an SD card changing LOAD_CMD to "load scsi 0:1":


<nowiki>
<nowiki>
$ export LOAD_CMD="load scsi 0:1"
$ export LOAD_CMD="load scsi 0:1"
$ bash ./scripts/uboot-script-gen /path/to/config
$ bash ./scripts/uboot-script-gen /path/to/config

Revision as of 21:23, 22 October 2019

Booting Xen from U-Boot requires:

  • loading all the required binaries, manually specifying the loading address for each of them making sure they don't overlap
    • Xen, Dom0 kernel, Dom0 ramdisk, device tree binary, any Dom0-less DomUs kernels, ramdisk and partial dtbs for passthrough
  • adding relevant nodes to device tree
    • the Dom0 kernel and ramdisk loading addresses need to be specified in device tree under /chosen

See booting.txt as a reference.

The processing is complex and cumbersome. To automate this configuration steps you can use ImageBuilder:

https://gitlab.com/ViryaOS/imagebuilder

ImageBuilder can be invoked as a container for build automation, but its useful scripts can also be called manually. Specifically, script/uboot-script-gen generates a U-Boot script that loads all the necessary binaries and automatically adds the required entries to device tree at boot time.

First write a config file, like the following:

MEMORY_START="0x0"
MEMORY_END="0x80000000"

UBOOT_DIR="uboot"

DEVICE_TREE="board.dtb"
XEN="xen-hypervisor"
DOM0_KERNEL="Image-dom0"
DOM0_RAMDISK="ramdisk-dom0.rootfs.cpio.gz"

NUM_DOMUS=2
DOMU_KERNEL[0]="dom1/Image-domU"
DOMU_RAMDISK[0]="dom1/ramdisk-domU"
DOMU_PASSTHROUGH_DTB[0]="dom1/passthrough-domU.dtb"
DOMU_KERNEL[1]="dom2/Image-domU"
DOMU_RAMDISK[1]="dom2/ramdisk-domU2"

UBOOT_SOURCE="boot.source"
UBOOT_SCRIPT="boot.scr"

The fields are self explanatory but you can find more detailed information on the readme. Make sure to use raw binaries for Xen, all the kernels and rootfs's, not U-Boot binaries (do not use the output of mkimage).

Then you can call uboot-script-gen as follows:

$ export LOAD_CMD="tftpb"
$ bash ./scripts/uboot-script-gen /path/to/config

to generate a U-Boot script named *boot.scr* that will load all your binaries automatically using tftp, you just need to load boot.scr and source it.

$ tftpb 0xC00000 boot.scr; source 0xC00000

The command used to load the binaries can be customized, for instance you can have uboot-script-gen generate a U-Boot script that loads binaries from an SD card changing LOAD_CMD to "load scsi 0:1":

$ export LOAD_CMD="load scsi 0:1"
$ bash ./scripts/uboot-script-gen /path/to/config