Orange Pi Zero support

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

Orange Pi Zero support

Johnny Sorocil
Hi all!

I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC).

I have few questions:
1) How to build vanilla u-boot which will be capable booting FreeBSD
kernel? I have managed to load ubldr, but not the kernel.
2) How to use newer Linux dts/dtb files?

1) u-boot
This is how I built u-boot:
git clone git://git.denx.de/u-boot.git
cd u-boot
git checkout v2017.05
# apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1)
(in the attachment)
gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024
seek=8

In the u-boot prompt:
  fatload mmc 0 0x42000000 ubldr.bin
  setenv fdtfile sun8i-h3-orangepi-one.dtb
  go 0x4200000
ubldr will work as expected, but kernel will hang at the start.
If I use
/usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then
the kernel and userland will boot normally.
This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab)

2) newer DTS/DTB
If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board
will boot fine, but I don't have network.
I can also boot normally if the dtb file is rebuilt manually:
  cd /usr/src/sys/gnu/dts/arm
  cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include
sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb
  ls -lh sun8i-h3-rebuilt.dtb
  -rw-r--r--  1 root  wheel    15K Jun 24 13:02 sun8i-h3-rebuilt.dtb
But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang:
  Using DTB from loaded file
'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'.
  Kernel entry at 0x42200100...
  Kernel args: -v
The same file boots Linux without problems.

I don't know why newer dtb files won't work because there is no output on
serial console.
Any ideas how to make it work?

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"

uboot_v2017.05.diff (688 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Jov-2
Hi,
I have tried orangepi plus 2e imange and this can be used to boot and run
orange pi zero and one.All except ethernet works well.
I build uboot use this:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214729
and use crochet build the image.

I see a previous thread say dts files from linux can not be used on FreeBSD
directly and should be modified.

Jov

2017-06-24 19:13 GMT+08:00 Johnny Sorocil <[hidden email]>:

> Hi all!
>
> I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC).
>
> I have few questions:
> 1) How to build vanilla u-boot which will be capable booting FreeBSD
> kernel? I have managed to load ubldr, but not the kernel.
> 2) How to use newer Linux dts/dtb files?
>
> 1) u-boot
> This is how I built u-boot:
> git clone git://git.denx.de/u-boot.git
> cd u-boot
> git checkout v2017.05
> # apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1)
> (in the attachment)
> gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
> gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
> dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024
> seek=8
>
> In the u-boot prompt:
>   fatload mmc 0 0x42000000 ubldr.bin
>   setenv fdtfile sun8i-h3-orangepi-one.dtb
>   go 0x4200000
> ubldr will work as expected, but kernel will hang at the start.
> If I use
> /usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then
> the kernel and userland will boot normally.
> This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab)
>
> 2) newer DTS/DTB
> If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board
> will boot fine, but I don't have network.
> I can also boot normally if the dtb file is rebuilt manually:
>   cd /usr/src/sys/gnu/dts/arm
>   cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include
> sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb
>   ls -lh sun8i-h3-rebuilt.dtb
>   -rw-r--r--  1 root  wheel    15K Jun 24 13:02 sun8i-h3-rebuilt.dtb
> But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang:
>   Using DTB from loaded file
> 'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'.
>   Kernel entry at 0x42200100...
>   Kernel args: -v
> The same file boots Linux without problems.
>
> I don't know why newer dtb files won't work because there is no output on
> serial console.
> Any ideas how to make it work?
>
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "[hidden email]"
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

aggaz
In reply to this post by Johnny Sorocil
Hello,

try something like this:

http://freebsd.1045724.x6.nabble.com/Re-FreeBSD-12-CURRENT-on-OrangePi-One-td6185280.html

Regards


