EBC Exercise 07 Updating an Old U-Boot

From eLinux.org
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder

What do you do if you get the following error?

bone$ config-pin -q P9_14
P9_14 pinmux file not found!
Pin has no cape: P9_14

Checking U-Boot Date

If you are running off an SD card there's a good chance you have booted off an old boot loader. Here's how to tell.

bone$ cd /opt/scripts/tools
bone$ sudo ./version.sh
[sudo] password for debian: 
dogtag:[BeagleBoard.org Debian Image 2018-07-29]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2016.11-rc3-00002-g73df7f]:[location: dd MBR]
[    0.986254] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    0.987354] gpio-of-helper ocp:cape-universal: ready

About 5 lines down you see the date of U-Boot. If it is too old (as mine is), it won't load the device tree correctly.

Forcing a boot from the SD card

There are multiple steps to the boot process. If you booted without holding a button down, the boot loader in the eMMC was used. It detected the presence of the SD card booted off of it. The problem is the boot loader may be too old.

It turns out the SD has a new version of the boot loader and you can force the Bone to use it.

Do this: Power off the Bone, then hold the BOOT button down while applying power. You can release it once the LEDs start flashing. (On the Green Wireless the boot button is located near the antennas and is labeled USER.)

Once the Bone has booted, rerun the config-pin command, and if it succeeds, the problem was an old boot loader.

bone$ config-pin -q P9_14
P9_14 Mode: default Direction: in Value: 0

Fixing the Problem, Blow Away Old Boot Loader

If you don't want to have to hold the BOOT button every time you boot (and nobody does), then you have a couple of choices. Choice 1 is to blow away the old boot loader. If the eMMC boot loader isn't found during the boot process, then the SD boot loader will be used. Try:

bone$ sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=1

This will copy zeros where the eMMC bootloader is. Next time you boot, you don't need to hold the button down.

Fixing the Problem, Install a New Boot Loader

You could instead install an updated boot loader. (If you are happy with the first choice, you don't need to do this one.) Do this by:

  1. Power down the Bone
  2. Remove the SD card
  3. Apply power, thus booting from the eMMC
  4. Make sure you are on the network
  5. Run sudo /opt/scripts/tools/developers/update_bootloader.sh. This will fetch a current boot loader and install it
  6. Power off the Bone
  7. Insert the SD card and apply power

The Bone should boot off the new boot loader and all should be good.

Yet Another Fix, Copy the SD Card to eMMC

One final fix is to copy the whole SD card to the eMMC and boot from it. Your SD has a current copy of the boot loader, so copying it to the eMMC will also work.

  • Edit uEnv.txt
bone$ sudo nano /boot/uEnv.txt
  • Go to the last line and remove the #.
  • Reboot. Rather than boot from the SD, it will copy the contents of the SD to the eMMC. This takes a while.
  • Once the LEDs have all turned off you can remove the SD card and reboot.
  • You will now be running off the eMMC.

Warning: Either label the SD card as a flasher, or reedit /boot/uEnv.txt and restore the #. Otherwise you might unintentionally over write you eMMC in the future.

thumb‎ Embedded Linux Class by Mark A. Yoder