Google Groups

Howto create a fully working Linaro Sd-card for Cubie 512 or 1GB version with SATA power-activated


Martin Wild Dec 4, 2012 10:00 AM
Posted in group: Cubieboard

Categories: Setting up : Ubuntu :

#This is a full tutorial how to make a booting Cubieboard Linaro SD-card with network SATA and Lightdm .
#This tutorial requires you to have basic linux knowledge and the know-how how to use a shell.
#All done here is tested on an standard 64bit Ubuntu 12.04 (which is the base for the Linaro rootfs).
#All commands in this tutorial can be copied and executed as they are. Choose yourself a working directory ,and stay there
#unless you need cd somewhere else. !BEWARE! when something gets written to your SD-card make sure to change the path to
#YOUR SD-CARD or you will probably loose something..
#I hope i didnt miss something important, but with this here and GOOGLE everyone should make it!

#1.Get an PC, an Cardreader and install Ubuntu 12.04
#First you should install GIT and wget for you will need it for sure...
#So open a terminal , create and cd into your working dir and begin with:

sudo apt-get install git wget

#Createing a booting Linaro (Ubuntu) SDcard to start on cubieboard:
#download the needed automake-tools , the Cubieboard hardwarepack and an Linaro rootfs...

sudo git clone https://github.com/linux-sunxi/sunxi-bsp/
cd sunxi-bsp
sudo wget http://dl.linux-sunxi.org/amery/sunxi-3.0/20121109-1024/cubieboard_hwpack.tar.xz
sudo wget http://releases.linaro.org/latest/ubuntu/precise-images/alip/linaro-precise-alip-20121124-519.tar.gz

#Now we write everything to your SD-Card ,and make sure your SD-Card is /dev/sdc (or change this) because
#EVERYTHING CONTAINING THIS DRIVE WILL BE OVERWRITTEN!!!

sudo ./scripts/sunxi-media-create.sh /dev/sdc cubieboard_hwpack.tar.xz linaro-precise-alip-20121124-519.tar.gz
sudo eject /dev/sdc

#if you have a Cubieboard 512Mb you need a different Hardwarepack. everything else stays the same.

git clone https://github.com/linux-sunxi/sunxi-bsp/
cd sunxi-bsp
wget http://dl.linux-sunxi.org/amery/sunxi-3.0/20121109-1024/cubieboard_512_hwpack.tar.xz
wget http://releases.linaro.org/latest/ubuntu/precise-images/alip/linaro-precise-alip-20121124-519.tar.gz
./scripts/sunxi-media-create.sh /dev/sdc cubieboard_512_hwpack.tar.xz linaro-precise-alip-20121124-519.tar.gz
eject /dev/sdc

#those are Specific hardwarepacks build by amery and an actual standard linaro rootfs,
#which will give you a bootable linaro sdcard with working sata driver, lightdm and activated ssh (user: linaro pass:linaro)
#different linaro rootfs-packs can be found under http://releases.linaro.org/latest/ubuntu/precise-images/


#Howto make SATA work:

#now you need to get bin2fex / fex2bin to convert your script.bin to script.fex to be
#able to edit it..

cd ..
sudo git clone https://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools
sudo make

#now youve got the tools you need.

#copy your script.bin (from the 1. Partition of your sdcard) to a place where you want to edit it
#(lets use sunxi-tools to make it easy )
#now convert script.bin to .fex with

./bin2fex script.bin script.fex

#open script.fex with an texteditor (eg. vi,nano)
#and search for the SATA-Section
#find the line

sata_power_en =

#and change to

sata_power_en = port:PB08<1><default><default><0> 

#save and convert back with

./fex2bin script.fex script.bin

#now just copy back script.bin to your sdcard and start your cubie
#if everything went right the hdd spins now up at boot

#Now make sure the SATA module is loaded

sudo lsmod

#that should bring up among others this line:

sw_ahci_platform

#if not start it manually by doing

sudo modprobe sw_ahci_platform

#or by adding "sw_ahci_platform" permanetly to /etc/modules

#now everything should be ready to use your hdd.

#This should be all to get started. this tutorial should work with other rootfs like Arch / Debian as well as long as they are
#build as HARD-FLOAT!!

Regards , Martin