Skip to content

Instantly share code, notes, and snippets.

@psanford
Last active April 6, 2020 05:12
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save psanford/6416725 to your computer and use it in GitHub Desktop.
Save psanford/6416725 to your computer and use it in GitHub Desktop.

Mirabox notes

THE LOCATION OF THIS PAGE HAS MOVED!

The new location is https://github.com/psanford/mirabox. I've turned it into a full git repository so that it is easier for others to contribute. This gist will not be updated anymore and I won't be checking the comments. Please open an issue or a pull request on the git repo.

OLD CONTENT:

There's not a lot of good documentation about Globalscale Technology's Mirabox so this page is intended to document everything I know about it. My goal is to run a modern kernel and bootloader on the Mirabox.

Hardware

The Mirabox uses a Marvell Armada 370 SoC ARM chip. The Armada 370 uses the ARMv7-A architecture2. The Mirabox comes with:1

  • 1GB of RAM
  • 1GB of NAND flash
  • 2 10/100/1000 ethernet ports
  • 2 USB 3.0 host ports
  • 1 microsd card reader (2? 1 external and 1 internal)
  • 1 Mini PCIe expansion slot
  • 3 GPIO LEDs
  • 1 GPIO button
  • 802.11b/g/n Wifi (88W8766)
  • Bluetooth 4.0 (88W8766) (older hardware revs had BT 3.0)

In June 2014 Marvell released detail specs for the Armada 370 SoC:

Kernel

The Mirabox originally came with a modified 2.6.35.9 kernel. More recent versions now ship with a modified 3.2.36 kernel.

Fortunately there is good support for the Armada 370 in more recent versions of the linux kernel.

What works in >= 3.14 kernel?

  • USB
  • LEDs
  • Ethernet*
  • SDCard
  • Wireless**
  • NAND flash (since 3.14)

*Ethernet works properly, but by default the NICs will have randomly assigned mac addresses. This can be done via uBoot10 if the mvneta is compiled into the kernel (not as a module). You can also read the uBoot variables for ethaddr and eth1addr using fw_printenv and set the mac addresses from an init script.

**Wireless works, but you must load the mvsdio kernel module with nodma=1 option11.

Building a kernel

You will need a cross compiling toolchain to build the kernel. The easiest way to get that is by downloading the one provided by Globalscale. To actually build the kernel run the following commands:

export PATH="/home/build/armv7-marvell-linux-gnueabi/bin:$PATH"
make ARCH=arm CROSS_COMPILE=arm-marvell-linux-gnueabi- mvebu_defconfig
make ARCH=arm CROSS_COMPILE=arm-marvell-linux-gnueabi- zImage
make ARCH=arm CROSS_COMPILE=arm-marvell-linux-gnueabi- armada-370-mirabox.dtb
cp arch/arm/boot/zImage zImage-with-dtb
cat arch/arm/boot/dts/armada-370-mirabox.dtb >> zImage-with-dtb
./scripts/mkuboot.sh -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'Linux-marvell' -d zImage-with-dtb uImage

The uBoot version that ships with the Mirabox doesn't support device tree, you you need to append the device tree to the kernel (and select the Use appended device tree option in the kernel config.

Bootloader

The Mirabox comes with an old version of U-Boot, modified to support the hardware. Currently there is no support in mainline U-Boot for the Mirabox.

Initial work has been done to support the Mirabox in the Barebox Bootloader by Free Electrons. This is currently limited to booting via serial port7.

Building Barebox

You will need to extract a binary blob from an existing bootloader for the mirabox. The easiest way to do this is to download the u-boot image from Globalscale.

mkdir /tmp/mirabox
./scripts/kwbimage -x -i ~/downloads/u-boot-db88f6710bp_nand.bin -o /tmp/mirabox

To build barebox:

export PATH="/home/build/armv7-marvell-linux-gnueabi/bin:$PATH"
cp /tmp/mirabox/kwbimage.cfg kwbimage.cfg
sed -i -e 's/nand/uart/' kwbimage.cfg
make ARCH=arm CROSS_COMPILE=arm-marvell-linux-gnueabi- globalscale_mirabox_defconfig
make ARCH=arm CROSS_COMPILE=arm-marvell-linux-gnueabi- make

To boot to barebox, run the following command:

./scripts/kwboot -t -b barebox-flash-image  -B 115200 /dev/ttyUSB0

What are kwbimage and kwboot?

Marvell EBU SoC supports booting an image over UART8, kwboot is a tool that implements this protocol.

The Marvell SoC requires a binary blob on boot for DDR3 training9. This is bundled with the bootloader in a specific format. kwbimage can be used to extract that binary blob from one image and add it to a new bootloader image.

Resources

Source and binaries from Globalscale can be found at:

Thanks

I want to thank the folks at Free Electrons for the work they have done to support the Armada 370 and the Mirabox.

@miccoli
Copy link

miccoli commented Mar 23, 2014

Later Miraboxes come with a newer kernel/distro

root@mirabox-debian:~# uname -a
Linux mirabox-debian 3.2.36 #5 Sun Oct 6 21:30:02 EDT 2013 armv7l GNU/Linux
root@mirabox-debian:~# cat /etc/debian_version 
7.4

@erdoukki
Copy link

erdoukki commented Jun 5, 2014

Marvell just made the full functional specification and hardware specification for their Armada 370 SoCs freely available on their Armada 300 product page.
http://www.marvell.com/embedded-processors/armada-300/

Copy link

ghost commented Jun 13, 2014

@erdoukki The DDR3 training/levelling setup is still secret

@psanford
Copy link
Author

Thanks for the updates! I've added some info for more recent kernel changes.

Copy link

ghost commented Dec 19, 2014

Can you update this with the real ethernet speed? Many of the ARM chips can't pass an 400-600Mbps limit. Thank you!

@psanford
Copy link
Author

I'm currently away from my hardware to do a network test, but there were some iperf results posted on the linux-arm-soc mailing list for the mirabox fairly recently (related to fixing some ethernet bugs on the platform): http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/307874.html.

Those tests show unidirectional traffic in the 920-940 Mbits/sec range.

@katmai
Copy link

katmai commented Jan 23, 2015

hi,

i am kinda stuck at this step:

mkdir /tmp/mirabox
./scripts/kwbimage -x -i ~/downloads/u-boot-db88f6710bp_nand.bin -o /tmp/mirabox

so what i did - i am on ubuntu 14.10 - i cloned the git repo from http://git.pengutronix.de/?p=barebox.git;a=shortlog;h=refs/heads/stable/v2014.12 for the latest barebox code, and after compiling the kernel in the steps above, i copied the .config from that linux kernel into the barebox folder and ran make.

however the kwboot and kwimage weren't compiled. am i doing something wrong here ?

@katmai
Copy link

katmai commented Jan 26, 2015

actually i didn't RTFM enough but at the step with:

mkdir /tmp/mirabox
./scripts/kwbimage -x -i ~/downloads/u-boot-db88f6710bp_nand.bin -o /tmp/mirabox

you have to compile the kwbimage.c first and then extract the stuff, and then go to the next step with compiling the barebox unless again i am doing something wrong. the binary for kwbimage is not compiled.

@psanford
Copy link
Author

I've created a full git repository so it is easier to collaborate: https://github.com/psanford/mirabox . Please open an issue or a pull request there instead of commenting here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment