[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

This is an old revision of the document!


Getting Slackware ARM on the Toshiba AC100 (also know as the Dynabook AZ)

At the time I originally wrote this I was using ARMedslack 13.37 but as of version 14 the official Slackware ARM port changed name to Slackware ARM. Any reference to ARMedslack in this short tutorial refers to the Slackware ARM official port.

Preface

You can have ARMedslack running on the AC100 but you ha veto do a little work to boot it as the official slackware port for ARM has no specific kernel for the AC100. Currently ARMedslack has a tegra kernel (3.4.2 at the time of writing) that is not yet ready for use on the AC100. Also Ubuntu has a version 3 kernels for the AC100 that I've not yet tested (3.1.10 at the time of writing).

I worked around the problem by using Ubuntu's 2.6.38 kernel for the AC100 and a custom initrd. I've also found the sources used to build the Ubuntu kernel and if you like to go about it with the home-brew way the initrd really does not need much apart from busybox so the road ahead is not too steep. Here's the configuration of the kernel I'm using on my AC100.

Requirements

What you'll need:

  • kernel 2.6.38 in zImage format for AC100 (from Ubuntu natty for AC100)
  • initrd.img for 2.6.38 (you can use the initrd from natty for AC100 but you may need to modify the init script if they don't use busybox's mdev)
  • make_bootimg and unpack_bootimg utility (got the link to the sources from ac100.grandou.net if I remember correctly)
  • tegra-linux utility for doing the nvflash stuff (avalible from Toshiba at the time of writing)
  • A means of writing the the new initrd and the root fs image to the AC100 (This can be any one of: a working linux installation or initrd on the AC100, Toshiba tegra4linux nvflash utility on a working linux ordinary PC).
  • A copy of the content of /proc/cmdline before you change kernel

Initrd

I use initrd to start my system but it is possible to have a kernel that has all the required drivers to boot all compiled in. Using initrd requires a little more work but can be used to do other interesting things like LVM and or encrypted root filesystem, root on usb or SD flash memory.

This is what my init script looks like in the initrd image (I used an initrd which had broken links so some commands had to be called directly by the busybox binary):

#!/bin/sh
exec 3>&1
mount -t sysfs -o nodev,noexec,nosuid none /sys
mount -t proc -o nodev,noexec,nosuid none /proc
sysctl -w kernel.printk="4 4 1 7" >/dev/null 2>&1
mount -t tmpfs -o mode=0755 none /dev
mknod -m 0600 /dev/console c 5 1
mknod /dev/null c 1 3
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts
busybox mdev -s
sleep 5
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o ro /dev/mmcblk0p7 /root
if [ ! -r /root/sbin/init ]
then
  /bin/sh
fi
umount /proc
umount /sys
umount /dev/pts
exec switch_root /root /sbin/init 3

Edit the above script to suit where you want to boot the miniroot from (in my case this is the internal EMMC drive biggest partition) and load any modules that are required for booting (my kernel configuration does not need to do that buy if you borrowed the binary kernel from somewhere you might need some modules for the FB console or for the mass storage). Make sure the minitoot fstab has the correct root device too.

My advice is that the first init scrip should drop you into a shell so that you can manually run the very few commands, this way you can test and debug problems very effectively. Once you have booted into the ARMedslack miniroot successfully you can then try do the same thing using the init script automatically.

Repackaging the boot image

You now need to repackage the kernel and the initrd so that the AC100 boot loader understands it. You will use the make_bootimg utility for this but you will also need to remake the initrd.

From your initrd tree repackage the initrd image:

find . | cpio -o -H newc |gzip -9c > ../initrd.img

Repackage a new image for partition 5 and flash it to the AC100 (after testing you may like to write it to partition 6 and boot without having to play with home button). To repackage the new boot image you will need to make sure you have the correct command line for your device … be warned that this may not be right for your device … it's just here as an example:

make_bootimg part05.img zImage initrd.img
make_bootimg part05.img -c "mem=448M@0M lp0_vec=0x2000@0x1c29e000 tegraboot=sdmmc tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800,system:1f00:25800:800,cache:27700:32000:800,misc:59700:400:800,userdata:59c00:9a600:800"

The make_bootimg tool (at the time of writing) is rather coarse and you will actually need to run it twice as you cannot do both those actions in one go, even if the help message suggests you could.

Depending on where you did this you may be able to flash this image back to the AC100 in different ways. The first time I did this it was from a linux PC with the Toshiba nvflash utility. When I moved image to partition 6 to boot without having to fiddle with buttons I think I did it from the initrd by using dd on the correct block device.

Rebooting

Boot while pressing HOME and then hit 1

You should get dropped into a shell as there is no init on the root yet. Format your target root partition mount it and extract the miniroot tarball to it. Make sure you set up inittab on the root partition to match your system.

Reboot again with the HOME pressed and hit 1 again … if all went well you should get a Slackware prompt on the text console. If you get dropped into an inirtd shell don't worry … it's some weird timing issue that often persists across reboots, it's better to work around the problem this way: from the initrd shell type the following

busybox mdev -s
source /init

Managing the boot image from the AC100

Once you have any sort of linux up and running on the AC100 (and the tegrapart command line sent to kernel is correct for your hardware) you can manage your boot images directly from the AC100.

You can dump the raw images like this (this dumps the recovery partition boot image {partition 5 seen from nvflash} on my device)

dd if=/dev/mmcblk0p1 of=recovery.img

You can then extract kernel and initrd with the unpack_bootimage, modify things and repackage it with the make_bootimage. the bootimage utils are available in source and can be compiled on you AC100 linux distro.

Write back the image with dd again. Once you're up the firs time you will need to complete the miniroot with all the other packages you need to make it into a desktop machine. The quickest way to do this is probably to install manually slackpkg and then use that to install the rest of the stuff.

Handy Workarounds

Here are some little issues I worked around that other people might find handy

MPlayer

Mplayer from armedslack has unsuitable defaults for the AC100 so if you want video and audio playback go and edit /etc/mplayer/mplayer.conf and set these two lines:

vo=x11
ao=alsa

pppd

pppd does not correctly setup /etc/resolve.conf … I worked around this by writing very simple ip-up and ip-down to be put in /etc/ppp/

/etc/ppp/ip-up:

#!/bin/bash
if [ $USEPEERDNS -eq 1 ]
then
cp /etc/resolv.conf /etc/org_resolv.conf
> /etc/resolv.conf
[ "$DNS1" != "" ] && echo "nameserver $DNS1" >> /etc/resolv.conf
[ "$DNS2" != "" ] && echo "nameserver $DNS2" >> /etc/resolv.conf
[ -s /etc/resolv.conf ] && cat /etc/ppp/resolv.conf > /etc/resolv.conf
fi

/etc/ppp/ip-down:

#!/bin/bash
[ -s /etc/org_resolv.conf ] && cat /etc/org_resolv.conf > /etc/resolv.conf

Battery Status

Acpi is not working right and apm seems useless so I read the battery charge state directly from /sys/class/power_supply/battery/charge_now but the format is not directly human readable so I wrote something that calculates is as a percentage:

echo " $(echo "($(cat /sys/class/power_supply/battery/charge_now) * 100) / $(cat /sys/class/power_supply/battery/charge_full_design)" | bc) %"

You will get an error if you run this when the AC100 is on AC power without the battery.

Adobe Flash plugin

Although you cannot download it from adobe, Android has the blasted libflasplayer.so library but even if you hack it out of some apk you will run into trouble with incompatible libraries dew to the different instruction sets used in android and ARMedslack. In order to get some basic flash support in my ARMedslack AC100 I used swfdec: it will not play youtube videos as you get told that you need to update but it's better then nothing. I've been reported that the android libflasplayer.so works on Slackware ARM 14.

Hardware information

Here is some of the information I fetched on my AC100 before going into reflashing it with a different OS

The original partition layout

This is the layout on a 10V device, layout may be slightly different on other versions. Retreave this by using nvflash –getpartitiontable:

part #  name    size    description       remarks
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 initrd kernel starts at 0x800 initrd starts at 0x20E800
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)  
10      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) user data (/storage)

A possible way to boot linux the first time

If I remember correctly I think this is how I first got my custom image from my linux PC to the AC100 with the linux4tegra utilities. I targeted the rescue partition so that if something went wrong I'd still have android working right from partition 6. If you have a rooted android with a terminal you could possibly do this from android by using dd on the correct block device or alternatively try booting the image and ramdisk without actually writing the images to flash until you have tested them to work correctly. At the time I did it the nvflash tool was poorly documented so I did not attempt booting the image without writing it to flash.

Start in Recovery mode

$ nvflash --bl fastboot.stock.bin --go

Backup your target partition

$ nvflash --resume --read 5 part05.img

Erase the kernel partition

$ nvflash --resume --format_partition 5

The system should go automatically to fastboot mode

Flash a kernel and a ramdisk

$ fastboot flash:raw boot zImage init.img

Manipulating the boot image

This is an example of how I manipulate the boot image:

# unpack a partition:
$ ./unpack_bootimg part05.img
kernel size = 2153760
kernel addr = 10008000
ramdisk size = 421004
ramdisk addr = 11000000
second size = 0
second addr = 10f00000
tags addr = 10000100
page_size = 2048
name =
cmdline =
id = 4ed00528 cb58acc7 f259f0eb 97d77baf e5bb19fd 00000000 00000000 00000000
extracting kernel in zImage
extracting ramdisk in initrd.img

# modifying a partition, updating the kernel and ramdisk
$ ./make_bootimg part05.img zImage initrd.img
kernel size = 2153760
kernel addr = 10008000
ramdisk size = 421004
ramdisk addr = 11000000
second size = 0
second addr = 10f00000
tags addr = 10000100
page_size = 2048
name =
cmdline =
id = 4ed00528 cb58acc7 f259f0eb 97d77baf e5bb19fd 00000000 00000000 00000000
kernel size = 2153760
ramdisk size = 421004

# updating the boot cmdline:
$ ./make_bootimg part05.img -c "mem=448M@0M nvmem=64M@448M vmalloc=320M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:700:a00:800,boot:1100:1000:800,mbr:2100:200:800,system:2300:25800:800,cache:27b00:32000:800,misc:59b00:400:800,userdata:5a000:9a600:800"

If you install the tools on the AC100 you can do this all from ARMedslack on the AC100.

Contacts

If you have any issues or suggestions about this short tutorial you are welcome to contact me ( louigi600 (at) yahoo (dot) it) or even contribute yourself directly on this wiki. I apologize in advance for any vital information that may have been left out when tosh-ac100.wetpaint.com was blocked and this how-to was moved here.

Sources

 howtos:hardware:arm:toshiba_ac100_dynabook_az ()