WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Cubieboard Install  (Read 36169 times)

Offline Peter Pudney

  • Newbie
  • *
  • Posts: 7
Re: Cubieboard Install
« Reply #15 on: January 12, 2014, 06:32:51 PM »
UPDATE: I have now got TC5 to boot to the command prompt on a Cubieboard 2; see the updated instructions in Reply #19.

I am trying to install TC5 (http://distro.ibiblio.org/tinycorelinux/5.x/armv7/Allwinner-A10/) on a CubieBoard 2 (A20) SD card. The kernel is starting, but stalls after the message:

  <6>Calibrating delay loop...

I am writing my SD card from a Mac. The steps were:

  • Clean the SD card:
    • unmount the volume using Disk Utility
    • sudo dd if=/dev/zero of=/dev/disk1 bs=1m count=1

  • Partition the SD card using Disk Utility: FAT, one partition.
  • Using the files from cubieboard2-linux3.3_hwpack/bootloader (from http://dl.linux-sunxi.org/users/hramrach/cubieboard2-linux3.3_hwpack.tar.xz)
    • unmount the volume
    • sudo dd if=sunxi-spl.bin of=/dev/disk1 bs=1024 seek=8
    • unmount the volume
    • sudo dd if=u-boot.bin of=/dev/disk1 bs=1024 seek=32

  • Copy `uImage` and `uCore` to the volume.
  • Copy `boards/cubieboard_script.bin` to the volume as `script.bin`.
  • Copy `uEnv.txt` and `boot.scr` to the volume.

I have attached a file of boot messages.

What should I try next?
« Last Edit: January 16, 2014, 07:38:58 PM by Peter Pudney »

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #16 on: January 15, 2014, 08:32:57 AM »
Hi: I have cubietruck. Are you sure that the media needs to unmounted when you run the dd command?
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline Peter Pudney

  • Newbie
  • *
  • Posts: 7
Re: Cubieboard Install
« Reply #17 on: January 15, 2014, 05:05:20 PM »
The SD card does have to be unmounted when you use the dd commands, otherwise you get (on a Mac):

    dd: /dev/disk1: Resource busy


On a Mac, the SD card will automatically remount after each dd command, and so you have to unmount it before each dd command. You can do this from Disk Utility by control-clicking on the volume.

As far as I can tell, I have successfully written the SD card. My problem occurs while booting the Cubie2. I can see what is happening by connecting the Cubie2's USB/serial cable to the serial pins on the Cubie2 board and monitoring the serial port using CoolTerm on the Mac. The boot messages are attached to my previous message. It all seems to proceed as expected until "Calibrating delay loop...", then stalls.

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #18 on: January 16, 2014, 08:16:33 AM »
Hi: You might be right. When I did the dd on Mint14 CLI the SD was mounted. After the image was written, the SD was unmounted. May be Linux unmount s  it automatically. The dd error or success messages are not very helpful!
As far as I remember, when I tried to dd while the sd card was mounted, i got an error message such as "can not write to..." I will double check. Within the ARM world, the new sd card needs to be formatted as FAT! Not a ms fdisk FAT. It must be a Linux FAT. (gparted or cli or so) If you have MAC how did you do it?
The sd card needs a boot loader plus a boot partition holding the kernel and some other files. In addition to that you need a root partition for the rest of the operating system.
This is the case for all ARM boards with Allwinner SoC.!
Boot- and root partition need to be ext2 or ext3. So the best way to make a sd is to use a Linux distri.
You could doctor with a hex editor and look whether there is the initial "pre loader" on your sd card at sector 16.
The u-boot boot loader is about 512kB in size. Behind that you must have various configuration information  up to sector 2048. The first partition on the sd card must be FAT or ext2 - nothing else - and must start at sector 2048. Otherwise you will have a conflict with the boot loader. Please let me know the results.

The boot process in ARM is more difficult than in the X86 world. But as allays, once we know it, it is easy. I am about to learn that stuff and have posted an idea for a cubieCore in my most recent post.
Please let me know what you think.
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline Peter Pudney

  • Newbie
  • *
  • Posts: 7
Re: Cubieboard Install
« Reply #19 on: January 16, 2014, 07:35:15 PM »
I have successfully got TC5 to boot to the command prompt on a Cubieboard 2 (A20). Here are instructions for creating a bootable SD card using Mac OS X. The process using Linux should be similar; the key is to use the boot files and kernel (iImage) from the Cubieboard2 hardware pack.

In the instructions below, make sure that you change diskx to the disk number (disk1, disk2, ...) of your SD card. You can find the disk number of the SD card using the mount command from an OS X terminal.

  • Download TC5 from http://distro.ibiblio.org/tinycorelinux/5.x/armv7/Allwinner-A10/. You need uCore, uEnv.txt and boot.scr.
  • Download the Cubieboard hardware pack from http://dl.linux-sunxi.org/users/hramrach/cubieboard2-linux3.3_hwpack.tar.xz
  • Clean the SD card:
    • unmount the volume using Disk Utility (control-click on the volume, then select unmount)
    • sudo dd if=/dev/zero of=/dev/diskx bs=1m count=1

  • Partition the SD card using Disk Utility. Select Partition Layout: 1 Partition with Options: Master Boot Record. Format as MSDOS (FAT).
  • Using the files from cubieboard2-linux3.3_hwpack/bootloader
    • unmount the volume
    • sudo dd if=sunxi-spl.bin of=/dev/diskx bs=1024 seek=8
    • unmount the volume
    • sudo dd if=u-boot.bin of=/dev/diskx bs=1024 seek=32

  • Copy uImage and script.bin to the volume from cubieboard2-linux3.3_hwpack.
  • Copy uCore, uEnv.txt and boot.scr to the volume from the TC5 distribution.


Insert the SD card into the Cubieboard 2 and apply power. Within 10 seconds the HDMI screen should show the TC5 prompt

    tc@box:~$

My next task is to get the GUI working.

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #20 on: January 17, 2014, 06:20:08 AM »
good morning:
thank you for sharing that info with me. I will try o do the same asap on my cubietruck. Yesterday I used dd to write an excellent server image (CTDebian) to my sd card. You are right, I left the sd card unmounted and it worked. Using dd a few weeks ago on an unmounted sd card brought me the "no media found" error. Strange? Ok but now I know.

If you are interested, the debian server images are on the cubyboard forum. It helps to be a member there also. Please find more info here:
http://www.cubieforums.com/index.php?action=printpage;topic=1275.0
As far as I know it works on CB2 also.
This server is a great work and boots lightning fast into command line. I also would like to put a light gui onto that server and use it as a mini desktop. The procedure should be similar to the Core gui.

t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #21 on: January 17, 2014, 10:21:54 AM »
Hi again: I followed your instructions - formatted the 2GB sd card FAT16 using gparted in Linux. Then I cleaned it.
Close to the URL folder  where your hawpack for cubieboard2 is located, I found a cubietruck_hwpack and used this one.
It had the  folders with the same name like your in cubietruck hwpack.

/bootloader
/kernel
/rootfs

Questions: Do I have to copy these three folders including its content  into my FAT16 partition? or just the script.bin?
Where do I copy the uCore. uEnv.txt and boot.scr?

My partition has no folders and just the files in it:
 /boot.scr
 /script.bin
 /uCore
 /uEnv.txt
 /uImage /boot.scr
 /script.bin
 /uCore
 /uEnv.txt
 /uImage

Which one of these files must executable? Could there be a problem with ownership?

Thank you for your help

t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Cubieboard Install
« Reply #22 on: January 17, 2014, 11:47:07 AM »
I followed your instructions - formatted the 2GB sd card FAT16 using gparted in Linux. Then I cleaned it.
I am curious how you cleaned a NAND based card ?

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #23 on: January 17, 2014, 12:13:03 PM »
Hi:
cubietruck has nand memory and a slot for a microsd card. I am trying to put core for A10 onto the cubietruck which is A20.
To clean a sd card Robert and Peter Pudney recommended to clean the sd card before writing on it:
sudo dd if=/dev/zero of=/dev/diskx bs=1m count=1
You probably thought I took it to the cleaner.  Now you know. :)
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Cubieboard Install
« Reply #24 on: January 17, 2014, 12:27:34 PM »
Was just curious, because normally writing zero's to nand flash actually fill's the cells and severely degrades it's immediate writing performance.  Writing 1's on the other hand empty's the cells

Will have to find a method which works,  will get back to you on that

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #25 on: January 17, 2014, 12:43:54 PM »
good point - never thought of that.
nand memory I call the built in memory in cubietruck.
sd memory I am calling the microSD cards, which fit into a slot on the cb3 board and act like a hard drive.
RaspberryPi f.i. has no nand - just an SD card slot
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline Peter Pudney

  • Newbie
  • *
  • Posts: 7
Re: Cubieboard Install
« Reply #26 on: January 17, 2014, 05:43:04 PM »
I am not sure how necessary it is to write zeroes to the beginning of the SD card, but it is recommended on several forums. I have omitted this step a few times, without any problems.

Copy just the files, not the folders, from the hardware pack and TC distribution to the SD card. My SD card looks like this:

$ ls -l
total 12864
-rwxrwxrwx@ 1 pjp  staff      304 17 Mar  2013 boot.scr
-rwxrwxrwx@ 1 pjp  staff    45088 23 Jun  2013 script.bin
-rwxrwxrwx@ 1 pjp  staff  2925169  2 Jan 06:10 uCore
-rwxrwxrwx@ 1 pjp  staff      117  3 Sep 22:35 uEnv.txt
-rwxrwxrwx@ 1 pjp  staff  3487576 23 Jun  2013 uImage


uImage and script.bin are from the kernel folder in the Cubie hardware pack; boot.scr, uCore and uEnv.txt are from the TC distribution.

I copied the files to the SD card using the Mac OS X GUI, which set the permissions as shown above. My SD card also contains a few hidden files that OS X uses for icons and trash, but these do not appear to effect anything.

You can monitor the boot process using a serial TTL to USB cable (supplied with my Cubieboard 2): http://linux-sunxi.org/Cubieboard/TTL

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Cubieboard Install
« Reply #27 on: January 17, 2014, 06:34:49 PM »
Hi again: I followed your instructions - formatted the 2GB sd card FAT16 using gparted in Linux.
Which one of these files must executable? Could there be a problem with ownership?

msdos/fat filesystems do not provide for POSIX permissions at all   ;)
« Last Edit: January 17, 2014, 06:36:38 PM by tinypoodle »
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Cubieboard Install
« Reply #28 on: January 18, 2014, 07:00:52 AM »
Hi Peter Pudney:
Thanks for the info. I tried several approaches and - no luck. In one case I produced a microSD which boots my CT into the NAND android 4.2.2 -- wow this is strange. The other cards did not boot at all.
My ct is Allwinner A20 2x cortex A7. The CB2 is also A20 and 2x cortex A7. But I am still not sure whether I should use the files from:
http://dl.linux-sunxi.org/users/oliver/cubietruck_hwpack.tar.xz
or from:
http://dl.linux-sunxi.org/users/hramrach/cubieboard2-linux3.3_hwpack.tar.xz --> you used his one

Here is how my content of the cubietruck_hwpack.tar.xz file looks like:
cubietruck hwpack content:

/cubietruck_hwpack/bootloader
/cubietruck_hwpack/kernel
/cubietruck_hwpack/rootfs

in /cubietruck_hwpack/bootloader there are the following files:

/cubietruck_hwpack/bootloader/sunxi-spl.bin
/cubietruck_hwpack/bootloader/u-boot.bin
/cubietruck_hwpack/bootloader/u-boot.img

I discovered that I have an additional file here named:u-boot.img
I do not know what to do with this file?

Question: When you dd the two .bin files to your sd card, did that generate the two partitions needed for a bootable sd card?
A bootable sd card needs the boot loader at the beginning of the partition up to sector 2048. After that the "boot stuff" is looking for an ext2 partition. In an older http://linux-sunxi.org/index.php.. article "Bootable SD card" it is recommended that you format this separate /boot partition FAT and after the dd. This does not make sense because it overwrites the code in front of  sector 2048 and in this case  the FAT partition starts at sector 1. Which means no u-boot no boot at all.

I might be almost there if I would know which sunxi-spl.bin and which u-boot.bin I should use. The ones from cubieboard2 or from cubietruck. In addition I need to know what to with that u-boot.img from the cubietruck  hwpack?

