testing Orange PI PC2 boot from SPI flash, a one liner to fix a missing comma

1,445 views
Skip to first unread message

Andrea Venturi

unread,
Jan 10, 2017, 6:44:45 PM1/10/17
to linux-sunxi
hello

i'm following the notes for booting my Orange PI PC2 from the embedded SPI flash! finally..


i,m using H5 branch of apritzel uboot: https://github.com/apritzel/u-boot/tree/h5

after having enabled SPI flash support (and CONFIG_SPL_SPI_SUNXI=y support as written in the URL above) in uboot .config,

the compile step returns this error:

"macro SPL_LOAD_IMAGE_METHOD requires 4 arguments, but only 3 given"

the issue is here:

https://github.com/apritzel/u-boot/blob/h5/drivers/mtd/spi/sunxi_spi_spl.c#L287

just need to add a comma in between "sunxi SPI" 0. as in:

diff --git a/drivers/mtd/spi/sunxi_spi_spl.c b/drivers/mtd/spi/sunxi_spi_spl.c                           
index e70064c..a24c115 100644                                                                            
--- a/drivers/mtd/spi/sunxi_spi_spl.c
+++ b/drivers/mtd/spi/sunxi_spi_spl.c
@@ -284,4 +284,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
        return 0;
 }
 /* Use priorty 0 to override the default if it happens to be linked in */
-SPL_LOAD_IMAGE_METHOD("sunxi SPI" 0, BOOT_DEVICE_SPI, spl_spi_load_image);
+SPL_LOAD_IMAGE_METHOD("sunxi SPI", 0, BOOT_DEVICE_SPI, spl_spi_load_image);

then compile works ok,  flashing to ROM to and boot too! it's great.

U-Boot SPL 2017.01-rc1-g5df570f-dirty (Jan 11 2017 - 00:14:09)
DRAM: 1024 MiB
Trying to boot from sunxi SPI

U-Boot 2017.01-rc1-g5df570f-dirty (Jan 11 2017 - 00:14:09 +0100) Allwinner Technology

CPU:   Allwinner H5 (SUN50I)
Model: OrangePi PC 2
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000


U-Boot 2017.01-rc1-g5df570f-dirty (Jan 11 2017 - 00:14:09 +0100) Allwinner Technology

CPU:   Allwinner H5 (SUN50I)
Model: OrangePi PC 2
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  2 ^H^H^H 1 ^H^H^H 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
starting USB...
No controllers found
USB is stopped. Please issue 'usb start' first.
....

i didn't try the kernel/rootfs support on microSD. i suppose it works. but i'm fanatic of "network" boot, so i'm wondering what has to be done to make the eth available as it looks like it is on this gist: https://gist.github.com/apritzel/c128b29c601d180d32d68ee4c9ed8f47

CPU: Allwinner H5 (SUN50I)
Model: OrangePi PC 2
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
MMC: no card present
*** Warning - MMC init failed, using default environment
In: serial
Out: serial
Err: serial
Net: phy interface7
eth0: ethernet@1c30000

BTW i'm using uboot cfg  file 'sun50i_h5_spl32_defconfig' avalable in pritzel H5 branch with the addition for SUNXI_SPL and SPI flash..

bye andrea


Priit Laes

unread,
Jan 11, 2017, 12:46:10 AM1/11/17
to ennesim...@gmail.com, linux-sunxi
On Tue, 2017-01-10 at 15:44 -0800, Andrea Venturi wrote:
> hello
>
> i'm following the notes for booting my Orange PI PC2 from the
> embedded SPI flash! finally..
>
>  https://linux-sunxi.org/Bootable_SPI_flash
>
> i,m using H5 branch of apritzel uboot: https://github.com/apritzel/u-
> boot/tree/h5
>
> after having enabled SPI flash support (and CONFIG_SPL_SPI_SUNXI=y
> support as written in the URL above) in uboot .config,
>
> the compile step returns this error:
>
> "macro SPL_LOAD_IMAGE_METHOD requires 4 arguments, but only 3 given"
>
> the issue is here:
>
> https://github.com/apritzel/u-
> boot/blob/h5/drivers/mtd/spi/sunxi_spi_spl.c#L287

