Home  >  Edison  >  Building

Building and flashing U-Boot

Building U-Boot using Yocto

U-Boot is built automatically as part of the image building, see Building and installing the image. The recipe will be provide the latest U-Boot with acpi patches provided if required by the kernel (see ACPI or no-ACPI).

Before flashing anything

The instructions on this page assume you have followed the instructions at Avoiding Permissions Issues. If you have not handled the permissions issues systematically via udev, you will need to invoke any instance of flashall.sh or dfu-util as root with sudo.

Flashing everything

To flash everything you use either the script flashall.sh or the Intel Flash Tools Lite. This replaces U-Boot, the kernel in the boot partition, U-Boot environment and the rootfs.

Flashing only U-Boot

To flash the Edison Arduino board you need 2 USB connections.

  1. Connect the first USB cable to the USB port marked as 3 in the photograph below.
    This cable will be your serial connection to the Edison. To connect to the edison you might use a terminal emulator like gtkterm. The serial port is probably /dev/ttyUSB0 and the baud rate is 115200 with parity none. If you prefer the command line you can use screen /dev/ttyUSB0 115200.

  2. The second cable to attach goes to the USB port marked as 2 in the photograph below.
    This port is a special port that can act as USB host or USB slave of which only one is active at a time. As you will be connecting to a host port of your PC, it needs to be configured as slave on the Edison. Push the switch down in the direction of the micro USB ports so that the port is enabled. Alt tekst

  3. On Ubuntu you might need to install the package dfu-util.

  4. Press the reset button (under the text RESET in the picture above).

  5. In your terminal press the ESC key to interrupt the boot process.

  6. You will probably see:

    U-Boot 2014.04 (Jun 06 2016 - 14:40:07)
    
    Don't forget for 2014.04 you need to apply `truncate` as decribed above.
    
  7. In your terminal type at the boot> prompt:

    run do_force_flash_os
    
  8. In a second terminal window:

    dfu-util -v -d 8087:0a99 --alt u-boot0 -D u-boot.bin
    

    This will flash u-boot to the u-boot0 partition. In the first terminal window you may watch the flashing to complete.

    #  
    DFU complete CRC32: 0xf340088e  
    DOWNLOAD ... OK  
    Ctrl+C to exit ...  
    boot > reset  
    resetting ...  
    

Flashing only IFWI

You can find out if you need to update IFWI by performing dmesg | grep OEMB.

If you find OEMB ifwi version : 237.011 you need to update, with OEMB ifwi version : 237.015 your are already up to date.

You can manually update IFWI by performing the following commands in addition to step 8 above:

dfu-util -v -d 8087:0a99 --alt ifwi00 -D "edison_ifwi-dbg-00-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib00 -D "edison_ifwi-dbg-00-dfu.bin"

dfu-util -v -d 8087:0a99 --alt ifwi01 -D "edison_ifwi-dbg-01-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib01 -D "edison_ifwi-dbg-01-dfu.bin"
 
dfu-util -v -d 8087:0a99 --alt ifwi02 -D "edison_ifwi-dbg-02-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib02 -D "edison_ifwi-dbg-02-dfu.bin"

dfu-util -v -d 8087:0a99 --alt ifwi03 -D "edison_ifwi-dbg-03-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib03 -D "edison_ifwi-dbg-03-dfu.bin"
 
dfu-util -v -d 8087:0a99 --alt ifwi04 -D "edison_ifwi-dbg-04-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib04 -D "edison_ifwi-dbg-04-dfu.bin"

dfu-util -v -d 8087:0a99 --alt ifwi05 -D "edison_ifwi-dbg-05-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib05 -D "edison_ifwi-dbg-05-dfu.bin"
 
dfu-util -v -d 8087:0a99 --alt ifwi06 -D "edison_ifwi-dbg-06-dfu.bin"
dfu-util -v -d 8087:0a99 --alt ifwib06 -D "edison_ifwi-dbg-06-dfu.bin"

Fixing up the u-boot environment

U-boot uses a sort of macro’s that you can run after you have interrupted the boot process (see run do_force_flash_os above). If you you are manually updating U-Boot, you probably want to run you new built image from the SD card or from USB. In that case you will need to make some changes manually to U-Boot’s environment because some keywords changed as well as add some command to boot the image on the SD card.

