# PandaBoard_L27.12.1-P2_Release_Notesに沿って、PandaboardにGingerbreadをのせてみた。
# PandaBoard L27.12.1-P2 Release NotesでAndroidをインストールしてみた。
# OMAPpedia PandaBoard L27.12.1-P2 Release Notes
# http://www.omappedia.org/wiki/PandaBoard_L27.12.1-P2_Release_Notes
# usage run [setup, download, make, create ]
# set -xv
#--------------------------------------------------------------------
#
# Environment Setup
#
#--------------------------------------------------------------------
cd ~
mv -f panda.sv3 panda.sv4
mv -f panda.sv2 panda.sv3
mv -f panda.sv1 panda.sv2
mv -f panda panda.sv1
mkdir -p panda
mkdir -p panda/pandroid
export BASE=~/panda/pandroid/L27.12.1-P2
mkdir -p $BASE/logs
cd $BASE
export BASE
#--------------------------------------------------------------------
# Tools & Dependency for Building
#--------------------------------------------------------------------
# from omapedia
sudo apt-get install git-core flex bison gperf libesd0-dev libwxgtk2.6-dev zlib1g-dev build-essential libstdc++5 tofrodos
# from Android Developers
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos
sudo apt-get install x-dev
sudo apt-get install libx11-dev
sudo apt-get install libncurses5-dev
sudo apt-get install openjdk-6-jdk
#sudo apt-get install sun-java6-jdk
sudo apt-get install git
sudo apt-get install curl
#--------------------------------------------------------------------
# Android Environment Setup
# Use the example below to setup your environment. Your environment may vary...
#--------------------------------------------------------------------
cd $BASE
mkdir -p mydroid
mkdir -p wlan_firmware
#Tool Chain for building Kernel and Drivers
#The Kernel and Driver sources are built using Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux version.
#Download: arm-2010q1-202 to $Your_PATH/L27.12.1-P2/build_tools/
cd $BASE
mkdir -p build_tools
cd build_tools
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
tar jxvf arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
cd $BASE/build_tools/arm-2010q1/
export PATH=$BASE/build_tools/arm-2010q1/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
export CROSS_COMPILE=arm-none-linux-gnueabi-
#--------------------------------------------------------------------
#Downloading Release Software
#--------------------------------------------------------------------
#Installing repo
#For detail information regarding repo visit: Using Repo and Git
#Other reference links on Git can be found in Techincal References page
#Download repo to environment
cd $BASE
mkdir -p bin
curl http://android.git.kernel.org/repo > ./bin/repo
chmod a+x ./bin/repo
export PATH=$BASE/bin:$PATH
#Download Android source
cd $BASE/mydroid
repo init -u git://git.omapzoom.org/platform/omapmanifest.git -b 27.x -m RLS27.12.1-P2_Gingerbread.xml
time repo sync
#--------------------------------------------------------------------
# Update PandaBoard device directory--- TODO: clean up and remove Blaze items
#--------------------------------------------------------------------
cd $BASE
cd mydroid/device/ti/pandaboard
git fetch http://review.omapzoom.org/p/device/ti/pandaboard refs/changes/12/13612/1 && git cherry-pick FETCH_HEAD
#Adding Mouse and Keyboard support
cd $BASE
cd mydroid/frameworks/base
git remote add rowboat git://gitorious.org/rowboat/frameworks-base.git
git fetch rowboat
git cherry-pick 17128d44ab04c5b7cb2911e8b1c9f837aa9b36a5
git cherry-pick 174cb50436065dc092114d69fb40d5a7712e3ca0
#--------------------------------------------------------------------
#Adding Audio Support
#Patch 1 of 2
cd $BASE
cd mydroid/hardware/ti/omap3
git fetch http://review.omapzoom.org/p/platform/hardware/ti/omap3 refs/changes/76/13276/5 && git cherry-pick FETCH_HEAD
#Patch 2 of 2
patch -p1 << _EOF_EOF_
diff --git a/modules/alsa/Android.mk b/modules/alsa/Android.mk
index 31d4890..b2c1e6b 100644
--- a/modules/alsa/Android.mk
+++ b/modules/alsa/Android.mk
@@ -39,6 +39,7 @@ ifeq (\$(strip \$(BOARD_USES_ALSA_AUDIO)),true)
endif
ifeq (\$(strip \$(TARGET_BOARD_PLATFORM)), omap4)
ifeq (\$(strip \$(TARGET_BOOTLOADER_BOARD_NAME)), pandaboard)
+ LOCAL_CFLAGS += -DOMAP4_PANDA
LOCAL_SRC_FILES:= alsa_panda.cpp
else
LOCAL_SRC_FILES:= alsa_omap4.cpp
diff --git a/modules/alsa/alsa_omap4.h b/modules/alsa/alsa_omap4.h
index cde2a3e..40bb63f 100644
--- a/modules/alsa/alsa_omap4.h
+++ b/modules/alsa/alsa_omap4.h
@@ -26,12 +26,18 @@
#endif
// alsa devices
+#ifdef OMAP4_PANDA
+#define MM_DEFAULT_DEVICE "plughw:0,4"
+#define MM_LP_DEVICE "hw:0,4"
+#define HDMI_DEVICE "plughw:0,6"
+#else
#define MM_DEFAULT_DEVICE "plughw:0,0"
#define BLUETOOTH_SCO_DEVICE "plughw:0,0"
#define FM_TRANSMIT_DEVICE
"plughw:0,0"
#define FM_CAPTURE_DEVICE "plughw:0,1"
#define MM_LP_DEVICE "hw:0,6"
#define HDMI_DEVICE
"plughw:0,7"
+#endif
// omap4 outputs/inputs
#define OMAP4_OUT_SCO (\\
_EOF_EOF_
#--------------------------------------------------------------------
# Adding WLAN support
cd $BASE/
git clone git://git.omapzoom.org/platform/hardware/ti/wlan.git
cd $BASE/wlan
git reset --hard 456971003aaa94a6b863b7a368aac8415ff32f8c
#--------------------------------------------------------------------
#Patch for Google apps crashing -- Courtesy of Always Innovating
cd $BASE/mydroid
patch -p1 << _EOF_EOF_
--- a/frameworks/base/libs/ui/InputReader.cpp
+++ b/frameworks/base/libs/ui/InputReader.cpp
@@ -426,7 +426,7 @@
{ // acquire state lock
AutoMutex _l(mStateLock);
- int32_t touchScreenConfig = InputConfiguration::TOUCHSCREEN_NOTOUCH;
+ int32_t touchScreenConfig = InputConfiguration:: TOUCHSCREEN_FINGER;
int32_t keyboardConfig = InputConfiguration::KEYBOARD_NOKEYS;
int32_t navigationConfig = InputConfiguration::NAVIGATION_NONAV;
{ // acquire device registry reader lock
_EOF_EOF_
#--------------------------------------------------------------------
# Kernel & Driver Source
# To clone kernel source from scratch do:
#--------------------------------------------------------------------
cd $BASE/
git clone git://git.omapzoom.org/kernel/omap.git kernel/android-2.6.35
cd kernel/android-2.6.35
git checkout ec895072ad0b686d2c130e5d80a3076a03042033
# If you already have kernel source cloned then just update it (and add a remote if it is the first time):
cd $BASE/kernel/android-2.6.35
git fetch origin
git checkout ec895072ad0b686d2c130e5d80a3076a03042033
#--------------------------------------------------------------------
# Kernel Patches
# Audio fixes for kernel:
#--------------------------------------------------------------------
cd $BASE/kernel/android-2.6.35
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/01/13001/2 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/02/13002/2 && git cherry-pick FETCH_HEAD
#--------------------------------------------------------------------
# EHCI fixes for kernel:
cd $BASE/kernel/android-2.6.35
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/17/13617/1 && git cherry-pick FETCH_HEAD
#--------------------------------------------------------------------
# DSS patch
cd $BASE/kernel/android-2.6.35
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/22/13722/2 && git cherry-pick FETCH_HEAD
#--------------------------------------------------------------------
# WLAN patches
cd $BASE/kernel/android-2.6.35
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/02/12002/2 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/03/12003/1 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/64/14064/1 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/67/14067/1 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/68/14068/1 && git cherry-pick FETCH_HEAD
T
# update panda_defconfig -- TODO:get this merged:
cd $BASE/kernel/android-2.6.35
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/29/13029/3 && git cherry-pick FETCH_HEAD
git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/61/13861/1 && git cherry-pick FETCH_HEAD
#--------------------------------------------------------------------
#U-Boot Source
cd $BASE
git clone git://git.omapzoom.org/repo/u-boot.git u-boot
cd u-boot
git checkout 601ff71c8d46b5e90e13613974a16d10f2006bb3
#-boot patch
#a patch is available that changes the bootdelay as well as configures the correct bootargs: bootargs patch
#--------------------------------------------------------------------
#X-loader Source
cd $BASE
git clone git://git.omapzoom.org/repo/x-loader.git x-loader
cd x-loaderT
git checkout c8855fa6b85bd44073bd1b25dbffa99f02cbeeed
#--------------------------------------------------------------------
# Build Instructions
#--------------------------------------------------------------------
# Setting up build environment
cd $BASE
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
export CROSS_COMPILE=arm-none-linux-gnueabi-
export PATH=$BASE/build_tools/arm-2010q1/bin:$PATH
#--------------------------------------------------------------------
# Building u-boot
# Before building u-boot adjust the bootdelay and bootargs in omap4430panda.h
# Note: Anyone wanting to try Fastboot do not adjust the BOOTDELAY
# changing bootdelay
#vim $YOUR_PATH/L27.12.1-P2/u-boot/include/configs/omap4430panda.h
#- #define CONFIG_BOOTDELAY 0
#+ #define CONFIG_BOOTDELAY 5
mv $BASE/u-boot/include/configs/omap4430panda.h \
$BASE/u-boot/include/configs/omap4430panda.h.org
sed -e 's/#define CONFIG_BOOTDELAY 0/#define CONFIG_BOOTDELAY 5/' \
$BASE/u-boot/include/configs/omap4430panda.h.org > \
$BASE/u-boot/include/configs/omap4430panda.h
#--------------------------------------------------------------------
# build u-boot
#--------------------------------------------------------------------
cd $BASE/u-boot
make distclean
make ARCH=arm omap4430panda_config
make 2>&1 |tee $BASE/logs/u-boot_make.out
#--------------------------------------------------------------------
# For information regarding Fastboot visit: Android_eMMC_Booting
# Building x-loader
#--------------------------------------------------------------------
cd $BASE/x-loader
make distclean
make ARCH=arm omap4430panda_config
make ift 2>&1 |tee $BASE/logs/x-loader_make.out
#--------------------------------------------------------------------
# Building Kernel
# Build KernelT
# To create kernel uImage you need to add "mkimage" directory path to your "PATH" environment variable. "mkimage" is located in your u-boot/tools/ directory.
#--------------------------------------------------------------------
cd $BASE/kernel/android-2.6.35
export PATH=$BASE/u-boot/tools:$PATH
make ARCH=arm distclean #(required for rebuild only)
make ARCH=arm panda_defconfig
make ARCH=arm uImage 2>&1 |tee $BASE/logs/kernel_make.out
#Building Kernel modules
cd $BASE/kernel/android-2.6.35
make ARCH=arm modules 2>&1 |tee $BASE/logs/kernel_modules.out
#--------------------------------------------------------------------
# Building WLAN driver
#--------------------------------------------------------------------
# Build 127x station driver
cd $BASE
mkdir -p wlan
cd wlan/wl1283/platforms/os/linux
export KERNEL_DIR=$BASE/kernel/android-2.6.35
make clean
make TNETW=1273
#--------------------------------------------------------------------
# Build 127x softAp driver
cd $BASE/wlan/wl1283_softAP/platforms/os/linux
make TNETW=1273
#--------------------------------------------------------------------
# Building Android Filesystem (AFS) with TI Codecs enabled
# on step below use the number of cores you have available; i.e. -j4 or -j12:
#--------------------------------------------------------------------
cd $BASE/mydroid
cp -Rfp device/ti/pandaboard/buildspec.mk.default buildspec.mk
make clean #(required for rebuild only)
make TARGET_PRODUCT=pandaboard -j4 2>&1 |tee $BASE/logs/android_make.out
#--------------------------------------------------------------------
# create rootfs
#--------------------------------------------------------------------
OUTDIR=$BASE/mydroid/out/target/product/pandaboard
cd $BASE
mkdir -p OUT ./OUT/rootfs
mkdir -p $OUTDIR/system/etc/wifi
mkdir -p $OUTDIR/system/etc/wifi/softap
cp -Rfp $BASE/kernel/android-2.6.35/drivers/staging/ti-st/*.ko
$OUTDIR/root
cp -Rfp $BASE/kernel/android-2.6.35/drivers/bluetooth/btwilink.ko
$OUTDIR/root
cp -Rfp $BASE/wlan/wl1283/platforms/os/linux/tiwlan_drv.ko
$OUTDIR/system/etc/wifi/
cp -Rfp $BASE/wlan/wl1283_softAP/platforms/os/linux/tiap_drv.ko
$OUTDIR/system/etc/wifi/softap/
cp -ax $BASE/mydroid/device/ti/proprietary-open/graphics/omap4/*
$OUTDIR/
cp -Rfp $OUTDIR/root/*
$BASE/OUT/rootfs
cp -Rfp $OUTDIR/system
$BASE/OUT/rootfs
cp -Rfp $OUTDIR/data
$BASE/OUT/rootfs
#--------------------------------------------------------------------
# create rootfs
#--------------------------------------------------------------------
cd $BASE
mkdir -p wlan_firmware
cd wlan_firmware
wget https://gforge.ti.com/gf/download/frsrelease/567/4721/Bluetooth_WLAN_KernelPatches_Firmware_Config_L27.12.1-P2-Pandroid-1.0-Linux-x86-Install
chmod a+x Bluetooth_WLAN_KernelPatches_Firmware_Config_L27.12.1-P2-Pandroid-1.0-Linux-x86-Install
./Bluetooth_WLAN_KernelPatches_Firmware_Config_L27.12.1-P2-Pandroid-1.0-Linux-x86-Install --mode silent --prefix out
mkdir -p $BASE/OUT/rootfs/system/etc/firmware
#copy *.ko to rootfs
cp -rfp $BASE/wlan/wl1283/platforms/os/linux/*.ko
$BASE/OUT/rootfs/system/etc/wifi/
cp -rfp $BASE/wlan/wl1283_softAP/platforms/os/linux/*.ko
$BASE/OUT/rootfs/system/etc/wifi/softap
#adding firmware to rootfs
cp -rfp $BASE/wlan_firmware/out/BT_Firmware/*
$BASE/OUT/rootfs/system/etc/firmware/
cp -rfp $BASE/wlan_firmware/out/WLAN_config/Station_config/tiwlan.ini
$BASE/OUT/rootfs/system/etc/wifi
cp -rfp $BASE/wlan_firmware/out/WLAN_config/AP_Config/tiwlan_ap.ini
$BASE/OUT/rootfs/system/etc/wifi/softap
cp -rfp $BASE/wlan_firmware/out/WLAN_Firmware/Station_FW/firmware.bin
$BASE/OUT/rootfs/system/etc/wifi
cp -rfp $BASE/wlan_firmware/out/WLAN_Firmware/AP_FW/firmware_ap.bin
$BASE/OUT/rootfs/system/etc/wifi/softap
#--------------------------------------------------------------------
# Replace Launcher apk
# Take this from L27.12.1-P2 binary release.
#--------------------------------------------------------------------
cd $BASE
mkdir -p pre_build
cd pre_build
wget http://pandroid.googlecode.com/files/L27.12.1-P2-pandroid_v2.tar.bz2
tar xvf L27.12.1-P2-pandroid_v2.tar.bz2
cp -Rfp $BASE/pre_build/patches/android_patches/Launcher2.apk $BASE/OUT/rootfs/system/app
#--------------------------------------------------------------------
# create boot
#--------------------------------------------------------------------
cd $BASE
mkdir -p OUT ./OUT/boot
cp -a $BASE/x-loader/MLO ./OUT/boot/MLO
cp -a $BASE/u-boot/u-boot.bin ./OUT/boot/u-boot.bin
cp -a $BASE/kernel/android-2.6.35/arch/arm/boot/uImage ./OUT/boot/uImage
#--------------------------------------------------------------------
# bootargs for pandaboard
#--------------------------------------------------------------------
#echo "setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 mem=456M@0x80000000 mem=512M@0xA0000000 root=/dev/mmcblk0p3 rw rootdelay=2 init=/init vram="32M" omapfb.vram=0:16M,1:16M consoleblank=0'" > /tmp/boot.script
#echo "setenv bootcmd 'mmcinit 0;fatload mmc 0 0x80000000 uImage; bootm 0x80000000'">>/tmp/boot.script
#echo "boot">>/tmp/boot.script
#echo "setenv console console=ttyO2,115200n8 androidboot.console=ttyO2" >/tmp/boot.script
#echo "setenv memory mem=456M@0x80000000 mem=512M@0xA0000000" >>/tmp/boot.script
#echo "setenv rootfs root=/dev/mmcblk0p3 rw rootdelay=2 init=/init" >>/tmp/boot.script
#echo "setenv vmem vram="32M" omapfb.vram=0:16M" >>/tmp/boot.script
#echo "setenv display omapdss.def_disp=hdmi consoleblank=0" >>/tmp/boot.script
#echo "setenv bootargs \${console} \${memory} \${rootfs}
\${vmem} \${display}" >>/tmp/boot.script
#echo "printenv bootargs" >>/tmp/boot.script
#echo "setenv bootcmd 'mmcinit 0;fatload mmc 0 0x80000000 uImage; bootm 0x80000000'" >>/tmp/boot.script
#echo "boot" >>/tmp/boot.script
#--------------------------------------------------------------------
#
#--------------------------------------------------------------------
echo "setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 mem=456M@0x80000000 mem=512M@0xA0000000 root=/dev/mmcblk0p3 rw rootdelay=2 init=/init vram=\"32M\" omapfb.vram=0:16M omapdss.def_disp=hdmi consoleblank=0'" >/tmp/boot.script
echo "etenv bootcmd 'mmcinit 0;fatload mmc 0 0x80000000 uImage; bootm 0x80000000'" >>/tmp/boot.script
echo boot >>/tmp/boot.script
$BASE/u-boot/tools/mkimage -A arm -T script -O linux -C none -a 0 -e 0 -n "boot.scr" -d /tmp/boot.script $BASE/OUT/boot/boot.scr
# なぜか、boot.scrは動かなかったので手動で起動。
#--------------------------------------------------------------------
# SD Write SDのスペシャルファイルはPCに合わせる事。
#--------------------------------------------------------------------
#sync;sync;sync
#sudo umount /dev/sdb1
#sudo umount /dev/sdb2
#sudo umount /dev/sdb3
#sync;sync;sync
#sudo sh ~/bin/mksdcard_panda.sh /dev/sdb
#sync;sync;sync
# 挿抜した後に書き込む。
#--------------------------------------------------------------------
#
# Create SD card
#
#--------------------------------------------------------------------
#cd $BASE
#sudo cp -a ./OUT/boot/MLO /media/boot
#sudo cp -a ./OUT/boot/u-boot.bin /media/boot
#sudo cp -a ./OUT/boot/boot.scr /media/boot
#sudo cp -a ./OUT/boot/uImage /media/boot\
#sudo cp -a ./OUT/rootfs/* /media/rootfs
#sync;sync;sync