This is fixed in mainline.
> -- 
> You received this message because you are subscribed to the Google
> Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Andrea Venturi

unread,
Jan 11, 2017, 3:20:33 PM1/11/17
to linux-sunxi, ennesim...@gmail.com
Il giorno mercoledì 11 gennaio 2017 06:46:10 UTC+1, Priit Laes ha scritto:
On Tue, 2017-01-10 at 15:44 -0800, Andrea Venturi wrote:
> hello
>
> i'm following the notes for booting my Orange PI PC2 from the
> embedded SPI flash! finally..
>
>  https://linux-sunxi.org/Bootable_SPI_flash
>
> i,m using H5 branch of apritzel uboot: https://github.com/apritzel/u-
> boot/tree/h5
>
> after having enabled SPI flash support (and CONFIG_SPL_SPI_SUNXI=y
> support as written in the URL above) in uboot .config,
>
> the compile step returns this error:
>
> "macro SPL_LOAD_IMAGE_METHOD requires 4 arguments, but only 3 given"
>
> the issue is here:
>
> https://github.com/apritzel/u-boot/blob/h5/drivers/mtd/spi/sunxi_spi_spl.c#L287

This is fixed in mainline.



thanx, i'll test ASAP.

i suppose we should update the ptr on linux-sunxi wiki, here:



Andre Przywara

unread,
Jan 12, 2017, 12:11:47 PM1/12/17
to ennesim...@gmail.com, linux-sunxi
Hi,

On 11/01/17 20:20, Andrea Venturi wrote:
> Il giorno mercoledì 11 gennaio 2017 06:46:10 UTC+1, Priit Laes ha scritto:
>
> On Tue, 2017-01-10 at 15:44 -0800, Andrea Venturi wrote:
> > hello
> >
> > i'm following the notes for booting my Orange PI PC2 from the
> > embedded SPI flash! finally..
> >
> > https://linux-sunxi.org/Bootable_SPI_flash
> <https://linux-sunxi.org/Bootable_SPI_flash>
> >
> > i,m using H5 branch of apritzel
> uboot: https://github.com/apritzel/u- <https://github.com/apritzel/u->
> > boot/tree/h5
> >
> > after having enabled SPI flash support (and CONFIG_SPL_SPI_SUNXI=y
> > support as written in the URL above) in uboot .config,
> >
> > the compile step returns this error:
> >
> > "macro SPL_LOAD_IMAGE_METHOD requires 4 arguments, but only 3 given"
> >
> > the issue is here:
> >
> >
> https://github.com/apritzel/u-boot/blob/h5/drivers/mtd/spi/sunxi_spi_spl.c#L287
>
>
> This is fixed in mainline.
>
>
>
> thanx, i'll test ASAP.
>
> i suppose we should update the ptr on linux-sunxi wiki, here:
>
> http://linux-sunxi.org/Xunlong_Orange_Pi_PC_2#Mainline_U-Boot

Please have some more patience. The existing code will take you nowhere:
- You seem to build a 32-bit only U-Boot, so no way to start 64-bit
kernels (check: you should have no booti command, but only bootz).
- This branch does not support a 64-bit SPL, so you can't switch to
this. You really need to combine a 32-bit SPL with a 64-bit U-Boot
proper, but ...
- You don't have ATF loaded, so the kernel will crash unless you disable
all secondary CPUs in the DT (which means you have one core only). Also
I believe there is one more thing which will fail, IIRC.

I managed to finally clean up my SPL FIT support last night, so there
should be a clean way of including the ATF in this process very soon.

And please be advised that this branch was more proof of concept code
and is a bit outdated already. Hopefully I will be able to send some
proper H5 U-Boot patches for discussion in the next few days.

Cheers,
Andre.
Reply all
Reply to author
Forward
0 new messages