Boot process of custom build getting stuck

I am trying understand the embedded linux concepts using beaglebone black.
I tried building the cross compiler, MLO, uboot, kernel, and filesystem for the Beaglebone black and put it on the sdcard.

I made 3 partitions:

  1. MLO, u-boot, uEnv.txt
  2. kernel, DTB
  3. rootfs

When I try to boot from the sd card, the kernel does not get loaded.
The log is given below

U-Boot SPL 2024.07-rc4-00012-g1ebd659cf0-dirty (Jun 12 2024 - 11:42:32 +0530)
Trying to boot from MMC1


U-Boot 2024.07-rc4-00012-g1ebd659cf0-dirty (Jun 12 2024 - 11:42:32 +0530)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM:  512 MiB
Core:  161 devices, 18 uclasses, devicetree: separate
WDT:   Started wdt@44e35000 with servicing every 1000ms (60s timeout)
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
<ethaddr> not set. Validating first E-fuse MAC
Net:   eth2: ethernet@4a100000using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC de:ad:be:ef:00:01
HOST MAC de:ad:be:ef:00:00
RNDIS ready
, eth3: usb_ether
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Extension init...
Found 0 extension board(s).
No EFI system partition
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
Loading Boot0000 'mmc 0' failed
Loading Boot0001 'mmc 1' failed
EFI boot manager: Cannot load any image
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Extension init...
Loading Boot0000 'mmc 0' failed
Loading Boot0001 'mmc 1' failed
EFI boot manager: Cannot load any image
## Error: "bootcmd_nand0" not defined
starting USB...
Bus usb@47401800: Port not available.
USB is stopped. Please issue 'usb start' first.
starting USB...
Bus usb@47401800: Port not available.
link up on port 0, speed 100, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4

But when I stop autoboot and try to load the kernel and filesystem by myself I am able to do it


U-Boot SPL 2024.07-rc4-00012-g1ebd659cf0-dirty (Jun 12 2024 - 11:42:32 +0530)
Trying to boot from MMC1


U-Boot 2024.07-rc4-00012-g1ebd659cf0-dirty (Jun 12 2024 - 11:42:32 +0530)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM:  512 MiB
Core:  161 devices, 18 uclasses, devicetree: separate
WDT:   Started wdt@44e35000 with servicing every 1000ms (60s timeout)
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
<ethaddr> not set. Validating first E-fuse MAC
Net:   eth2: ethernet@4a100000using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC de:ad:be:ef:00:01
HOST MAC de:ad:be:ef:00:00
RNDIS ready
, eth3: usb_ether
Hit any key to stop autoboot:  0
MBOOT=>
MBOOT=> <INTERRUPT>
MBOOT=>  setenv bootargs "console=ttyO0,115200n8 root=/dev/mmcblk0p3 rw rootfstype=ext4 rootwait"
MBOOT=> <INTERRUPT>
MBOOT=>  load mmc 0:2 $loadaddr zImage
12112384 bytes read in 779 ms (14.8 MiB/s)
MBOOT=> <INTERRUPT>
MBOOT=> load mmc 0:2 $fdtaddr am335x-boneblack.dtb
69985 bytes read in 11 ms (6.1 MiB/s)
MBOOT=> bootz $loadaddr - $fdtaddr
Kernel image @ 0x82000000 [ 0x000000 - 0xb8d200 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
Working FDT set to 88000000
   Loading Device Tree to 8ffeb000, end 8ffff160 ... OK
Working FDT set to 8ffeb000

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.4.0 (mohit@mohit-VirtualBox) (arm-cortex_a8-linux-gnueabihf-gcc (crosstool-NG 1.26.0) 13.2.0, GNU ld (crosstool-NG 1.26.0) 2.40) #1 SMP Wed Jun 12 14:10:11 IST 2024
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[    0.000000] Memory policy: Data cache writeback
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 64 MiB at 0x9b800000
[    0.000000] Zone ranges: 
...

Can someone explain the issue. My doubt is that the uboot is not getting uEnv.txt but I don’t understand why.

Looks like you need to add a file

extlinux.conf

# Generic Distro Configuration file generated by OpenEmbedded
LABEL Poky (Yocto Project Reference Distro)
	KERNEL ../zImage
	FDT ../am335x-boneblack.dtb
	APPEND root=PARTUUID=${uuid} rootwait rw earlycon console=${console},${baudrate}

This is one I am working on and it loads.

2 Likes

Mainline u-boot looks for extlinux/extlinux.conf vs uEnv.txt

2 Likes

Thanks to both of you. I will make the required changes.

1 Like

Just note extlinux.conf does have one catch, all files must be in the same partition, that it itself has been loaded from. Therefore stick it in the second partition.

OK, I will do as suggested.

Which other source should I use to build uboot for using uEnv.txt if I wish to do it?

You’ll need a git tag from a few years ago… extlinux.conf has been the default for a few years now

Ok, it seems the source from where I am learning is old. I will work with the newer version only then. Thanks alot!

Whatever source that was, they should have reference a git branch or commit

Thanks @RobertCNelson and @foxsquirrel. The boot completed after making the changes suggested by you.

1 Like