Gentoo on the TrimSlice
1.
Overview
Installing Gentoo in the TrimSlice is pretty simple if you're already a Gentoo user.
You need to use an SD card, at least of 2 GB of size. If you
are familar with the Gentoo Linux installation process, there is not much
different here.
Warning: Please keep in mind that this guide was tested on the TrimSlice devkit,
so bluetooth and wifi support are out of the scope of this guide since the devkit lacks
those. |
2.
Requirements
To be able to install Gentoo, you'll need the following:
- An x86/amd64 based PC with Gentoo and an SD card reader on it
- A TrimSlice
- One SD card (2 GB is enough)
- A network connection
3.
Preparing to install your TrimSlice
Overview
Before we start the installation process, we need to get/build a kernel for the TrimSlice
Emerging needed tools
For building the stuff needed to boot our TrimSlice, we need the following tools emerged
on the host system where we're going to build them.
-
sys-devel/crossdev - to create a crosscompiler
-
dev-embedded/u-boot-tools - to create a kernel image U-Boot can understand
Code Listing 3.1: Emerge needed tools |
# emerge sys-devel/crossdev dev-embedded/u-boot-tools
|
Build a crosscompiler
Code Listing 3.2: Building a crosscompiler |
# crossdev -S armv7a-unknown-linux-gnueabi
|
Obtaining/Building a kernel
For booting the TrimSlice we need a kernel. The vanilla kernel.org doesn't have
all the drivers, etc needed for the TrimSlice yet.
Therefore we'll use the kernel maintained by Compulab(The company behind TrimSlice).
Compulab's git tree is available at http://gitorious.org/trimslice-kernel.
On this guide we'll be using the 1.01-upstream branch.
Code Listing 3.3: Obtaining the kernel |
# wget http://gitorious.org/trimslice-kernel/trimslice-kernel/archive-tarball/trimslice/1.01-upstream
# tar zxvf 1.01-upstream && cd trimslice-kernel-trimslice-kernel
|
Code Listing 3.4: Configuring the kernel |
# make ARCH=arm trimslice_defconfig
|
Code Listing 3.5: Cross-compiling the kernel |
# make -j9 ARCH=arm CROSS_COMPILE=armv7a-unknown-linux-gnueabi- uImage
|
Once it gets built we'll have a kernel image on arch/arm/boot/uImage.
Creating the boot script
Since we're using an SD card to do our install, we'll have to create
a boot script that U-Boot will read from the SD card upon startup so it knows
where to load the kernel from and the specific parameters to boot from SD.
Create a file called boot.script with the following contents:
Code Listing 3.6: boot.script content |
setenv bootargs 'root=/dev/mmcblk0p1 rw rootwait console=tty1 console=ttyS0,115200n8 mem=384M@0M mem=512M@512M nvmem=128M@384M vmalloc=248M nohdparm noinitrd init=/sbin/init rootwait loglevel=8 video=tegrafb'
ext2load mmc 0:1 4080000 /boot/uImage
bootm 4080000
|
Now we need to convert it to a format U-Boot can understand.
Code Listing 3.7: Converting boot.script to boot.scr |
# mkimage -A arm -T script -C none -n "TrimSlice boot script" -d boot.script boot.scr
|
It will generate a file called boot.scr that contains the commands U-Boot will execute upon starting.
We'll copy that file to the /boot directory.
4.
SD card setup
Overview
We'll just create a partition that uses all the space on the card.
Warning: I've been told that most of the USB SD card readers display the SD card as an /dev/sd*
device, so make sure you modify the parameters i mention as /dev/mmcblk0 accordingly. |
Creating the partition table and formatting the SD card
First we need to create the partition table on the SD card. This will
erase all the contents on the card, so make sure you don't have any important
data on it.
Code Listing 4.1: Creating a new partition table with one partition |
# fdisk /dev/mmcblk0
Command (m for help): o
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (2048-15654911, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15654911, default 15654911):
Using default value 15654911
Command (m for help): w
|
Now we'll format the new partition
Code Listing 4.2: Formatting the new partition |
# mkfs.ext3 -i 4096 /dev/mmcblk0p1
|
Copying the kernel to the SD card
Now we'll mount the first partition on the card and copy the needed files
(the ones that we built before) to boot our TrimSlice.
Code Listing 4.3: Copying the kernel to the SD card |
# mkdir /mnt/p1 ; mount /dev/mmcblk0p1 /mnt/p1 ; mkdir /mnt/p1/boot
# cp boot.scr /mnt/p1/boot
# cp arch/arm/boot/uImage /mnt/p1/boot
|
5.
Installing Gentoo
Overview
The installation on this device is a bit different, and therefore easy, as we can't install Gentoo on it
by booting an installation environment. For installing Gentoo (and any other distro, really)
you need to put the SD card on your PC and prepare there the
minimal installation.
What we'll have to do to setup our installation is:
- Extract stage3 to the 1nd partition of the SD card
- Extract portage snapshot (required to emerge things and ntp(see below))
- Setup fstab
- Setup root password
- Configure hostname and networking (optional, but recommended)
- Enable SSH access (optional, but recommended)
- Enable serial console access (optional, but recommended)
Stages information
Here's some information about the stages.
- Architecture: arm
- Subarchitecture: armv7a
- CHOST: armv7a-unknown-linux-gnueabi
- Profile: default/linux/arm/10.0
We'll be using the new EABI, also called gnueabi. That is armel on Debian.
Therefore, we need an armv7a-unknown-linux-gnueabi stage3 for best performance, available under the
releases/arm/autobuilds directory in your favorite mirror
Optionally you can also grab a portage snapshot
Extracting a stage3
Extract the stage3 you downloaded.
Code Listing 5.1: Extracting the stage3 |
# tar xjpf stage3-armv7a-20101118.tar.bz2 -C /mnt/p1
|
Extracting a portage snapshot (optional)
Code Listing 5.2: Extracting the snapshot |
# tar xjpf portage-latest.tar.bz2 -C /mnt/p1/usr
|
Setup fstab
Edit the /mnt/p1/etc/fstab file to look like this:
Code Listing 5.3: /mnt/p2/etc/fstab |
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/mmcblk0p1 / ext3 noatime 0 1
/dev/SWAP none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto 0 0
|
Setting the default root password
This is the most important part of the installation. As without the root
password we won't be able to login!
For setting the password, we need to be able to run passwd. However that's
not possible since our PC can't run ARM binaries. Therefore we need to modify
the file that contains the passwords (/etc/shadow) inside the chroot,
so we can set a default root password.
Code Listing 5.4: Change the default root password |
# openssl passwd -1
# nano -w /mnt/p1/etc/shadow
root:s3cr3t:14698:0:::::
root:$6$I9Q9AyTL$Z76H7wD8mT9JAyrp/vaYyFwyA5wRVN0tze8pvM.MqScC7BBm2PU7pLL0h5nSxueqUpYAlZTox4Ag2Dp5vchjJ0:14698:0:::::
|
Setup hostname and networking
Please read
the network configuration chapter of the ARM handbook to configure the network.
Enabling SSH access (optional)
We can add sshd to the startup of our system so we can access our TrimSlice
using ssh.
Code Listing 5.5: Adding sshd to the startup |
# ln -s /mnt/p1/etc/init.d/sshd /mnt/p1/etc/runlevels/default
|
Enabling serial console access (optional)
By default the ttyS0 port is configured at 9600 bps. However, almost all of the
ARM devices run the serial port at 115200 bps.
So this should be added to the /etc/inittab file:
Code Listing 5.6: Configuring serial console |
# nano -w /mnt/p1/etc/inittab
s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
|
Finishing the installation
Let's unmount the SD card
Code Listing 5.7: Unmounting the SD card |
# umount /mnt/p1
|
This is pretty much all of the installation.
I'd highly recommend that you read all the recommendations of the handbook.
6.
Booting up our new system
Once you have the card ready, put it into the TrimSlice... and you should be able to boot it.
7.
After booting
One of the problems of the TrimSlice is that it doesn't save the date because it doesn't have
a battery for the clock.
After logging into our new Gentoo on TrimSlice installation, I'd recommend setting a date and
emerging net-misc/ntp to keep the clock up-to-date. Also it's recommended to put both
ntp-client and ntpd to boot on startup, so you get a proper date setup.
However, keep in mind that NTP requires a network connection and a NTP server being reachable,
either on the local network or on the Internet.
Code Listing 7.1: Emerging net-misc/ntp |
# emerge net-misc/ntp
# rc-update add ntpd default
# rc-update add ntp-client default
# /etc/init.d/ntp-client start
# /etc/init.d/ntpd start
|
8.
Accelerated graphics drivers
Overview
The TrimSlice has a graphic chip that needs a binary driver provided by Nvidia for accelerated
graphics. Those can be found on the overlay below.
Tegra Overlay
I've created an overlay for providing ebuilds for installing the accelerated graphics drivers and
libraries that are available on the Nvidia L4T.
The overlay is available in the official gentoo overlays repository:
http://git.overlays.gentoo.org/gitweb/?p=proj/tegra.git;a=summary.
Please check the documentation about using overlays: http://www.gentoo.org/proj/en/overlays/userguide.xml.
Emerging the accelerated graphics driver
Once you've added the overlay to your list of overlays, you can emerge
the drivers:
Code Listing 8.1: Emerging the accelerated graphics driver |
# emerge -v tegra-drivers
|
9.
References
You may find more documentation about the device itself and Linux-related at
the following links:
10.
Thanks
-
trimslice.com for providing me a TrimSlice devkit to document and
support Gentoo on it
- Siarhei Siamashka (ssvb) for giving helpful hints
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.
|