2 2
divis1969

Rock64 boot from SSD/HDD (attached via USB)

Recommended Posts

Hi,

Is it possible to boot from SSD? How it should be partitioned? Can I use any arbitrary partition for rootfs?

Should I follow the procedure from this thread ? It assumes I should write the armbian image to a whole drive instead of partition, right?

 

Well, I actually tried some way...

First, I've tried to just run some utility from ambian-config that transfers rootfs to a partition. Device did not boot after this (with SD card ejected).

Then I've flashed the ayufan's u-boot-flash-spi-rock64.img.xz. This also fails (boot log is attached) but the log looks promising.

 

BTW, I'm experimenting with Ubuntu 18.04 image built by myself from armbian's development branch. Should I use 16.04 instead?

 

Does armbian have its own image/procedure to place uboot into SPI?

 

Just in case here is the drive partitioning (fdisk log from Linux PC):

Disk /dev/sde: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x22138112

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sde1            2048 119769087 119767040  57.1G 83 Linux
/dev/sde2       156354560 488396799 332042240 158.3G 83 Linux
/dev/sde3  *    119769088 156354559  36585472  17.5G 83 Linux

Partition table entries are not in disk order.

And I'm trying to use third partition for rootfs. This partition was actually created after shrinking partition 1 in the freed space.

Drive is attached to USB3.

minicom.cap

Share this post


Link to post
Share on other sites

The "some utility from ambian-config" from my initial post seems exactly this nand-sata-install.

 

I've also tried it after SPI boot is flashed first. The results are the same.

Share this post


Link to post
Share on other sites

After some debugging I suppose the armbian's boot.scr seems completely ignore the boot partition number specified by ${distro_bootpart}.

In case of SD card boot it is equal 1 and this I suppose is the default value for operations like 'load ${devtype} ${devnum} ...'

 

Share this post


Link to post
Share on other sites

Finally I was able to boot from SSD's partition.

Attached is the patch for  boot-rk3328.cmd.

Steps:

1. Flash the ayufan's u-boot-flash-spi-rock64.img.xz to SD card, boot the device and wait for SPI bootloader flashed.

2. Flash the Armbian image (build with the patch) to SD card, boot the device with it

3. Login to a device, run nand-sata-install (copy rootfs to the selected SSD partition) , power off the device when finished.

4. Remove the SD card and boot the device.

diff.txt

Share this post


Link to post
Share on other sites

Did not work for me. I had already an Armbian image wrote to SD, so I patched the file /boot/boot.cmd and recompiled with sudo mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr.

Then rebooted and ran nand-sata-install.

This is the bootlog:

Spoiler

DDR version 1.12 20180104                                                       
In                                                                              
SRX                                                                             
LPDDR3                                                                          
786MHz                                                                          
Bus Width=32 Col=11 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=4096MB          
ddrconfig:7                                                                     
OUT                                                                             
                                                                                
U-Boot SPL 2017.09-ga0a2b48 (May 18 2018 - 08:07:29)                            
setup_ddr_param  1                                                              
booted from SPI flash                                                           
Trying to boot from SPI                                                         
NOTICE:  BL31: v1.3(debug):9d3f591                                              
NOTICE:  BL31: Built : 14:39:02, Jan 17 2018                                    
NOTICE:  BL31:Rockchip release version: v1.3                                    
INFO:    ARM GICv2 driver initialized                                           
INFO:    Using opteed sec cpu_context!                                          
INFO:    boot cpu mask: 1                                                       
INFO:    plat_rockchip_pmu_init: pd status 0xe                                  
INFO:    BL31: Initializing runtime services                                    
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE iniK
ERROR:   Error initializing runtime service opteed_fast                         
INFO:    BL31: Preparing for EL3 exit to normal world                           
INFO:    Entry point address = 0x200000                                         
INFO:    SPSR = 0x3c9                                                           
                                                                                
                                                                                
U-Boot 2017.09-ga0a2b48 (May 18 2018 - 08:07:44 +0000), Build: jenkins-linux-bu1
                                                                                
Model: Pine64 Rock64                                                            
DRAM:  4 GiB                                                                    
MMC:   rksdmmc@ff520000: 0, rksdmmc@ff500000: 1                                 
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
*** Warning - No block device, using default environment                        
                                                                                
