Gentoo on SABRE Lite

Jan 23 2014 Published by under Linux

I recently received several SABRE Lite BD-SL-i.MX6 boards for running ARM benchmarks on DataMill. To install Gentoo on it, you need a USB-to-serial cable converter. It came with a 4GB SD card, which is large enough to get you started.
Overview of the installation:

  • Reset board and format SD card (optional)
  • Compile kernel with btrfs support (optional)
  • Copy boot script and kernel
  • Extract stage3 and portage snapshot
  • Configure the install
  • Backup and clone (optional)

Reset board and format SD card

When I first tried to boot images extracted to the SD card on the board, it always got stuck at the U-Boot prompt. It turned out that there were environment variables left over from previous uses for these boards. Here is the way to reset board variables:

U-Boot > run clearenv
U-Boot > reset

After I managed to boot Linux images on it, I went onto formatting the card for a Gentoo install. I used sfdisk so that formatting can be scripted with a file which I saved as mmc_partitions:

# partition table of /dev/sdd
unit: sectors

/dev/sdd1 : start=     2048, size=   102400, Id=83
/dev/sdd2 : start=   104448, size=  7669760, Id=83
/dev/sdd3 : start=        0, size=        0, Id= 0
/dev/sdd4 : start=        0, size=        0, Id= 0

I formatted the second partition as btrfs so that compression could be used on the small SD card. You may want to format it as ext3 to save time. If you have problems getting it to boot, check to make sure your btrfs-progs are not newer than the btrfs version the kernel is built to support. sys-fs/btrfs-progs-0.20_rc1 worked for the January 2014 kernel source.

# sfdisk -f /dev/sdd < mmc_partitions
# mkfs.btrfs -f /dev/sdd2 && mkfs.ext2 /dev/sdd1

Compile kernel with btrfs support

The git tree for the kernel is available at https://github.com/boundarydevices/linux-imx6/. There are two main branches, one for Android and one for non-Android. Use the most recent one for non-Android.

# wget https://github.com/boundarydevices/linux-imx6/archive/boundary-imx_3.0.35_4.1.0.zip
# unzip boundary-imx_3.0.35_4.1.0.zip
# cd linux-imx6-boundary-imx_3.0.35_4.0.0
# make ARCH=arm imx6_defconfig
# vim .config

Make the following changes to the kernel config:

CONFIG_DEVTMPFS=y
CONFIG_BTRFS_FS=y
CONFIG_CRYPTO_CRC32C=y
CONFIG_LIBCRC32C=y

Gentoo requires a devtmpfs filesystem to mount at /dev while selecting btrfs also selects LIBCRC32C. The CRC32c CRC algorithm is used by btrfs for checksums.
Now cross compile the kernel

# make -j9 ARCH=arm CROSS_COMPILE=armv7a-unknown-linux-gnueabi- uImage

Copy boot script and kernel

Download 6x_bootscript-20121110 available from a blog post and rename it 6x_bootscript. Get the kernel from one of the i.MX6 builds if you decided to skip building it.

# mount -o compress=zlib /dev/sdd2 /mnt/p1 && mkdir /mnt/p1/boot && mount /dev/sdd1 /mnt/p1/boot
# cp 6x_bootscript /mnt/p1/boot
# cp uImage /mnt/p1/boot

uImage is located in /usr/src/linux/arch/arm/boot if you compiled the kernel.

Extract stage3 and portage snapshot

Download the latest stage3 tarball and extract it

tar xjpf stage3-armv7a*.tar.bz2 -C /mnt/p1

BD-SL-i.MX6 with serial cable
If you get errors trying to run emerge --sync, it is because downloading the portage tree is not optional unlike other guides indicate. Simply download it from your nearest mirror and extract it

# tar xjpf portage-latest.tar.bz2 -C /mnt/p1/usr

Configure the install

If you compiled the kernel with btrfs, edit /mnt/p1/etc/fstab file so that zlib compression is enabled

/dev/mmcblk0p1          /boot           ext2            noatime         0 1
/dev/mmcblk0p2          /               btrfs            noatime,compress=zlib
       0 1