> Hi all!
>
> I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC).
>
> I have few questions:
> 1) How to build vanilla u-boot which will be capable booting FreeBSD
> kernel? I have managed to load ubldr, but not the kernel.
> 2) How to use newer Linux dts/dtb files?
>
> 1) u-boot
> This is how I built u-boot:
> git clone git://git.denx.de/u-boot.git
> cd u-boot
> git checkout v2017.05
> # apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1)
> (in the attachment)
> gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
> gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
> dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024
> seek=8
>
> In the u-boot prompt:
>   fatload mmc 0 0x42000000 ubldr.bin
>   setenv fdtfile sun8i-h3-orangepi-one.dtb
>   go 0x4200000
> ubldr will work as expected, but kernel will hang at the start.
> If I use
> /usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then
> the kernel and userland will boot normally.
> This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab)
>
> 2) newer DTS/DTB
> If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board
> will boot fine, but I don't have network.
> I can also boot normally if the dtb file is rebuilt manually:
>   cd /usr/src/sys/gnu/dts/arm
>   cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include
> sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb
>   ls -lh sun8i-h3-rebuilt.dtb
>   -rw-r--r--  1 root  wheel    15K Jun 24 13:02 sun8i-h3-rebuilt.dtb
> But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang:
>   Using DTB from loaded file
> 'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'.
>   Kernel entry at 0x42200100...
>   Kernel args: -v
> The same file boots Linux without problems.
>
> I don't know why newer dtb files won't work because there is no output on
> serial console.
> Any ideas how to make it work?
> -------------- next part --------------
> diff --git a/lib/bch.c b/lib/bch.c
> index ec53483774..b45c507c51 100644
> --- a/lib/bch.c
> +++ b/lib/bch.c
> @@ -61,7 +61,11 @@
>  #include <linux/bitops.h>
>  #else
>  #include <errno.h>
> +#ifdef __FreeBSD__
> +#include <machine/endian.h>
> +#else
>  #include <endian.h>
> +#endif
>  #include <stdint.h>
>  #include <stdlib.h>
>  #include <string.h>
> @@ -112,7 +116,7 @@ struct gf_poly_deg1 {
>   unsigned int   c[2];
>  };
>  
> -#ifdef USE_HOSTCC
> +#if defined USE_HOSTCC && !defined __FreeBSD__
>  static int fls(int x)
>  {
>   int r = 32;
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
In reply to this post by Johnny Sorocil
On Sat, 24 Jun 2017 13:13:40 +0200
Johnny Sorocil <[hidden email]> wrote:

> Hi all!
>
> I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC).
>
> I have few questions:
> 1) How to build vanilla u-boot which will be capable booting FreeBSD
> kernel? I have managed to load ubldr, but not the kernel.

 The easiest way is to use my github fork
(https://github.com/evadot/u-boot/tree/freebsd) This have all the
patches for FreeBSD that haven't made upstream yet.
 As soon as U-Boot 2017.07 is out (it should be out on July 10th) I'll
create a new branch on the FreeBSD fork
(https://github.com/freebsd/u-boot).

 Step to compile U-Boot:

 export CROSS_COMPILE=arm-none-eabi-
 gmake board_defconfig
 gmake menuconfig (and select "Enable FreeBSD boot")
 gmake

> 2) How to use newer Linux dts/dtb files?

 For Allwinner it's straight forward, with a few exception we use the
Linux DTS untouched.

> 1) u-boot
> This is how I built u-boot:
> git clone git://git.denx.de/u-boot.git
> cd u-boot
> git checkout v2017.05
> # apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1)
> (in the attachment)
> gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
> gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
> dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024
> seek=8
>
> In the u-boot prompt:
>   fatload mmc 0 0x42000000 ubldr.bin
>   setenv fdtfile sun8i-h3-orangepi-one.dtb
>   go 0x4200000
> ubldr will work as expected, but kernel will hang at the start.
> If I use
> /usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then
> the kernel and userland will boot normally.
> This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab)
>
> 2) newer DTS/DTB
> If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board
> will boot fine, but I don't have network.
> I can also boot normally if the dtb file is rebuilt manually:
>   cd /usr/src/sys/gnu/dts/arm
>   cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include
> sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb
>   ls -lh sun8i-h3-rebuilt.dtb
>   -rw-r--r--  1 root  wheel    15K Jun 24 13:02 sun8i-h3-rebuilt.dtb
> But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang:
>   Using DTB from loaded file
> 'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'.
>   Kernel entry at 0x42200100...
>   Kernel args: -v
> The same file boots Linux without problems.
>
> I don't know why newer dtb files won't work because there is no output on
> serial console.
> Any ideas how to make it work?

 There is nothing on the serial console because we miss the h2
