So, I am halfway though a course on Udemy from ‘Fastbit embedded Brain Academy’, learning how to boot, configure and run Linux on an embedded single board computer (the BeagleBone Black). The course has been very good so far, and I would certainly recommend it for people with some programming knowledge.
The course has many challenges that relate to the contents of the section of lectures, and lecture 62 holds challenges related to compiling an MLO and u-boot image that have a longer default timeout i.e. the time given that lets the user interrupt booting from the uEnv instructions.
In order to change the behaviour of u-boot to extend this wait time, it is necessary to configure u-boot and compile from the source code. I followed the instruction from the course instructor, as to download and install the prerequisite compiler and files to perform this process. However, I found that first stage ROM boot loader would load the MLO and u-boot.img files from the SD card, with a few horrible warning messages (and in some cases the Linux kernel would fail to boot).
I received warnings like those in the screen grab below (using minicom and UART):
Although the MLO and u-boot files are picked up (shown by the extension of the time out to 10 seconds), we are failing to read and load a bunch of stuff.
After a little digging and googling I came across this post on the longer vision blog, describing the process of patching the u-boot source code for the am335x used in the BeagleBone Black.
I will note the abridged steps for a linux computer here:
Download and unpack the Linaro gcc arm-linux cross-compiler
http://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/
Add the compiler to your path, or set a system variable if you want:
export PATH=$PATH:<path-to-extracted-compiler/bin/>
Clone the u-boot repo
git clone https://github.com/u-boot/u-boot.git
Checkout a release version of the u-boot repo
cd u-boot git checkout v2018.01</pre>
Clone the patching repo
cd .. git clone https://github.com/eewiki/u-boot-patches.git
Navigate to the patches for the version of u-boot you are using
cd u-boot-patches/v2018.01/ <span class="line">cp 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch ../../u-boot/</span> <span class="line">cp 0002-U-Boot-BeagleBone-Cape-Manager.patch ../../u-boot/</span>
Apply the necessary patches for your board
cd ../../u-boot/ <span class="line">patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch</span> <span class="line">patch -p1 < 0002-U-Boot-BeagleBone-Cape-Manager.patch</span>
Perform a distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
Make the board-specific default configuration file
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_boneblack_defconfig
Make the config editor gui, and customise your configuration. In this case I have changed the wait time to 10 seconds
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
Make all in u-boot. Here I am utilising 4 threads, as denoted by the -j flag.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4
Move your files to your SD card.
cp MLO /media//BOOT/ cp u-boot.img /media//BOOT/ sync
Plug and play!