Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/system/bin/sh
- cd /tmp/otgmod
- # add usbdisk support to ramdisk
- echo Unpacking ramdisk...
- dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=boot.img
- chmod 755 unpackbootimg
- ./unpackbootimg -i boot.img
- mkdir ramdisk
- cd ramdisk
- gzip -dc ../boot.img-ramdisk.gz | cpio -i
- if ! ( grep -q usbdisk fstab.mako ); then
- echo Modifying ramdisk...
- echo "/devices/platform/msm_hsusb_host/usb2 /storage/usbdisk0 auto defaults voldmanaged=usbdisk:auto" >> fstab.mako
- sed '/symlink \/mnt\/shell\/emulated\/0 \/storage\/emulated\/legacy/ a\
- \
- # USB storage -ziddey\
- mkdir \/storage\/usbdisk0 0000 system system\
- export SECONDARY_STORAGE /storage/usbdisk0\
- symlink \/storage\/usbdisk0 \/usbdisk\
- symlink \/storage\/usbdisk0 \/mnt\/usbdisk' -i init.mako.rc
- find . | cpio --create --format='newc' | gzip > ../newboot.img-ramdisk.gz
- cd ..
- echo \#!/sbin/sh > createnewboot.sh
- 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
- chmod 755 createnewboot.sh
- chmod 755 mkbootimg
- ./createnewboot.sh
- echo Flashing ramdisk...
- dd if=newboot.img of=/dev/block/platform/msm_sdcc.1/by-name/boot
- else
- cd ..
- fi
- # allow play store apps that require usb host
- if ! ( grep -q ro.usb.host=1 /system/build.prop ); then
- echo Modifying /system/build.prop...
- echo ro.usb.host=1 >> /system/build.prop
- fi
- # workaround to allow app writing to usb drives
- if ! [ -f /system/etc/permissions/platform.xml.1 ]; then
- echo Creating backup /system/etc/permissions/platform.xml.1...
- cp /system/etc/permissions/platform.xml /system/etc/permissions/platform.xml.1
- echo Modifying /system/etc/permissions/platform.xml...
- 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
- fi
- # cleanup
- cd ..
- rm -rf otgmod
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement