Debian testing with 3D and CedarX (via libhybris) howto on CubieTruck (CubieBoard3)

Really outdated I think now...

I’ve successfully installed from scratch a Debian Testing on my CubieTruck, there is how to get it working.

The only thing which doesn’t seems to works, is 3D GL for games…

FIRST.

I’ve installed the Lubuntu Server with VGA or HDMI NAND image with live…thing tool.

Only to get a proper /dev/nanda bootloader partition, you should do the same, this howto asumes that.

1. Create SD-Card with Lubuntu linaro

Just follow this tutorial.

You can also chroot on the SD-Card rootfs and install OpenSSH Server.

2. Reboot with the SD-Card plugged in

Do a ssh on linaro@your_cubie, password is linaro.

3. Format the NAND properly

This will erase all the nand, so, do the following.

3.1 Backup

mkdir /mnt/{boot,rootfs}
mount /dev/nanda /mnt/boot/
mkdir ~/boot/
cp -r /mnt/boot/* ~/boot/

3.2 Partitions

umount /dev/nanda
sudo nand-part /dev/nand 32768 'bootloader 131072' 'rootfs 10584064'

if you run sudo nand-part you will see something like that at the end :

2 partitions
partition 1: class = DISK, name = bootloader, partition start = 32768, partition size = 131072 user_type=0
partition 2: class = DISK, name = rootfs, partition start = 163840, partition size = 10584064 user_type=0

3.3 Format

Reboot, with the SD-Card plugged in, the NAND driver doesn’t support repartition on-the-fly.

Then, format the two partitions :

mkfs.ext2 /dev/nanda
mkfs.ext4 /dev/nandb

4. Installation

4.1 bootloader

mount /dev/nanda /mnt/boot
cp -r ~/boot/* /mnt/boot/
set "nand_root" to /dev/nandb in /boot/uEnv.txt
sync

4.2 rootfs

sudo apt-get install debootstrap
mount /dev/nandb /mnt/rootfs
debootstrap --verbose --arch armhf --variant=minbase --foreign testing /mnt/rootfs http://ftp.debian.org/debian
chroot /mnt/rootfs

Inside the chroot now:
/debootstrap/debootstrap --second-stage

cat `<<END >` /etc/apt/sources.list
deb http://ftp.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.debian.org/debian/ testing main contrib non-free
deb http://ftp.debian.org/debian/ testing-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ testing-updates main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free
END

apt-get update

export LANG=C
apt-get install apt-utils dialog locales
dpkg-reconfigure locales
# Choose en_US.UTF-8 for both prompts, or whatever you want.
export LANG=en_US.UTF-8

apt-get install dhcp3-client udev netbase ifupdown iproute openssh-server iputils-ping wget net-tools ntpdate ntp vim nano less tzdata console-tools module-init-tools mc

cat `<<END >` /etc/network/interfaces
auto lo eth0
allow-hotplug eth0
iface lo inet loopback
iface eth0 inet dhcp
END
echo debian > /etc/hostname

cat `<<END >` /etc/fstab
# /etc/fstab: static file system information.
#
# `<file system>` `<mount point>`   `<type>`  `<options>`       `<dump>`  `<pass>`
/dev/nanda      /boot               ext2    noatime,noauto,errors=remount-ro 0 1
END

apt-get install openssh-server
passwd

echo "T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100" >> /etc/inittab

/etc/init.d/ntpd stop
exit

normally, done.

Unplug SD-Card, reboot, should display a prompt or whatever.

5. Fresh debian

5.1 Install whole lot of things

As root, install sudo, and create an user

apt-get install sudo
adduser fluttershy
usermod -a -G video,sudo fluttershy
passwd fluttershy

Then you can re-log under fluttershy and do sudo things. youhou!

sudo apt-get install htop ssh smartmontools bash-completion screen wget mplayer2 mesa-utils

sudo apt-get install git-core build-essential \
libusb-1.0.0-dev pkg-config xorg-dev xutils-dev libdrm-dev autoconf gettext libtool automake libltdl-dev  x11proto-dri2-dev \
libvdpau-dev

5.2 Clone whole lot of things

cd
git clone https://github.com/linux-sunxi/libvdpau-sunxi.git
git clone https://github.com/ssvb/xf86-video-sunxifb.git
git clone git://github.com/linux-sunxi/sunxi-tools.git
git clone https://github.com/hglm/a10disp.git
git clone https://github.com/linux-sunxi/sunxi-mali.git
git clone https://github.com/robclark/libdri2.git
wget http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/sintel_trailer-1080p.mp4

5.3 Tools

cd sunxi-tools
make
cd ../a10disp
cp ~/xf86-video-sunxifb/src/sunxi_disp_ioctl.h .
make clean
make

5.4 MALI X11 / 3D

echo sunxi_cedar_mod | sudo tee -a /etc/modules
cat `<<END >` /etc/udev/rules.d/50-mali.rules
KERNEL=="mali", MODE="0660", GROUP="video"
KERNEL=="ump", MODE="0660", GROUP="video"
KERNEL=="cedar_dev", MODE="0660", GROUP="video"
KERNEL=="disp", MODE="0660", GROUP="video"
END

cd ~/libdri2
./autogen.sh
make
sudo make install
cd ~/sunxi-mali
git submodule init
git submodule update
sudo make
sudo make install

cd ~/xf86-video-sunxifb
autoreconf -vi
./configure --prefix=/usr
make
sudo make install

sudo mkdir /usr/share/X11/xorg.conf.d/
sudo cp xorg.conf /usr/share/X11/xorg.conf.d/99-sunxifb.conf

# FIX MESA SHIT
mkdir ~/mesa_shit
mv /usr/lib/arm-linux-gnueabihf/libEGL.* ~/mesa_shit

# Only after a working X11
make test
DISPLAY=:0 ./test/test
# You should see something

5.5 VDPAU-Sunxi

This permits to decode h264, mpeg1 and mpeg2. The thing with libvde / libhybris and Android libs only works with a stripped-down vlc version, which doesn’t seems to build anymore…

cd ~/libvdpau-sunxi
make
sudo make install

5.x Remove useless things

sudo apt-get remove --purge libusb-1.0.0-dev pkg-config libdri2-dev xorg-dev xutils-dev libdrm-dev autoconf gettext libtool automake libltdl-dev  x11proto-dri2-dev \
libvdpau-dev

6. Play videos

cat `<<END >` .mplayer/config
# Write your default config options here!

vo=vdpau,
vc=ffmpeg12vdpau,ffh264vdpau,ffwmv3vdpau,ffvc1vdpau,
END

echo "VDPAU_DRIVER=sunxi" | sudo tee -a /etc/environment
echo "VDPAU_DRIVER=sunxi" | sudo tee -a /etc/X11/Xsession.d/10sunxi
echo "export VDPAU_DRIVER" | sudo tee -a /etc/X11/Xsession.d/10sunxi

7. XFCE4

sudo apt-get install xfce4 xfce4-goodies lightdm

8. Ressources used

  • http://linux-sunxi.org/Debian debootstrap and things for debian-armhf
  • http://linux-sunxi.org/Binary_drivers drivers for MALI X11 / 3D
  • http://linux-sunxi.org/CedarX/libve libve / libhybris for CedarX, doesn’t got it to work
  • http://github.com/linux-sunxi/libvdpau-sunxi libvdpau for sunxi
  • A lot of googling and trying