definition in aw_machdep.c
 I've started to add proper support for it today but there is some
problems with some old clocks drivers. I'm currently patching them and
hope to commit H2Plus support today or tomorow.

 Cheers,

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
On Sat, 24 Jun 2017 17:15:39 +0200
Emmanuel Vadot <[hidden email]> wrote:

> On Sat, 24 Jun 2017 13:13:40 +0200
> Johnny Sorocil <[hidden email]> wrote:
>
> > Hi all!
> >
> > I am trying to run FreeBSD on Orange Pi Zero board (Allwinner H2+ SoC).
> >
> > I have few questions:
> > 1) How to build vanilla u-boot which will be capable booting FreeBSD
> > kernel? I have managed to load ubldr, but not the kernel.
>
>  The easiest way is to use my github fork
> (https://github.com/evadot/u-boot/tree/freebsd) This have all the
> patches for FreeBSD that haven't made upstream yet.
>  As soon as U-Boot 2017.07 is out (it should be out on July 10th) I'll
> create a new branch on the FreeBSD fork
> (https://github.com/freebsd/u-boot).
>
>  Step to compile U-Boot:
>
>  export CROSS_COMPILE=arm-none-eabi-
>  gmake board_defconfig
>  gmake menuconfig (and select "Enable FreeBSD boot")
>  gmake
>
> > 2) How to use newer Linux dts/dtb files?
>
>  For Allwinner it's straight forward, with a few exception we use the
> Linux DTS untouched.
>
> > 1) u-boot
> > This is how I built u-boot:
> > git clone git://git.denx.de/u-boot.git
> > cd u-boot
> > git checkout v2017.05
> > # apply patch so it can be built on FreeBSD (tested on FreeBSD 11.1-BETA1)
> > (in the attachment)
> > gmake ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
> > gmake -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
> > dd if=u-boot-sunxi-with-spl.bin conv=notrunc,sync of=/dev/mmcsd0 bs=1024
> > seek=8
> >
> > In the u-boot prompt:
> >   fatload mmc 0 0x42000000 ubldr.bin
> >   setenv fdtfile sun8i-h3-orangepi-one.dtb
> >   go 0x4200000
> > ubldr will work as expected, but kernel will hang at the start.
> > If I use
> > /usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin then
> > the kernel and userland will boot normally.
> > This is tested booting -CURRENT from Jul 22 (git: 57e30b47aab)
> >
> > 2) newer DTS/DTB
> > If I use sun8i-h3-orangepi-one.dtb from FreeBSD source tree then the board
> > will boot fine, but I don't have network.
> > I can also boot normally if the dtb file is rebuilt manually:
> >   cd /usr/src/sys/gnu/dts/arm
> >   cpp -P -x assembler-with-cpp -I /usr/src/sys/gnu/dts/include -include
> > sun8i-h3-orangepi-plus.dts /dev/null | dtc -O dtb -o ./sun8i-h3-rebuilt.dtb
> >   ls -lh sun8i-h3-rebuilt.dtb
> >   -rw-r--r--  1 root  wheel    15K Jun 24 13:02 sun8i-h3-rebuilt.dtb
> > But, if dtb files from Armbian (Linux 4.11) are used, kernel will hang:
> >   Using DTB from loaded file
> > 'boot/dtb-4.11.3-sun8i/sun8i-h2-plus-orangepi-zero.dtb'.
> >   Kernel entry at 0x42200100...
> >   Kernel args: -v
> > The same file boots Linux without problems.
> >
> > I don't know why newer dtb files won't work because there is no output on
> > serial console.
> > Any ideas how to make it work?
>
>  There is nothing on the serial console because we miss the h2
> definition in aw_machdep.c
>  I've started to add proper support for it today but there is some
> problems with some old clocks drivers. I'm currently patching them and
> hope to commit H2Plus support today or tomorow.
>
>  Cheers,
>
> --
> Emmanuel Vadot <[hidden email]> <[hidden email]>
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "[hidden email]"

 Sometime I'm just stupid and find problem where there is none.
 H2+ support has been commited in r320315.

 Ethernet and Wifi isn't supported yet.

 Let me know if you have any problems.

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
In reply to this post by Emmanuel Vadot-7
On Sat, Jun 24, 2017 at 5:15 PM, Emmanuel Vadot <[hidden email]>
wrote:

>  There is nothing on the serial console because we miss the h2
> definition in aw_machdep.c
>  I've started to add proper support for it today but there is some
> problems with some old clocks drivers. I'm currently patching them and
> hope to commit H2Plus support today or tomorow.

It's nice to hear that :)

I was experimenting with dts files (copied ethernet and emac part to the
working dts file) - there will be output on the serial console, but no
network:
# dmesg | grep awg
  awg0: <Allwinner Gigabit Ethernet> mem
0x1c30000-0x1c30103,0x1c00030-0x1c00033
irq 35 on simplebus0 dfs
  awg0: PHY type: rgmii, conf mode: reg
  awg0: EMAC clock: 0x00140006
  awg0: AHB frequency 300000000 Hz, MDC div: 0x3
  awg0: soft reset timed out
  device_attach: awg0 attach returned 60
Datasheet for H3 says that soft reset should be performed only after all
clock inputs are valid.
Is that because kernel is using old clock drivers?

Are these assumptions correct:
- the kernel will automatically use if_awg driver for the network card
  (even on H2+ which doesn't have a Gb interface) if there is a correct
  ethernet entry in dts?
- when using newer Linux dts file (for H2+) there is no output on the
  serial console because dts file states that this is H2+, but FreeBSD
  kernel doesn't know what to do with H2+?
- newer Linux dts files (which defines SoC as H2+) will be able to be
  used to boot FreeBSD?

What is the status of FreeBSD SDIO support?

Can I somehow help with the porting effort?

Maybe slightly OT:
How kernel is debugged? Connect JTAG debugger and then single step?
What to use from HW and SW for that purpose?
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
In reply to this post by Emmanuel Vadot-7
On Sat, Jun 24, 2017 at 6:42 PM, Emmanuel Vadot <[hidden email]>
wrote:

>   Sometime I'm just stupid and find problem where there is none.
>  H2+ support has been commited in r320315.
>
>  Ethernet and Wifi isn't supported yet.
>
>  Let me know if you have any problems.
>

Great, thank you!

-CURRENT is building and I'll report back results
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
In reply to this post by Johnny Sorocil
On Sat, 24 Jun 2017 19:31:35 +0200
Johnny Sorocil <[hidden email]> wrote:

> On Sat, Jun 24, 2017 at 5:15 PM, Emmanuel Vadot <[hidden email]>
> wrote:
>
> >  There is nothing on the serial console because we miss the h2
> > definition in aw_machdep.c
> >  I've started to add proper support for it today but there is some
> > problems with some old clocks drivers. I'm currently patching them and
> > hope to commit H2Plus support today or tomorow.
>
> It's nice to hear that :)
>
> I was experimenting with dts files (copied ethernet and emac part to the
> working dts file) - there will be output on the serial console, but no
> network:
> # dmesg | grep awg
>   awg0: <Allwinner Gigabit Ethernet> mem
> 0x1c30000-0x1c30103,0x1c00030-0x1c00033
> irq 35 on simplebus0 dfs
>   awg0: PHY type: rgmii, conf mode: reg
>   awg0: EMAC clock: 0x00140006
>   awg0: AHB frequency 300000000 Hz, MDC div: 0x3
>   awg0: soft reset timed out
>   device_attach: awg0 attach returned 60
> Datasheet for H3 says that soft reset should be performed only after all
> clock inputs are valid.
> Is that because kernel is using old clock drivers?

 For H3 we switch to clkng already.
 The problem is that dts binding were not standardized when we added
the driver (they will be in Linux 4.12).

> Are these assumptions correct:
> - the kernel will automatically use if_awg driver for the network card
>   (even on H2+ which doesn't have a Gb interface) if there is a correct
>   ethernet entry in dts?

 Yes.

> - when using newer Linux dts file (for H2+) there is no output on the
>   serial console because dts file states that this is H2+, but FreeBSD
>   kernel doesn't know what to do with H2+?

 Not anymore but yes.

> - newer Linux dts files (which defines SoC as H2+) will be able to be
>   used to boot FreeBSD?

 Yes.

> What is the status of FreeBSD SDIO support?

 Not sure, maybe imp@ or kibab@ can answer that question.

> Can I somehow help with the porting effort?
>
> Maybe slightly OT:
> How kernel is debugged? Connect JTAG debugger and then single step?
> What to use from HW and SW for that purpose?

 I mostly use printf because I don't have jtag hardware and I'm lazy :)

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
In reply to this post by Johnny Sorocil
I have built -CURRENT (63fd4c37fb976e1c00408fd95f168af12088f92b) but I am
unable to boot the board with sun8i-h2-plus-orangepi-zero.dtb (there is
nothing on serial console).
If sun8i-h3-orangepi-one.dtb is loaded, then board boots normally.

Steps to reproduce:
rm -rf /usr/obj
make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
buildworld
make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
KERNCONF=ALLWINNER buildkernel
make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
KERNCONF=ALLWINNER DESTDIR=/mnt/sd2/ installkernel
make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
KERNCONF=ALLWINNER DESTDIR=/mnt/sd2/ installworld
cp -f /usr/obj/arm.armv6/usr/src/sys/boot/arm/uboot/ubldr{,.bin} /mnt/sd1
umount /mnt/sd1 ; umount /mnt/sd2
dd if=/usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin
conv=notrunc,sync of=/dev/mmcsd0 bs=1024 seek=8

  loader> load -t dtb sun8i-h2-plus-orangepi-zero.dtb
  loader> boot
  Booting...
  Using DTB from loaded file '/boot/dtb/sun8i-h2-plus-orangepi-zero.dtb'.
  Kernel entry at 0x42200100...
  Kernel args: (null)
and it will hang

If H3 dtb file is used:
loader> load -t dtb sun8i-h3-orangepi-one.dtb
loader> boot
Booting...

Using DTB from loaded file
'/boot/dtb/sun8i-h3-orangepi-one.dtb'.

Kernel entry at
0x42200100...

Kernel args:
(null)

KDB: debugger backends:
ddb

KDB: current backend:
ddb

Copyright (c) 1992-2017 The FreeBSD
Project.

Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993,
1994

        The Regents of the University of California. All rights
reserved.

FreeBSD is a registered trademark of The FreeBSD
Foundation.

FreeBSD 12.0-CURRENT #0 63fd4c37fb9(master): Sun Jun 25 12:03:35 CEST
2017
    root@innovator:/usr/obj/arm.armv6/usr/src/sys/ALLWINNER
arm

FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM
4.0.0)
<...>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
On Sun, 25 Jun 2017 13:14:11 +0200
Johnny Sorocil <[hidden email]> wrote:

