Building U-Boot PicoZed

Recently I needed to build U-Boot for the Picozed.  Mainly because we needed to get our control platform running on another Picozed variant but also to de-risk part of our process. For those of you that don’t know the control platform (called the Fyfe) is made from our IP blocks is in the Zynq fabric with Linux running on the Zynq A9 cores as the software host.  This gives us dedicated FPGA speed real time control in the fabric and all the good things that Linux provides such as networking, scripting , python and the like.  We use a PicoZed as the System on Module (SoM) for our control platform.  So this is the first post in the article series Building U-Boot Picozed.

Building U-Boot PicoZed

U-Boot is the ubiquitous boot loader for booting Linux.  It can be used to boot other systems as well but I just needed to create a U-Boot that would get me up and running on the Picozed.  Building U-Boot had never been my thing but it was decided that I should build and learn it for myself.

U-Boot or more correctly Das U-Boot is supported and maintained by the people at  https://www.denx.de/wiki/U-Boot.

Submarines

As an aside I think that the name Das U-Boot is a reference to the 1981 movie Das Boot about a U boat submarine.  This is a great movie with superb German dialog version.  Check it out.  Information on the movie is here https://en.wikipedia.org/wiki/Das_Boot.  The German language version is the better version.

Help!

So as I have been doing this whole software development thing for a while and as always the first thing I did was ask an expert.  It is always good to ask an expert.  It actually doesn’t matter which expert as the experts generally all know each other.

I asked Adam Taylor from Aduivo Engineering and of Microzed chronicle fame.  He helps with tricky FPGA issues and also helps with our IP blocks and test-benches.  Adam, it turns out, is not a U-Boot guy but recommended a number of people.  He also put a LinkedIn post out for me.  And I got recommended through Adam T. to Matteo Vit.  Matteo is extremely helpful.

FSBL

So I need to fill in some of the story as to how I was constrained.  We have this one client who likes Vivado 2016.2 and so we have residual development and support requirements that are in Vivado 2016.2.  Vivado moves on regularly and it generally gets better.  At the moment on my Linux laptop I have Vivado 2016.2, 2016.4, 2017.1 and 2017.2 all installed and all with projects.  I also have SDK for all these Vivado varients also.  I run straight Ubuntu 16.04 and all the Vivado versions go.

The risks of updating to new versions or providing support with historic Vivado versions are really beyond what I want to get into here.  I hope to write another blog series about that later.

Before we built U-Boot we needed the FSBL.  Before I did this I asked about whether this was the best way to go forward.

SPL or not?

I also consulted with Charles M. who is a very good Linux and U-Boot guy, a really good consultant on flash memory usage and also he is great company.  He proposed that I take the SPL route to U-Boot.  The SPL approach is where the processor configuration is done by including the hardware specific initialization code (ps7_init_gpl) into the U-Boot build.  This SPL is not officially supported by Xilinx for the Zynq U-Boot release.  The Xilinx description of the process is here http://www.wiki.xilinx.com/U-Boot+Secondary+Program+Loader.  I did not pursue this SPL but I plan to go through this process in the future for completeness.

Which U-Boot version?

It’s clear when you look at it that the U-Boot version and the Linux version need not be the same.  This was a really big realization for me.  And an important realization for those building Linux systems.

U-Boot is a boot-loader and it moves the binaries of the kernel, ramdisk and device tree from storage media to memory.  That is all it does.  U-Boot isn’t actually a Linux specific program.

U-Boot for PicoZed – should just work right?

So some of you will be wondering why I am writing this as the PicoZed must have an off the shelf from the git repo U-Boot version that just goes?  I found that the answer to this is no.  The U-Boot build when I selected PicoZed for the make option from the repo I pulled from the xilinx git did not work on a PicoZed.  I also found that the defconfig used for the picozed (don’t worry if you don’t know what that is I’ll get to that in a follow up blog) was not correctly setup to support the flash memory on the PicoZed.

Well this was a surprise.

So as a relative new U-Boot software user I decided that I would build U-Boot for the PicoZed myself and share the process with you.  I take the FSBL approach so what I do is compatible with the Xilinx supported U-Boot.  And I got it working.  Over the next couple of months I will show you what I have learned in building U-Boot.