2011-02-18 20:14:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-03-23 22:16:01 +00:00
|
|
|
VER=2.5.1
|
2011-02-18 20:14:01 +00:00
|
|
|
ROM=Froyo_Sense_Revolution
|
|
|
|
|
|
|
|
BUILD1_NAME=${ROM}_${VER}_CWM
|
|
|
|
BUILD2_NAME=${ROM}_${VER}_DFT
|
2011-03-13 13:17:33 +00:00
|
|
|
BUILD3_NAME=${ROM}_${VER}_LK
|
2011-02-18 20:14:01 +00:00
|
|
|
BUILD1=/tmp/${BUILD1_NAME}
|
|
|
|
BUILD2=/tmp/${BUILD2_NAME}
|
2011-03-13 13:17:33 +00:00
|
|
|
BUILD3=/tmp/${BUILD3_NAME}
|
2011-02-18 20:14:01 +00:00
|
|
|
TOOLS=${PWD}/../tools
|
|
|
|
MKYAFFS=${TOOLS}/mkyaffs2image
|
|
|
|
UNYAFFS=${TOOLS}/unyaffs
|
2011-03-13 13:17:33 +00:00
|
|
|
MAIN=${PWD}
|
|
|
|
|
|
|
|
syncDirs()
|
|
|
|
{
|
|
|
|
mkdir -p ${BUILD1}
|
|
|
|
echo -n "Synchronising the build ... "
|
|
|
|
rsync --exclude ".svn" -az ${MAIN}/../build/* ${BUILD1}/.
|
|
|
|
echo "DONE"
|
|
|
|
rm -rf ${BUILD1}/boot/initrd
|
|
|
|
|
|
|
|
# Change the version number in build.prop
|
|
|
|
sed -i s/ro.product.version=.*/ro.product.version=${VER}/g ${BUILD1}/system/build.prop
|
|
|
|
sed -i s/ro.build.description=.*/ro.build.description=${ROM}/g ${BUILD1}/system/build.prop
|
2011-09-03 20:06:20 +00:00
|
|
|
sed -i s/ro.modversion=.*/ro.modversion=${ROM}_${VER}/g ${BUILD1}/system/build.prop
|
2011-03-13 13:17:33 +00:00
|
|
|
}
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
set_perm_recursive()
|
|
|
|
{
|
|
|
|
file=`echo $5 | sed -E 's/\///'`
|
|
|
|
chown -R $1:$2 $file
|
|
|
|
find $file -type d -exec chmod $3 {} \;
|
|
|
|
find $file -type f -exec chmod $4 {} \;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm()
|
|
|
|
{
|
|
|
|
file=`echo $4 | sed -E 's/\///'`
|
|
|
|
chown $1:$2 $file
|
|
|
|
chmod $3 $file
|
|
|
|
}
|
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
doFiles()
|
2011-02-18 20:14:01 +00:00
|
|
|
{
|
|
|
|
# create symlinks for busybox
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/system/xbin > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
for file in `cat ${TOOLS}/busybox`
|
|
|
|
do
|
2011-03-13 13:17:33 +00:00
|
|
|
ln -sf busybox $file
|
2011-02-18 20:14:01 +00:00
|
|
|
done
|
2011-03-13 13:17:33 +00:00
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# create symlinks for toolbox
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/system/bin > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
for file in `cat ${TOOLS}/toolbox`
|
|
|
|
do
|
2011-03-13 13:17:33 +00:00
|
|
|
ln -sf toolbox $file
|
2011-02-18 20:14:01 +00:00
|
|
|
done
|
2011-03-13 13:17:33 +00:00
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# create symlink for su
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/system/bin > /dev/null 2>&1
|
|
|
|
ln -sf ../xbin/su
|
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# To enable a2sd+ by default
|
|
|
|
# app, app-private and dalvik-cache
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/data > /dev/null 2>&1
|
|
|
|
ln -s /sd-ext/app
|
|
|
|
ln -s /sd-ext/app-private
|
|
|
|
ln -s /sd-ext/dalvik-cache
|
|
|
|
touch .dalvikcache
|
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# To enable datasd uncomment the lines below
|
2011-03-13 13:17:33 +00:00
|
|
|
#pushd ${BUILD1}/data > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
#ln -s /sd-ext/data
|
|
|
|
#touch .datasd
|
2011-03-13 13:17:33 +00:00
|
|
|
#popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/system/etc/init.d > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
mv dtapp 04apps2sd
|
2011-03-13 13:17:33 +00:00
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# change permissions
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
set_perm_recursive 0 0 0755 0644 "/system"
|
|
|
|
set_perm_recursive 0 2000 0755 0755 "/system/bin"
|
|
|
|
set_perm 0 3003 02750 "/system/bin/netcfg"
|
|
|
|
set_perm 0 3004 02755 "/system/bin/ping"
|
|
|
|
set_perm 0 2000 06750 "/system/bin/run-as"
|
|
|
|
set_perm_recursive 1002 1002 0755 0440 "/system/etc/bluetooth"
|
|
|
|
set_perm 0 0 0755 "/system/etc/bluetooth"
|
|
|
|
set_perm 1000 1000 0640 "/system/etc/bluetooth/auto_pairing.conf"
|
|
|
|
set_perm 3002 3002 0444 "/system/etc/bluetooth/blacklist.conf"
|
|
|
|
set_perm 1002 1002 0440 "/system/etc/dbus.conf"
|
|
|
|
set_perm 1014 2000 0550 "/system/etc/dhcpcd/dhcpcd-run-hooks"
|
|
|
|
set_perm_recursive 0 2000 0755 0750 "/system/etc/init.d"
|
|
|
|
set_perm 0 0 0755 "/system/etc/init.d"
|
|
|
|
set_perm 0 2000 0550 "/system/etc/init.goldfish.sh"
|
2011-03-13 13:17:33 +00:00
|
|
|
#set_perm 0 0 0544 "/system/etc/install-recovery.sh"
|
2011-02-18 20:14:01 +00:00
|
|
|
set_perm_recursive 0 0 0755 0555 "/system/etc/ppp"
|
|
|
|
set_perm_recursive 0 2000 0755 0755 "/system/xbin"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/hcitool"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/librank"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/procmem"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/procrank"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/su"
|
|
|
|
set_perm 0 0 06755 "/system/xbin/tcpdump"
|
2011-03-13 13:17:33 +00:00
|
|
|
set_perm 0 0 04755 "/system/bin/pppd"
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
createDFT()
|
|
|
|
{
|
|
|
|
syncDirs
|
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
|
|
|
rm -rf ../${BUILD2_NAME}.7z
|
|
|
|
rm -rf ${BUILD2}
|
|
|
|
mkdir ${BUILD2}
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
doFiles
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
# create images
|
2011-03-13 13:17:33 +00:00
|
|
|
echo -n "Creating DFT img files ... "
|
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
|
|
|
[ -d system ] && echo -n "system ... " && ${MKYAFFS} system ${BUILD2}/system.img > /dev/null 2>&1
|
|
|
|
[ -d boot ] && echo -n "boot ... " && ${MKYAFFS} boot ${BUILD2}/boot.img > /dev/null 2>&1
|
|
|
|
[ -d data ] && echo -n "data ... " && ${MKYAFFS} data ${BUILD2}/data.img > /dev/null 2>&1
|
|
|
|
[ -d recovery ] && echo -n "recovery ... " && ${MKYAFFS} recovery ${BUILD2}/recovery.img > /dev/null 2>&1
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
echo "DONE"
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
cp ${TOOLS}/DFT/* ${BUILD2}/.
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD2}/.. > /dev/null 2>&1
|
|
|
|
echo -n "Creating DFT archive ... "
|
|
|
|
7zr a ${BUILD2_NAME}.7z ${BUILD2_NAME} > /dev/null 2>&1
|
|
|
|
echo "DONE"
|
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
createCWM()
|
|
|
|
{
|
2011-03-13 13:17:33 +00:00
|
|
|
syncDirs
|
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
rsync --exclude ".svn" -az ${TOOLS}/META-INF .
|
2011-03-13 13:17:33 +00:00
|
|
|
pushd ${BUILD1}/boot > /dev/null 2>&1
|
|
|
|
|
|
|
|
if [[ "$1" == "LK" ]] ; then
|
|
|
|
genInitrd LK
|
|
|
|
${TOOLS}/mkbootimg --kernel zImage --ramdisk initrd.gz --cmdline "console=null" --base 0x11800000 -o ${BUILD1}/boot.img
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
rm -rf boot
|
|
|
|
cp META-INF/com/google/android/updater-script.lk META-INF/com/google/android/updater-script
|
|
|
|
touch system/ppp
|
|
|
|
rm -rf ../${BUILD1_NAME}_LK.zip
|
|
|
|
echo -n "Creating CWM LK zip file ... "
|
|
|
|
zip -9Dry -q ../${BUILD1_NAME}_LK.zip *
|
|
|
|
echo "DONE"
|
|
|
|
rm -rf system/ppp
|
|
|
|
else
|
|
|
|
genInitrd
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
cp META-INF/com/google/android/updater-script.std META-INF/com/google/android/updater-script
|
2011-03-23 22:16:01 +00:00
|
|
|
rm -rf system/app/ROMManager.apk
|
2011-03-13 13:17:33 +00:00
|
|
|
rm -rf ../${BUILD1_NAME}.zip
|
|
|
|
echo -n "Creating CWM zip file ... "
|
|
|
|
zip -9Dry -q ../${BUILD1_NAME}.zip *
|
|
|
|
echo "DONE"
|
|
|
|
fi
|
|
|
|
|
2011-02-18 20:14:01 +00:00
|
|
|
rm -rf META-INF
|
2011-03-13 13:17:33 +00:00
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
}
|
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
createLK()
|
|
|
|
{
|
|
|
|
syncDirs
|
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
|
|
|
rm -rf ../${BUILD3_NAME}.7z
|
|
|
|
rm -rf ${BUILD3}
|
|
|
|
mkdir ${BUILD3}
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
doFiles
|
|
|
|
touch ${BUILD1}/system/ppp
|
|
|
|
genInitrd LK
|
|
|
|
|
|
|
|
pushd ${BUILD1}/boot > /dev/null 2>&1
|
|
|
|
${TOOLS}/mkbootimg --kernel zImage --ramdisk initrd.gz --cmdline "console=null" --base 0x11800000 -o ${BUILD3}/boot.img
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
pushd ${BUILD1} > /dev/null 2>&1
|
|
|
|
[ -d system ] && ${MKYAFFS} system ${BUILD3}/system.img > /dev/null 2>&1
|
|
|
|
[ -d data ] && ${MKYAFFS} data ${BUILD3}/data.img > /dev/null 2>&1
|
|
|
|
popd
|
|
|
|
|
|
|
|
cp ${TOOLS}/fastboot* ${BUILD3}/.
|
|
|
|
cp ${TOOLS}/recovery_lk.img ${BUILD3}/recovery.img
|
|
|
|
pushd ${BUILD3}/.. > /dev/null 2>&1
|
|
|
|
echo -n "Creating LK archive ... "
|
|
|
|
7zr a ${BUILD3_NAME}.7z ${BUILD3_NAME} > /dev/null 2>&1
|
|
|
|
echo "DONE"
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
rm -rf ${BUILD1}/system/ppp
|
|
|
|
}
|
|
|
|
|
|
|
|
genInitrd()
|
|
|
|
{
|
|
|
|
|
|
|
|
mkdir -p ${BUILD1}/boot/initrd
|
|
|
|
rsync --exclude ".svn" -az ${MAIN}/../build/boot/initrd/ ${BUILD1}/boot/initrd
|
|
|
|
echo -n "Creating initrd ... "
|
|
|
|
pushd ${BUILD1}/boot/initrd > /dev/null 2>&1
|
|
|
|
chmod 770 bin/*
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-23 22:16:01 +00:00
|
|
|
# if [[ "$1" == "LK" ]] ; then
|
|
|
|
# mv init.android init
|
|
|
|
# pushd sbin > /dev/null 2>&1
|
|
|
|
# ln -sf ../init ueventd
|
|
|
|
# popd > /dev/null 2>&1
|
|
|
|
# fi
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
find .|cpio --quiet -H newc -o|gzip -9 -c - > ../initrd.gz
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
popd > /dev/null 2>&1
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
rm -rf ${BUILD1}/boot/initrd
|
|
|
|
echo "DONE"
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
if [[ `echo $0 | grep createInitrd.sh` ]]; then
|
2011-02-18 20:14:01 +00:00
|
|
|
|
2011-03-13 13:17:33 +00:00
|
|
|
cp ${BUILD1}/boot/initrd.gz /tmp/initrd.gz.$$
|
|
|
|
rm -rf ${BUILD1}
|
|
|
|
mkdir ${BUILD1}
|
|
|
|
cp /tmp/initrd.gz.$$ ${BUILD1}/initrd.gz
|
|
|
|
ls -lh ${BUILD1}/initrd.gz
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
echo Build started on `date`
|
|
|
|
echo
|
|
|
|
|
|
|
|
if [[ `echo $0 | grep createInitrd.sh` ]]; then
|
|
|
|
|
2011-03-23 22:16:01 +00:00
|
|
|
#if [[ "$1" == "LK" ]] ; then
|
|
|
|
# genInitrd LK
|
|
|
|
#else
|
2011-03-13 13:17:33 +00:00
|
|
|
genInitrd
|
2011-03-23 22:16:01 +00:00
|
|
|
#fi
|
2011-03-13 13:17:33 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
syncDirs
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
createCWM
|
2011-03-13 13:17:33 +00:00
|
|
|
createCWM LK
|
|
|
|
#createDFT
|
|
|
|
#createLK
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
rm -rf ${BUILD1}
|
|
|
|
rm -rf ${BUILD2}
|
2011-03-13 13:17:33 +00:00
|
|
|
rm -rf ${BUILD3}
|
2011-02-18 20:14:01 +00:00
|
|
|
|
|
|
|
echo "your files are here"
|
|
|
|
echo ""
|
|
|
|
ls -lh /tmp/${ROM}_${VER}*
|
2011-03-13 13:17:33 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo Build finished on `date`
|