> I have built -CURRENT (63fd4c37fb976e1c00408fd95f168af12088f92b) but I am
> unable to boot the board with sun8i-h2-plus-orangepi-zero.dtb (there is
> nothing on serial console).
> If sun8i-h3-orangepi-one.dtb is loaded, then board boots normally.
>
> Steps to reproduce:
> rm -rf /usr/obj
> make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
> buildworld
> make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
> KERNCONF=ALLWINNER buildkernel
> make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
> KERNCONF=ALLWINNER DESTDIR=/mnt/sd2/ installkernel
> make -j4 TARGET_ARCH=armv6 SRCCONF=/dev/null __MAKE_CONF=/dev/null
> KERNCONF=ALLWINNER DESTDIR=/mnt/sd2/ installworld

 You should use the GENERIC kernel, I'll remove ALLWINNER as it's not
needed anymore.

> cp -f /usr/obj/arm.armv6/usr/src/sys/boot/arm/uboot/ubldr{,.bin} /mnt/sd1
> umount /mnt/sd1 ; umount /mnt/sd2

 It is not needed.

> dd if=/usr/local/share/u-boot/u-boot-orangepi-one/u-boot-sunxi-with-spl.bin
> conv=notrunc,sync of=/dev/mmcsd0 bs=1024 seek=8

 I wouldn't use a different u-boot, see my last mail for compiling
