Problems booting Xen on Rock64 (RK3328) using u-boot script

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems booting Xen on Rock64 (RK3328) using u-boot script

Todd Stellanova
Hello,

I'm trying a few different routes to get Xen and a dom0 kernel to boot on the Rock64 SOC.  

First of all, I have a working Debian Stretch image that I intend to use as dom0.
I am able to boot that just fine using extlinux.

I also built Xen for arm64 and am able to boot that image ("xenImage802") using extlinux-- 
but of course, using extlinux I'm unable to preload the dom0 image and configure the Xen kernel to know where to find it.

So now I created a u-boot boot.cmd to configure dtb:

```
load ${devtype} ${devnum}:${distro_bootpart} ${xen_addr_r} xenImage802
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} dtb
fdt addr $fdt_addr_r
fdt resize
fdt set /chosen xen,xen-bootargs \"$xen_bootargs\"
fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\"
fdt set /chosen \#address-cells <1>
fdt set /chosen \#size-cells <1>
fdt mknode /chosen module@0
fdt resize
fdt set /chosen/module@0 compatible "xen,linux-zimage" "xen,multiboot-module"
fdt resize
fdt print /chosen
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} Image
booti ${xen_addr_r} -  ${fdt_addr_r}
```
And converted to a u-boot runnable script
`mkimage -C none -A arm64 -T script -d boot.cmd boot.scr`


Running boot.scr the u-boot prompt (after loading):

```
Found U-Boot script boot.scr
reading boot.scr
375 bytes read in 3 ms (122.1 KiB/s)
## Executing script at 00500000
reading xenImage802
885136 bytes read in 303 ms (2.8 MiB/s)
reading dtb
56922 bytes read in 24 ms (2.3 MiB/s)
chosen {
#address-cells = <0x00000001>;
#size-cells = <0x00000001>;
xen,dom0-bootargs = "console=hvc0 rw root=/dev/mmcblk1p7 clk_ignore_unused rootwait earlycon=xenboot";
xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=512M";
bootargs = "earlyprintk=uart8250-32bit,0xff130000";
stdout-path = "serial2:1500000n8";
module@0 {
compatible = "xen,linux-zimage", "xen,multiboot-module";
};
};
reading Image
19644424 bytes read in 6616 ms (2.8 MiB/s)
Bad Linux ARM64 Image magic!
```

FWIW these are the addresses I'm using:

```
xen_addr_r=0x01000000
fdt_addr_r=0x01f00000
kernel_addr_r=0x02000000
```

To summarize: booti is failing with "Bad Linux ARM64 Image magic!" even though extlinux is successfully able to boot this exact same Xen image ("xenImage802").  I have to wonder if somehow the image is getting overwritten somehow, or if booti is looking for a different formatted image. 

FWIW here's how I'm creating the xenImage802:
`mkimage -A arm64 -T kernel -a 0x80200000 -e 0x80200000 -C none -d xen/xen xenImage802`

and the extlinux.conf line:

```
label kernel-xen
    kernel /xenImage802
    initrd /initrd.img
    fdt /dtb
    append loglevel=7 rw root=LABEL=linux-root rootwait rootfstype=ext4 panic=10 init=/sbin/init coherent_pool=1M ethaddr=${ethaddr} eth1addr=${eth1addr} serial=${serial#} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
```

Thanks for any suggestions!

Todd

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Problems booting Xen on Rock64 (RK3328) using u-boot script

Julien Grall-3


On 28/05/18 00:10, Todd Stellanova wrote:
> Hello,

Hello,

> I'm trying a few different routes to get Xen and a dom0 kernel to boot
> on the Rock64 SOC.
>
> First of all, I have a working Debian Stretch image that I intend to use
> as dom0.
> I am able to boot that just fine using extlinux.
>
> I also built Xen for arm64 and am able to boot that image
> ("xenImage802") using extlinux--
> but of course, using extlinux I'm unable to preload the dom0 image and
> configure the Xen kernel to know where to find it.
>
> So now I created a u-boot boot.cmd to configure dtb:
>
> ```
> load ${devtype} ${devnum}:${distro_bootpart} ${xen_addr_r} xenImage802
> load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} dtb
> fdt addr $fdt_addr_r
> fdt resize
> fdt set /chosen xen,xen-bootargs \"$xen_bootargs\"
> fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\"
> fdt set /chosen \#address-cells <1>
> fdt set /chosen \#size-cells <1>
> fdt mknode /chosen module@0
> fdt resize
> fdt set /chosen/module@0 compatible "xen,linux-zimage"
> "xen,multiboot-module"
> fdt resize
> fdt print /chosen
> load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} Image
> booti ${xen_addr_r} -  ${fdt_addr_r}
> ```

The script looks good to me.

> And converted to a u-boot runnable script
> `mkimage -C none -A arm64 -T script -d boot.cmd boot.scr`
>
>
> Running boot.scr the u-boot prompt (after loading):
>
> ```
> Found U-Boot script boot.scr
> reading boot.scr
> 375 bytes read in 3 ms (122.1 KiB/s)
> ## Executing script at 00500000
> reading xenImage802
> 885136 bytes read in 303 ms (2.8 MiB/s)
> reading dtb
> 56922 bytes read in 24 ms (2.3 MiB/s)
> chosen {
> #address-cells = <0x00000001>;
> #size-cells = <0x00000001>;
> xen,dom0-bootargs = "console=hvc0 rw root=/dev/mmcblk1p7
> clk_ignore_unused rootwait earlycon=xenboot";
> xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=512M";
> bootargs = "earlyprintk=uart8250-32bit,0xff130000";
> stdout-path = "serial2:1500000n8";
> module@0 {
> compatible = "xen,linux-zimage", "xen,multiboot-module";
> };
> };
> reading Image
> 19644424 bytes read in 6616 ms (2.8 MiB/s)
> Bad Linux ARM64 Image magic!
> ```
>
> FWIW these are the addresses I'm using:
>
> ```
> xen_addr_r=0x01000000
> fdt_addr_r=0x01f00000
> kernel_addr_r=0x02000000
> ```

I never used that board. Do those addresses belong to the RAM? Have you
tried different ones?

>
> To summarize: booti is failing with "Bad Linux ARM64 Image magic!" even
> though extlinux is successfully able to boot this exact same Xen image
> ("xenImage802").  I have to wonder if somehow the image is getting
> overwritten somehow, or if booti is looking for a different formatted
> image.
>
> FWIW here's how I'm creating the xenImage802:
> `mkimage -A arm64 -T kernel -a 0x80200000 -e 0x80200000 -C none -d
> xen/xen xenImage802`
This steps will create a U-boot Image. This is different from a Linux
ARM64 Image and hence the error above. IIRC, you would use bootm here to
load U-boot Image.

Otherwise you could directly use xen/xen with booti.

>
> and the extlinux.conf line:
>
> ```
> label kernel-xen
>      kernel /xenImage802
>      initrd /initrd.img
>      fdt /dtb
>      append loglevel=7 rw root=LABEL=linux-root rootwait rootfstype=ext4
> panic=10 init=/sbin/init coherent_pool=1M ethaddr=${ethaddr}
> eth1addr=${eth1addr} serial=${serial#} cgroup_enable=cpuset
> cgroup_memory=1 cgroup_enable=memory swapaccount=1
> ```
>
> Thanks for any suggestions!

Cheers,

--
Julien Grall

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users