[U-Boot] [Xen-devel] [For knowledge-sake] Understanding of couple of things under the hood

Ajay Garg ajaygargnsit at gmail.com
Tue May 1 12:00:32 UTC 2018


Thanks a ton Julien, that was mighty useful !!

On Tue, May 1, 2018 at 4:44 PM, Julien Grall <julien.grall at arm.com> wrote:
>
>
> On 01/05/18 11:27, Ajay Garg wrote:
>>
>> Hi All.
>
>
> Hello,
>
>
>> I have been able to bring up xen on cubieboard2, using the following
>> script gathered from google :
>>
>> ###################################################################
>> # SUNXI Xen Boot Script
>> # Arch Linux ARM adaption of the cmd file which can be found at
>> http://openmirage.org/wiki/xen-on-cubieboard2
>>
>> # Addresses suitable for 1GB system, adjust as appropriate for a 2GB
>> system.
>> # Top of RAM:         0x80000000
>> # Xen relocate addr   0x7fe00000
>> setenv kernel_addr_r  0x7f600000 # 10 MB
>> setenv fdt_addr       0x7ec00000 #  2 MB
>> setenv xen_addr_r     0x7ea00000 #  2 MB
>>
>> setenv fdt_high      0xffffffff # Load fdt in place instead of relocating
>>
>> # Load xen/xen to ${xen_addr_r}.
>> fatload mmc 0 ${xen_addr_r} /xen
>> setenv bootargs "dom0_mem=256M"
>>
>> # Load appropriate .dtb file to ${fdt_addr}
>> fatload mmc 0 ${fdt_addr} /sun7i-a20-cubieboard2.dtb
>> fdt addr ${fdt_addr} 0x40000
>> fdt resize
>> fdt chosen
>> fdt set /chosen \#address-cells <1>
>> fdt set /chosen \#size-cells <1>
>>
>> # Load Linux arch/arm/boot/zImage to ${kernel_addr_r}
>> fatload mmc 0 ${kernel_addr_r} /zImage
>>
>> fdt mknod /chosen module at 0
>> fdt set /chosen/module at 0 compatible "xen,linux-zimage"
>> "xen,multiboot-module"
>> fdt set /chosen/module at 0 reg <${kernel_addr_r} 0x${filesize} >
>> fdt set /chosen/module at 0 bootargs "console=hvc0 rw root=/dev/mmcblk0p2
>> rootwait  clk_ignore_unused"
>>
>> bootz ${xen_addr_r} - ${fdt_addr}
>> ###################################################################
>>
>>
>> I have been able to understand most of the workflow, except three things :
>>
>> a)
>> Is the relocation-address of xen, given by
>>                 # Xen relocate addr   0x7fe00000
>> hardcoded? Or it is computed someway from ${kernel_addr_r},
>> {fdt_addr}, {xen_addr_r}?
>>
>> In the bootup logs, xen does relocate to 0x7fe00000, so surely there
>> is some magic going ..
>
>
> Xen will always relocate towards the end of the memory. See get_xen_paddr()
> in xen/arch/arm/setup.c. As the placement of the binaries by U-boot will
> have an impact to the relocation address, you need to cleverly choose the
> different addresses.
>
>>
>>
>> b)
>> What does the argument 0x40000 signify in the following :
>>                 fdt addr ${fdt_addr} 0x40000
>>
>> I consulted https://www.denx.de/wiki/DULG/UBootCmdFDT, but did not
>> find anything about this third argument.
>
>
> It is explained in section 5.9.7.7. The length is optional and used to tell
> the size of the FDT. This is useful in case the original FDT is not big
> enough to create more properties/nodes.
>
>>
>>
>> c)
>> I assume filesize is the size of the kernel-binary, but how is it
>> determined in the following :
>>                 fdt set /chosen/module at 0 reg <${kernel_addr_r}
>> 0x${filesize} >
>
>
> filesize will contain the size of the latest binary load in memory. The
> udpate will be done by fatload command.
>
> Cheers,
>
> --
> Julien Grall



-- 
Regards,
Ajay


More information about the U-Boot mailing list