Disclaimer :
This document is a work in progress and should not be considered official yet.
|
Gentoo on the Nvidia Tegra 250 Developer Kit
1.
Overview
Installing Gentoo in the Nvidia Tegra 250 is pretty simple if you're already a Gentoo user.
You can either use a sufficiently sized SD card (>=2GB for ease) or an USB HDD. If you
are familar with the Gentoo Linux installation process, there is not much
different here.
2.
Requirements
To be able to install Gentoo, you'll need the following:
- An x86/amd64 based PC with Linux on it
- A Nvidia Tegra 250 Developer Kit
- The USB -> USB mini type B cable the board comes with
- One USB HDD
- A network connection
3.
Preparing to install your Nvidia Tegra
Overview
Before we start the installation process, we need to build a kernel for the Nvidia Tegra
and the utility to flash it to our board on our computer.
The Nvidia Tegra comes without any Operating System on it. At the moment it uses
the fastboot method for flashing a kernel in case of Linux(Windows CE/Android is
another story). U-Boot works but for now we'll use the official method.
Obtaining/Building a kernel
For booting the Nvidia Tegra we need a kernel. In this document we'll use the kernel provided
by Nvidia which is available on Nvidia's GIT server. For doing so
we need dev-vcs/git on our system.
Note: Kernel.org's kernel still doesn't support some hardware on the board as of 2011-06-18 |
Code Listing 3.1: Get the kernel source |
# emerge dev-vcs/git
# git clone git://nv-tegra.nvidia.com/linux-2.6.git
# cd linux-2.6
# git checkout tegra-10.9.9
|
Now that we have the kernel source, we can build it. However since the Nvidia Tegra is an ARM
device, we need to crosscompile the kernel to ARM. For doing so, on Gentoo we use sys-devel/crossdev,
which provides us an easy way to create a cross-compiler. On other Linux distros, you can use
the CodeSourcery toolchain.
Code Listing 3.2: Creating a cross-compiler |
# emerge -v crossdev
# crossdev -S armv7a-unknown-linux-gnueabi
|
Once we have our crosscompiler, we can crosscompile it finally. We'll use the default kernel config
since it has all we need.
Code Listing 3.3: Cross-compiling the kernel |
# make ARCH=arm CROSS_COMPILE="armv7a-unknown-linux-gnueabi-" tegra_harmony_gnu_linux_defconfig
# make -j9 ARCH=arm CROSS_COMPILE="armv7a-unknown-linux-gnueabi-" zImage
|
Once it gets built, we'll now have a kernel image on arch/arm/boot/zImage.
Obtaining and building the fastboot loader
The bootloader we'll use is the one that gets used for Android.
This bootloader, fastboot, is available on the Android SDK
Note: If the following download is not available, check on
Nvidia's Tegra250 Downloads page
for the latest version of the Android for Linux download |
Code Listing 3.4: Download and unpack Nvidia's Android SDK for Linux |
# wget http://developer.download.nvidia.com/tegra/files/os/tegra_froyo_20110207.run.gz
# gzip -d tegra_froyo_20110207.run.gz
# chmod +x tegra_froyo_20110207.run
# ./tegra_froyo_20110207.run
|
After accepting the license, the binary will extract a directory called tegra_froyo_20110207.
In this directory you'll find the fastboot bootloader.
You also need to copy the previously built zImage into that directory
We'll enter into the new directory and download the following file
which contains the partitions that will be created on the board's NAND.
Code Listing 3.5: Getting the NAND partition config file |
# cd tegra_froyo_20110207
# wget http://dev.gentoo.org/~armin76/arm/tegra2/linux_fastboot_nand.cfg
|
Compile the fastboot utility on your PC
For flashing a kernel into the board, we need the fastboot utility
on our PC. The flashing is done through the miniUSB port the board has.
Note: You can download a fastboot binary instead from
HTC's webpage |
For building such tool, we need, unfortunately, java.
Code Listing 3.6: Emerging required dependencies |
# emerge -v =sun-jdk-1.5*
|
Then, we'll checkout the repositories that are needed for fastboot
Code Listing 3.7: Checking out fastboot repositories |
# git clone git://nv-tegra.nvidia.com/android/platform/build.git build
# git clone git://nv-tegra.nvidia.com/android/platform/external/svox.git external/svox
# git clone git://nv-tegra.nvidia.com/android/platform/external/zlib.git external/zlib
# git clone git://nv-tegra.nvidia.com/android/platform/system/core.git system/core
# cd system/core
# git checkout tegra-9.12.5
# cd ..
|
Now, we compile it.
Code Listing 3.8: Compiling fastboot |
# make -f build/core/main.mk fastboot
|
Flashing the bootloader
Now we'll format the NAND and flash the bootloader into it.
Make sure you plug the power cable on the board, then connect the usb cable
to the board and to your PC.
To power on the board, you need to press *BOTH* the Force Recovery and the Power on
buttons until the LEDs power up.
Then execute the following command to flash the bootloader.
Important: Remember to copy the previously zImage into the tegra_froyo_20110207 directory! |
Code Listing 3.9: Recreating the partitions and flashing the bootloader |
# ./nvflash --bct flash.bct --setbct --bl bootloader.bin --configfile linux_fastboot_nand.cfg --odmdata 0x303d8011 --create --go
Nvflash started
rcm version 0X20001
System Information:
chip name: t20
chip id: 0x20 major: 1 minor: 2
chip sku: 0x8
chip uid: 0x1614308744607417
macrovision: disabled
hdcp: enabled
sbk burned: false
dk burned: false
boot device: nand
operating mode: 3
device config strap: 0
device config fuse: 0
sdram config strap: 0
sending file: tegra_250_333MHz_1GB.bct
- 4080/4080 bytes sent
tegra_250_333MHz_1GB.bct sent successfully
odm data: 0x303d8011
downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: fastboot.bin
\ 888192/888192 bytes sent
fastboot.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
setting device: 1 0
creating partition: BCT
creating partition: PT
creating partition: EBT
creating partition: UIP
creating partition: USP
creating partition: SOS
creating partition: LNX
creating partition: MBR
creating partition: UBN
creating partition: MPT
Formatting partition 2 BCT please wait.. done!
Formatting partition 3 PT please wait.. done!
Formatting partition 4 EBT please wait.. done!
Formatting partition 5 UIP please wait.. done!
Formatting partition 6 USP please wait.. done!
Formatting partition 7 SOS please wait.. done!
Formatting partition 8 LNX please wait.. done!
Formatting partition 9 MBR please wait.. done!
Formatting partition 10 UBN please wait.. done!
Formatting partition 11 MPT please wait.. done!
done!
sending file: fastboot.bin
\ 888192/888192 bytes sent
fastboot.bin sent successfully
sending file: zImage
\ 2488384/2488384 bytes sent
zImage sent successfully
"Entering NvFlash recovery mode / Nv3p Server"
"Starting Fastboot USB download protocol"
|
That means the flashing of the bootloader went correctly, we can now flash the kernel.
Code Listing 3.10: Flashing the kernel |
# out/host/linux-x86/bin/fastboot -i 0x955 -p sda1 flash:raw boot PATH_TO_zImage
creating boot image...
creating boot image - 2492416 bytes
sending 'boot' (2434 KB)... OKAY
writing 'boot'... OKAY
|
Remember to save this command(and the binaries), since its the command you'll need to put a new
kernel
That means our Nvidia Tegra is ready to boot, now you can turn it off, and let's focus on the Gentoo
installation on our USB disk
4.
Installing Gentoo
Overview
The installation this device is a bit different, 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 USB disk or usb stick on your PC and prepare there the
minimal installation.
I'd recommend reading the ARM handbook, for creating the partitions, extracting
the stage, configure the networking, etc...until you're able to create a
minimum filesystem.
So please read and follow the ARM Handbook from the beginning, just skip the 10th
chapter, as its irrelevant for our machine. I'll just explain what we have to
do differently. Please read below first so you know when you have to go back to
this document during the installation.
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, instead of the old ABI. That
is armel on Debian. There's no exact reason for why we should use this
EABI and not the old one, apart that this one is better than the old.
Therefore, we need an armv7a-unknown-linux-gnueabi stage3, available under the
releases/arm/autobuilds directory in your favorite mirror
Setup fstab
Warning: From now on i'll suppose you have formatted your USB HDD, mounted, and extracted a stage3 on /mnt/hdd |
Edit the /mnt/hdd/etc/fstab file to look like this:
Code Listing 4.1: /mnt/hdd/etc/fstab |
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1 / 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 4.2: Change the default root password |
# openssl passwd -1
# nano -w /mnt/hdd/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 Nvidia Tegra board
using ssh.
Code Listing 4.3: Adding sshd to the startup |
# ln -s /mnt/hdd/etc/init.d/sshd /mnt/hdd/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 4.4: Configuring serial console |
# nano -w /mnt/hdd/etc/inittab
s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
|
5.
Booting to our new system
Once you've finished the installation of Gentoo into your Nvidia Tegra, you can
simply push the reset button. Then it will boot from the external storage device.
6.
References
You may find more documentation about the device itself and Linux-related at
the following links:
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.
|