U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Xen-devel] [For knowledge-sake] Understanding of couple of things under the hood
Date: Tue, 1 May 2018 12:14:58 +0100	[thread overview]
Message-ID: <99fb8595-10c8-a180-eb4e-befe43cd721d@arm.com> (raw)
In-Reply-To: <CAHP4M8VRMwJrDAs201vf3z9e+WV9pUfGbaiFiYVhuagjsfzAqw@mail.gmail.com>



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

  reply	other threads:[~2018-05-01 11:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 10:27 [U-Boot] [For knowledge-sake] Understanding of couple of things under the hood Ajay Garg
2018-05-01 11:14 ` Julien Grall [this message]
2018-05-01 12:00   ` [U-Boot] [Xen-devel] " Ajay Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99fb8595-10c8-a180-eb4e-befe43cd721d@arm.com \
    --to=julien.grall@arm.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox