Author Topic: CubieTruck Plus boot from SATA hard drive  (Read 332 times)

Offline aragorn2101

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
CubieTruck Plus boot from SATA hard drive
« on: November 20, 2017, 02:26:19 am »

Hey guys,

I've got a CubieTruck Plus (Cubieboard v5) currently booting from EMMC with Linaro Ubuntu 14.04. Everything is fine but I was wondering if I can make it boot from the SATA hard drive. It would be nice to have all the space.

I have noticed that the board does not boot if I put an empty micro SD in. It also does not boot when I connect the SATA hard drive. I would have been happy if it booted just fine with an empty drive plugged in. I could mount it and store all my data or move my home directory there. But it is just not booting.

So, I thought, since it is not booting at all, maybe connecting any drive (micro SD or SATA HD) makes the boot process ignore the EMMC and look for bootloaders on the drives instead.

I have seen that it is possible to burn the linaro image to SD card so that it boots the OS from there instead of EMMC. Is it possible to do the same thing with the SATA hard drive? Can I just clone the micro SD Linaro to the SATA hard drive and boot from there?

Offline rgmhtt

  • Full Member
  • ***
  • Posts: 175
  • Karma: +4/-1
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #1 on: November 23, 2017, 02:35:04 pm »
I only have Cubietrucks and I use Fedora/Centos.

But...

I suspect you have a uboot with Linaro.  Put JUST the uboot on the mSD; NO PARTITIONS.

Put all your OS partitions  on the SATA drive.

Boot and see what happens.

I worked with the uboot developer for Allwinner CPUs some years ago getting this working, and I use it all the time.  The key point is ONLY uboot on the mSD card.


Offline aragorn2101

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #2 on: November 26, 2017, 06:12:37 am »
Thanks a lot for your reply rgmhtt.

I just tried what you suggested. Unfortunately, it did not work. I got messages like a kernel panic.

One question: how does the board know where the / filesystem is?

I think this is the key. I use Linux all the time and booting a distro on a PC is quite simple. The bootloader is given the instruction where to find the kernel and the / filesystem (e.g. /dev/sda2,3,4...).

But here, how does it work? I find it a bit disappointing that there is not more information about these technicalities. These boards are very good in terms of open sourcing, but we need more information to be able to tweak things.

Offline rgmhtt

  • Full Member
  • ***
  • Posts: 175
  • Karma: +4/-1
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #3 on: November 26, 2017, 08:23:45 am »
Again, I use only Fedora and Centos.  In fact I am one of the armv7hl testers for these distros.

There are clear instructions on the Fedora arm site and Centos about this.  Plus I have it on my website:

http://medon.htt-consult.com/Centos7-armv7.html

I currently do not have a separate CubieTruck uboot on my site, but I can put one there for you.  When you boot up, what uboot version is reported to the console?

Allwinner A20 uboot for some time has 'know' that if there are no partitions on the mSD card, to look for sata or usb (though I have not tried usb for a long time).  I don't think they goot the nrand partitions working for booting...

It is all in the uboot.  see what my console looks like booting a Cubie2:


U-Boot SPL 2016.09.01 (Oct 19 2016 - 13:46:44)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC1


U-Boot 2016.09.01 (Oct 19 2016 - 13:46:44 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Cubietech Cubieboard2
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SCSI:  Target spinup took 0 ms.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
Net:   eth0: ethernet@01c50000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
Hit any key to stop autoboot:  2  1  0
switch to partitions #0, OK
mmc0 is current device
** Invalid partition 1 **
scanning bus for devices...
  Device 0: (0:0) Vendor: ATA Prod.: WDC WD3200BPVT-8 Rev: 01.0
            Type: Hard Disk
            Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
Found 1 device(s).

Device 0: (0:0) Vendor: ATA Prod.: WDC WD3200BPVT-8 Rev: 01.0
            Type: Hard Disk
            Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
... is now current device
Scanning scsi 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf


Offline rgmhtt

  • Full Member
  • ***
  • Posts: 175
  • Karma: +4/-1
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #4 on: November 26, 2017, 08:56:53 am »
Another thought.

Your distro may be using the original Cubie uboot, not the independent sunxi uboot.  You would know this if your WiFi and Bluetooth work.  These were never 'cracked' by the open community.  The original uboot does not know how to switch to the sata, and a kernel that works with the original uboot would not know how to interact with the open sunxi uboot.  You would have to check the sunxi uboot site for Linaro support, or the Linaro web site.


Offline aragorn2101

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #5 on: November 27, 2017, 03:31:19 am »
Thank you so much, rgmhtt.

It worked. I actually had a small misunderstanding from your first reply. I made the bootable microSD and transfered the root filesystem to a SATA drive. But I deleted only the root filesystem partition from the microSD and the partition mmcblk1p1 was still there (with the uImage). That's why the kernel panic: it was looking for the root filesystem on the microSD itself.

That link you posted did the trick. Now I understand. The "MBR" of the microSD does the work. So, I put the Linaro image on the microSD again and opened it with fdisk, and deleted all partitions, after transfering contents to SATA drive. It booted and used the SATA drive. Great.

Just one last question out of curiosity: if I have to transfer that uBoot to another microSD, can I use dd and read the first 512 bytes like I would do with a MBR hard disk?

Offline rgmhtt

  • Full Member
  • ***
  • Posts: 175
  • Karma: +4/-1
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #6 on: November 27, 2017, 06:13:43 am »
It is much more than a MBR of 512 bytes,  The uboot is equivalent to an i386 BIOS.  The Cubietruck one I have here  for 10/26/17 is 545.6KB.  So your dd is much larger than moving a MBR.

I use the cheapest, smallest mSD card I can get for this purpose, and just dd the more.

I just uploaded the 10/26/17 Cubietruck uboot:

http://www.htt-consult.com/~rgm/cubieboard/u-boot-CT-10-2016-sunxi-with-spl.bin

You can try that in place of the Cubie2 I have in my guide.

BTW, on Fedora/Centos, you install uboot-tools and there there is a directory (somewhere) with ALL the current various board uboots...

Offline aragorn2101

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: CubieTruck Plus boot from SATA hard drive
« Reply #7 on: November 27, 2017, 06:27:26 am »
Ok, I see.

Yeah, I'm also going to buy the smallest possible microSD and move the uBoot there.

Many thanks for your help. Now we understand better how booting works on these devices.
I'll certainly try the uboot-tools.

Best regards.

;D
« Last Edit: November 27, 2017, 06:28:58 am by aragorn2101 »