In:    serial@ff130000                                                          
Out:   serial@ff130000                                                          
Err:   serial@ff130000                                                          
Model: Pine64 Rock64                                                            
misc_init_r                                                                     
cpuid=55524b5030393030330000000019221b                                          
serial=ffd85cc1a7e7931                                                          
normal boot                                                                     
Net:   eth0: ethernet@ff540000                                                  
Hit any key to stop autoboot:  0                                                
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
Card did not respond to voltage select!                                         
mmc_init: -95, time 9                                                           
starting USB...                                                                 
USB0:   USB EHCI 1.00                                                           
USB1:   USB OHCI 1.0                                                            
USB2:   Core Release: 3.10a                                                     
USB3:   Register 2000140 NbrPorts 2                                             
Starting the controller                                                         
USB XHCI 1.10                                                                   
scanning bus 0 for devices... 2 USB Device(s) found                             
scanning bus 1 for devices... 1 USB Device(s) found                             
scanning bus 2 for devices... 1 USB Device(s) found                             
scanning bus 3 for devices... 2 USB Device(s) found                             
       scanning usb for storage devices... 2 Storage Device(s) found            
                                                                                
Device 0: Vendor: WD       Rev: 1012 Prod: My Book 1140                         
            Type: Hard Disk                                                     
            Capacity: 2861556.0 MB = 2794.4 GB (732558336 x 4096)               
... is now current device                                                       
Scanning usb 0:1...                                                             
ethernet@ff540000 Waiting for PHY auto negotiation to complete......... TIMEOUT!
Could not initialize PHY ethernet@ff540000                                      
missing environment variable: pxeuuid                                           
missing environment variable: bootfile                                          
Retrieving file: pxelinux.cfg/01-6a-1b-b4-e4-1f-fd                              
ethernet@ff540000 Waiting for PHY auto negotiation to complete......... TIMEOUT!

 

I don't know if this is because I am using an hdd instead of sdd, and maybe the slow spin up time causes problems... I will try with another disk.

Share this post


Link to post
Share on other sites

How is your drive partitioned? I suppose the partition intended for booting should be marked with boot flag. Not sure whether nand-sata-setup is setting it.

Uboot should be able to find the script first:

       scanning usb for storage devices... 1 Storage Device(s) found

Device 0: Vendor: Samsung  Rev: 8101 Prod: SSD 850 EVO 250G
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
Scanning usb 0:3...
Found U-Boot script /boot/boot.scr

BTW, I should say this booting is not as reliable as I wish. In my case device typically does not boot or hangs sometime time later. Most likely this is because power consumption of my drive is excessive, but perhaps USB init is also not reliable - if I start the device without the serial console (USB/TTL converter), device does not boot in 99% cases. If converter is attached - device boots on second-third attempt (with reset button), and works pretty good for a long time (this actually confuses me, because console does not provide any power, maybe device becomes slower.?..)
 

Share this post


Link to post
Share on other sites
(edited)

On a Pi when do this you need to make a couple changes before it will boot.  The drive will probably become /dev/sda (with partition numbers).  Mount the drive so you can work on it,  then edit the /etc/fstab (the one on the hard drive, not the one on your sd card.  The perspective is about to change, instead of root being on something like /dev/mmcblk0p2 it's going to be on probably /dev/sda2.  Change that in fstab.  See the fstab man page if in doubt.  Unmount the partition when you're done.

 

I don't have my Rock running right now but if it has a boot partition you need to edit cmdline.txt (again,be sure it's the one on the hard drive, not your sd one).  So mount the 1st partition (/dev/sda1 probably).  Open cmdline.txt in your text editor and where it says root=/dev/mmcblk0p change that to root=/dev/sda1. Unmount the partition.

 

I've seen my rock64 under Ayufan's Debian and Ubuntu, both had 7 partitions, I don't know if that's common.  Most everything was in the last one, look at the sizes.

 

I had mine working but there seems to be some sort of timeout in the USB hardware on my Pi. When I walk away for 10 minutes or so it disconnects.  Different operating systems, an SD card in a reader instead of a hard drive, same thing happens.  Usually a crash and whatever was mounted needs to be fscked.  So I boot from SD, keep important stuff on the hard drive.  Good for changing operating systems or computers, just plug it in and mount it.  I plug it into my Pi  or my Rock64, works the same.  Handy once you get used to it.

Edited by ab1jx
Pi 2 parttions vs rock's 7 partitons

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2