I’ve tried building U-Boot and Android before for an undocumented armv7 device and I ran into problems. Some problems was because of incomplete tutorials and others because of my lack of attention because of the numerous errors. I’ve taken my time and have put together a tutorial that if it’s easy enough for me to follow, I’m pretty sure it’s easy enough for you.
If you’re ready let’s get started.
Prerequisites
- Computer running Ubuntu (built on Ubuntu 17.04 Zesty)
- Linaro Toolchain (tested with GCC Linaro 6.3.1 x86_64)
- Das U-Boot Source (tested with U-Boot 2017 05 RC2)
- libncurses-dev
- libncursesw5-dev
- device-tree-compiler
First, your computer should be running Debian or a flavor such as Ubuntu.
Download the Linaro Toolchain from the link above. You can get the latest version or the version I used.
$ mkdir ~/Downloads/buildme
$ cd ~/Downloads/buildme
$ wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
Extract the toolchain in the directory you created.
$ tar xf gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
Add the path to the toolchain bin to your environment variable.
$ export PATH=${PATH}:${PWD}/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/
Download the U-Boot Source from the link above. You can get the version featured in this tutorial or the latest version.
$ wget http://ftp.denx.de/pub/u-boot/u-boot-2017.05-rc2.tar.bz2
Extract the U-Boot source in the directory you created.
$ tar xf u-boot/u-boot-2017.05-rc2.tar.bz2
Use apt or apt-get and Install libncurses-dev, libncursesw5-dev and device-tree-compiler.
Update: Make was complaining about dtc being out of date and to update to at least dtc 1.4 on freshly installed systems even with the Linaro Toolchain.
$ apt-get install libncurses-dev libncursesw5-dev device-tree-compiler
Now with all of that out of the way. Let’s get to building Das U-Boot.
Navigate to the U-Boot folder that was created when you extracted the u-boot source.
$ cd u-boot-2017.05-rc2
Now run make clean and make distclean.
$ make clean O=./output/ && make distclean O=./output/
List the available Board_defconfig to make sure your board is supported
$ ls configs | more
When you find your board’s defconfig press CTRL + C.
Let’s prepare make for our board. Make sure you type it correctly because it is case sensitive.
$ make CROSS_COMPILE=arm-linux-gnueabihf- YourBoard_defconfig O=./output/
Now let’s make the menu config so that it’s easier to change settings if needed. If not, skip this step.
$ make CROSS_COMPILE=arm-linux-gnueabihf- menuconfig O=./output/
In the menu config, there is a lot of settings that you can change. Make sure you stay within the realm of configuration for your board. Worst case senario is your board won’t boot.
You are ready to compile Das U-Boot.
Enter the following make command to start the process. It shouldn’t take too long.
$ make CROSS_COMPILE=arm-linux-gnueabihf- -j$(nproc) O=./output/
When it’s finished, you can find your built files in the root u-boot directory.
In my case, I’m making a bootable SD Card and building for Cubietruck so, I’ll use the file “u-boot-sunxi-with-spl.bin”.
Congratulations. you successfully built Das U-Boot for your development purposes.
If you encounter any errors, please comment below and I’ll do my best to help or find a resolution.
Refer to my other tutorial to learn how to create a bootable SD Card.