Home › Forums › Hardware discussions › How do I boot from a hard drive?
Tagged: cheap tadalafil 5mg SexheenCe
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.
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 /
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'
save
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!
Cheers!
@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.
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
Technical specification tables can not be displayed on mobile. Please view on desktop