The Fucking Simple AC100 Guide


Posted:   |  More posts about Hardware

This guide describes how to get Linux onto the Toshiba AC100 in a simple and detailed way.

Introduction

The AC100 is a bit of a pain in the ass for two main reasons: 1. Whacky hardware that isn't quite supported yet. 2. The Tegra Partition Table.

The proprietary (but gratis) nvflash tool allows you to download and upload partitions to your device and also repartition the AC100's eMMC Internal Storage (no, you can't just repartition from within Linux!). The other tool we use frequently is abootimg, which allows you to unpack, edit and create boot images.

I do not recommend repartitioning your eMMC at least until you have a few weeks of experience with the AC100 and you're comfortable sure you know what you are doing - repartitioning may break compatibility with pre-compiled images and if you don't know what you're doing you won't be able to recover.

The main things you have to keep in mind when putting Linux on the AC100 are:

  • What partitions and where.
  • Have I told the kernel where my MBR partition starts? Have I told it where my rootfs is located? (Whats an MBR? link to Wikipedia Article)
  • Have I backed up?
  • Have I got the matching kernel modules in my rootfs?

Getting Linux On

Step 2. Gather system files.

You need 4 things to install a Linux distribution on your AC100.

  1. Boot image

    You can use one of these boot images: http://avolver.ru/ac100/kernels/

  2. Kernel Modules

    Get these from the same place you got your kernel image from. It should be an archive file (tar.gz or .zip or whatever)

  3. A rootfs

    This is an archive file full files which contains the basic configuration and tools for your distribution.

    I use Arch Linux - Trim Slice Latest

    This is for Debian, I don't know if it works. Definitely update once installed! http://freevec.org/repository/images/armhf-unstable-main.tar.lzma

  4. A SD card or USB stick.

    SD card is recommended.

Step 3. Prepare your rootfs.

  1. Format your SD card or USB stick

    Use an EXT file system.

  2. Extract your rootfs to the storage device.

    That is, the SD card or USB stick you just formatted.

  3. Extract your kernel modules into /lib/modules/

    After they're extracted there should be a /lib/modules/[kernel version] directory.

Step 4. Flash the boot image.

Now you need to write your kernel and initrd to the AC100's boot partition. You should have downloaded a file called something like boot.img back in step 2. To do this you need to use nvflash.

Hold down Ctrl and Esc and then press and release the power button. The AC100 should start up but the screen should stay blank.

./nvflash --bl harmony/fastboot.bin --sync

./nvflash -r --download 6 /path/to/boot.img

This assumes that your boot partition is partition 6.

Step 5. Try booting

Good luck!

  1. Insert the SD card or USB stick and reboot.

    It should start booting linux and hopefully will find your rootfs and start loading up stuff. If it stops in busybox then it is probably because it could not locate the rootfs. See "Internal Partions" for info on changing where the kernel looks to find the rootfs.

  2. Continue

    You can continue to run on the SD card, however you probably want to install to the eMMC.

Installing to the eMMC

To install to the eMMC you need to have access to the internal partitions. See "Internal Partitions" for more detailed information.

You need to copy a rootfs over and make a few small changes.

  1. Copy the rootfs

    The easiest way to copy the rootfs is to just your SD card in another computer and copy all the contents into another directory. Do this because some files will not allow you to copy them while the system is using them.

  2. Mount an eMMC partition

    I don't know the exact path to mount as my AC100 was second-hand and already re-partitioned - however the process is the same, just replace X.

    mount /dev/mmcblk0pX /mnt

  3. Copy the rootfs to the mounted internal partition

    You can use rsync instead of plain cp.

    cp -r /myrootfs /mnt

  4. Adjust the fstab in the rootfs

    Edit /mnt/etc/fstab using your favourite editor (vim). Make sure it has the following:

    /dev/mmcblk0p2/ext4 defaults,noatime,nodiratime 0 0 0 tmpfs /tmp tmpfs nodev,nosuid 0 0

    However that first line is likely to be different for you because my partition layout is fairly non-standard. You may also want to do:

    /dev/mmcblk0p5/home ext4 defaults,noatime,nodiratime 0 0 0 0

    Where mmcblk0p5 is your data partition (which is partition 14 in nvflash by default).

    Note that I have my partitions formatted to ext4 - you may want to format to ext4 as well. Use parted to do this, or if you have X running on your SD card then you can use gparted.

  • Adjust kernel parameters.

    If you have default partitioning and are using the http://revolver.ru/ac100 boot images you can reflash with a "p12.img" image and it should work. Else see "Internal Partitions" for more info.

