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

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #368

    What’s the uBoot magic to get it to boot from a hard drive without the SDCard? I assume that can be done…

    I’m running Arch ARM, but I guess it’s similar for all distros.

    If this is documented somewhere already, and I didn’t see it, my apologies: please point me to it.

    Benjamin Huang

    Hi jernst,

    Please do “scsi reset” under u-boot to check if your SATA drive can be detected, then do ext4ls to list the file system of your SATA partition. To setup boot from SATA drive is very similar to boot from SD card, except to use scsi instead of mmc as the parameter to the ext4load. We’ll try to get the instructions on the ESPRESSObin wiki, before it is ready, please check the doc at http://wiki.macchiatobin.net/tiki-index.php?page=Use+SATA+drives+in+U-Boot for reference.

    Below are the examples for scsi reset and ext4ls
    Marvell>> scsi reset

    Reset SCSI
    Setting SCSI to 0
    Target spinup took 0 ms.
    AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
    flags: ncq led only pmp fbss pio slum part sxs
    scanning bus 0 for devices…
    Device 0: (0:0) Vendor: ATA Prod.: PNY CS1311 120GB Rev: CS13
    Type: Hard Disk
    Capacity: 114473.4 MB = 111.7 GB (234441648 x 512)
    Invalid port number 2
    Invalid port number 3
    Invalid port number 4
    Invalid port number 5
    Invalid port number 6
    Invalid port number 7
    Found 1 device(s).

    Marvell>> ext4ls scsi 0:1 /

    4096 .
    4096 ..
    16384 lost+found
    4096 bin
    4096 boot
    4096 dev
    4096 etc
    4096 home
    4096 lib
    4096 media
    4096 mnt
    4096 opt
    4096 proc
    4096 root
    4096 run
    4096 sbin
    4096 srv
    4096 sys
    4096 tmp
    4096 usr
    4096 var


    You may wish to see this thread for how to boot from SATA: Armbian Forum

    Also including some info below:

    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/sdb1 rw rootwait; booti $kernel_addr - $fdt_addr'
    run bootcmd

    In the post I include my u-boot config for booting from SATA. If it will be the only drive attached and you do NOT have USB drives connected it should be changed to reflect /dev/sda1 in your case.

    I also used Boot from removable storage – Ubuntu as a reference, and if you type help while in u-boot its pretty easy to get help on the needed commands.

    Hope this helps!



    @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.


    Got it to work just fine since I posted this. Thanks for all the help.

    Documented here: https://ubos.net/docs/users/installation/espressobin.html#optional-boot-from-a-sata-disk-instead-of-an-sd-card

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Signup to our newsletter

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