ReferencePlatforms/mobile-imaging-android-tegra

From MozillaWiki
Jump to: navigation, search

Set up a Fedora 14 imaging netbook for Android 2.2 Tegra 250

Requirements

  • Fedora 14 netbook
  • USB port
  • SD card slot

Basic first install steps

  • Install Fedora. Create an account called mozilla.
  • Log in as an mozilla.
  • Create a base directory. I chose ~/android-tegra
  • Download the JDK
    • Run it as root; it should install the RPMs.
  • Download the Android SDK tarball.
    • I extracted this into ~/android-tegra/android-sdk-linux_86
    • run tools/android and install the Android Repository -> SDK Platform Android 2.2 and Android Repository -> Android SDK Platform-tools
  • Download the Tegra Android 2.2. The PDF is helpful; you need the RUN file.
    • I installed this into ~/android-tegra/tegra_froyo_20101105
  • sudo yum install telnet wget

Update startup scripts

Add ~/android-tegra/android-sdk-linux_86/platform-tools to your PATH in ~/.bashrc

Create SUT directory

mkdir ~/android-tegra/SUT
cd ~/android-tegra/SUT
# copy SUTAgentAndroid apk, Watcher apk, FenCP apk, FfxCP apk here.

Create a tegra_gainroot.sh

#!/system/bin/sh

mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cd /system/bin
cat sh > su
chmod 4755 su
chmod 4755 reboot

Create an initialize_tegra.sh

#!/bin/sh -e

APK_LIST="SUTAgentAndroidBob26.apk Watcher26.apk FenCP25.apk FfxCP25.apk"
BASEPORT=42000