Set kernel boot argument in /mnt/p1/etc/inittab. Change the console= argument to ttymxc1. eg "$bootargs console=ttymxc1,115200 vmalloc=400M consoleblank=0 rootwait"
The rest of the process is the same as for other ARM boards, such as the Trimslice. The guide for it is available at http://dev.gentoo.org/~armin76/arm/trimslice/install.xml.
4 SABRE Lite i.mx6 Development Boards on the benchmark rack

Backup and clone

First make the backup in a folder

cd /backups
tar -cvpzf backup.tar.gz /mnt/p1/

After unmounting the SD card and testing it on the device, put in a new one and clone it with the following commands

sfdisk -f /dev/sdd < mmc_partitions
mkfs.btrfs -f /dev/sdd2 && mkfs.ext2 -FF /dev/sdd1
mount -o compress=zlib /dev/sdd2 /mnt/p1 && mkdir /mnt/p1/boot && mount /dev/sdd1 /mnt/p1/boot
tar xzpf backup.tar.gz -C /mnt/p1
vim /mnt/p1/etc/conf.d/hostname

umount /mnt/p1/boot && umount /mnt/p1

The Funtoo ARM Guide has up to date sections on setting the root password and using swclock. If you decide to use swclock, update the last shutdown time to set the clock with touch /tmp/mnt/p1/lib/rc/cache/shutdowntime after extracting the tarball.

No responses yet

e17 Menu Icons

Aug 27 2013 Published by under Linux

After installing e17 on Gentoo and a few applications, I noticed that some of the applications in the menu had icons while others did not. The same icons were missing in the IBar and other places. At first, I checked the wiki page on e17, it suggested to install evas_generic_loaders with SVG support. Contrary to what it suggests, evas_generic_loaders does not affect menu icon display it is used for tooltip previews in the file browser.
The way to set is to navigate to Settings -> All -> Look -> Application Theme and open the Icons tab. Once I selected Gnome, all the icons appeared. “Enable icon theme for applications” was already checked by default. If you do not see Gnome icons in the Icons tab, make sure you have installed x11-themes/gnome-icon-theme if you’re using Gentoo.

No responses yet

A Lesson About APT

May 29 2010 Published by under Linux

I often get an unbootable Linux system and not remember which file I edited or whatever else I did. In this situation, I hit Alt-F2 to switch to the second console (the first one is used to output boot information). Then here’s what I do at the terminal

Username: root
Password:
>history
.
.
.
vim /etc/X11/xorg.conf
>

Unfortunately, that’s not what happened this time. Xorg had problems starting, and I couldn’t issue keyboard commands. Next, I booted into Windows to finish up my tasks. See, I made a shared NTFS partition that is mounted by every OS I boot. In Linux, I create a symlink in the home folder called Documents, somewhat like 7’s Documents library folder. Now on the weekend, I finally get a chance to see what’s up with the Debian system. A piece of wisdom (wit won’t really help) applies here,

Insanity: doing the same thing over and over again and expecting different results.
– Albert Einstein

I simply used the reparation kernel boot parameters and switched to a terminal using Alt+F2. Now I’m in the driver’s seat again.

Username: root
Password:
>history
.
.
.
apt-get purge kate
apt-get purge kwrite
>apt-get autoremove
.
.
.
* packages removed
>

I immediately ran that command, as I remembered a message about it last time I used apt-get. Apparently, Entrance, e17’s login manager, couldn’t start without some configuration files removed by apt-get purge. The autoremove command does dependency checking for programs that are not used in the tree anymore. It also uninstalls them, so they are no longer loaded via symlink by the login manager.

>shutdown -r now
Terminating Running Processes . . .
Switching to Runlevel 6

That was it. Problems in Linux are often as quick and easy to fix as it was created.

No responses yet

GCC 4.4.0 for Windows

May 15 2009 Published by under Windows

The current version of gcc that comes with MinGW is 3.4.5 (meaning it’s the last release of the v3). That was almost 2 years ago. I know this because I used a gentoo linux distribution. Besides, I’m running 7 x86-64. So I decide to provide the equation for the solution.

No responses yet