Marvell ARMADA 7K/8K and MACCHIATObin support

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

Marvell ARMADA 7K/8K and MACCHIATObin support

Mark Kettenis
Hi Folks,

I recently got myself a MACCHIATObin board

  https://www.solid-run.com/marvell-armada-family/macchiatobin/
  http://wiki.macchiatobin.net/tiki-index.php

with the intention to make OpenBSD run on it.  I made some good
progress and the board is now somewhat usable.  At this point the
standard xhci(4), ahci(4) and the new dwpcie(4) drivers work.  So the
SB 3.0 port, the three SATA ports and the PCIe x4 slot function.  The
uSD slot, onboard eMMC and the onboard network interfaces don't work
yet.  Especially the latter is unfortunate for a networking oriented
board like this.  So I'll be working on that in the near future.

As usual the firmware siatuation is a bit of a mess.  The firmware
that comes with the board is a fairly recent U-Boot version but it is
buggy and crashes when it loads the OpenBSD EFI boot loader.  A
firmware built from the last vendor sources exhibits the same
problems.  Mainline U-Boot does a better job but also has bugs.  Only
booting from uSD-card works reliably.  Booting from USB works somewhat
but makes the bootloader crash roughly 50% of the time.  Fortunately
the board resets itself and then tries again.  Booting from SATA or
network doesn't work.

I have made working firmware available at:

  https://sibelius.home.xs4all.nl/firmware/armada-8040-mcbin/flash-image.bin

and a usable device tree at:

  https://sibelius.home.xs4all.nl/firmware/armada-8040-mcbin/armada-8040-mcbin.dtb

My recommendation is to put the firmware (and only the firmware) on a
uSD card with:

  # dd if=flash-image.bin of=/dev/sdXc seek=4096

Then put miniroot63.fs (use a -current snapshot) onto a USB key/disk with:

  # dd if=miniroot63.fs of=/dev/sdXc bs=1m

and copy the device tree onto the msdos filesystem on the USB key/disk with:

  # mount /dev/sdXi /mnt
  # mkdir /mnt/marvell
  # cp armada-8040-mcbin.dtb /mnt/marvell
  # umount /mnt

Configure the jumpers or dip switches on the board to boot from uSD
card and plug in both the uSD card and the USB key/drive.  Turning on
the board should get you into the OpenBSD installer.  After
installation you'll have to copy the devicetree onto the disk you
installed on once more.

With 4 Cortex-A72 cores at 1.6 GHz.  The board is pretty fast.  IT is
only a little bit slower than my SoftIron Overdrive 1000.

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Corsaire01
This post was updated on .
Hello Mark,

I am another possessor of a Macchiatobin trying to run openbsd.

However, I am not a happy camper since I am still unable to make it boot...

I followed your carefully written procedure but fails miserably after
entering the UEFI.

Here is the UEFI Shell prompt I get after booting the uSD card

UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
     BLK0: Alias(s):
          VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x0)
     BLK1: Alias(s):
          VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x1)
     BLK2: Alias(s):
          VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x2)
     BLK3: Alias(s):
          VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,000078F20000000000)/SD(0x0)

Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell>

As you can see it seems the USB key I put the minirootfs on does not appear.

I tried too to boot with the Bootloader U-Boot 2017.03-armada-17.10 from the
Marvell site http://macchiatobin.net/software/

I get the same result as you, I can boot into u-boot fine, see the USB key
contents, send it commands to load the binary blob and EFI payload but it
crashes and reset.

Here are my parameters:

usb start; fatload usb 0:1 0x5000000 /efi/boot/bootaa64.efi ; fatload usb 0:1 0x4f00000 /marvell/armada-8040-mcbin.dtb; bootefi 0x5000000 0x4f00000

I also tried differents armada-8040-mcbin.dtb I got for the Ubuntu 16.04.03
LTS image and from another source on the web (oups lost the link).

So, I have a UEFI/U-boot bootable macchiatobin, but no way to make the
actual openbsd kernel to be loaded and run.

Did you make any progress on your part or have another reliable boot
procedure ?



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-port-arm-f206279.html

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Mark Kettenis
> Date: Sat, 20 Oct 2018 19:22:52 -0700 (MST)
> From: Corsaire01 <[hidden email]>
>
> Hello Mark,

Hi,

