Build U-Boot from denx u-boot source

Hi, I want to know if there is a way to build U-Boot from denx source. I was looking but there’s no support for BPI-M5 but for Odroid C4. I want to run kernel 5.X mainline.

Does Odroid C4 have the same CPU as M5? If so I believe you just have to adjust the pinmuxing. Check if odroid-c4 has a DTS file, and change the muxing accordingly. You might be limited on the types of boot though. Ethernet booting might not working if PHYs are different

In fact, the last mainline kernel provide the dts for BPI-M5, the thing is I don’t know how made the right kernel configs for BPI-M5 in the menuconfig, boot.ini settings and overlays.

This is what I want to do:

https://linux-meson.com/doku.php

Settings and overlays are usually independent from kernel (they run before everything). So you should be okay by just copying the ones from the original image.

The menuconfig part I would try running defconfig (make ARCH=arm64 defconfig) and try to boot with this. Might boot, but miss the necessary modules for other IC on the board. For those you can go in Device Drivers menu and select the ones on your board (’/’ key brings the search menu, it helps finding most of the drivers).

Have you tried the doku tutorial you shared, where did it took you?

Thanks for your help Otavio, I tried with 5.14 mainline Kernel source and defconfig, the good thing with 5.14 mainline Kernel source is that comes with dtbs for bananna pi m5. At last I made it boot but ethernet is not working, It’s good to kwon (I’m not an expert on this matters) that the overlays are usually independent from kernel.

If it boots is a very good sign. Do you reach a bash terminal? The usual handover process is something like: Power->Pre-boot routines (overlays and U-Boot PSL)->U-Boot->Kernel + DTS->/sbin/init->bash

If you can see Kernel messages but no terminal all you have to do is double check /sbin/init and your bash (some images uses busybox for this).

The missing ethernet, most likely is just a missing driver. From the photos it seems like M5 uses a Realtek as PHY, but I couldn’t discern the part number. M5 and Odroid-C4 seems to have similar design, the latest uses a Realtek RTL8211F. Check if your board has the same one (the Phy is the closest to the Ethernet Jack, it has a crab as logo).

On menuconfig, navigate to Device Drivers->Network Device Support->Ethernet Driver Support and look if Realtek Devices is checked (with a * not a M), if it’s try checking all other Realtek options (RTL-8139, RTL-8129 and 8169), if you still can’t get a connection you might need the firmware binaries. What distro are you using, try searching for “firmware-realtek” with your distro name on google.

Hi Otavio, thanks for your help, your tip for ethernet works well but have some issues due tmp free space, I don’t understand why if I used the same root file system without that trouble. By other hand, I’ve found that there is an update for BPI-M5 support on https://source.denx.de/u-boot/custodians/u-boot-amlogic, it supposed to build an U-Boot for Amlogic but I don’t know how to burning into SD Card after build process.

You might be missing a tmp partition or not big enough, that’s usually on “/tmp/”. Can you see that folder on the root of the system? What lsblk returns? On SD based systems is a good thing to mount /var/log and /tmp on RAM filesystems (ramfs) or more durable memories, Banana Pi W2 for example has a eMMC Flash so my lsblk reads like:

mmcblk1      179:0    0  7.3G  0 disk
├─mmcblk1p1  179:1    0    1G  0 part  /var
└─mmcblk1p2  179:2    0    1G  0 part  /tmp
mmcblk1boot0 179:8    0    4M  1 disk
mmcblk1boot1 179:16   0    4M  1 disk
mmcblk1rpmb  179:24   0  512K  0 disk
mmcblk0      179:32   0 29.7G  0 disk
├─mmcblk0p1  179:33   0  256M  0 part  /boot
└─mmcblk0p2  179:34   0  3.7G  0 part  /

Try checking where your device is mounting /tmp, if M5 has some sort of flash change /etc/fstab to mount /tmp there. U-boot usually provides flashing documentation, boot.ini probably contains the boot binary it will run, copy the binary generated on u-boot (u-boot.bin usually) to the root of your SD card and copy the name to boot.ini.

This might also be helpful: https://www.cnx-software.com/2016/11/19/how-to-create-a-bootable-recovery-sd-card-for-amlogic-tv-boxes/

I try the https://u-boot.readthedocs.io/en/latest/board/amlogic/odroid-c4.html method without success, BPI-M5 have the same file scheme but it doesn’t work.