Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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} ...'

 

Posted

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

Posted

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.

Posted

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.?..)
 

Posted (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
Posted

Sorry to resurrect an old thread!

As a new Armbian user on Rock64, I found this thread while searching for a guide on how to boot from a usb device. After playing around with partitions and the armbian-config utility,  I realized that after copying rootfs to the usb device, the board will still read from the /boot partition on the sd card, then will load rootfs from the external drive. If the board is powered on without the sd card, boot will fail. This method works fine for my purposes. If there is a way to configure the rock64 to read from a /boot partition on a usb device, I haven't found one.

 

I hope this helps any other new folks like myself who want to run Armbian from usb/ssd on Rock64. Cheers!

Posted
5 hours ago, UnicornFarts said:

If the board is powered on without the sd card, boot will fail.

First, make sure that U-Boot is detecting USB drive as a Mass Storage device.

Second, make sure that USB drive has a /boot directory stuffed with all required files, it should not be a mount point where the /boot of SDCard is mounted there.

Third, make sure this USB /boot/armbranEnv.txt has the proper UUID of the USB partition in "rootdev" variable.

 

Posted
5 hours ago, martinayotte said:

First, make sure that U-Boot is detecting USB drive as a Mass Storage device.

Second, make sure that USB drive has a /boot directory stuffed with all required files, it should not be a mount point where the /boot of SDCard is mounted there.

Third, make sure this USB /boot/armbranEnv.txt has the proper UUID of the USB partition in "rootdev" variable.

 

How can I tell that u-boot detects usb drive as a mass storage device?

 

I copied /boot from /dev/mmcblk1 (sdcard) to usb drive

unmounted the sdcard

put copied files into /boot on usb drive

edited new /boot/armbianEnv.txt to set rootdev to UUID of usb drive as reported from gnome-disks

powered off and removed sdcard

powered on and no boot.

 

I then noticed that the file /boot/boot.cmd also contains: 

setenv rootdev "/dev/mmcblk1"
 

changed to:

setenv rootdev "/dev/sda1"

 

rebooted, but still won't boot without sdcard. Ideas?

Posted

I have not tried this with an armbiasn build,  but am successfull using Ayufan's from a Samsung  portable SSD attached via USB3 port,  I had to use SPI flash for u-boot and enable a rootdelay  (I am using 90 right now which is much longer than it needs to be) That  would be one of the bootargs in the boot.cmd file, I would think.  Not sure if can be added from armbianEnv.txt   I know that rootwait is already one of the boot args,  but I think that perhaps that rootdelay is perhaps called at a different point in startup.  FWIW

Posted
17 hours ago, UnicornFarts said:

How can I tell that u-boot detects usb drive as a mass storage device?

During u-boot detection phase ...

Do you have a USB-TTL Serial dongle  attached to debug pins to see the logs ?

On 11/18/2018 at 4:18 AM, UnicornFarts said:

If the board is powered on without the sd card, boot will fail.

Oh ! Almost forgot to ask before : Do you have an eMMC modules on your board ? If not, then the only possible option to get U-Boot installed on the small 8 pins SPI-NOR Flash IC, but I've never tried that.

13 hours ago, UnicornFarts said:

Does /boot need to be FAT?

With Ayufan build, yes, but not with Armbian builds ...

 

Posted
On 11/19/2018 at 3:12 AM, UnicornFarts said:

Dumb question:

Does /boot need to be FAT?

No, it can be any bootable partition. Did you read the thread? I've showed the partitioning of SSD I've used to boot.

The main issue with Armbian booting from SSD is that its uboot script does not correctly handle partitions. Check the diff.txt I've attached to my message of May 17.

Unless you apply this somehow (build Armbian by yourself, for example), this booting from SSD won't work.

Posted

I can never seem to get the Rock64 to boot consistently from the SSD. Sometimes it comes up, sometimes it just "hangs". About once out of every 6 or seven times can I SSH into it - this is regardless of distro whether it's Bionic or Stretch. This is totall after flashing it to allow for USB boot.

 

On the Pi, I was able to solve this 100% of the time by using a small microSD card with nothing but "bootcode.bin" and an empty file called "timeout" which tells the boot to hang for a bit while things "spin up" and the SSD (or HD) mass storage come available. Once I did this, all my Pi's work great. In addition with the Pi I am able to do all of this completely "headless" where I can restore an .img onto the SSD, copy over a wpa_supplicant.conf file and touch an ssh file and "boom", I can always get to it consistently without having to prep it by plugging in a monitor and keyboard to make manual changes before booting it headless. 

 

Are there any steps to make this a similar possibility with the Rock64? Is there some image I can put on an SD card that will accomplish the same thing and then let bootup happen and continue on the image restored to the SSD that is hanging off the USB 3.0 port? Personally I don't care if it has a microSD in it or not - as long as it boots consistently 100% of the time and all of the real I/O occurs on the SSD drive. 

 

Thanks!

 

Ryan

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines