1

I'm currently reading Master Embedded Linux Programming and I'm on the chapter where it goes into bootloaders, more specifically U-Boot for the Beaglebone Black.

I have built a crosscompiler and I'm able to build U-Boot, however I can't make it run the way it is described in the book.

After some experimentation and Google'ing, I can make it work by writing MLO and u-boot.img in raw mode (using these command)

However, if I put the files in a FAT32 MBR boot partition, the Beaglebone will not boot, it will only show a string of C's, which indicate that it is trying to get its bootloader from the serial interface and it has decided it cannot boot from SD card.

I have also studied this answer. According to that answer I should be doing everything correctly. I've tried to experiment with the MMC raw mode options in the U-Boot build configuration, but I've not been able to find a change that works.

I feel like there must be something obvious I'm missing, but I can't figure it out. Are there any things I can try to debug this further?

Update: some more details on the partition tables.

When using the "raw way" of putting LBO and u-boot.img on the SD cards, I have not created any partitions at all. This works:

$ sudo sfdisk /dev/sda -l
Disk /dev/sda: 117,75 GiB, 126437294080 bytes, 246947840 sectors
Disk model: MassStorageClass
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

When trying to use a boot partition, that does not work, I have this configuration:

$ sudo sfdisk /dev/sda -l
Disk /dev/sda: 117,75 GiB, 126437294080 bytes, 246947840 sectors
Disk model: MassStorageClass
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3d985ec3

Device     Boot Start    End Sectors Size Id Type
/dev/sda1  *     2048 133119  131072  64M  c W95 FAT32 (LBA)

Update 2: The contents of the boot partition is the exact same 2 files that I use for the raw writes, so they are confirmed to work:

$ ls -al
total 1000
drwxr-xr-x  2 peter  peter   16384 Jan  1  1970 .
drwxr-x---+ 3 root   root     4096 Jul 18 08:44 ..
-rw-r--r--  1 peter  peter  108184 Jul 14 13:56 MLO
-rw-r--r--  1 peter  peter  893144 Jul 14 13:56 u-boot.img

Update 3: I have already tried the following U-Boot options to try it go get to work (in the SPL / TPL menu):

  • "Support FAT filesystems" This is enabled by default. I can't really find a good reference for the U-Boot options, but I am guessing this is what enables booting from a FAT partition (which is what I'm trying to do)
  • "MCC raw mode: by sector" I have disabled this. As expected, this indeed breaks the booting in raw mode, which is the only thing I got working up till now.
  • "MCC raw mode: by partition". I have tried to enable this and using partition 1 to load U-Boot from. I'm not sure how to understand this option. I assume raw mode does not require partitions, but this asks for what partition to use...

In general, if any one can point me to a U-Boot configuration reference, that would already by very helpful. Right now, I'm just randomly turning things on and off that sound like they may help.

Peter
  • 870
  • 6
  • 20
  • "*However, if I put the files in a FAT32 MBR **boot** partition, the Beaglebone will not start U-Boot ...*" -- You mention a "*boot*" partition. Does that mean that this partition is actually marked active or bootable? If not, then it should be. – sawdust Jul 14 '22 at 21:28
  • yes, correct, it's both. Sorry that wasn't clear. I'll try to add some more details on the partition later today. – Peter Jul 15 '22 at 06:29
  • Please also post a listing of the root directory. – sawdust Jul 15 '22 at 18:49
  • I have added what is on the boot partition. From what i can find the fact that the files are owned by me and not root should not be a problem, since FAT32 doesn't contain ownership or permission data. – Peter Jul 18 '22 at 06:51
  • "*The contents of the boot partition is the exact same 2 files that I use for the raw writes*" -- That can be a problem. That MLO would be looking for the U-Boot image at a raw sector location, instead of a file in the FAT filesystem. "*the Beaglebone will not start U-Boot*" -- Exactly what does this mean? Does this mean that the MLO is loaded and does execute? IOW study the **Clarification** section of https://stackoverflow.com/questions/60873038/how-to-write-new-mlo-and-u-boot-img-to-an-sd-card-without-erasing-the-os/60880147#60880147 – sawdust Jul 18 '22 at 07:34
  • SO is a programming Q&A platform and this question is not about programming. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) – Rob Jul 18 '22 at 12:35
  • What would be the correct place to ask this question? It is embedded programming, which I would consider some form of programming. Also both beagleboneblack and u-boot are available tags... – Peter Jul 18 '22 at 12:44
  • @sawdust thanks for sticking with me. I have already tried the config options mentioned in that answer, but none seem to help and I can't find good info on what all the options do (I have added this to my question) – Peter Jul 18 '22 at 12:45
  • 1
    "*'MCC raw mode: by partition'. I have tried to enable this ...*" -- No, that is clearly for ***raw*** mode. The salient config entry is `MMC Boot Partition` to enable ***fs*** (filesystem) mode. Try using the `` at the bottom of the menuconfig screen to obtain info on the selected config entry. Review **include/generated/autoconf.h** after a build. Also search for a CONFIG_SPL_FS_LOAD_PAYLOAD_NAME definition of "u-boot.img" (typically in an **include/configs/my_board.h** header file. – sawdust Jul 19 '22 at 00:03

0 Answers0