u-boot yourself.

>   loader> load -t dtb sun8i-h2-plus-orangepi-zero.dtb
>   loader> boot
>   Booting...
>   Using DTB from loaded file '/boot/dtb/sun8i-h2-plus-orangepi-zero.dtb'.
>   Kernel entry at 0x42200100...
>   Kernel args: (null)
> and it will hang
>
> If H3 dtb file is used:
> loader> load -t dtb sun8i-h3-orangepi-one.dtb
> loader> boot
> Booting...
>
> Using DTB from loaded file
> '/boot/dtb/sun8i-h3-orangepi-one.dtb'.
>
> Kernel entry at
> 0x42200100...
>
> Kernel args:
> (null)
>
> KDB: debugger backends:
> ddb
>
> KDB: current backend:
> ddb
>
> Copyright (c) 1992-2017 The FreeBSD
> Project.
>
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993,
> 1994
>
>         The Regents of the University of California. All rights
> reserved.
>
> FreeBSD is a registered trademark of The FreeBSD
> Foundation.
>
> FreeBSD 12.0-CURRENT #0 63fd4c37fb9(master): Sun Jun 25 12:03:35 CEST
> 2017
>     root@innovator:/usr/obj/arm.armv6/usr/src/sys/ALLWINNER
> arm
>
> FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM
> 4.0.0)
> <...>

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Ganbold Tsagaankhuu-2
In reply to this post by Johnny Sorocil
On Sun, Jun 25, 2017 at 1:31 AM, Johnny Sorocil <[hidden email]> wrote:

> On Sat, Jun 24, 2017 at 5:15 PM, Emmanuel Vadot <[hidden email]>
> wrote:
>
> >  There is nothing on the serial console because we miss the h2
> > definition in aw_machdep.c
> >  I've started to add proper support for it today but there is some
> > problems with some old clocks drivers. I'm currently patching them and
> > hope to commit H2Plus support today or tomorow.
>
> It's nice to hear that :)
>
> I was experimenting with dts files (copied ethernet and emac part to the
> working dts file) - there will be output on the serial console, but no
> network:
> # dmesg | grep awg
>   awg0: <Allwinner Gigabit Ethernet> mem
> 0x1c30000-0x1c30103,0x1c00030-0x1c00033
> irq 35 on simplebus0 dfs
>   awg0: PHY type: rgmii, conf mode: reg
>   awg0: EMAC clock: 0x00140006
>   awg0: AHB frequency 300000000 Hz, MDC div: 0x3
>   awg0: soft reset timed out
>   device_attach: awg0 attach returned 60
> Datasheet for H3 says that soft reset should be performed only after all
> clock inputs are valid.
> Is that because kernel is using old clock drivers?
>

Just to test:

https://people.freebsd.org/~ganbold/FreeBSD-armv6-12.0-nanopi-neo.img.xz

The image is not so recent, but you can use (or its dtb) to test Ethernet
on Orange PI Zero.

Ganbold


>
> Are these assumptions correct:
> - the kernel will automatically use if_awg driver for the network card
>   (even on H2+ which doesn't have a Gb interface) if there is a correct
>   ethernet entry in dts?
> - when using newer Linux dts file (for H2+) there is no output on the
>   serial console because dts file states that this is H2+, but FreeBSD
>   kernel doesn't know what to do with H2+?
> - newer Linux dts files (which defines SoC as H2+) will be able to be
>   used to boot FreeBSD?
>
> What is the status of FreeBSD SDIO support?
>
> Can I somehow help with the porting effort?
>
> Maybe slightly OT:
> How kernel is debugged? Connect JTAG debugger and then single step?
> What to use from HW and SW for that purpose?
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "[hidden email]"
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
In reply to this post by Emmanuel Vadot-7
On Sun, Jun 25, 2017 at 1:21 PM, Emmanuel Vadot <[hidden email]>
wrote:

>  You should use the GENERIC kernel, I'll remove ALLWINNER as it's not
> needed anymore.
>

Yes, GENERIC armv6 kernel is booting on Orange Pi Zero (with u-boot from
ports for Orange Pi Zero and "boot/dtb/sun8i-h2-plus-orangepi-zero.dtb") :)
Thank you for the help


