diff options
-rwxr-xr-x | releasetools/aries_ota_from_target_files | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | updater.sh | 43 | ||||
-rwxr-xr-x | updater_cdma.sh | 105 |
3 files changed, 112 insertions, 38 deletions
diff --git a/releasetools/aries_ota_from_target_files b/releasetools/aries_ota_from_target_files index 3616302..9d702c7 100755 --- a/releasetools/aries_ota_from_target_files +++ b/releasetools/aries_ota_from_target_files @@ -48,7 +48,7 @@ def CopyBMLoverMTD(output_zip): output_zip.write(os.path.join(UTILITIES_DIR, "erase_image"),"erase_image") output_zip.write(os.path.join(UTILITIES_DIR, "bml_over_mtd"),"bml_over_mtd") output_zip.write(os.path.join(LOCAL_DIR, "bml_over_mtd.sh"),"bml_over_mtd.sh") - output_zip.write(os.path.join(LOCAL_DIR, "updater.sh"),"updater.sh") + output_zip.write(os.path.join(TARGET_DIR, "updater.sh"),"updater.sh") def WriteFullOTAPackage(input_zip, output_zip): # TODO: how to determine this? We don't know what version it will diff --git a/updater.sh b/updater.sh index 05b3840..48f6513 100644..100755 --- a/updater.sh +++ b/updater.sh @@ -2,24 +2,12 @@ # # Universal Updater Script for Samsung Galaxy S Phones # (c) 2011 by Teamhacksung +# GSM version # set -x export PATH=/:/sbin:/system/xbin:/system/bin:/tmp:$PATH -# check device model -if /tmp/busybox test "`getprop ro.product.model`" = "SCH-I500" ; then - # we're on fascinate/mesmerize/showcase - sdcard_device="/dev/block/mmcblk1p1" - data_device="/dev/block/mmcblk0p1" - use_radio_files="false" -else - # gsm sgs devices - sdcard_device="/dev/block/mmcblk0p1" - data_device="/dev/block/mmcblk0p2" - use_radio_files="true" -fi - # check if we're running on a bml or mtd device if /tmp/busybox test -e /dev/block/bml7 ; then # we're running on a bml device @@ -27,8 +15,8 @@ if /tmp/busybox test -e /dev/block/bml7 ; then # make sure sdcard is mounted if ! /tmp/busybox grep -q /mnt/sdcard /proc/mounts ; then /tmp/busybox mkdir -p /mnt/sdcard - /tmp/busybox umount -l $sdcard_device - if ! /tmp/busybox mount -t vfat $sdcard_device /mnt/sdcard ; then + /tmp/busybox umount -l /dev/block/mmcblk0p1 + if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard ; then /tmp/busybox echo "Cannot mount sdcard." exit 1 fi @@ -40,9 +28,6 @@ if /tmp/busybox test -e /dev/block/bml7 ; then # everything is logged into /sdcard/cyanogenmod.log exec >> /mnt/sdcard/cyanogenmod_bml.log 2>&1 -# gsm -if $use_radio_files ; then - # make sure efs is mounted if ! /tmp/busybox grep -q /efs /proc/mounts ; then /tmp/busybox mkdir -p /efs @@ -62,8 +47,6 @@ if $use_radio_files ; then /tmp/busybox mkdir -p /mnt/sdcard/backup/efs /tmp/busybox cp -R /efs/ /mnt/sdcard/backup -fi - # write the package path to sdcard cyanogenmod.cfg if /tmp/busybox test -n "$UPDATE_PACKAGE" ; then PACKAGE_LOCATION=${UPDATE_PACKAGE#/mnt} @@ -90,8 +73,8 @@ elif /tmp/busybox test -e /dev/block/mtdblock0 ; then /tmp/busybox mkdir -p /sdcard if ! /tmp/busybox grep -q /sdcard /proc/mounts ; then - /tmp/busybox umount -l $sdcard_device - if ! /tmp/busybox mount -t vfat $sdcard_device /sdcard ; then + /tmp/busybox umount -l /dev/block/mmcblk0p1 + if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /sdcard ; then /tmp/busybox echo "Cannot mount sdcard." exit 4 fi @@ -103,9 +86,6 @@ elif /tmp/busybox test -e /dev/block/mtdblock0 ; then # everything is logged into /sdcard/cyanogenmod.log exec >> /sdcard/cyanogenmod_mtd.log 2>&1 -# gsm -if $use_radio_files ; then - # create mountpoint for radio partition /tmp/busybox mkdir -p /radio @@ -133,8 +113,6 @@ if $use_radio_files ; then # unmount radio partition /tmp/busybox umount -l /dev/block/mtdblock5 -fi - # if a cyanogenmod.cfg exists, then this is a first time install # let's format the volumes and restore radio and efs if ! /tmp/busybox test -e /sdcard/cyanogenmod.cfg ; then @@ -155,15 +133,12 @@ fi # unmount and format data /tmp/busybox umount /data - /tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data $data_device + /tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/mmcblk0p2 # unmount and format datadata /tmp/busybox umount -l /datadata /tmp/erase_image datadata -# gsm -if $use_radio_files ; then - # restore efs backup if /tmp/busybox test -e /sdcard/backup/efs/nv_data.bin ; then /tmp/busybox umount -l /efs @@ -184,12 +159,6 @@ if $use_radio_files ; then exit 7 fi -else -# erase partitions anyways - /tmp/erase_image radio - /tmp/erase_image efs -fi - # flash boot image /tmp/bml_over_mtd.sh boot 72 reservoir 2004 /tmp/boot.img diff --git a/updater_cdma.sh b/updater_cdma.sh new file mode 100755 index 0000000..a44f978 --- /dev/null +++ b/updater_cdma.sh @@ -0,0 +1,105 @@ +#!/tmp/busybox sh +# +# Universal Updater Script for Samsung Galaxy S Phones +# (c) 2011 by Teamhacksung +# CDMA version +# + +set -x +export PATH=/:/sbin:/system/xbin:/system/bin:/tmp:$PATH + +# check if we're running on a bml or mtd device +if /tmp/busybox test -e /dev/block/bml7 ; then +# we're running on a bml device + + # make sure sdcard is mounted + if ! /tmp/busybox grep -q /mnt/sdcard /proc/mounts ; then + /tmp/busybox mkdir -p /mnt/sdcard + /tmp/busybox umount -l /dev/block/mmcblk1p1 + if ! /tmp/busybox mount -t vfat /dev/block/mmcblk1p1 /mnt/sdcard ; then + /tmp/busybox echo "Cannot mount sdcard." + exit 1 + fi + fi + + # remove old log + rm -rf /mnt/sdcard/cyanogenmod_bml.log + + # everything is logged into /sdcard/cyanogenmod.log + exec >> /mnt/sdcard/cyanogenmod_bml.log 2>&1 + + # write the package path to sdcard cyanogenmod.cfg + if /tmp/busybox test -n "$UPDATE_PACKAGE" ; then + PACKAGE_LOCATION=${UPDATE_PACKAGE#/mnt} + /tmp/busybox echo "$PACKAGE_LOCATION" > /mnt/sdcard/cyanogenmod.cfg + fi + + # Scorch any ROM Manager settings to require the user to reflash recovery + /tmp/busybox rm -f /mnt/sdcard/clockworkmod/.settings + + # write new kernel to boot partition + /tmp/flash_image boot /tmp/boot.img + if [ "$?" != "0" ] ; then + exit 3 + fi + /tmp/busybox sync + + /sbin/reboot now + exit 0 + +elif /tmp/busybox test -e /dev/block/mtdblock0 ; then +# we're running on a mtd device + + # make sure sdcard is mounted + /tmp/busybox mkdir -p /sdcard + + if ! /tmp/busybox grep -q /sdcard /proc/mounts ; then + /tmp/busybox umount -l /dev/block/mmcblk1p1 + if ! /tmp/busybox mount -t vfat /dev/block/mmcblk1p1 /sdcard ; then + /tmp/busybox echo "Cannot mount sdcard." + exit 4 + fi + fi + + # remove old log + rm -rf /sdcard/cyanogenmod_mtd.log + + # everything is logged into /sdcard/cyanogenmod.log + exec >> /sdcard/cyanogenmod_mtd.log 2>&1 + + # if a cyanogenmod.cfg exists, then this is a first time install + # let's format the volumes and restore radio and efs + if ! /tmp/busybox test -e /sdcard/cyanogenmod.cfg ; then + exit 0 + fi + + # remove the cyanogenmod.cfg to prevent this from looping + /tmp/busybox rm -f /sdcard/cyanogenmod.cfg + + # unmount, format and mount system + /tmp/busybox umount -l /system + /tmp/erase_image system + /tmp/busybox mount -t yaffs2 /dev/block/mtdblock2 /system + + # unmount and format cache + /tmp/busybox umount -l /cache + /tmp/erase_image cache + + # unmount and format data + /tmp/busybox umount /data + /tmp/make_ext4fs -b 4096 -g 32768 -i 8192 -I 256 -a /data /dev/block/mmcblk0p1 + + # unmount and format datadata + /tmp/busybox umount -l /datadata + /tmp/erase_image datadata + + # erase partitions anyways + /tmp/erase_image radio + /tmp/erase_image efs + + # flash boot image + /tmp/bml_over_mtd.sh boot 72 reservoir 2004 /tmp/boot.img + + exit 0 +fi + |