آموزش ساخت ریکاوری CWMاز منبع(بخش سوم)
با بخش سوم آموزش در خدمتتان هستیم خیلی سریع بریم برای ادامه کار
برای فایل fstab شما باید فایل stock boot.img را آنپک کنید،فایل را داخل برنامه آنپک که قبلا گذاشتیم بذارید و کد زیر را تایپ کنید
unpack_img boot.img
اگر هم پردازنده مدیاتک بود از کد زیر استفاده کنید
unpack_MTK_img boot.img
بعد از آن پوشه ramdisk را باز و فایل fstab را به مسیر recovery/root انتقال بدهید و نام آن را همانطور که قبلا گفتیم طبق چیپ موبایلتان مانند fstab.{hardware} تغییر دهید.
به پوشه cm11 بروید در مسیر bootable/recovery/etc فایل init.rc به محل موبایلتان پوشه /recovery انتقال دهید و نامش را به init.{hardware}.rc تغییر دهید.
در cm11 از fstab ورژن دو استفاده شده شما برای کامل کردن محتوای fstab.{hardware} و recovery.fstab می توانید از سایت github دنبال یک گوشی هم چیپ گوشی خودتان بگردید و در پوشه آن فایل fstab را مقابل فایل خود بگذارید و همانند آن ویرایشش کنید
یک نمونه فایل fstab متعلق به گوشی HTC M7
Copyright (C) 2014 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. <src> <mnt_point> <type> <mnt_flags> <fs_mgr_flags> dev/block/platform/msm_sdcc.1/by-name/dsps /firmware_dsps vfat ro,shortname=lower wait dev/block/platform/msm_sdcc.1/by-name/radio /firmware_radio vfat ro,shortname=lower wait dev/block/platform/msm_sdcc.1/by-name/adsp /firmware_q6 vfat ro,shortname=lower wait dev/block/platform/msm_sdcc.1/by-name/wcnss /firmware_wcnss vfat ro,shortname=lower wait dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults dev/block/platform/msm_sdcc.1/by-name/devlog /devlog ext4 noatime,nosuid,nodev,barrier=0 wait dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,noatime,barrier=0 wait dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=0 wait dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,barrier=0 wait,encryptable=/dev/block/platform/msm_sdcc.1/by-name/extra SD card devices/platform/msm_sdcc.1/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:36,noemulatedsd USB storage devices/platform/msm_hsusb_host/usb auto auto defaults voldmanaged=usbdisk:auto
یک نمونه recovery.fstab برای گوشی MTK Lenovo P780
# Android fstab file. # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK #<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> /emmc@android /system ext4 ro,noatime wait /emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait /emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer # vold-managed volumes /devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard1:8, /devices/platform/mtk-msdc.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard0:auto /dev/bootimg /boot emmc defaults defaults /dev/nvram /nvram emmc defaults defaults /dev/recovery /recovery emmc defaults defaults /dev/uboot /uboot emmc defaults defaults /dev/misc /misc emmc defaults defaults
در مدیاتک fstab.mt6589 دارای دو پارتیشن اضافه می باشد(امنیتی)
# Android fstab file. # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK #<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> /emmc@android /system ext4 ro,noatime wait /emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait /emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer /emmc@protect_f /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check /emmc@protect_s /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check # vold-managed volumes /devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:8 /devices/platform/mtk-msdc.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto /devices/platform/mt_usb/sda/sda1 auto auto defaults voldmanaged=usbotg:auto /dev/bootimg /boot emmc defaults defaults /dev/nvram /nvram emmc defaults defaults /dev/recovery /recovery emmc defaults defaults /dev/uboot /uboot emmc defaults defaults /dev/misc /misc emmc defaults defaults
ولی بقیه در recovery.fstab یکی می باشند اگر تغییر دیگری هست به نسبت موبایل خودتان باید خودتان پیدایش کنید در زیر یک نمونه مدیاتک دیگر برایتان میذاریم
# Android fstab file. # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK #<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> /ubi@system /system ubifs ro,noatime wait /ubi@cache /cache ubifs noatime,nosuid,nodev,noauto_da_alloc wait /ubi@userdata /data ubifs noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer # vold-managed volumes /devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:8, /devices/platform/mtk-msdc.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto /dev/mtd/mtd6 /boot mtd defaults defaults /dev/mtd/mtd2 /nvram mtd defaults defaults /dev/mtd/mtd7 /recovery mtd defaults defaults /dev/mtd/mtd5 /uboot mtd defaults defaults /dev/mtd/mtd9 /misc mtd defaults defaults
برای کسب اطلاعات بیشتر درباره پارتیشن کد زیر را برای فراخوانی مسیر دستگاهتان وارد کنید
adb shell ls /proc
و نام فایل مورد نظر خود را در آخر کد زیر وارد و آن را ببینید
adb shell cat /proc/the_name_you_see
و نام پارتیشنی که میخواهید اطلاعات مورد نیاز خودتان را بیابید بنویسید
در زیر نمونه proc list ما را ببینید
C:\Users\carliv>adb shell ls /proc * daemon not running. starting it now on port 5037 * * daemon started successfully * 1 ........ 98 <- ignored aed asound audio batdrv_log boot_mode bootprof buddyinfo bus cgroups clkmgr cmdline consoles cpu cpu_ss cpufreq cpuinfo crypto devices diskstats dma-mappings driver dumchar_info emifreq emmc execdomains fat fb fgadc_log filesystems fm freqhopping fs golden_setting gpt_stat gpufreq interrupts iomem ioports irq kallsyms kmsg kpagecount kpageflags last_kmsg lk_env loadavg locks log_ts mcdi meminfo misc modules mounts msdc_FT msdc_debug msdc_help msdc_tune msdc_tune_flag mt_hotplug_test mtd mtk_battery_cmd mtk_mdm_txpwr mtk_sched mtkcooler mtkfb_size mtktsbattery mtktscpu mtktspa mtktspmic mtktz mtprof net nt35590_hd720_dsi_vdo_truly pagetypeinfo partitions pm_init ptp pvr rid sched_debug schedstat scsi sd_upgrade self softirqs stat swaps sys sysram sysram_flag timer_list tty uid_stat uptime version vmallocinfo vmstat wdk wmt_tm xlog yaffs zoneinfo C:\Users\carliv> >
در قدم بعدی فایل init.{hardware}.rc را از ریکاوری باز کنید باید در آن تغییراتی بدید که بتوانید از رابط USB mass storage و sdcards استفاده کنید
import /init.recovery.${ro.hardware}.rc on early-init # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. write /sys/fs/selinux/checkreqprot 0 # Set the security context for the init process. # This should occur before anything else (e.g. ueventd) is started. setcon u:r:init:s0 start ueventd start healthd on init export PATH /sbin:/system/bin export ANDROID_ROOT /system export ANDROID_DATA /data export EXTERNAL_STORAGE /sdcard symlink /system/etc /etc mkdir /boot mkdir /recovery mkdir /sdcard mkdir /internal_sd mkdir /external_sd mkdir /sd-ext mkdir /datadata mkdir /emmc mkdir /system mkdir /data mkdir /cache mount tmpfs tmpfs /tmp chown root shell /tmp chmod 0775 /tmp mkdir /mnt 0775 root system mkdir /storage 0050 root sdcard_r mount tmpfs tmpfs /storage mode=0050,uid=0,gid=1028 # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt/shell 0700 shell shell # Directory for putting things only root should see. mkdir /mnt/secure 0700 root root # Create private mountpoint so we can MS_MOVE from staging mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0 # Directory for staging bindmounts mkdir /mnt/secure/staging 0700 root root # Fuse public mount points. mkdir /mnt/fuse 0700 root system mount tmpfs tmpfs /mnt/fuse mode=0775,gid=1000 on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18D1 write /sys/class/android_usb/android0/idProduct D001 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} write /sys/class/android_usb/android0/iProduct ${ro.product.model} write /sys/class/android_usb/android0/iSerial ${ro.serialno} on boot ifup lo hostname localhost domainname localdomain class_start default on property:sys.powerctl=* powerctl ${sys.powerctl} service ueventd /sbin/ueventd critical seclabel u:r:ueventd:s0 service healthd /sbin/healthd -n critical seclabel u:r:healthd:s0 service recovery /sbin/recovery seclabel u:r:recovery:s0 service setup_adbd /sbin/setup_adbd oneshot service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery disabled socket adbd stream 660 system system seclabel u:r:adbd:s0 service vold /sbin/minivold socket vold stream 0660 root mount ioprio be 2 seclabel u:r:recovery:s0 # setup_adbd will start adb once it has checked the keys on property:service.adb.root=1 write /sys/class/android_usb/android0/enable 0 restart adbd write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=1 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct D003 write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=0 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct D001 write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/enable ${service.adb.root}
بازم هنوز قسمتهای کم دارد و ممکن است که دو قسمت sdcards را نخواند،این کدها را در فایل init.recovery.{hardware}.rc در مسیر recovery/root هم می توانید قرار بدهید. در ذهن داشته باشید این برای سیستم اندرویدfstab می باشد و برای ریکاوری کاملا متفاوتر می باشد برای نمونه به کدهای زیر نگاهی بندازید
1. noemulated
on early-init # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. write /sys/fs/selinux/checkreqprot 0 # Set the security context for the init process. # This should occur before anything else (e.g. ueventd) is started. setcon u:r:init:s0 start ueventd start healthd on init export PATH /sbin:/system/bin export ANDROID_ROOT /system export ANDROID_DATA /data export EXTERNAL_STORAGE /storage/sdcard0 export SECONDARY_STORAGE /storage/sdcard1 symlink /system/etc /etc mkdir /boot mkdir /recovery mkdir /sdcard mkdir /internal_sd mkdir /external_sd mkdir /sd-ext mkdir /datadata mkdir /sdcard2 mkdir /system mkdir /cache mkdir /data mount tmpfs tmpfs /tmp chown root shell /tmp chmod 0775 /tmp # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt 0775 root system mkdir /storage 0050 root sdcard_r mount tmpfs tmpfs /storage mode=0050,uid=0,gid=1028 mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw mkdir /storage/sdcard0 0700 root root mkdir /storage/sdcard1 0700 root root symlink /storage/sdcard0 /sdcard symlink /storage/sdcard0 /mnt/sdcard symlink /storage/sdcard1 /sdcard2 symlink /storage/sdcard1 /mnt/sdcard2 mkdir /mnt/shell 0700 shell shell # Directory for putting things only root should see. mkdir /mnt/secure 0700 root root # Create private mountpoint so we can MS_MOVE from staging mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0 # Directory for staging bindmounts mkdir /mnt/secure/staging 0700 root root # Fuse public mount points. mkdir /mnt/fuse 0700 root system mount tmpfs tmpfs /mnt/fuse mode=0775,gid=1000 on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18D1 write /sys/class/android_usb/android0/idProduct D003 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} write /sys/class/android_usb/android0/iProduct ${ro.product.model} write /sys/class/android_usb/android0/iSerial ${ro.serialno} on boot ifup lo hostname localhost domainname localdomain class_start default on property:sys.powerctl=* powerctl ${sys.powerctl} service ueventd /sbin/ueventd critical seclabel u:r:ueventd:s0 service healthd /sbin/healthd -n critical seclabel u:r:healthd:s0 service recovery /sbin/recovery seclabel u:r:recovery:s0 service setup_adbd /sbin/setup_adbd oneshot service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery disabled socket adbd stream 660 system system seclabel u:r:adbd:s0 service vold /sbin/minivold socket vold stream 0660 root mount ioprio be 2 seclabel u:r:recovery:s0 # virtual sdcard daemon running as media_rw (1023) service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0 class late_start disabled # virtual sdcard daemon running as media_rw (1023) service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1 class late_start disabled # setup_adbd will start adb once it has checked the keys on property:service.adb.root=1 write /sys/class/android_usb/android0/enable 0 restart adbd write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=1 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct D003 write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=0 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct D001 write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/enable ${service.adb.root}
2. one emulated:
on early-init # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. write /sys/fs/selinux/checkreqprot 0 # Set the security context for the init process. # This should occur before anything else (e.g. ueventd) is started. setcon u:r:init:s0 start ueventd start healthd on init export PATH /sbin:/system/bin export ANDROID_ROOT /system export ANDROID_DATA /data export EXTERNAL_STORAGE /storage/sdcard0 symlink /system/etc /etc symlink /data/media/0 /storage/sdcard0 mkdir /boot mkdir /recovery mkdir /sdcard mkdir /internal_sd mkdir /external_sd mkdir /sd-ext mkdir /datadata mkdir /system mkdir /emmc mkdir /cache mkdir /data mount tmpfs tmpfs /tmp chown root shell /tmp chmod 0775 /tmp # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt 0775 root system mkdir /storage 0050 root sdcard_r mount tmpfs tmpfs /storage mode=0050,uid=0,gid=1028 mkdir /mnt/shell 0700 shell shell # Directory for putting things only root should see. mkdir /mnt/secure 0700 root root # Create private mountpoint so we can MS_MOVE from staging mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0 # Directory for staging bindmounts mkdir /mnt/secure/staging 0700 root root # Fuse public mount points. mkdir /mnt/fuse 0700 root system mount tmpfs tmpfs /mnt/fuse mode=0775,gid=1000 on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 0BB4 write /sys/class/android_usb/android0/idProduct 0C03 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} write /sys/class/android_usb/android0/iProduct ${ro.product.model} write /sys/class/android_usb/android0/iSerial ${ro.serialno} on boot ifup lo hostname localhost domainname localdomain class_start default on property:sys.powerctl=* powerctl ${sys.powerctl} service ueventd /sbin/ueventd critical seclabel u:r:ueventd:s0 service healthd /sbin/healthd -n critical seclabel u:r:healthd:s0 service recovery /sbin/recovery seclabel u:r:recovery:s0 service setup_adbd /sbin/setup_adbd oneshot service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery disabled socket adbd stream 660 system system seclabel u:r:adbd:s0 service vold /sbin/minivold socket vold stream 0660 root mount ioprio be 2 seclabel u:r:recovery:s0 # setup_adbd will start adb once it has checked the keys on property:service.adb.root=1 write /sys/class/android_usb/android0/enable 0 restart adbd write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=1 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct 0C03 write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=0 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct 0C01 write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/enable ${service.adb.root}
3. one emulated and one noemulated:
on early-init # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls. write /sys/fs/selinux/checkreqprot 0 # Set the security context for the init process. # This should occur before anything else (e.g. ueventd) is started. setcon u:r:init:s0 start ueventd start healthd on init export PATH /sbin:/system/bin export ANDROID_ROOT /system export ANDROID_DATA /data export EXTERNAL_STORAGE /storage/sdcard0 export SECONDARY_STORAGE /storage/sdcard1 symlink /system/etc /etc symlink /data/media/0 /storage/sdcard0 mkdir /boot mkdir /recovery mkdir /sdcard mkdir /internal_sd mkdir /external_sd mkdir /sd-ext mkdir /sdcard2 mkdir /datadata mkdir /system mkdir /emmc mkdir /cache mkdir /data mount tmpfs tmpfs /tmp chown root shell /tmp chmod 0775 /tmp # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt 0775 root system mkdir /storage 0050 root sdcard_r mount tmpfs tmpfs /storage mode=0050,uid=0,gid=1028 mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw mkdir /mnt/shell 0700 shell shell mkdir /storage/sdcard1 0700 root root symlink /storage/sdcard1 /mnt/sdcard2 # Directory for putting things only root should see. mkdir /mnt/secure 0700 root root # Create private mountpoint so we can MS_MOVE from staging mount tmpfs tmpfs /mnt/secure mode=0700,uid=0,gid=0 # Directory for staging bindmounts mkdir /mnt/secure/staging 0700 root root # Fuse public mount points. mkdir /mnt/fuse 0700 root system mount tmpfs tmpfs /mnt/fuse mode=0775,gid=1000 on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 0BB4 write /sys/class/android_usb/android0/idProduct 0C03 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} write /sys/class/android_usb/android0/iProduct ${ro.product.model} write /sys/class/android_usb/android0/iSerial ${ro.serialno} on boot ifup lo hostname localhost domainname localdomain class_start default on property:sys.powerctl=* powerctl ${sys.powerctl} service ueventd /sbin/ueventd critical seclabel u:r:ueventd:s0 service healthd /sbin/healthd -n critical seclabel u:r:healthd:s0 service recovery /sbin/recovery seclabel u:r:recovery:s0 service setup_adbd /sbin/setup_adbd oneshot service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery disabled socket adbd stream 660 system system seclabel u:r:adbd:s0 service vold /sbin/minivold socket vold stream 0660 root mount ioprio be 2 seclabel u:r:recovery:s0 # virtual sdcard daemon running as media_rw (1023) service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1 class late_start disabled # setup_adbd will start adb once it has checked the keys on property:service.adb.root=1 write /sys/class/android_usb/android0/enable 0 restart adbd write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=1 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct 0C03 write /sys/class/android_usb/android0/functions mass_storage,adb write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=0 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idProduct 0C01 write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/enable ${service.adb.root}
همان طور که می بینید برای حافظه خارجی (/storage/sdcard1) وقتی که موجود باشد دسترسی بصورت other/world” (-w 1023) می باشد
ولی برای حافه داخلی هم یوزر هم دیگران دسترسی کامل دارند.برای داشتن این دسترسی ها در ریکاوری کدهای بالا را در init.recovery.{hardware}.rc کپی کنید در آخر باید شبیه به کد زیر باشد
on init export EXTERNAL_STORAGE /storage/sdcard0 export SECONDARY_STORAGE /storage/sdcard1 mkdir /sdcard2 # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw mkdir /storage/sdcard0 0700 root root mkdir /storage/sdcard1 0700 root root symlink /storage/sdcard0 /sdcard symlink /storage/sdcard0 /mnt/sdcard symlink /storage/sdcard1 /sdcard2 symlink /storage/sdcard1 /mnt/sdcard2 on fs write /sys/class/android_usb/android0/functions mass_storage,adb on boot # virtual sdcard daemon running as media_rw (1023) service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0 class late_start disabled # virtual sdcard daemon running as media_rw (1023) service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1 class late_start disabled
و در آخر دو فایل idVendor و idProduct را نیز چک می کنیم
write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18D1 write /sys/class/android_usb/android0/idProduct D003 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions mass_storage,adb
در شکل اولیه اینگونه بود
write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 18D1 write /sys/class/android_usb/android0/idProduct D001 write /sys/class/android_usb/android0/f_ffs/aliases adb write /sys/class/android_usb/android0/functions adb
برای استفاده از mass storage این تغییرات را دادیم، این به شما بستگی دارد ولی برای بررسی شمارها باید 18D1 و D001″, “D003 باشند در صورت نصب درایورهای گوگل باشند.
تا اینجا بخش سوم را به پایان می دهیم با ما باشید تا پایان آموزش
کپی برداری از متن بدون ذکر منبع شرعا حرام و مورد پسند نویسنده نمی باشد