So I've decided to write this little guide because of how much I've suffered to get this to work, and how absolutely broken the MACCHAITObin documentation is. Actually, just their website in general is broken. Marvell, please get your act together with your website. It's not as if you're modifying it all that often, so stop breaking things.

With that out of the way, let's get to business.

Requirements

Aside from the MACCHIATObin itself (which I believe should be fairly obvious), you're also going to want the following:

Prepare ArchLinuxARM U-Boot SD Card

It's very possible you'll run into issues later when installing UEFI onto the SPI, so it's good to have an SD card that you can boot from, so as to have access to a prompt. For this, I suggest going through the entire U-Boot install instructions provided by ArchLinuxARM.[1] I also suggest paying attention to the DIP switch or jumper settings, and pay attention to which are for SD card and SPI boot. This should appear on the board, and in the ArchLinuxARM documentation it shows the settings for SD card boot, but I'll repeat both here:

Switches/Jumpers
Boot Type 1 2 3 4 5 6
SD Card OFF ON ON ON OFF ON
SPI OFF OFF OFF ON ON OFF

Use this as a guide for whenever I refer to booting from SD card or from the SPI.

Install UEFI on SPI

The documentation for this can properly be found on the Solid Run Developer Center[2], but I'll be repeating here, mostly because I've had issues with a few of the options.

Firstly, regarding the different options for obtaining a flash image, I'll just say that I've tried the docker image, and I've tried compiling natively on the MACCHIATObin, but both of these ran into issues. The docker image ran into a syntax error[3] and the native build had some issues when running Python tests, namely with codec.lookup('ucs-2'), saying it couldn't find the codec. Ultimately both errors are Python problems. Coincidence? I think not! But I'll forget about my disliking of Python for now and get on with this guide.

So really, the best option is to use the pre-built binary, which is SPI specific.[4] Once you have this, you're gonna want to save it to the USB storage device using a FAT32 formatted partition. If you're reading this sort of guide you should already know how to format a USB storage device, but I'll remind you that you don't only have to format the partition with mkfs.vfat -F 32 <partition>, but you actually also have to set the partition type to FAT32. I say this because I forgot to do this, and waste some time on it.

Once you have this done, copy the image binary onto the newly formatted storage device. You can either keep the name of uefi-mcbin-spi.bin or you can change it to flash-image.bin, which is the filename used in the Solid Run documentation for flashing to SPI from U-Boot. Your choice, just make sure to take it into consideration. I'll use uefi-mcbin-spi.bin since that's what I used anyways.

Now that this is done, it's time to flash the image to the SPI. To do this, insert the USB storage device into the USB 3.0 slot on the MACCHIATObin, and insert the SD card with ArchLinuxARM (and U-Boot) into the SD card slot. Set the jumpers to boot from the SD card. Connect to the MACCHIATObin via serial USB. Finally, boot the machine and make sure to interrupt the boot process (when prompted) to enter the U-Boot console. From here, we'll be running the instructions for installing an image to the SPI Flash via U-Boot found in the documentation,[5] modifying, of course, for the filename:

To test to see if this has worked, turn off the MACCHIATObin, switch the jumpers to boot from SPI, and check to see if you get a UEFI prompt. This should appear not only if you start up in a serial console, but also on a screen if you have everything hooked up with the graphics card. If you do see a prompt, then all has worked as expected. If you don't, try doing this process a few more times. It gave me some weird errors the first few times I tried, and then magically it started working after what must've been the third time.

Installing ArchLinuxARM

References

  1. MACCHIATObin - Arch Linux ARM
  2. Armada 8040 UEFI - Solid Run
  3. Syntax Error when Fetching Sources for UEFI Build - Issue #1 - Josua-SR/boot-builder - GitHub
  4. SolidRun Images: 8040/UEFI
  5. Armada 8040 U-Boot and ATF: to SPI Flash - Solid Run