Home Forums Hardware discussions How do I boot from a hard drive? Reply To: How do I boot from a hard drive?


@TheLinuxBug – Thank you for the easy snippet.

For those who want to try booting from SATA, I’d like to provide some details.
First: You do not have to use the “save” or “saveenv” command before you’re sure that your bootcmd is correct.
By that, I mean that you can start up your EspressoBIN, hit space to stop the boot process and then type your “setenv bootcmd …” line followed by “run bootcmd”. Your defaults will not be changed, so if you press the reset button, you’ll boot from mmc.
This minimizes the risk of messing up the SPI-flash.

Once you’ve confirmed that your bootcmd is correct, you can type the “setenv bootcmd …” line followed by “save”; this allows you to experiment and fail a few times before getting it right. 🙂

Next, I have my harddisk partitioned so that my rootfs is on partition number 8.
My boot partition is still the first partition, but the line from @TheLinuxBug will need slight modifications to work with a rootfs on other partitions than the first:

setenv bootcmd 'scsi scan; scsi dev 0; ext4load scsi 0:1 $kernel_addr $image_name;ext4load scsi 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/sda8 rw rootwait; booti $kernel_addr - $fdt_addr'

As you see here, I’ve modified the argument to “root=” from /dev/sdb1 to /dev/sda8.

If you want to make sure that you got the partition number right, you can …

  • Check partition 1: ext4ls scsi 0:1 /
  • Check partition 2: ext4ls scsi 0:2 /
  • Check partition 8: ext4ls scsi 0:8 /

Let’s break down the bootcmd shown above:

  • “scsi scan” … probe/scan for ‘scsi’ devices (our SATA is in this category). Without this, any access to scsi would fail.
  • “scsi dev N” … set current device to N.
  • “ext4load scsi 0:1 $kernel_addr $image_name” – from scsi device 0, partition 1, load the image named $image_name to memory address $kernel_addr.
  • “ext4load scsi 0:1 $fdt_addr $fdt_name” – like above, the fdt (Flattened Device Tree) blob is loaded into memory address $fdt_addr.
  • “setenv bootargs $console root=/dev/sda8 rw rootwait” – set up boot arguments that are passed to the kernel; see below.
  • “booti $kernel_addr – $fdt_addr” – boot the linux kernel image that we loaded into memory earlier and point to the flattened device tree. The dash is because we don’t have an initrd image, but we want to specify a fdt argument.


  • “root=/dev/sda8” – we’ve covered this one; this sets the root file system (eg. which partition is “/”)
  • “rw” – mount the root file system as read/write
  • “rootwait” – wait (indefinitely) for root device to show up (useful for devices that are detected asynchronously, such as USB and MMC devices).

In addition, ‘$console’ is given as a part of bootargs; it’s simply another variable that is expanded:
The value of $console on my device is …
console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000
-It simply sets up the serial interface to 115200 baud.
(It’s best not to make any changes to the serial console, as this is your “life-line”).
If you want to fiddle with these settings, here are a few values that should be valid:
1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 153600, 230400, 250000, 256000, 460800, 500000, 576000 and 921600.
-Make sure your terminal suports the speed you’re setting or you’ll be in lots of trouble trying to get things working again.

There are much more to uboot than described here; for instance, the setup Arch Linux uses for EspressoBIN is much different.
Some people like to break some of the arguments out so they’re using environment variables; this allow you to change settings easily without rewriting the bootcmd.
For instance, you could make a new environment variable called bootPart and set it to your rootfs partition – just in case you want to change it some day in the future.

I hope this will help you getting your hands dirty; eg. making your EspressoBIN boot from SATA or even eMMC if you prefer – but remember to keep log files away from eMMC, MMC and SDcard devices. I recommend having a separate partition for /var.
For eMMC, MMC and SD, it might be useful to mount all other partitions than /var (especially rootfs) as read-only by default.
-But make sure you’re familiar with the mount command, so you can re-mount as read/write when you want to make changes.

Signup to our newsletter

Technical specification tables can not be displayed on mobile. Please view on desktop