Inside u-boot you can see this environment by using the command:

    printenv

From when running linux and logged into the Edison you can see the environment using:

    fw_printenv

You can change a line by using setenv/fw_setenv.

  • The following lines need to be changed since the keyword mmc has changed to raw. For example inside u-boot:
setenv dfu_alt_info "ifwi${hardware_id} raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2;u-boot0 part 0 1;u-boot-env0 part 0 2;u-boot1 part 0 3;u-boot-env1 part 0 4;boot part 0 7;rootfs part 0 8;update part 0 9;home part 0 10;vmlinuz fat 0 7;initrd fat 0 7"
        
setenv do_dfu_alt_info_ifwi 'setenv dfu_alt_info "ifwi${hardware_id} raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2"'
        
setenv do_dfu_alt_info_mmc 'setenv dfu_alt_info "ifwi${hardware_id} raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2;u-boot0 part 0 1;u-boot-env0 part 0 2;u-boot1 part 0 3;u-boot-env1 part 0 4;boot part 0 7;rootfs part 0 8;update part 0 9;home part 0 10;vmlinuz fat 0 7;initrd fat 0 7"'
  • Inside linux replace setenv with fw_setenv.

  • Inside u-boot you will want to permanently store the above using saveenv. Inside linux, the environment is automatically stored.

  • Further on you will like to boot the new kernel and image on the sdhc. Add the following commands:

boot_edsboot=zboot 0x100000 0 0x6000000 0x1800000
bootargs_edsboot=tty1 console=ttyS2,115200n8 root=/dev/mmcblk1 rootfstype=ext4 systemd.unit=multi-user.target hardware_id=${hardware_id}
edsboot=run clean_bootargs_mode; setenv bootargs ${bootargs_common} ${bootargs_edsboot}; run load_edsboot; run boot_edsboot
load_edsboot=load mmc 1 0x100000 /boot/bzImage;load mmc 1 0x6000000 /boot/initrd

And to reboot in the kernel and image on the sdhc:

do_handle_bootargs_mode=run do_preprocess_bootargs_mode; if itest.s $bootargs_mode == "sdhc" ; then run edsboot; fi; if itest.s $bootargs_mode == "ota" ; then run do_ota; fi; if itest.s $bootargs_mode == "boot" ; then run do_boot; fi; if itest.s $bootargs_mode == "flash"; then run do_flash; fi; run do_fallback; exit;

Further to boot in the initrd and drop to a prompt to repair broken file systems:

boot_rescue=zboot ${loadaddr} 0x1800000 0x6000000 0x1800000
bootargs_rescue=debugshell=0 tty1 console=ttyS2,115200n8 root=/dev/mmcblk0p7 rootfstype=vfat systemd.unit=multi-user.target hardware_id=${hardware_id}
do_rescue=setenv bootargs ${bootargs_rescue}; run load_rescue; run boot_rescue
load_rescue=load mmc 0:7 ${loadaddr} bzImage;load mmc 0:7 0x6000000 initrd
  • When done you be able to boot the new system on sdhc using the command (in U-Boot): run edsboot or reboot sdhc (in linux).
  • run do_rescue will take you to the initrd (in U-Boot).

    The parameters root and rootfstype tell the initramfs init script to mount mmcblk1 (this should be your sdcard). It will wait for 30 seconds and search for /sbin/init on the rootfs. If the rootfs does not appear or init is not found it will mount all partitions possible and then fall back to a prompt for you to investigate the situation. The remaining parameters are passed on to the new init (systemd).

Building U-Boot manually outside of Yocto

Background

The following instructions are provided by Andy Shevshenko (0andriy or AShev) on the Edison community pages. They are currently out of date, but provided here for reference purposes. He also provides a kernel with patches applied to run on Edison out of the box.

See:

The status is being tracked here:

Instructions for building

  • Clone u-boot from https://github.com/andy-shev/u-boot/tree/edison
  • The current version is edison-v2019.01

    git clone git@github.com:andy-shev/u-boot.git
    cd u-boot
    git checkout edison-v2019.01  
    
  • To build:

    make clean
    make edison_defconfig
    make -j8
    
  • If you never updated U-Boot you are still on v2014.04. In this case, or if you have edison-v2016.11, or edison-v2017.01 you need to do:

    truncate -s %4096 u-boot.bin
    

    otherwise skip this step.