which uboot source to compile (and how) for emmc/NAND

Hi,

I’m trying to automate the process of flashing a bootable emmc (NAND) on my beagle bone black. I’ve pin strapped the board to boot using bootp/dhcp - the kernel that gets loaded by the u-boot.img (that was pulled in via dhcp+tftp) uses an initramfs as the basis of writing the MLO, (a different) u-boot.img and root file system (containing zImage and uEnv.txt) to emmc/NAND. This all works and when I restart the beagle bone black it boots as I expect. Hooray for automated emmc flashing.

However my problem is that I can’t seem to hand roll a version the the MLO and u-boot.img that I flash to NAND. What I’m using right now are copies I found of these two files in the debian images distributed here: https://beagleboard.org/latest-images (These images tend to contain filesystems with /opt/backup/uboot/MLO and /opt/back/uboot/u-boot.img files existing). If I use these two boot loader files, and craft my /boot/uEnv.txt just so (uuid needs to be specified), then I can boot a couple of kernels/filesystems I have lying around successfully.

But I can’t seem to reproduce these two files (MLO and u-boot.img) for my NAND from source. I’ve tried these git repos:

git://git.denx.de/u-boot.git
git://git.ti.com/ti-u-boot/ti-u-boot.git

and even the u-boot source that that ships with the SDK:
~/ti-processor-sdk-linux-am335x-evm-04.00.00.04/board-support/u-boot-2017.01+gitAUTOINC+9fd60700db-g9fd60700db/

For each of those I’m running

make CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_evm am335x_evm_defconfig && make CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_evm

And I’ve even tried a different config:

make CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_boneblack am335x_boneblack_defconfig && make CROSS_COMPILE=arm-linux-gnueabihf- O=am335x_boneblack

This compilation process creates the MLO and u-boot.img files, but I can never seem to successfully boot anything if I use them regardless of which config I use.

If it helps with clarity, I am trying out MLO and u-boot.img files by booting from the SD card, copying over the new versions, and then running

dd if=MLO of=/dev/mmcblk1 conv=notrunc bs=128k count=1 seek=1
dd if=u-boot.img of=/dev/mmcblk1 conv=notrunc bs=384k count=2 seek=1

Note that I can always get back to the “bootable state” by writing the backup boot loader files that come with debian distro instead: (the sd card is running debian 8.7):

dd if=/opt/backup/uboot/MLO of=/dev/mmcblk1 conv=notrunc bs=128k count=1 seek=1
dd if=/opt/backup/uboot/u-boot.img of=/dev/mmcblk1 conv=notrunc bs=384k count=2 seek=1

How can I build MLO and u-boot.img files in order to successfully boot a kernel and file system of my choosing on the emmc/NAND? Is there a page somewhere? Any help would be appreciated.

I’m a newbie, so take this with a grain of salt or as comic relief for the experts on this website.

I don’t completely understand what you’re trying to do, but it sounds like the kernel some how contains/flashes MLO/u-boot.img???

But maybe you can generate SD Card which contains everything you need (e.g. MLO, u-boot.img, kernel, fs, uEnv.txt) and then uncomment the appropriate line within uEnv.txt to convert that into a flasher image, and subsequently flash the eMMC…

Instructions for where to get EVERYTHING and transfer it to SD card for the BBB can be found here:

https://eewiki.net/display/linuxonarm/BeagleBone+Black

Once you download the u-boot source and apply all of the the obligatory patches for BBB, you will have a buildable u-boot/SPL tree.

In lieu of generating a complete SD card image, it MAY BE possible to dd just the MLO/u-boot.img to the eMMC on the BBB, but I think you can only do this from a running FS on the BBB.

AFAIK That SDK isn’t Debian usually it’s Arago and the sdk has a wiki describing building uboot but if your looking duplicate those .org binaries. If you search this group you should find a link Probally from Robert as to how to clone and build the correct stuff. Also check his eewiki he’s got detailed instructions

Hi Jeff,

Thanks for your reply. After I wrote that post I found the exact same link (https://eewiki.net/display/linuxonarm/BeagleBone+Black) and the “obligatory patches” are basically what I was missing for building the MLO and u-boot.img files for the EMMC.

Sorry if I wasn’t clear - my task is to write the contents of the EMMC from scratch using only an Ethernet connection. I’m doing that using BOOTP/DHCP and TFTP. It’s working now.

Thanks,

Dave.

Good to hear…

This may come in handy when we’re at the point of writing the eMMC in our board…

Regards,

jeff

Hi Jeff (and posterity),

I am just going over my notes now and making sure it’s all reproducible. When you use BOOTP/DHCP to grab the bootloaders you have to set up a TFTP server to supply u-boot.spl.bin and u-boot.img files (and a zImage but … tmi for now) - my point being you have to generate these two files (u-boot.spl.bin and u-boot.img) from the u-boot source. And these are different to the MLO and u-boot.img files you flash to your NAND . This NAND part I definitely have working thanks to the recipe we both found above (https://eewiki.net/display/linuxonarm/BeagleBone+Black).

Frustratingly, I had to use a different git repo to generate the BOOTP/DHCP boot loader files (u-boot.spl.bin and u-boot.img respectively). To generate these I instead use:

git clone git://[git.ti.com/ti-u-boot/ti-u-boot.git](http://git.ti.com/ti-u-boot/ti-u-boot.git)
cd ti-u-boot
git checkout ti-u-boot-2017.01
CC=arm-linux-gnueabihf-
make CROSS_COMPILE=${CC} O=am335x_evm am335x_evm_defconfig 
make CROSS_COMPILE=${CC} O=am335x_evm 

And then the files you are after are am335x_evn/spl/u-boot-spl.bin and am335x_evn/u-boot.img.

I hope that helps anyone in the same situation.

It would be interesting to hear from anyone with more insight…

end spam,

Dave.