Toshiba AC100/Dynabook AZ

On the one hand it is well made device, a small, lightweight with a 10” screen and a very good battery uptime. It can be seen both as a developer board, as well as a device to make ones work. On the other hand, installed Android system is not a good solution for a laptop-like device (although it's great for smartphones).

The only way to get rid of restrictions on Android and to use all of the features of hardware is to install an open operating system (a Linux distribution).

Unfortunately, NVIDIA's official support for Linux on base boards, with are foundations of this device, has been suspended (and nobody knows if it will be continued on and when).

Fortunately, kernel sources and development tools for (officially supported) Android, can be successfully used to install self-made, or ready-made Linux distribution.

Changelog

  • 2012-01-28 - It is time for little update.

I am currently heavily using AC100, running stable Debian GNU/Linux distribution with 3.0 kernel to prepare my new book.

Such configuration is working quite nice and stable, giving me required amount of unplugged working time (it lasts about 8 hours of writing, compilling LaTeX and small programs in C/C++). I choosed Stable branch of Debian because it has working chromium-browser but I am looking forward to ArmHardFlow initiative in a near future.

nvflash

From NVIDIA'S website we should download the package (OS pack) containing tools for NVIDIA Tegra Ventana development board. It's specification is close to the AC100. We will use it to get the nvflash tolls.

http://developer.nvidia.com/node/19101

We will need the Linux version.

http://developer.download.nvidia.com/tegra/files/os/tegra_ventana_gb_20110222.run.gz

Unpack and install it (you must accept the license):

$ gunzip tegra_froyo_20110207.run.gz
$ sh tegra_froyo_20110207.run.gz
...
By answering 'yes' to the next question you confirm you have read, understood and accept all the terms of this license.
Do you accept the terms of this license? yes/no? yes
Creating directory tegra_ventana_gb_20110222
Verifying archive integrity... All good.
Uncompressing NVIDIA Tegra 250 Android Installer............
 
$ cd tegra_ventana_gb_20110222/

Current partition layout

No Name Size Purpose
2 BCT 3 145 728 (3 MB) boot config table
3 PT 524 288 (512 kB) partition table
4 EBT 2 097 152 (2 MB) bootloader
5 SOS 5 242 880 (5 MB) recovery partition
6 LNX 8 388 608 (8 MB) linux kernel and inird
7 MBR 1 048 576 (1 MB) master boot record
8 APP 314 572 800 (300 MB) applications (/system)
9 CAC 419 430 400 (400 MB) cache (/cache)
19 MSC 2 097 152 (2 MB) misc (/misc)
11 EM1 524 288 (512 kB)
12 UBA 1 294 991 360 (1235 MB) user data (/data)
13 EM2 524 288 (512 kB)
14 UDB 5 950 144 512 (5674.5 MB) (rest) user data (/storage)

New partition layout

No Title Size Purpose
2 BCT 3 145 728 (3 MB) boot config table - depends on the system that we intend to upload
3 PT 524 288 (512 KB) partition table (for nvflash)
4 EBT 2 097 152 (2 MB) bootloader
5 SOS 5 242 880 (5 MB) not used, can be backup system (for testing or updating), the bootloader will run it when device is booted with the Home key pressed
6 LNX 8 388 608 (8 MB) kernel, the partition must be at right (encoded in the bootloader) offset
5 MBR 5 242 880 (5 MB) master boot record - the partition table for Linux
7 APP rest root file system (Debian)

Configuration

Partition layout (and their content) will be written by nvflash with the following configuration file:

linux.cfg
[device]
type=hsmmc
instance=3
 
[partition]
name=BCT
id=2
type=boot_config_table
allocation_policy=sequential
filesystem_type=basic
size=3145728
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
 
[partition]
name=PT
id=3
type=partition_table
allocation_policy=sequential
filesystem_type=basic
size=4096
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
 
[partition]
name=EBT
id=4
type=data
allocation_policy=sequential
filesystem_type=basic
size=2097152
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=ac100-bootloader.bin
 
[partition]
name=SOS
id=5
type=data
allocation_policy=sequential
filesystem_type=basic
size=5242880
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
 
[partition]
name=LNX
id=6
type=data
allocation_policy=sequential
filesystem_type=basic
size=8388608
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=linux.img
 
[partition]
name=MBR
id=7
type=data
allocation_policy=sequential
filesystem_type=basic
size=1048576
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
 
[partition]
name=APP
id=8
type=data
allocation_policy=sequential
filesystem_type=basic
size=0xFFFFFFFFFFFFFFFF
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=rootfs.img

This file is a modified OS Pack's flash.cfg.

In addition to partition layout changes, the partition number 4 type is also changed. From type=bootloader to type=data. Change is necessary for programming.

Data

You will be needing data files: bootloader, kernel and root file system.

EBT and Bootloader

The EBT file is needed to program and run the device. The file copied from my AC100: ac100.bct

As Bootloader you can use:

  • Data previously copied from the 4th partition.
  • Copy the bootloader from my device: ac100-bootloader.bin
  • Bootloader from Android update released by Toshiba. Hence comes the above file.

Kernel

You can use kernel 2.6.32 (the same as in the supplied Android). For proper operation, it requires nvrm_daemon program. It is (or rather was) supplied by NVIDIA in the package linux4tegra. The source code is not publicly available.

The second possibility is to use newer kernel: 2.6.37 or 6.2.38 (the latter is experimental). They do not require additional software. Work on these revisions are carried out under the ChromeOS project.

Toolchain is needed to compile the kernel. Since the kernel does not use the standard library and the build system itself determine the ABI version and processor type, you can use any cross-toolchain capable of producing ARM machine code. I am using the arm-cortex_a9-linux-gnueabi as described here.

$ export PATH=/home/marcin/x-tools/arm-cortex_a9-linux-gnueabi/bin:$PATH

Kernel and its parameters should be packaged in the file understood by the bootloader, produced by the mkbootimg tool.

3.0.8 (recommended)

The new 3.0 kernel works very well. „Mostly stable” version is available from marvin24s git repository (in chromeos-ac100-3.0 branch). It boots fast, power management, input and sound works very well.

$ git clone git://gitorious.org/~marvin24/ac100/marvin24s-kernel.git -b chromeos-ac100-3.0

HEAD of the repository is far less stable (I sometimes have trouble booting it).

The current commit as for this document is: c3f97e1841f5d0ed44255a22b0acb1382a4844b3

$ make ARCH=arm CROSS_COMPILE=cortex_a9_neon-linux-gnueabi- paz00_defconfig

For my own usage I change some of the kernel settings:

  • SLUB instead of SLAB allocator
  • CONFIG_NEON = y
  • CONFIG_R8712U = m (needed for my additional USB Wi-Fi card)
  • CONFIG_DEBUG_KERNEL = n
  • CONFIG_SECURITY = n
$ make ARCH=arm CROSS_COMPILE=cortex_a9_neon-linux-gnueabi- -j4

2.6.38

This version had been taken from one of the branches of the repository: http://gitorious.org/~marvin24/ac100/marvin24s-kernel.

The description is here mostly for historical reasons.

A few versions are available as branches of the repository. To download it, specify the branch while calling git. (e.g. -b ChromeOS-AC100-2.6.38-exp).

Described configuration is chosen rather subjectively (minimalist) on the basis of the experimental kernel in Ubuntu.

$ git clone git://gitorious.org/~marvin24/ac100/marvin24s-kernel.git
$ cd marvin24s-kernel
 
$ wget -c http://bis.org.pl/static/ac100/ac100-2.6.38.config
$ cp ac100-2.6.38.config .config
 
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a9-linux-gnueabi- oldconfig
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a9-linux-gnueabi-

2.6.32

A modified version of the kernel originally released by Toshiba (to fulfill the GPL) is located on the site: http://gitorious.org/ac100.

This wersion works very well for me.

Kernel configuration file: ac100-2.6.32.config.

$ git clone git://gitorious.org/ac100/kernel.git
$ cd kernel
 
$ wget -c http://bis.org.pl/static/ac100/ac100-2.6.32.config
$ cp ac100-2.6.32.config .config
 
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a9-linux-gnueabi- oldconfig
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a9-linux-gnueabi-

Other versions

  • The first version of the kernel sources released by Toshiba (in order to fulfill GPL license) was 2.6.29. It has the same characteristics and limitations, as 2.6.32.
  • 2.6.37 - is being actively developed in Ubuntu. The repository: http://ppa.launchpad.net/ac100/ppa/ubuntu/ contains the latest versions of packages including the pre-compiled kernel and source code with patches. Additional information can be found at developers website: https://launchpad.net/~ac100.

mkbootimg

This is one of the programs included in the Android SDK. Because Android uses a specific build system, we will compile only a mkbootimg tool along with its dependencies:

$ git clone git://android.git.kernel.org/platform/system/core.git
 
$ mkdir mkbootimg-build
$ cd mkbootimg-build
 
$ cp -v ../core/mkbootimg/bootimg.h ./
$ cp -v ../core/mkbootimg/mkbootimg.c ./
$ cp -v ../core/libmincrypt/sha.c ./
$ mkdir -v mincrypt
$ cp -v ../core/include/mincrypt/sha.h ./mincrypt/
 
$ gcc -I. -c sha.c
$ gcc -I. -c mkbootimg.c
$ gcc -s -o mkbootimg mkbootimg.o sha.o
 
$ cp mkbootimg ../

Kernel parameters

Compiled kernel and it's boot parameters, should be placed in linux.img.

Original Android kernel parameters:

mem=448M@0M nvmem=64M@448M vmalloc=320M video=tegrafb console=tty1 usbcore.old_scheme_first=1 
tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk3p1 rootwait

tegrapart parameter consists of a list of comma-separated partition definitions:

<name>:<offset (in blocks)>:<size (in blocks)>:<blocksize>

In theory it determines order of partitions visible in Linux, in practice it is interpreted differently depending on the kernel version.

3.0.8 (recommended)
  • Kernel parameters are similar to 2.6.38, the lp0_vec is no longer needed.
  • I use ext4 filesystem, so I added rootfstype=ext4 to make it mount faster.
  • If You ommit tegrapart=…, eMMC slill will be detected (containig some partitions) but device name and partition order will be different. This topic needs research.
$ mkbootimg \
  --kernel marvin24s-kernel/arch/arm/boot/zImage \
  --ramdisk /dev/null \
  --cmdline \
    'mem=448M@0M tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk0p3 rootwait rootfstype=ext4 console=tty1' \
  -o linux.img
2.6.38

In case of kernel 2.6.38 (and also 2.6.37), command line is a bit different, the „magic parameter”: lp0_vec is needed:

./mkbootimg \
  --kernel marvin24s-kernel/arch/arm/boot/zImage \
  --ramdisk /dev/null \
  --cmdline \
    'mem=448M@0M lp0_vec=0x2000@0x1c29e000 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk0p3 console=tty1 rootwait' \
  -o linux.img

Internal eMMC memory is accessible via device file: mmcblk0. Partitions are properly organized on the basis of the tegrapart= value. The driver will allow access to the partition containing the kernel: the main one (mmcblk0p2) and spare one (mmcblk0p1) and the file system (mmcblk0p3).

2.6.32

MMC devices are detected in different order, so the internal memory is accessible via mmcblk3 device file. The parameter tegrapart seems to be ignored, so the root filesystem is available as the only partition mmcblk3p1.

./mkbootimg \
  --kernel kernel/arch/arm/boot/zImage \
  --ramdisk /dev/null \
  --cmdline \
    'mem=448M@0M nvmem=64M@448M vmalloc=320M video=tegrafb console=tty1 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk3p1 rootwait' \
  -o linux.img

Root file system

To prepare a small, optimized root filesystem, you can use the buildroot toolkit.

The other way is to install full distribution (e.g. Debian or Ubuntu). They are not optimized to use all features of the processors architecture, but provide plenty of pre-compiled, ready to install packages. We will install Debian 6.0.

Buildroot

http://buildroot.uclibc.org/ I use version 2011.05.

Configuration is fairly standard, we select the appropriate toolchain (path and prefix) and several programs.

Target Architecture (arm)  --->
Target Architecture Variant (cortex-A9)  --->
Toolchain  --->
      Toolchain type (External toolchain)  --->
      Toolchain (Custom toolchain)  --->
  (/home/marcin/x-tools/arm-cortex_a9-linux-gnueabi) Toolchain path
  (arm-cortex_a9-linux-gnueabi) Toolchain prefix
  External toolchain C library (glibc)  --->
  [*] Toolchain has C++ support?
  [ ] Use software floating point by default
System configuration  --->
  (ac100) System hostname
  (Welcome to AC100) System banner
  (tty1) Port to run a getty (login prompt) on
Filesystem images  --->
  [*] ext2 root filesystem

Complete, ready to use configuration file is here: buildroot.config.

The output/images/rootfs.ext2 will be produced. It should be placed under the name rootfs.img, in the directory from which it will be read by nvflash.

You can also burn the image file in the appropriate partition (8).

This solution is fast but unfortunately not flexible. The generated image is an ext2 filesystem (while e.g. ext4 has a much better mount time). In addition, the build tools do not provide resize2fs command, so filesystem cannot be resized to fill all available partition space.

In addition, we have omitted installing kernel modules (this can be done in the same way as described below in Debian).

Debian

To prepare a Debian image we will use debootstrap.

In a similar way, You can also install other distributions: using the same tools - Ubuntu, using similar (e.g. febootstrap - Fedora).

Stage I (host)

The following command will perform the first stage of the installation. Directory debian-AC100 containing minimal base system and additional packages needed to configure Wi-Fi later on, will be created.

Firmware is in the non-free section, so its use must be enforced.

sudo debootstrap --arch=armel --foreign \
  --include=wireless-tools,wpasupplicant,firmware-ralink \
  --components=main,contrib,non-free \
  stable debian-ac100 http://ftp.pl.debian.org/debian

The files will occupy about 146MB. Additional packages were downloaded, but will be extracted during stage IV.

Stage II (host) - Kernel modules

In directory where the kernel was built:

make INSTALL_MOD_PATH=<path to debian-ac100 directory> modules_install

E.g:

make INSTALL_MOD_PATH=../debian-AC100 modules_install

Modules for kernel 2.6.37 occupy 14MB.

Stage III (host) - preparing the file system

The system installed in the debian-arm directory should be placed in a ext4 image and burned to device partition 8.

To shorten the time of burning the image, We will create a 512MB image. After starting and configuring the system, it can be increased to the full partition size using resize2fs.

We create a sparse file, then the file system on it. Mount the image in working directory and copy files to it.

dd if=/dev/zero of=rootfs.img bs=1M count=1 seek=511
sudo mkfs.ext4 -m0 rootfs.img
sudo tune2fs -c0 -i0 rootfs.img
sudo mount -o loop rootfs.img /mnt
sudo cp -a debian-ac100/* /mnt
sudo umount /mnt

File rootfs.img should be placed in partition 8. This process is described below (NOTE! Before recording anything to device make a backup copy!).

Stage IV (device) - the first launch

While starting new system for a first time, it is necessary to add the kernel parameters:

rw init=/bin/sh

To do this, we should generate the image (linux.img) for the bootloader, and then put it in 6th partition.

After starting the kernel it executes /bin/sh as the first process, which gives access to a root shell. It can be used to complete the installation:

/debootstrap/debootstrap --second-stage

Administrator password must be set:

passwd root

In order to be able to install software, the repositories must be defined in /etc/apt/sources.list file:

deb http://ftp.pl.debian.org/debian stable main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-free

Finally, the root file system should be increased to fill all available space:

resize2fs /dev/mmcblk0p3

Tool can work on filesystem that is currently used, but only if it was previously normally unmounted.

System can be run normally now (without the init=/bin/sh kernel parameter).

Programming device

Backup

„Bricking” (changing in a very expensive paperweight) devices built on the basis of modern processors is quite difficult. And surely this can not be done just by deleting the contents of internal memory.

If it does not suitable to run the program, the processor goes into the bootstrap, and can be programmed through the USB port. You can also bypass the standard boot sequence and go straight to the programming mode by pressing Ctrl and Escape buttons during the device startup (before turning it on).

Although it is almost impossible to totally brick the AC100, You can easily face the „dead end” if You do not have the appropriate files: BCT and bootloader.

Files can be downloaded from this site or copied from the device itself, using the following commands:

nvflash --bl bootloader.bin --go
nvflash --resume --getpartitiontable partitiontable.txt
for i in 2 3 4 5 6 7 8 9 10 11 12 13; do
  sudo nvflash --resume --read $i part-$i.img
done

Sometimes nvflash –read hangs. If it happens, You should restart the machine again, load the bootloader again (first click) and then continue from the failed operation.

  • The BCT is the first 4080 bytes of partition 2
  • The bootloader occupies 1066kB initial partition 4 (the data from my version).

After doing the backup, you can proceed to programming the device.

Programming for the first time

$ sudo ./nvflash --bct ac100.bct --setbct --configfile linux.cfg --create --bl bootloader.bin --go
Nvflash started
rcm version 0X20001
System Information:
   chip name: t20
   chip id: 0x20 major: 1 minor: 2
   chip sku: 0x8
   chip uid: 0x161c11034260e057
   macrovision: disabled
   hdcp: enabled
   sbk burned: false
   dk burned: false
   boot device: emmc
   operating mode: 3
   device config strap: 1
   device config fuse: 0
   sdram config strap: 1

sending file: ac100.bct
- 4080/4080 bytes sent
ac100.bct sent successfully
downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: bootloader.bin
/ 779268/779268 bytes sent
bootloader.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
setting device: 2 3
creating partition: BCT
creating partition: PT
creating partition: EBT
creating partition: MBR
creating partition: LNX
creating partition: APP
Formatting partition 2 BCT please wait.. done!
Formatting partition 3 PT please wait.. done!
Formatting partition 4 EBT please wait.. done!
Formatting partition 5 MBR please wait.. done!
Formatting partition 6 LNX please wait.. done!
Formatting partition 7 APP please wait.. done!
done!
sending file: ac100-bootloader.bin
- 1091584/1091584 bytes sent
ac100-bootloader.bin sent successfully
sending file: linux.img
\ 2967552/2967552 bytes sent
linux.img sent successfully

Programming again

Complete initialization of the device is needed only for the first time (to rearrange partition layout). To re-flash kernel or root filesystem image, You can just load the bootloader and then burn the files in the appropriate places:

Bootloader (runs in RAM and accepts commands):

$ sudo ./nvflash --bl bootloader.bin --go
Nvflash started
rcm version 0X20001
System Information:
   chip name: t20
   chip id: 0x20 major: 1 minor: 2
   chip sku: 0x8
   chip uid: 0x161c11034260e057
   macrovision: disabled
   hdcp: enabled
   sbk burned: false
   dk burned: false
   boot device: emmc
   operating mode: 3
   device config strap: 1
   device config fuse: 0
   sdram config strap: 1

downloading bootloader -- load address: 0x108000 entry point: 0x108000
sending file: bootloader.bin
/ 779268/779268 bytes sent
bootloader.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully

Kernel:

$ sudo ./nvflash --resume --download 6 linux.img 
Nvflash started
[resume mode]
sending file: linux.img
\ 2967552/2967552 bytes sent
/home/atmel/linux.img sent successfully

Root file system image:

$ sudo ./nvflash --resume --download 8 rootfs.img 

From the operating system

Kernel 2.6.37 configured as described above, gives access to both partitions containing kernel images. So You can record new version of image using dd tool from running system.

The checklist to install Debian

  • Compile the kernel.
  • Create linux.img containing kernel with special parameters.
./mkbootimg --kernel marvin24s-kernel/arch/arm/boot/zImage --ramdisk /dev/null --cmdline 'mem=448M@0M
lp0_vec=0x2000@0x1c29e000 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk0p3
console=tty1 rootwait rw init=/bin/sh' -o linux.img
  • Put linux.img into partition 6:
sudo ./nvflash --bl bootloader.bin --go
sudo ./nvflash --resume --download 6 linux.img
  • Create rootfs image: install base system (Debian stage I), add modules (Stage II) and prepare system image (Stage

III)

  • Put rootfs image into parition 8.
sudo ./nvflash --bl bootloader.bin --go
sudo ./nvflash --resume --download 8 rootfs.img
  • Run the system. After initializing the kernel, command prompt will start.
  • Execute Stage IV of installation.
/debootstrap/debootstrap --second-stage
  • Set root password.
passwd root
  • Create final linux.img (with normal kernel parameters).
./mkbootimg --kernel marvin24s-kernel/arch/arm/boot/zImage --ramdisk /dev/null --cmdline 'mem=448M@0M
lp0_vec=0x2000@0x1c29e000 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=/dev/mmcblk0p3
console=tty1 rootwait' -o linux.img
  • Put it into partition 6 of the device.
sudo ./nvflash --bl bootloader.bin --go
sudo ./nvflash --resume --download 6 linux.img
  • Turn on the device, login as root and enjoy.
ostatnio zmienione: 2012/08/19 21:58