>   I wouldn't use a different u-boot, see my last mail for compiling
> u-boot yourself.
>

I have problem compiling your fork of u-boot (and vanilla v2017.07.):
Steps:
git checkout freebsd
export CROSS_COMPILE=arm-none-eabi-
gmake orangepi_zero_defconfig
gmake menuconfig        # select "Enable FreeBSD boot"
gmake -j4

*** binman needs the Python libfdt library.
*** Either install it on your system, or try:
***
*** sudo apt-get install swig libpython-dev
***
*** to have U-Boot build its own version.

pkg info python\*
python-2.7_3,2
python2-2_3
python27-2.7.13_4
python3-3_3
python34-3.4.6_2
python36-3.6.1_2
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
On Mon, 26 Jun 2017 07:34:56 +0200
Johnny Sorocil <[hidden email]> wrote:

> On Sun, Jun 25, 2017 at 1:21 PM, Emmanuel Vadot <[hidden email]>
> wrote:
>
> >  You should use the GENERIC kernel, I'll remove ALLWINNER as it's not
> > needed anymore.
> >
>
> Yes, GENERIC armv6 kernel is booting on Orange Pi Zero (with u-boot from
> ports for Orange Pi Zero and "boot/dtb/sun8i-h2-plus-orangepi-zero.dtb") :)
> Thank you for the help
>
>
> >   I wouldn't use a different u-boot, see my last mail for compiling
> > u-boot yourself.
> >
>
> I have problem compiling your fork of u-boot (and vanilla v2017.07.):
> Steps:
> git checkout freebsd
> export CROSS_COMPILE=arm-none-eabi-
> gmake orangepi_zero_defconfig
> gmake menuconfig        # select "Enable FreeBSD boot"
> gmake -j4
>
> *** binman needs the Python libfdt library.
> *** Either install it on your system, or try:
> ***
> *** sudo apt-get install swig libpython-dev
> ***
> *** to have U-Boot build its own version.
>
> pkg info python\*
> python-2.7_3,2
> python2-2_3
> python27-2.7.13_4
> python3-3_3
> python34-3.4.6_2
> python36-3.6.1_2

 sudo pkg install swig30 should solve the problem.

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
On Mon, Jun 26, 2017 at 8:40 AM, Emmanuel Vadot <[hidden email]>
wrote:

>  sudo pkg install swig30 should solve the problem.
>

<...>
  COPY    u-boot.dtb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named libfdt

*** binman needs the Python libfdt library.
*** Either install it on your system, or try:
***
*** sudo apt-get install swig libpython-dev
***
*** to have U-Boot build its own version.
gmake: *** [Makefile:1359: checkbinman] Error 1

% /usr/local/bin/swig3.0 -version
SWIG Version 3.0.12
Compiled with c++ [amd64-portbld-freebsd11.0]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information

I had installed swig 2.0 but it didn't help.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Emmanuel Vadot-7
On Mon, 26 Jun 2017 19:06:11 +0200
Johnny Sorocil <[hidden email]> wrote:

