Home  >  Edison  >  Building

Disaster recovery

More on initrd on the boot partition

You may have noted that U-Boot loads the kernel and initrd from the image partition (either on the eMMC or the SDHC). To do that U-Boot must be able to access the device. Currently, U-Boot support the eMMC and SDHC devices, and fat, ext4 and btrfs filesystems.

In case you want to boot directly from an external USB disk, you need to enable that in U-Boot as well as support for the file system, if not one of the above.

Alternatively, there is a kernel and initrd installed on the boot partition. You can also add whatever drivers you need to that (by exending edison-rescue.bb) and tell the initrd where to find the image. As an example this line in the U-Boot environment tells the initrd to search for the image on the ext4 partition SDHC:

bootargs_edsboot=tty1 console=ttyS2,115200n8 root=/dev/mmcblk1 rootfstype=ext4 systemd.unit=multi-user.target

Using initrd as a rescue partition

From U-Boot you can run do_rescue. This will take you into the initrd in the boot partition on the emmc (/dev/mmcblk0p7) and drop you into a shell. Here you will have available the packages:

  • busybox
  • e2fsprogs
  • btrfs-tools
  • parted

These tools should allow you to fixup a broken root file system.

Flashall (old image)

If at any point you messed up the Edison or want to go back to the factory state, you need to flash the original image. The image actually consists of several parts, i.e. u-boot (boot loader), ifwi (intel firmware binaries), kernel and root file system. It should not be necessary except after you did Recovery (see below), but just in case of emergency you can download an Edison 2.1 image here.

  1. Ungzip the file

  2. Run sudo ./flashall.sh

Recovery

As described above, u-boot can update itself. However, if u-boot itself is broken (you built a non-functioning image) interrupted flashing, or whatever, it won’t boot, and consequently won’t be able to re-flash it self.

Fortunately, u-boot is loaded by the PSH KERNEL (microkernel), and this can flash a new u-boot. For this the flashall script needs to be run with an option:

    sudo ./flashall.sh --recovery

The script will be requiring another tool, xFSTK for which you can download the sources here: https://github.com/edison-fw/xFSTK. This builds at least on Ubuntu 20.04 and 20.10.

To install on Ubuntu:

    sudo dpkg -i xfstk-downloader-1.8.5.ubuntu20.04-amd64.deb

After, installing flashall recovery should work.

xFSTK

xFSTK can also be build directly from meta-intel-edison using the following command:

bitbake xfstk-native -caddto_recipe_sysroot

This will build the native version in a reproducible way, and place it in the sysroot. To run it:

oe-run-native xfstk-native xfstk-dldr-solo

When calling:

    make recover

Yocto will build the xfstk-native recipe then call:

    out/current/build/toFlash/flashall.sh --recovery --native

This will require:

  1. Yocto installed, so at least make setup
  2. toFlash filled with the image files, see Building the image