Wednesday, November 09, 2016

Archlinux on the Toradex T20 (with Archlinux' kernel)

This is a followup on my earlier blogpost Archlinux on the Toradex T20 from 2012.

I happened to resurrect my old Toradex NVidia Tegra T20 / Colibri / Iris eval-board, which I had running using Toradex' kernel back in 2012 already. And it's amazingly smooth to run the stock Archlinux-Arm distribution for ARM7 CPUs on it, as I found out:

You'll need:

  • a SD-card formatted using the EFI partition table format (the stock uboot for whatever reason didn't like it when I had it partitioned as MBR)
  • two partitions, one for boot, one for the rest (I used vfat / ext4)
  • mkfs.vfat on the first partition (will be mmcblock0p1 on the Toradex), mkfs.ext4 for the 2nd.
  • mount the first partition (vfat) as "boot" in the second partition (ext4, rootfs)
  • unpack http://os.archlinuxarm.org/os/ArchLinuxARM-trimslice-latest.tar.gz in the 2nd partition
  • in "boot" create a uImage from the zImage (the stock u-boot of Toradex can't boot zimages directly), I use the following script (on the toradex module itself, useful after a kernel upgrade!) You'll need the "mkimage" utility from uboot-tools.
[root@alarm ~]# cat /usr/local/sbin/mkuimage.sh 
#!/bin/sh

mkimage -A arm -O linux -T kernel -C none \
-a 0x00008000 -e 0x00008000 \
-n "Linux Kernel" -d /boot/zImage /boot/UImage

Interrupt the bootloader (in the stock configuration, bootdelay is zero, so you'll have to hit your keys hard to get it to interrupt the boot!) and configure the following environment variables like so:

(copy & paste every line separately, I got lost characters when I paste then as a whole!)

env default -f
setenv dtaddr 0x1000000
setenv dtbname tegra20-iris-512
setenv myload_img fatload mmc 0:1 \${loadaddr} uimage
setenv myload_fdt fatload mmc 0:1 \${dtaddr} dtbs/\${dtbname}.dtb \; fdt addr \${dtaddr}
setenv myload mmc part\;run myload_img\;run myload_fdt
setenv myargs setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootdelay=2
setenv myboot run myargs \; run myload \; bootm \${loadaddr} - \${dtaddr}
setenv bootcmd run myboot
setenv bootdelay 5
saveenv

If you just want to test, leave out the last "saveenv" and type "run myboot", after a reset, your Toradex module will still be completely unchanged. If you save the environment (u-boot configuration) with "saveenv", the module should boot up archlinux automatically.

Update: I just realized, the variable "fdtaddr" I used initially is used by u-boot internally and overwritten on every boot, don't use it then :-).

Bootup:

U-Boot 2011.06-dirty (Dec 18 2014 - 22:27:35)

TEGRA2
DRAM:  512 MiB
NAND:  1024 MiB
MMC:   Tegra2 SD/MMC: 0
Board: Toradex Colibri T20
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 

Partition Map for MMC device 0  --   Partition Type: EFI

Part  Start LBA  End LBA
gpt1  0x800    0x407FF
gpt2  0x40800    0x1D47BDE
reading uimage

5623992 bytes read
reading dtbs/tegra20-iris-512.dtb

28979 bytes read
## Booting kernel from Legacy Image at 00408000 ...
   Image Name:   Linux Kernel
   Created:      2016-11-08  21:31:41 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5623928 Bytes = 5.4 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x1000000
   Loading Kernel Image ... OK
OK
   Loading Device Tree to 01ff5000, end 01fff132 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.8.6-1-ARCH (builduser@leming) (gcc version 6.2.1 20160830 (GCC) ) #1 SMP Mon Oct 31 23:22:19 MDT 2016



No comments: