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

Ajay Garg ajaygargnsit at gmail.com
Tue May 1 10:27:05 UTC 2018


Hi All.

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 ..


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.


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} >


Will be grateful for some help, as it will gain deeper understanding
of the ecosystem.


Thanks and Regards,
Ajay


More information about the U-Boot mailing list