> On Mon, Jun 26, 2017 at 8:40 AM, Emmanuel Vadot <[hidden email]>
> wrote:
>
> >  sudo pkg install swig30 should solve the problem.
> >
>
> <...>
>   COPY    u-boot.dtb
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named libfdt
>
> *** binman needs the Python libfdt library.
> *** Either install it on your system, or try:
> ***
> *** sudo apt-get install swig libpython-dev
> ***
> *** to have U-Boot build its own version.
> gmake: *** [Makefile:1359: checkbinman] Error 1
>
> % /usr/local/bin/swig3.0 -version
> SWIG Version 3.0.12
> Compiled with c++ [amd64-portbld-freebsd11.0]
> Configured options: +pcre
> Please see http://www.swig.org for reporting bugs and further information
>
> I had installed swig 2.0 but it didn't help.

 Ah yes you need swig13 sorry (or patch some files in u-boot as it
calls 'swig' and we install swig3 as swig3.0 etc ....)

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
On Mon, Jun 26, 2017 at 7:18 PM, Emmanuel Vadot <[hidden email]>
wrote:

>
>  Ah yes you need swig13 sorry (or patch some files in u-boot as it
> calls 'swig' and we install swig3 as swig3.0 etc ....)
>

Now it's working, thanks :)
>  U-Boot 2017.07-rc2-05617-gbb5fe68ffc (Jun 26 2017 - 19:39:45 +0200)
Allwinner Technology
> CPU:   Allwinner H3 (SUN8I 1680)
> Model: Xunlong Orange Pi Zero
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Johnny Sorocil
In reply to this post by Ganbold Tsagaankhuu-2
On Mon, Jun 26, 2017 at 7:11 AM, Ganbold Tsagaankhuu <[hidden email]>
wrote:

> Just to test:
>
> https://people.freebsd.org/~ganbold/FreeBSD-armv6-12.0-nanopi-neo.img.xz
>
> The image is not so recent, but you can use (or its dtb) to test Ethernet
> on Orange PI Zero.
>

I didn't test the whole image, just dtb files, but they are not working on
-CURRENT from Jul 24.

nanopi-neo.dtb
nanopi_neo.dtb
orangepi-one.dtb
    awg0: <Allwinner Gigabit Ethernet> mem 0x1c30000-0x1c30103,
        0x1c00030-0x1c00033 irq 28 on simplebus0
    awg0: PHY type: mii, conf mode: reg
    awg0: EMAC clock: 0x00168000
    awg0: AHB frequency 200000000 Hz, MDC div: 0x3
    awg0: soft reset timed out
    device_attach: awg0 attach returned 60

sun8i-h3-nanopi-neo.dtb
    panic: Can't determine TI Chip

I'll try later to copy ethernet part on the dts in the tree.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Orange Pi Zero support

Bernd Walter-4
On Tue, Jun 27, 2017 at 11:27:32PM +0200, Johnny Sorocil wrote:

> On Mon, Jun 26, 2017 at 7:11 AM, Ganbold Tsagaankhuu <[hidden email]>
> wrote:
>
> > Just to test:
> >
> > https://people.freebsd.org/~ganbold/FreeBSD-armv6-12.0-nanopi-neo.img.xz
> >
> > The image is not so recent, but you can use (or its dtb) to test Ethernet
> > on Orange PI Zero.
> >
>
> I didn't test the whole image, just dtb files, but they are not working on
> -CURRENT from Jul 24.

I did test one of Ganbold's nanopi-neo image in november, when the zero
came out and it worked for me on the 256MB and 512MB OrangePi zero boards.
I'm pretty sure ethernet had worked just fine.
The only thing, which was a bit unstable was USB, which however was more
likely because of the power supply setup I'd used during the test, than
anything software related.

> nanopi-neo.dtb
> nanopi_neo.dtb
> orangepi-one.dtb
>     awg0: <Allwinner Gigabit Ethernet> mem 0x1c30000-0x1c30103,
>         0x1c00030-0x1c00033 irq 28 on simplebus0
>     awg0: PHY type: mii, conf mode: reg
>     awg0: EMAC clock: 0x00168000
>     awg0: AHB frequency 200000000 Hz, MDC div: 0x3
>     awg0: soft reset timed out
>     device_attach: awg0 attach returned 60
>
> sun8i-h3-nanopi-neo.dtb
>     panic: Can't determine TI Chip
>
> I'll try later to copy ethernet part on the dts in the tree.
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "[hidden email]"

--
B.Walter <[hidden email]> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"