Reboot and enjoy.

Internal Partitions

The internal storage is formatted with a partition table format which I call the Tegra Partition Table. Support for this format is fairly limited so we have to use nvflash to work with partitions for the most part. However once Linux has located partitions by reading the MBR you can reformat partitions and read/write them. Getting Linux to find the partition in the first place is our biggest problem.

To make the kernel see our partitions we need to adjust the "tegrapart" kernel parameter to make sure it finds the MBR partition - from there Linux can figure out the rest of the partitions. This isn't as easy as just editing grub.cfg like on x86 - however it is not as hard as recompiling the kernel. To edit the kernel parameters we need to work with a file called bootimg.cfg which we can get by unpacking a boot image using the abootimg tool.

An interesting piece of documentation is the Tegra Partion Table example.

Getting the abootimg Tool

abootimg allows you to pack and unpack an image file.

  1. Get the abootimg tool.

    http://gitorious.org/ac100/abootimg - you can get a git clone or just download the tarball.

  2. Build abootimg

    Just unpack the archive (if you didn't do a git clone) and run "make"! Super simple.

Unpack, Modify and Re-pack an Image

First, make sure you have abootimg. If you don't have it see the section in this article which describes getting it.

  1. To unpack an image

    After running this you should get 3 files. bootimg.cfg, initrd.img and zImage.

    abootimg -x boot.img

  2. Modify bootimg.cfg
    • In my case I have to adjust the tegrapart parameter from "mbr:b00" (or whatever) to "mbr:300" so that Linux could read from it to find the locations of the other partitions.
    • You may also want to adjust the root parameter to point to your rootfs location. For me this is mmcblk0p2 - but if you want it to point to a SD card do "root=/dev/mmcblk1p1" or for a USB drive do "root=/dev/sda1"
    • If you build your own kernel you may have to adjust the bootsize parameter to suit your zImage.
  3. Pack an Image

    abootimg --create modified-boot.img -f bootimg.cfg -k zImage -r initrd.img

You should now have a modified-boot.img file that you can flash using nvflash.

Note: once you have Linux running and your partitions are detected you can make new boot images and flash them from the AC100 itself by using the "dd" utility which comes standard with nearly all Linux distributions.

Repartitioning

To learn about repartitioning you can read: http://tosh-ac100.wetpaint.com/page/Repartition+Internal+Storage

I recommend changing as little of the partition table as possible, especially not the MBR partition. Most people flat-out do not recommend repartitioning at all.

Compiling Marvin's Kernels

Although you can certainly do complicated compiling setups with cross-compilers and distcc, I find that the kernel can be compiled in about 45 minutes on the AC100. I use a USB hard drive, though NFS can also work.

  1. Get the source from Marvin24's Gitorious

    https://gitorious.org/~marvin24/ac100/marvin24s-kernel - clone it to the USB drive or extract it to the USB drive if you get a tarball.

  2. Build the kernel and modules

    In the source directory run

    make paz00_defconfig

    make

    Then wait... Then build the modules.

    make modules

    make modules_install

    Note: If you want your modules to install to a directory of your choosing (so you can easily just zip them up) do:

    INSTALL_MOD_PATH=/path/to/dir make modules_install

  3. Make your zImage

    This is the actual kernel binary.

    make zImage

    The resulting zImage file will end up in arch/arm/boot

Common Problems

These are mostly ones that I have encountered.

  • No internal partitions show up in Linux!

    Run "dmesg|less" and then search for "parse_tegra" and see what is complaining about. It is likely that you have no given the correct location of the MBR in the tegrapart kernel parameter.

  • My mouse won't move!

    Try the touchpad toggle key, which is above the "7" key. Derp.

  • It keeps crashing!

    Yeah I know. Come into the #ac100 channel on irc.freenode.net and tell us your kernel version, distribution and detailed explanation of the problem.

    If you're running one of Marvin's 3.0 kernels you may want to downgrade to 3.0.8 because there is a problem with CPU stability (voltage and SMP related).

    The wireless driver is pretty crashy too.

Comments powered by Disqus
Contents © 2013 Daniel Devine - Nikola Powered - Flattr Me! Flattr this Source