Navigation

User login

CuBox-i4Pro

Somewhere back in August or September, I pre-ordered a CuBox-i — A nicely finished, completely hackable, and reasonably powerful ARM system, nicely packaged and meant to be used to hack on. A sweet deal!

There are four models (you can see the different models' specs here) — I went for the top one, and bought a CuBox-i4Pro. That means, I have a US$130 nice little box, with 4 ARM7 cores, 2GB RAM, WiFi, and... well, all of its basic goodies and features. For some more details, look at the CuBox-i block diagram.

I got it delivered by early January, and (with no real ARM experience on my side) I finally got to a point where I can, I believe, contribute something to its adoption/usage: How to get a basic Debian system installed and running in it.

The ARM world is quite different to the x86 one: Compatibility is much harder, the computing platform does not self-describe properly, and a kernel must first understand how a specific subarchitecture is before being able to boot on it. Somewhere in the CuBox forums (or was it the IRC channel?) I learnt that the upstream Linux kernel does not yet boot on the i.MX6 chip (although support is rumored to be merged for the 3.14 release), so I am using both a kernel and an uBoot bootloader not built for (or by) Debian people. Besides that, the result I will describe is a kosher Debian install. Yes, I know that my orthodox friends and family will say that 99% kosher is taref... But remember I'm never ever that dogmatic. (yeah, right!)

Note that there is a prebuilt image you can run if you are so inclined: In the CuBox-i forums and wiki, you will find links to a pre-installed Debian image you can use... But I cannot advise to do so. First, it is IMO quite bloated (you need a 4GB card for a very basic Debian install? Seriously?) Second, it has a whole desktop environment (LXDE, if I recall correctly) and a whole set of packages I will probably not use in this little box. Third, there is a preinstalled user, and that's a no-no (user: debian, password: debian). But, most importantly, fourth: It is a nightly build of the Testing (Jessie) suite... Built back in December. So no, as a Debian Developer, it's not something we should recommend our users to run!

So, in the end and after quite a bit of frustration due to my lack of knowledge, here goes the list of steps I followed:

I created a 2GB partition, but much less can suffice; I'd leave it at least to 1GB to do the base install, although it can be less once the system is set up (more on this later). Partition and format using your usual tools (fdisk+mke2fs, or gparted, or whatever suits your style).

Install the bootloader

I followed up the instructions on this CuBox-i forums thread to get the SPL and uBoot bootloader running. In short, from this Google Drive folder, download the SPL-U-Boot.img.xz file, uncompress it (xz --decompress SPL-U-Boot.img.xz), and write it to the SD card just after the partition map: As root,# dd if=SPL-U-Boot.img of=/dev/mmcblk0 bs=1024 seek=1 skip=1.
Actually, to be honest: As I wanted something basic to be able to debug from, I downloaded (from the same Google Drive) the busybox.img.gz file. That's a bit easier to install from: xz --decompress busybox.img.xz, and just dump it into the SD from the beginning (as it does already include a partition table):# dd if=busybox.img of=/dev/mmcblk0
This card is already bootable and minimal, and allows to debug some bits from the CuBox-i itself (as we will see shortly).
After this step, I created a second partition, as I said earlier. So, my mmcblk0p1 partition holds Busybox, and the second will hold Debian. We are still working from the x86 system, so we mount the SD card in /media/mmcblk0p2

Installing the base system

Without debian-installer to do the heavy lifting, I went for debootstrap. As I ran it from my PC, debootstrap's role will be for this first stage only to download and do a very initial pre-unpacking of the files: Bootstrapping a foreign architecture implies, right, using the --foreign switch:debootstrap --foreign --arch=armhf wheezy /media/mmcblk0p2 http://http.debian.net/debian
You can add some packages you often use by specifying --include=foo,bar,baz
So, take note notes: This board is capable of running the armhf architecture (HF for Hardware Float). It can also run armel, but I understand it is way slower.

First boot (with busybox)

So, once debootstrap finishes, you are good to go to the real hardware! Unmount the SD card, put it in the little guy, plug your favorite console in (I'm using the serial port), and plug the power in! You should immediately see something like:

U-Boot SPL 2013.10-rc4-gd05c5c7-dirty (Jan 122014 - 02:18:28)

Boot Device: SD1

reading u-boot.img

Load image from RAW...

U-Boot 2013.10-rc4-gd05c5c7-dirty (Jan 122014 - 02:18:28)

CPU: Freescale i.MX6Q rev1.2 at 792 MHz

Reset cause: POR

Board: MX6-CuBox-i

DRAM: 2 GiB

MMC: FSL_SDHC: 0

In: serial

Out: vga

Err: vga

Net: phydev = 0x0

Phy not found

PHY reset timed out

FEC

(Re)start USB...

USB0: USB EHCI 1.00

scanning bus 0for devices... 1 USB Device(s) found

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

scanning usb for ethernet devices... 0 Ethernet Device(s) found

Hit any key to stop autoboot: 3

Let it boot (that means, don't stop autoboot), and you will soon see a familiar #, showing you are root in the busybox environment. Great! Now, mount the Debian partition:# mount /dev/mmcblk0p2 /mnt

Finishing debootstrap's task

With everything in place, it's time for debootstrap to work. Chroot into the Debian partition:# chroot /mnt
And ask Debootstrap to finish what it started:# /debootstrap/debootstrap --second-stage
Be patient, as this step takes quite a bit to be finished.

Some extra touches...

After this is done, your Debian system is almost ready to be booted into. Why almost? Because it still does not have any users, does not know its own name nor knows I want to use it via a serial terminal, and does not know how the filesystems should be mounted and made available. And having a Debian system means having its very extensive software repository collection handy! Five very simple tasks to fix:

Set a password for root:

# passwd

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

Setting your hostname is trivial:

# echo cubox-i.gwolf.org > /etc/hostname

So you have now a usable root user, and when you boot with it you can create further users.

Now, to get the serial console working (you might not need it, if you use the CuBox-i via keyboard+monitor) add a line to /etc/inittab specifying the details of the serial console. You can just do this:

Create a /etc/fstab specifying how the system will be laid out. Right now, it is quite trivial (and in fact, I used my machine for some time without even thinking about this, just using the parameter provided to the kernel, this setting will just give you an easier and even faster experience):

# cat > /etc/fstab

/dev/mmcblk0p2 / ext3 noatime 00

/dev/mmcblk0p1 /boot ext2 ro 00

proc /proc proc defaults 00

tmpfs /tmp tmpfs defaults 00

tmpfs /run tmpfs defaults 00

Tell your computer where to get the Debian packages. I suggest you use the http.debian.net meta-mirror, which will resolve to the mirror closest to you, but you can of course choose from the worldwide list of Debian mirrors.

So, ready to boot Debian? Ok, first exit the chroot shell, to go back to the Busybox shell, unmount the Debian partition, and set the root partition read-only:

# exit

# umount /mnt

# mount / -o remount,ro

Disconnect and connect power, and now, do interrupt the boot process when you see the Hit any key to stop automount prompt. To see the configuration of uboot, you can type printenv — We will only modify the parameters given to the kernel:

So, how big is this minimal Debian installed system? I cheated a bit on this, as I had already added emacs and screen to the system, so yours will be a small bit smaller. But anyway — Lets clear our cache of downloaded packages, and see the disk usage information:

root@cubox-i:~# apt-get clean

root@cubox-i:~# df -h

Filesystem Size Used Avail Use% Mounted on

rootfs 689M 228M 427M 35%/

/dev/root 689M 228M 427M 35%/

devtmpfs 881M 0 881M 0%/dev

tmpfs 177M 144K 177M 1%/run

tmpfs 5.0M 05.0M 0%/run/lock

tmpfs 353M 0 353M 0%/run/shm

tmpfs 881M 0 881M 0%/tmp

So, instead of a 4GB install, we have a 228MB one. Great improvement!

For this first boot, and until you set up a way to automatically (or configure it to be static) determine the network configuration, you can use dhclient eth0 to request an IP address via the wired network port (configuring the wireless network is a bit more involved; I suggest you install the wicd-curses package to help on that regard). With the network working, update the Debian package lists:

Yay, all of Debian is now at your fingertips! Now, lets get it to do something useful, in a most Debianic way!

[note]: I have tried to keep this as true as possible to the real install. I have modified this text every now and then, looking at ways to make it a little bit better. So, excuse me if you find any inconsistencies in the instructions! :)

[update]: I finally followed through the instructions again and produced a downloadable image, where I did all of this work, and you can just download it and play with your CuBox-i! You can download it from my people.debian.org space. You will find there instructions on how to get it installed.

I have read your instructions, but I have decided to download your precompiled image.

It contains kernel 3.0.35 and I am trying to switch it to kernel 3.14:

I have recompile uboot and install it (dd).
I have commented out /boot partition /dev/mmcblk0p1 from fstab.
I have compiled kernel and placed it to /boot (not on separate partition) with dts directory.
I have created uEnv.txt (which is not in precompiled img).

You need to have a new version of u-boot installed that can recognize a gzip-compressed image and give it the needed initrd.

I don't have the full instructions to do this, as it was a friend of mine that helped me. The tricky part is that you need specific versions, as the support for the CuBox-i had to be removed later due to some other breakages.

What I don't get at the moment is to shutdown the device, at least the way I know it from other archs.
Is armhf (or the cubox in particular) not able to do a power off after shutdown?
And I only get the warning message that the shutdown ist started. No shutdown success, no power of (means the screen stays "on" with the last warning message in the console

I have used the download image successfully to boot OK. I wanted to add a webserver and the used rootfs gets close to 100%. How can I expand this? Gparted has a bug that will not allow me to do this? Manual parted command also fails. I have a 15G SDcard.

Managed to answer this myself after testing. Once the wheezy image was copied to the 15G microSD card, I used fdisk to delete the 2nd partition, n option to create a new one with the end sectors now using the whole card. option w writes it and after a reboot , resize2fs. df -h showed the disk now correct size. Then booted the card and added web and mail server packages. (Ispconfig3 in fact).

Hi Gunnar,
first of all thanks for your excellent work !
I have installed your image on my cubox-i2 it boot 1 time every 3-4 power on. I explain better. When I power on my cubox-i the red light in front remain switched off, I have to try 3 or 4 times (pull and put back the power) and then the cubox-i boot.

I thought the problem was the sd, I changed it, but the problem is the same.

I just got a Cubox Pro. Copied the image you provided to an sdcard, inserted it into the cubox and powered it on. The cubox appears to be following the boot process outlined at:http://www.solid-run.com/mw/index.php?title=CuBox_boot_process
but is unable to find a boot.scr file anywhere in the image (nor am I). Interrupting, setting variables and running boot just starts the search for boot.scr off again as that is what the bootcmd variable tells it to do. I can load the kernel with ext2load but any attempt to boot it ends with the words 'Starting kernel ...' and nothing further on either display or serial console.

Am I missing something? IIRC with the GuruPlug I had to upgrade the built in firmware in order to boot debian. Is something similar necessary with the CuBox?

I cannot provide much help, as I don't know the CuBox-i's innards any better than what I have just described. The link you provide is specific to the older model (the CuBox, not the CuBox-i).

My image works only with the CuBox-i; I know for a fact it runs in my model (CuBox-i4 Pro), and I expect it to run in the whole series. CuBox-i does not have a user-facing firmware (the initial boot loader is taken from the SD card), so I understand it to be an all-or-nothing issue: If you get any output from the box, you will get the kernel to boot. And if you don't, you didn't make the image correctly :) (Solidrun's people say the CuBox-i is unbrickable because there's nothing in it that can lead to a non-functioning device due to user interaction).

Gunnar,
A great many of us have used your image/procedue to get a stable debian install on our cuboxes. Everything works wonderfully, except wifi (for some of us?). I cant help buy feel I'm missing something trivial. Could you perhaps hold our hands and breifly walk us through the steps you took to get your Wifi online? Many of us are still scratching our heads. I know I would buy you a bottle of bourbon!

I'm sorry... Really! I don't know what should be done to get your Wifi working. I just set up my machine following precisely the instructions I gave in this post, and the Wifi was working from the first moment!

You might want to try installing wicd and wicd-curses, that's the connection manager I've found to be more compatible with my way of interacting with a computer. But besides that, I have no idea on where to point to :-|

(and I'm sorry for not being entitled to a good free bottle of bourbon :( )

First off, big thanks for putting together the image. I have been trying different images since getting my Cubox earlier this week, and yours is the best so far.

Your comments seem to indicate that you have functional wifi. On the image I downloaded, I can get wired Ethernet functional, but I see no trace of the bcm4329 mentioned in the dmesg log. Can you tell me what I need to do to get the bcm4329 wifi to function?

I cannot really comment much on that regard... With the 3.0.x kernel I based my image on, it Just Worked™. The kernel is built completely as a monolith, no modules even exist on the install, so there was no need even to look for the existing/supported hardware.

Of course, among my to-do items to update the image and the kernel. I have had no time to play with it. But yes, I'd love to use a more recent kernel.

I am an italian Debian user and I tried on my cubx 4p the image that you prepared and is very good to start what one wants!
I would like to use Cubox as an access point under my TV and install a small web server but when I start hostapd with a minimal configuuration with -d option, I get a log with some row with error and a message: Operation non supported.
On cubox forum someone told me that wifi chipset should support ap mode with a specialized firmware, you can see here http://imx.solid-run.com/forums/viewtopic.php?f=13&t=52&start=10 the post of pepedog.

Is it possible load this specilized firmware from your Debian base version ?
Thanks !

The kernel I'm using is built with everything it supports compiled in (i.e. compiled with "YES", not with "MODULE"), so there are no loadable modules to speak of. I don't even know if it supports loading modules!

I have not tried building a kernel higher than the one I got (or different at all). Steve Langasek was able to get a stock 3.13 kernel, IIRC, but it was without support for many bits in the CuBox-i's hardware (such as the graphics stack).

Thanks for sharing your image.
I loaded it onto an SD and booted.
But I get no networking. The ethernet cable is plugged in, but I get no connection.
dmesg | tail is of no help:
SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom-kill(F) kill-all-

What I did there is just to set up the most basic of environments — To set up networking, you have to configure it. First of all, for non-persistent use, you can just issue «dhclient eth0», and it should ask for a DHCP lease over the Ethernet interface. You can also statically assign an address — i.e. ip addr add 192.168.0.101/24 dev eth0 followed by ip route add default via 192.168.0.254 (of course, with the relevant network addresses).

Of course, you can later specify this in /etc/network/interfaces, or use a connection manager to sense where it is and set up the network accordingly. Many people prefer Network Manager, but my personal preference leans towards wicd (particularly, wicd-curses).

Is it possible to share the situation as you had before the step "First boot" so that it would be only a matter of unzip the necessary files to the SD-card and then run?
I am new to the linux environment and I read your tutorial several times but I can´t make any sense of it (which is fully my unawareness...)

You have to dump your image into a SD card, not just unzip it. The reason for it is that some bits must be in precise locations of the card — including, of course, the first sector (which is outside any of the partitions). In any Unix system, just use dd as shown in the linked page; in Windows-land, you will have to grab it from the Internet. I found one site with dd for windows; I have not yet tested it, but it seems to have the exact same syntax. Of course, make sure you know the right device name for your SD card (or you risk overwriting other things — Including your own operating system!)

Sorry for not coming back to you earlier on this — But I must recognize I completely owe the answer to Tricorn, in the CuBox-i forums. Quoting from his reply there,

Note that if you want to save the environment ("save" or "env save", same thing) you'll have to power-cycle after running in Linux, not sure why, but the reboot makes U-Boot think the card is write-locked.

Are the drivers for video and all networking running without issue or did you have to hack those in from someplace? I looked at your tutorial, it's great, just want to know before I go to build my own image.

I have also ordered the same model, which is yet to be shipped (I've ordered mine in December but SolidRun "forgot" to mention that they don't have any in stock!), so your writeup is, pretty much, spot on.

Have you tried, or thought of, using Emdebian Grip instead, or is it simply a matter of changing 'sources.list'?

Since it's binary-compatible with Debian "proper" I was thinking of using it to save even more space.

This question is for testing whether you are a human visitor and to prevent automated spam submissions. Keep in mind that all comments will also have to be administrator-moderated. Don't waste your time writing a spam that no one will read.

Blog posts by category

Todo el material que encuentres en este sitio está disponible libremente, y tienes derecho de usarlo como más te guste siempre que el documento en cuestión no mencione explícitamente diferentes requisitos.All the material found at this site is freely available, and you can use it as you wish, except when the document mentions explicitly different conditions.