if [ $# -ne 1 ] ; then
    echo "Usage: $0 <tegra-xxx>"
    exit -1
fi
TEGRANAME=$1

echo $TEGRANAME | grep '^tegra-[0-9][0-9][0-9]$' > /dev/null
if [ $? -ne 0 ] ; then
    echo "$1 is not a valid tegra name!"
    exit -1
fi

TEGRANUM=`echo $TEGRANAME | sed -e s/tegra-//`
PORT=`expr 42000 + $TEGRANUM`

if [ $TEGRANUM -gt 10 -a $TEGRANUM -le 30 ] ; then
    SUTSERVER="10.250.48.151"
elif [ $TEGRANUM -gt 30 -a $TEGRANUM -le 50 ] ; then
    SUTSERVER="10.250.48.152"
elif [ $TEGRANUM -gt 50 -a $TEGRANUM -le 70 ] ; then
    SUTSERVER="10.250.48.153"
elif [ $TEGRANUM -gt 70 -a $TEGRANUM -le 90 ] ; then
    SUTSERVER="10.250.48.154"
else
    SUTSERVER="10.250.48.9"
fi

echo "Associating $TEGRANAME with Server $SUTSERVER Port $PORT"

cd ../SUT
sudo adb devices
adb wait-for-device
sleep 60
for apk in $APK_LIST; do
    adb install -r $apk
done
adb push tegra_gainroot.sh /sdcard/tegra_gainroot.sh
cat SUTAgent.ini.tmpl | sed -e "s/\(IPAddr *= *\).*$/\1$SUTSERVER/" | sed -e "s/\(PORT *= *\).*$/\1$PORT/" > tmpfile
adb push tmpfile /data/data/com.mozilla.SUTAgentAndroid/files/SUTAgent.ini
adb shell chmod 777 /data/data/com.mozilla.SUTAgentAndroid/files
cat watcher.ini.tmpl | sed -e "s/\(PingTarget *= *\).*$/\1$SUTSERVER/" > tmpfile
adb push tmpfile /data/data/com.mozilla.watcher/files/watcher.ini
adb shell chmod 777 /data/data/com.mozilla.watcher/files
adb shell sh /sdcard/tegra_gainroot.sh
adb shell am start -a android.settings.APPLICATION_SETTINGS
adb shell mkdir /mnt/sdcard/tests
## HDMI
#adb shell setprop persist.tegra.dpy5.mode.width 1680
#adb shell setprop persist.tegra.dpy5.mode.height 1050
# VGA/CRT
#adb shell setprop persist.tegra.dpy3.mode.width 1680
#adb shell setprop persist.tegra.dpy3.mode.height 1050
rm tmpfile
echo "##########"
echo "$TEGRANAME associated with server $SUTSERVER Port $PORT"
echo "Set Development -> Stay Awake on the tegra,"

Create an SUTAgent.ini.tmpl

[Registration Server]
IPAddr = 10.250.48.9
PORT = 20742
HARDWARE = Android Board
POOL = GENERAL

Create a watcher.ini.tmpl

[watcher]
// hostname or ip address of target for ping check
PingTarget = 10.250.48.9
// delay in ms. until the first check
delay = 60000
// amount of time in ms. between checks
period = 300000
// number of failures that trigger a reboot
strikes = 5

Fix perms + softlink

chmod a+rx initialize.sh tegra_gainroot.sh
cd ../tegra_froyo_20101105
ln -s ../SUT/initialize.sh .

Set up a Windows 7 imaging netbook for Android 2.2 Tegra 250

Requirements

  • These instructions are for 32 bit Windows 7
    • it's doable with 64 bit, but no docs here
    • it's doable with linux (see above)
    • it's probably doable with other flavors of Windows, but not tested
  • USB port
  • SD card slot

Basic first install steps

  • Log in as an administrator.
  • Install Cygwin (Choose full install).
  • Create a base directory. I chose c:/android-tegra
  • Download the Android SDK zip.
    • I extracted this into c:/android-tegra/android-sdk-windows
  • Download the Tegra 250 Support pack installer. The PDF is helpful; you need the MSI.
    • I installed this into c:/android-tegra/tegra_froyo_20101105
  • Install USBDeview (search CNet for a newer or 64 bit version if necessary).
    • I extracted this into c:/android-tegra/usbdeview

Fix ADB

ADB doesn't work out of the box for the Tegras. The first two posts here are very important.

To allow the netbook to use ADB with the Tegras:

# Create ~/.android/adb_usb.ini
cd /cygdrive/c/Documents\ and\ Settings/Mozilla\ Corporation
mkdir .android
cd .android
echo "0x955" > adb_usb.ini
# Edit android_winusb.inf
cd /cygdrive/c/android-tegra/android-sdk-windows/usb_driver
cp android_winusb.inf android_winusb.orig

Edit android_winusb.inf. For a 32 bit machine, in the [Google.NTx86] section, add the following lines:

;NVIDIA Tegra
%SingleAdbInterface% = USB_Install, USB\VID_0955&PID_7000
%CompositeAdbInterface% = USB_Install, USB\VID_0955&PID_7100&MI_01

Create startup scripts

I created a c:/android-tegra/android-tegra.bat:

@echo off
rem android imaging startup batch script

c:
chdir c:\cygwin\bin
bash --init-file /cygdrive/c/android-tegra/android-tegra.sh

I created a c:/android-tegra/android-tegra.sh:

# android imaging env

export TEGRA_DIR=/cygdrive/c/android-tegra/tegra_froyo_20101105
export PATH=/usr/local/bin:/usr/bin:/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/lib/lapack:$TEGRA_DIR:/cygdrive/c/android-tegra/android-sdk-windows/tools
cd $TEGRA_DIR
export PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ "

(I basically did echo $PATH >> filename and echo $PS1 >> filename and edited accordingly, adding $TEGRA_DIR and the android-sdk-windows/tools directory to the PATH.)

Create shortcuts

android_install

  • Copy your Cygwin Bash Shell shortcut on the desktop.
  • Rename to android_install
  • Right click, Properties -> Shortcut
  • Change the target to c:\android-tegra\android-tegra.bat
  • Start in: c:\android-tegra

Double click, and test:

  • You should be in /cygdrive/c/android-tegra/tegra_froyo_20101105
  • which adb should give you /cygdrive/c/android-tegra/android-sdk-windows/tools/adb

USBDeview

  • Right click on Start -> Open Windows Explorer
  • Go to c:\android-tegra\usbdeview
  • Right click on USBDeview, Send to -> Desktop (create shortcut)
  • Rename the shortcut to USBDeview

Double click, and test:

  • USBDeview should open

Device Manager

  • Right click on Start -> Open Windows Explorer
  • Go to c:\windows\system32, scroll down
  • Right click on devmgmt, Send to -> Desktop (create shortcut)
  • Rename the shortcut to Device Manager

Double click, and test:

  • Device Manager should open

Helpful links