Newsgroup: it.fan.marco-ditri
Titolo: Easily installing Debian on a Cubieboard

I recently bought a Cubieboard to replace my old Sheevaplug which has
finally blown a power supply capacitor (this appears to be a common
defect of Sheevaplugs), so I am publishing these instructions which
show how to install Debian on sunxi[0] systems (i.e. based on the
Allwinner A10 SoC or one of its newer versions) with no need for cross
compilers, emulators or ugly FAT partitions.
 
This should work on any sunxi system as long as U-Boot[1] is at least
version 2012.10.
 
The first step is to erase the beginning of SD card to remove anything
in the unpartitioned space which may confuse U-Boot, partition and
format it as desired. The first partition must begin at 1MB
(1024*1024/512=2048 sectors) because the leading unpartitioned space is
used by the boot loaders[2].
 
dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=1
parted /dev/mmcblk0
 
  mklabel msdos
  mkpart primary ext4 2048s 15G
  unit s
  print
  mkpart primary linux-swap ... -1
 
mkfs.ext4 -L root /dev/mmcblk0p1
mkswap --label swap /dev/mmcblk0p2
 
 
Download the boot loaders and an initial kernel[3] and install them:
 
tar xf cubieboard_hwpack.tar.xz
dd if=bootloader/sunxi-spl.bin of=/dev/mmcblk0 bs=1024 seek=8
dd if=bootloader/u-boot.bin of=/dev/mmcblk0 bs=1024 seek=32
 
mount /dev/mmcblk0p1 /mnt
mkdir /mnt/boot/
 
cp kernel/script.bin kernel/uImage /mnt/boot/
 
 
script.bin is Allwinner's proprietary equivalent of the device tree[4]:
it will be needed until sunxi support will be fully merged in mainline
kernels.
 
U-Boot needs to be configured to load the kernel from the ext4 file
system (join the lines at \\, this is not a supported syntax!):
 
cat << END > /mnt/boot/uEnv.txt
# kernel=uImage
root=/dev/mmcblk0p1 rootwait
boot_mmc=ext4load mmc 0:1 0x43000000 boot/script.bin && ext4load mmc
0:1 0x48000000 boot/${kernel} /\\/  && watchdog 0 && bootm 0x48000000
END
 
 
Now the system is bootable: add your own root file system or build one
with debootstrap. My old Sheevaplug tutorial[5] shows how to do this
without a working ARM system or emulator (beware: the other parts are
quite obsolete and should not be trusted blindly).
 
If you have an old armel install around it will work as well, and you
can easily cross-grade it to armhf as long as it is up to date to at
least wheezy (the newer, the better).
 
You can also just use busybox for a quick test:
 
mkdir /mnt/bin/
dpkg-deb -x .../busybox-static_1.21.0-1_armhf.deb .
cp bin/busybox /mnt/bin/
ln -s busybox /mnt/bin/sh
 
 
After booting the busybox root file system you can run busybox
--install /bin/ to install links for all the supported commands.
 
Until Debian kernels will support sunxi (do not hold your breath: there
are still many parts which are not yet in mainline[6]) I recommend to
install one of Roman's kernels[7]:
 
dpkg -i
linux-image-3.4.67-r0-s-rm2+_3.4.67-r0-s-rm2+-10.00.Custom_armhf.deb
mkimage -A arm -O linux -T kernel -C none -a 40008000 -e 40008000 \
  -n uImage -d /boot/vmlinuz-3.4.67-r0-s-rm2+
/boot/uImage-3.4.67-r0-s-rm2+
 
 
It is not needed with these kernels for most setups, but an initramfs
can be created with:
 
update-initramfs -c -k 3.4.67-r0-s-rm2+
mkimage -A arm -T ramdisk -C none -n uInitrd \
  -d /boot/initrd.img-3.4.67-r0-s-rm2+ /boot/uInitrd-3.4.67-r0-s-rm2+
 
 
/boot/uEnv.txt will have to be updated to load the initramfs[8].
 
Since the Cubieboard lacks a factory-burned MAC address you should
either configure one in script.bin[9] or (much easier) add it to
/etc/network/interfaces:
 
iface eth0 inet dhcp
	hwaddress ether xx:xx:xx:xx:xx:xx
 
 
To learn more about the Allwinner SoCs boot process you can consult
1[10] and 2[11].
 
 
[0] 
http://linux-sunxi.org/
 
[1] 
http://www.denx.de/wiki/U-Boot
 
[2] 
http://linux-sunxi.org/Bootable_SD_card
 
[3] 
http://linux-sunxi.org/Hwpack
 
[4] 
http://linux-sunxi.org/Fex_Guide
 
[5] 
http://blog.bofh.it/debian/id_265
 
[6] 
http://linux-sunxi.org/Linux_mainlining_effort
 
[7] 
https://romanrm.net/a10/kernel
 
[8] 
http://linux-sunxi.org/Initial_Ramdisk
 
[9] 
http://linux-sunxi.org/EMAC
 
[10] 
http://rhombus-tech.net/allwinner_a10/a10_boot_process/
 
[11] 
http://linux-sunxi.org/BROM
 
 
Permalink: 
http://blog.bofh.it/debian/id_440
 


Perche non la A20? E' dual core e costa poco di piu'!
 
Giulia
 
 

 Perche non la A20? E' dual core e costa poco di piu'!
 
e se dopo funziona come facciamo ... ?

 e se dopo funziona come facciamo ... ?
 
Il canchero di sheevaplug ?
 
 

 
Sorry.Can you help me?
 
Im trying to figure out how to install Debian in PCDuino. See:
http://forums.debian.net/viewtopic.php?f=17&t=109842
 
 
Does this instructions will work, as well for Pc Duino?
How stable is you Debian installation in Cubieborad. Can you do normal tasks without crahses? Also can you run the X server and some desktop enviroment??
 
Thanks
 

Perche non la A20? E' dual core e costa poco di piu'!
Perché il supporto è meno maturo e non mi serviva qualcosa più veloce.
 
-- 
ciao, | Those people who think they know everything
Marco | are a great annoyance to those of us who do. (Isaac Asimov)