Advertisement
souper

Untitled

Sep 18th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. #!/system/bin/sh
  2. cd /tmp/otgmod
  3.  
  4. # add usbdisk support to ramdisk
  5. echo Unpacking ramdisk...
  6. dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=boot.img
  7. chmod 755 unpackbootimg
  8. ./unpackbootimg -i boot.img
  9. mkdir ramdisk
  10. cd ramdisk
  11. gzip -dc ../boot.img-ramdisk.gz | cpio -i
  12. if ! ( grep -q usbdisk fstab.mako ); then
  13. echo Modifying ramdisk...
  14. echo "/devices/platform/msm_hsusb_host/usb2 /storage/usbdisk0 auto defaults voldmanaged=usbdisk:auto" >> fstab.mako
  15.  
  16. sed '/symlink \/mnt\/shell\/emulated\/0 \/storage\/emulated\/legacy/ a\
  17. \
  18. # USB storage -ziddey\
  19. mkdir \/storage\/usbdisk0 0000 system system\
  20. export SECONDARY_STORAGE /storage/usbdisk0\
  21. symlink \/storage\/usbdisk0 \/usbdisk\
  22. symlink \/storage\/usbdisk0 \/mnt\/usbdisk' -i init.mako.rc
  23.  
  24. find . | cpio --create --format='newc' | gzip > ../newboot.img-ramdisk.gz
  25. cd ..
  26.  
  27. echo \#!/sbin/sh > createnewboot.sh
  28. echo ./mkbootimg --kernel boot.img-zImage --ramdisk newboot.img-ramdisk.gz --cmdline \"$(cat boot.img-cmdline)\" --base 0x$(cat boot.img-base) --pagesize 2048 --ramdiskaddr 0x81800000 --output newboot.img >> createnewboot.sh
  29. chmod 755 createnewboot.sh
  30. chmod 755 mkbootimg
  31. ./createnewboot.sh
  32.  
  33. echo Flashing ramdisk...
  34. dd if=newboot.img of=/dev/block/platform/msm_sdcc.1/by-name/boot
  35. else
  36. cd ..
  37. fi
  38.  
  39. # allow play store apps that require usb host
  40. if ! ( grep -q ro.usb.host=1 /system/build.prop ); then
  41. echo Modifying /system/build.prop...
  42. echo ro.usb.host=1 >> /system/build.prop
  43. fi
  44.  
  45. # workaround to allow app writing to usb drives
  46. if ! [ -f /system/etc/permissions/platform.xml.1 ]; then
  47. echo Creating backup /system/etc/permissions/platform.xml.1...
  48. cp /system/etc/permissions/platform.xml /system/etc/permissions/platform.xml.1
  49. echo Modifying /system/etc/permissions/platform.xml...
  50. sed -e '/WRITE_EXTERNAL_STORAGE" >$/N;s/\n\(\([ \t]*\)<group gid="sdcard_rw".*$\)/\n\2<group gid="media_rw" \/>\n\1/' -i /system/etc/permissions/platform.xml
  51. fi
  52.  
  53. # cleanup
  54. cd ..
  55. rm -rf otgmod
  56.  
  57. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement