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 …
Let’s break down the bootcmd shown above:
bootargs:
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.
Technical specification tables can not be displayed on mobile. Please view on desktop