All of lore.kernel.org
 help / color / mirror / Atom feed
* [For knowledge-sake] Understanding of couple of things under the hood
@ 2018-05-01 10:27 Ajay Garg
  0 siblings, 0 replies; 3+ messages in thread
From: Ajay Garg @ 2018-05-01 10:27 UTC (permalink / raw)
  To: u-boot, xen-devel

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@0
fdt set /chosen/module@0 compatible "xen,linux-zimage" "xen,multiboot-module"
fdt set /chosen/module@0 reg <${kernel_addr_r} 0x${filesize} >
fdt set /chosen/module@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@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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [For knowledge-sake] Understanding of couple of things under the hood
  2018-05-01 11:14 ` Julien Grall
@ 2018-05-01 12:00   ` Ajay Garg
  0 siblings, 0 replies; 3+ messages in thread
From: Ajay Garg @ 2018-05-01 12:00 UTC (permalink / raw)
  To: Julien Grall; +Cc: u-boot, xen-devel

Thanks a ton Julien, that was mighty useful !!

On Tue, May 1, 2018 at 4:44 PM, Julien Grall <julien.grall@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@0
>> fdt set /chosen/module@0 compatible "xen,linux-zimage"
>> "xen,multiboot-module"
>> fdt set /chosen/module@0 reg <${kernel_addr_r} 0x${filesize} >
>> fdt set /chosen/module@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@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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [For knowledge-sake] Understanding of couple of things under the hood
  2018-05-01 10:27 [U-Boot] " Ajay Garg
@ 2018-05-01 11:14 ` Julien Grall
  2018-05-01 12:00   ` Ajay Garg
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2018-05-01 11:14 UTC (permalink / raw)
  To: Ajay Garg, u-boot, xen-devel



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@0
> fdt set /chosen/module@0 compatible "xen,linux-zimage" "xen,multiboot-module"
> fdt set /chosen/module@0 reg <${kernel_addr_r} 0x${filesize} >
> fdt set /chosen/module@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@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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-01 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 10:27 [For knowledge-sake] Understanding of couple of things under the hood Ajay Garg
  -- strict thread matches above, loose matches on Subject: below --
2018-05-01 10:27 [U-Boot] " Ajay Garg
2018-05-01 11:14 ` Julien Grall
2018-05-01 12:00   ` Ajay Garg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.