Cubieboard2 SD-Card

From Void Linux Wiki
Jump to: navigation, search

rootfs-install

Grab latest rootfs for the Cubieboard2:

$ wget http://repo.voidlinux.eu/live/void-cubieboard2-rootfs-latest.tar.xz
Make sure to check that sha256 is correct. The sha256 hash is stored in the sha256sums.txt file.

Preparing the SD card

The SD card must have at least 2 partitions, one as FAT for /boot and another one as ext4 (the default kernel cmdline expects the rootfs to be in ext4) for /; let's begin preparing the partitions and mounting them in a directory:

$ parted /dev/sda <- change this to match your SD card

# Create the FAT partition of 64MB and make it bootable
(parted) mktable msdos
(parted) mkpart primary fat32 2048s 64MB
(parted) toggle 1 boot

# Create the rootfs partition until end of device
(parted) mkpart primary ext4 64MB -1
(parted) quit

Now let's create the filesystems in the SD card:

 $ mkfs.vfat /dev/sda1 <- change this to match your SD card and FAT32 partition
 $ mkfs.ext4 -O ^has_journal /dev/sda2 <- change this to match your SD card and ext4 partition

The -O ^has_journal option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).

Preparing target rootfs directory

 $ mkdir -p ~/rootfs
 # mount /dev/sda2 ~/rootfs/
 # mkdir -p ~/rootfs/boot
 # mount /dev/sda1 ~/rootfs/boot

Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:

 # tar xvfJp void-cubieboard2-rootfs-latest.tar.xz -C ~/rootfs
 # sync
Do not forget to unpack the rootfs as root and with the -p flag to set appropiate permissions.

The /boot partition must also be added to /etc/fstab:

 # echo '/dev/mmcblk0p1 /boot vfat defaults 0 2' >> ~/rootfs/etc/fstab

Flashing the u-boot bootloader

 # dd if=~/rootfs/boot/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
 # sync

Umount the SD card filesystems from target rootfs directory.

Insert the SD card and test the Cubieboard2 boots correctly, the root password is voidlinux.

X11

At the very least this is the list of required packages:

$ xbps-install -Sy xorg-minimal xf86-video-fbturbo-sunxi

To install all X client applications:

$ xbps-install -Sy xorg-apps

To install all X font packages:

$ xbps-install -Sy xorg-fonts

As final step make sure the user running X is part of the groups audio and video.

Troubleshooting

How to enable the serial console

First make sure that ttyS0 is listet within /etc/securetty. Then mount the rootfs and add the service:

 # mkdir ~/rootfs
 # mount /dev/sdX2 ~/rootfs
 # ln -s /etc/sv/agetty-ttyS0 ~/rootfs/etc/runit/runsvdir/default
 # umount ~/rootfs

Now you should have a console on the serial port.