> I am another possessor of a Macchiatobin trying to run openbsd.
>
> However, I am not a happy camper since I am still unable to make it boot...
>
> I followed your carefully written procedure but fails miserably after
> entering the UEFI.
>
> Here is the UEFI Shell prompt I get after booting the uSD card
>
>
> As you can see it seems the USB key I put the minirootfs on does not appear.
>
> I tried too to boot with the Bootloader U-Boot 2017.03-armada-17.10 from the
> Marvell site http://macchiatobin.net/software/
>
> I get the same result as you, I can boot into u-boot fine, see the USB key
> contents, send it commands to load the binary blob and EFI payload but it
> crashes and reset.
>
> Here are my parameters:
>
> And the less-than-satisfactory result
>
>
> I also tried differents armada-8040-mcbin.dtb I got for the Ubuntu 16.04.03
> LTS image and from another source on the web (oups lost the link).
>
> So, I have a UEFI/U-boot bootable macchiatobin, but no way to make the
> actual openbsd kernel to be loaded and run.
>
> Did you make any progress on your part or have another reliable boot
> procedure ?

It seems some information has been stripped from your mail.  My
experience with USB on this port aren't great.  I think there are some
issues with powering the ports.  Using a powered hub might help.  The
problems might be related to missing GPIO code that has been recently
submitted to the tianocore edk2 mailing list.

Alternatively you could write the miniroot to a SATA disk (or SSD)
from another machine and try to boot from that.

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Corsaire01
> It seems some information has been stripped from your mail.

Yup, dunno why tough.

I included a but more console output, but anyway the thing is

-I can't see the USB key with your archive
-It crashes at loading the dtb/EFI payload with the marvell provided U-boot

> My experience with USB on this port aren't great.  I think there are some
> issues with powering the ports.  Using a powered hub might help.  The
> problems might be related to missing GPIO code that has been recently
> submitted to the tianocore edk2 mailing list.
>
> Alternatively you could write the miniroot to a SATA disk (or SSD)
> rom another machine and try to boot from that.

I'll try that !

Thanks for your time.



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-port-arm-f206279.html

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Corsaire01
In reply to this post by Mark Kettenis
Mark Kettenis wrote
> My experience with USB on this port aren't great.  I think there are some
> issues with powering the ports.  Using a powered hub might help.

I tryed with a USB hub, to no avail... no change :(



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-port-arm-f206279.html

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Corsaire01
In reply to this post by Mark Kettenis
Hello again Mark,

Some progress here.

You were right about the USB trouble.
Instead of a USB key I tried to put a sata disk on a USB tray and ran your
image, but it failed too.
same as before no fs0: available.

Then I too the drive out of the usb tray and put it on one of the sata plug
on the macchiatobin, booted again and, voila !
This time I got the OpenBSD prompt right.

here is the log for the record.

Tianocore/EDK2 firmware version MARVELL_EFI
Press ESCAPE for boot options ...
UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
      FS0: Alias(s):HD0b65535a1:;BLK1:
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,000054F40000000000)/Sata(0x
1,0xFFFF,0x0)/HD(1,MBR,0x00000000,0x2000,0x2000)
     BLK0: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,000054F40000000000)/Sata(0x
1,0xFFFF,0x0)
     BLK2: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,000054F40000000000)/Sata(0x
1,0xFFFF,0x0)/HD(4,MBR,0x00000000,0x4000,0x6800)
     BLK3: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x0)
     BLK4: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x1)
     BLK5: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00006EF00000000000)/eMMC(0x
0)/Ctrl(0x2)
     BLK6: Alias(s):
         
VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,000078F20000000000)/SD(0x0)

Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell> bootaa64.efi
>> OpenBSD/arm64 BOOTAA64 0.13
boot>
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: 2696864+410652+8951776+739752
[202623+96+324624+179996]=0xfea
fd8
type 0x2 pa 0x0 va 0x0 pages 0x4000 attr 0xe
type 0x7 pa 0x4200000 va 0x0 pages 0x33e00 attr 0xe
type 0x4 pa 0x38000000 va 0x0 pages 0x20 attr 0xe
type 0x7 pa 0x38020000 va 0x0 pages 0x78d8 attr 0xe
type 0x4 pa 0x3f8f8000 va 0x0 pages 0x20 attr 0xe
type 0x3 pa 0x3f918000 va 0x0 pages 0x4e attr 0xe
type 0x4 pa 0x3f966000 va 0x0 pages 0x67c attr 0xe
type 0x3 pa 0x3ffe2000 va 0x0 pages 0x1c attr 0xe
type 0x4 pa 0x3fffe000 va 0x0 pages 0x2 attr 0xe
type 0x7 pa 0x40000000 va 0x0 pages 0x75922 attr 0xe
type 0x2 pa 0xb5922000 va 0x0 pages 0xcd2 attr 0xe
type 0x1 pa 0xb65f4000 va 0x0 pages 0xfc attr 0xe
type 0x9 pa 0xb66f0000 va 0x0 pages 0x80 attr 0xe
type 0x2 pa 0xb6770000 va 0x0 pages 0x4 attr 0xe
type 0x7 pa 0xb6774000 va 0x0 pages 0x64c6 attr 0xe
type 0x4 pa 0xbcc3a000 va 0x0 pages 0x1 attr 0xe
type 0x7 pa 0xbcc3b000 va 0x0 pages 0x54 attr 0xe
type 0x4 pa 0xbcc8f000 va 0x0 pages 0x22 attr 0xe
type 0x7 pa 0xbccb1000 va 0x0 pages 0x1 attr 0xe
type 0x4 pa 0xbccb2000 va 0x0 pages 0x238e attr 0xe
type 0x7 pa 0xbf040000 va 0x0 pages 0x500 attr 0xe
type 0x3 pa 0xbf540000 va 0x0 pages 0x2d0 attr 0xe
type 0x5 pa 0xbf810000 va 0x1fdd0db000 pages 0x3e0 attr 0x800000000000000e
type 0x7 pa 0xbfbf0000 va 0x0 pages 0x60 attr 0xe
type 0x6 pa 0xbfc50000 va 0x1fdd51b000 pages 0x390 attr 0x800000000000000e
type 0x7 pa 0xbffe0000 va 0x0 pages 0x1f attr 0xe
type 0x4 pa 0xbffff000 va 0x0 pages 0x1 attr 0xe
type 0x7 pa 0x100000000 va 0x0 pages 0x40000 attr 0xe
type 0x0 pa 0x4000000 va 0x0 pages 0x200 attr 0x0
type 0xb pa 0xf4284000 va 0x1fdd8ab000 pages 0x1 attr 0x8000000000000001
type 0xb pa 0xf4700000 va 0x1fdd8ac000 pages 0x1 attr 0x8000000000000001
type 0xb pa 0xf93c0000 va 0x1fdd8ad000 pages 0x30 attr 0x8000000000000001
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved.
https://www.OpenBSD.org

OpenBSD 6.4 (RAMDISK) #501: Fri Oct 12 23:33:30 MDT 2018
    [hidden email]:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem  = 4222169088 (4026MB)
avail mem = 4053790720 (3865MB)
mainbus0 at root: Marvell 8040 MACCHIATOBin
cpu0 at mainbus0 mpidr 0: ARM Cortex-A72 r0p1
cpu0: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.7
efi0: EDK II rev 0x10000
psci0 at mainbus0: PSCI 1.1, SMCCC 1.1
simplebus0 at mainbus0: "ap806"
simplebus1 at simplebus0: "config-space"
ampintc0 at simplebus1 nirq 352, ncpu 4: "interrupt-controller"
ampintcmsi0 at ampintc0: nspi 32
ampintcmsi1 at ampintc0: nspi 32
ampintcmsi2 at ampintc0: nspi 32
ampintcmsi3 at ampintc0: nspi 32
syscon0 at simplebus1: "system-controller"
mvclock0 at syscon0
mvpinctrl0 at syscon0
mvgpio0 at syscon0
agtimer0 at simplebus1: tick rate 25000 KHz
com0 at simplebus1: ns16550, no working fifo
com0: console
simplebus2 at mainbus0: "cp0"
simplebus3 at simplebus2: "config-space"
mvicu0 at simplebus3
syscon1 at simplebus3: "system-controller"
mvclock1 at syscon1
mvgpio1 at syscon1
xhci0 at simplebus3, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
xhci1 at simplebus3, xHCI 1.0
usb1 at xhci1: USB revision 3.0
uhub1 at usb1 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
ahci0 at simplebus3: AHCI 1.0
scsibus0 at ahci0: 32 targets
sxitwi0 at simplebus3
iic0 at sxitwi0
sxitwi1 at simplebus3
iic1 at sxitwi1
"nxp,pca9548" at iic1 addr 0x70 not configured
com1 at simplebus3: ns16550, no working fifo
mvrng0 at simplebus3
dwpcie0 at simplebus2
pci0 at dwpcie0
ppb0 at pci0 dev 0 function 0 "Marvell ARMADA 7K/8K Root Complex" rev 0x00
pci1 at ppb0 bus 1
simplebus4 at mainbus0: "cp1"
simplebus5 at simplebus4: "config-space"
mvicu1 at simplebus5
syscon2 at simplebus5: "system-controller"
mvclock2 at syscon2
mvgpio2 at syscon2
xhci2 at simplebus5, xHCI 1.0
usb2 at xhci2: USB revision 3.0
uhub2 at usb2 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
ahci1 at simplebus5: AHCI 1.0
ahci1: port busy after first PMP probe FIS
ahci1: port busy after first PMP probe FIS
ahci1: port 1: 3.0Gb/s
scsibus1 at ahci1: 32 targets
sd0 at scsibus1 targ 1 lun 0: <ATA, OCZ-AGILITY2, 1.35> SCSI3 0/direct fixed
naa.5e83a97f29180002
sd0: 57241MB, 512 bytes/sector, 117231408 sectors, thin
com2 at simplebus5: ns16550, no working fifo
mvrng1 at simplebus5
softraid0 at root
scsibus2 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on rd0a swap on rd0b dump on rd0b
WARNING: clock lost 17624 days
WARNING: CHECK AND RESET THE DATE!
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/arm64 6.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s
#

It seems really that the USB support at EFI/u-boot level have to be
perfected.
I'll continue my tinkering and put my results here if something important or
interesting pops out.



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-port-arm-f206279.html

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Corsaire01
In reply to this post by Mark Kettenis
Hi Mark,

One question regarding your build.

>I have made working firmware available at:
>
>https://sibelius.home.xs4all.nl/firmware/armada-8040-mcbin/flash-image.bin

Could you give us the procedure you used to create the EFI image ?

Thanks for your time.



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-port-arm-f206279.html

Reply | Threaded
Open this post in threaded view
|

Re: Marvell ARMADA 7K/8K and MACCHIATObin support

Mark Kettenis
> Date: Fri, 26 Oct 2018 07:09:15 -0700 (MST)
> From: Corsaire01 <[hidden email]>
>
> Hi Mark,
>
> One question regarding your build.
>
> >I have made working firmware available at:
> >
> >https://sibelius.home.xs4all.nl/firmware/armada-8040-mcbin/flash-image.bin
>
> Could you give us the procedure you used to create the EFI image ?
>

It is a bit complicated.  I did the build on a Linux system.  To keep
things organized, I created a build directory.  Inside this directory
I checked out the following git repositories:

  https://github.com/tianocore/edk2.git
  https://github.com/tianocore/edk2-platforms.git
  https://github.com/tianocore/edk2-non-osi.git

  https://git.linaro.org/uefi/uefi-tools.git

  https://github.com/MarvellEmbeddedProcessors/ble-marvell.git
  https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git
  https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git

  https://github.com/ARM-software/arm-trusted-firmware.git

and downloaded the Linaro GCC5 toolchain from:

  http://releases.linaro.org/components/toolchain/binaries/5.3-2016.05/aarch64-linux-gnu/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz

I untarred the toolchain in a directory gcc5.

The Marvell repositories need specific branches to be checked out:

  $ cd ble-marvell
  $ git checkout atf-mainline
  $ cd ..
  $ cd binaries-marvell
  $ git checkout binaries-marvell-armada-18.06
  $ cd ..
  $ cd mv-ddr-marvell
  $ git checkout mv_ddr-armada-atf-mainline
  $ cd ..

And you need to create some symlinks:

  $ cd arm-trusted-firmaware
  $ ln -s ../ble-marvell ble
  $ cd drivers/marvell
  $ ln -s ../../../mv-ddr-marvell mv_ddr
  $ cd ../../..

Then I use the script at the end of this mail to build the firmware.

This all worked on August 9 of this year.

Cheers,

Mark


#!/bin/sh

PATH=$PATH:$PWD/gcc5/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu/bin

uefi-tools/edk2-build.sh -b RELEASE mcbin

export CROSS_COMPILE=aarch64-linux-gnu-
export SCP_BL2=$PWD/binaries-marvell/mrvl_scp_bl2_mss_ap_cp1_a8040.img
export BL33=$PWD/Build/Armada80x0McBin-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd
cd arm-trusted-firmware
make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 PLAT=a80x0_mcbin all fip
cd ..