0

I've been experimenting with embedded linux using a BeagleBone Black. I've managed to create a minimal linux distribution using yocto.

When I want to flash the secondary bootloader (MLO) and the bootloader (u-boot) onto a FAT partition of an SD card by using a script I found in a tutorial, it all works, the board boots up. But when I want to redo everything on my own, not by using the script, the board does not boot from the SD card (even though the same files appear to be copied to the same location, as with the script). Apparently, my commands are not doing the same thing, but I don't understand why.

Can you guys help me understand what is the difference between my commands and the commands of the script? (FYI, The script copies the kernel and the rootfs onto a different partition of SD card as well, but I could redo that part, so that's not an issue)

My command:

$ sudo cp ~/<path_to_file>/MLO /media/<USER>/boot/
$ sudo cp ~/<path_to_file>/u-boot.img /media/<USER>/boot/

The script:

#!/bin/bash

if [ $# -ne 2 ]; then
        echo "Usage: $0 [machine] [image]"
        echo "       machine is, e.g., beaglebone"
    echo "       image is, e.g., core-image-minimal"
        exit 1
fi

if [ -z BUILDDIR ]; then
    echo "Please source oe-init-build-env"
    exit 1
fi

BOOT_PART=/media/${USER}/boot
ROOTFS_PART=/media/${USER}/rootfs

MACHINE=$1
IMAGE=$2-${MACHINE}

IMAGES_DIR=tmp/deploy/images/${MACHINE}

if [ ! -d $BOOT_PART ]; then
    echo "Can't find $BOOT_PART on sdcard"
    exit 1
fi

if [ ! -d $ROOTFS_PART ]; then
    echo "Can't find $ROOTFS_PART on sdcard"
    exit 1
fi

cp ${IMAGES_DIR}/MLO ${BOOT_PART}
if [ $? -ne 0 ]; then echo "Error: dd"; exit 1; fi
cp ${IMAGES_DIR}/u-boot.img ${BOOT_PART}
if [ $? -ne 0 ]; then echo "Error: dd"; exit 1; fi

sudo tar -C $ROOTFS_PART -xf ${IMAGES_DIR}/${IMAGE}.tar.bz2
if [ $? -ne 0 ]; then echo "Error: dd"; exit 1; fi

echo "Success!"
1
  • (1) *"The board does not boot" is a useless summary that provides zero details of what might be the failure. (2) If you're using two different SD cards, then swap what you're writing to the cards in case it's the SD card itself that's the issue.
    – sawdust
    May 5 '19 at 21:30
0

On your SD card you need the partition to be FAT32 format. Firstly mount that partition to a temporary dir Copy the MLO FIRST! And then copy the u-boot.img Copy all that data to the RAM using the sync command Unmount the temporary directory, so the flow of commands should be:

$ sudo mount /dev/MYDISK /mnt $ sudo cp MLO /mnt $ sudo cp u-boot.img /mnt $ sudo sync $ sudo umount /mnt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.