Making SD boot default on BBB by erasing eMMC MBR
If you are using a newer eMMC flasher image on the eMMC memory of the Beaglebone black hardware, then you don’t see two partitions of the eMMC.
For example, if I just run the command lsblk here. You see here mmcblk0, this is nothing but your SD card, which has got two partitions, P1 and P2. And this is the on-board eMMC.
The newer eMMC flash images of beagleboard.org, it creates only one partition here, mmcblk1p1, as shown in Figure 1. You don’t see p2.
And you cannot locate the MLO in this partition.
Let’s mount that, mount/dev/mmcblk1p1, let’s mount to some mount point. And here, if you go inside the boot, you don’t see MLO here, as shown in Figure 2.
That’s because the newer eMMC flasher Debian images of beagleboard.org, it creates only one partition, mmcblk1p1, and this is of type EXT4.
And it doesn’t copy the boot images such as MLO and U-boot into this partition.
It actually creates 1MB of MBR(master boot record), as shown in Figure 3. So, it stores the MLO and U-boot into this MBR. There is no file system on the MBR; you cannot mount the MBR. These MLO and U-boot are hardcoded onto this MBR.
And now, if you want to force your Beaglebone hardware to boot from the SD card by default, then you have to erase this MBR.
You can recover it when you want. We will see that later. Let’s erase that MBR.
Let’s get back to the Beaglebone. So, go to the beagle bone command prompt here, and let’s first unmount this partition as shown in Figure 4.
Let’s use the dd command to first take the snapshot of the MBR, as shown in Figure 5.
Let’s save that into some file. Because we may want to recover it later.
That’s why I’m going to use the dd command, input file= dev/mmcblk1 and the output file is equal to let me call it as emmc boot. img.
We are copying some data, that is, MBR, into this file. This is a local file. And the block size is equal to 1MB we are copying and count = 1 time. Hit enter. Now you see here this file gets created, which has the snapshot of the MBR.
Now we are going to zero out the MBR. Let’s again use the dd command dd; the input file is equal to dev/zero, output five is equal to dev mmcblk1, And bs is equal to 1 megabytes, the count is equal to 1. We zeroed out the MBR, as shown in Figure 6.
To test this, you have to remove the power from the Beagle bone black hardware. You just disconnect the USB cable from your computer and connect the USB cable back to your computer to give power to your board.
You can see that the board is booting from an SD card, as shown in Figure 7. It is not trying to boot from the eMMC.
Let’s see how to recover the MBR as shown in Figure 8.
Let’s login and use the dd command, input file. The input file will be emmcboot.img what we saved earlier, and the output file is equal to dev/mmcblk1. And bs is equal to1 megabyte, count = 1.
To test this, just remove power from your Beagle bone black hardware by disconnecting the USB cable and connecting it back, it is booting from the eMMC.
I hope you can reproduce this at your desk and I will see you in the following article.
Get the Full course on Linux Device Driver Here.
FastBit Embedded Brain Academy Courses
click here: https://fastbitlab.com/course1