After that is done I could create a 64 MB ext2 partition starting at sector 2048 which would be the boot partition. Fies: uCore, uEnv.txt and boot.scr probably belong into this partition.

Behind the boot 64 MB boot partition the rext4 root partition could start at sector 133120. So now what belongs into this root partition?
I could put the content from the hw_pack /cubietruck_hwpack/rootfs folder into it?

If somebody could help me here I might be able to have a Core for cubietruck

t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline Peter Pudney

  • Newbie
  • *
  • Posts: 7
Re: Cubieboard Install
« Reply #29 on: January 18, 2014, 07:17:34 PM »
I suspect you should be using the cubietruck hardware pack.

The "Bootloader" section of the Bootable SD card article (http://linux-sunxi.org/Bootable_SD_card) has an example where u-boot.img is placed at sector 40 instead of placing u-boot.bin at sector 32.

When I partitioned my SD card, the single partition was placed at sector 8192. When I examine the SD card using fdisk I get:


Disk: /dev/disk2   geometry: 966/255/63 [15523840 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: 0B 1023 254  63 - 1023 254  63 [      8192 -   15515648] Win95 FAT-32
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused     
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused     
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused     


The "Starting" and "Ending" values do not look right, but my fdisk man page says most modern systems use the "start" and "size" fields instead.

The "Partitioning" section of the Bootable SD card article says you can use only one partition; it is an experimental feature, but it works for me.

When I dd the two bin files they are placed at sectors 8 and 32, well before the single partition.

I ignored the roofs folder from the Cubie hardware pack---TinyCore does not appear to need it.

What messages do you get from the serial port while booting?