小米2修改boot合并分区教程

By Starstok

小米2修改boot合并分区教程

解包boot.img

打开fstab.qcom

查找原代码:

/dev/block/platform/msm_sdcc.1/by-name/system       /system         ext4    ro,barrier=1                       wait

改好的代码:

/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1,discard                wait

继续查找:

/dev/block/platform/msm_sdcc.1/by-name/userdata     /data           ext4
noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,errors=panic wait,check,encryptable=footer,length=-16384

改后的代码:

/dev/block/platform/msm_sdcc.1/by-name/userdata      /data          ext4
nosuid,nodev,barrier=1,noauto_da_alloc,discard      wait,check,encryptable=/dev/block/platform/msm_sdcc.1/by-name/bk1

继续查找:

/devices/platform/msm_hsusb_host*               auto            auto    defaults             voldmanaged=usbdisk:auto

改后的代码:

/devices/platform/msm_hsusb_host*                    auto            auto    defaults         voldmanaged=usbotg:auto

接下来修改init.qcom.rc

查找:

mkdir /storage 0775 system system
mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
mkdir /storage/sdcard0 0775 system system
mkdir /storage/usbdisk 0775 system system
mkdir /storage_int 0775 media_rw media_rw
chown media_rw media_rw /storage_int

查找到的代码替换成:

mkdir /mnt/shell/emulated 0700 shell shell
mkdir /storage/emulated 0555 root root
mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw
mkdir /storage/usbotg 0700 root root

继续查找:

export EXTERNAL_STORAGE /storage/sdcard0

改后的代码:

export EXTERNAL_STORAGE /storage/emulated/legacy
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated

继续查找:

symlink /storage/sdcard0 /sdcard
symlink /storage/sdcard0 /storage_int
symlink /storage/sdcard0 /mnt/sdcard
symlink /storage/usbdisk /usbdisk
symlink /storage/usbdisk /mnt/usbdisk

查找到的代码替换成:

# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
symlink /storage/emulated/legacy /storage/sdcard0
symlink /mnt/shell/emulated/0 /storage/emulated/legacy

继续查找:

chmod 0775 /storage_int
chown media_rw media_rw /storage_int
mkdir /storage_int/ramdump 0775
chown media_rw media_rw /storage_int/ramdump
mkdir /storage_int/ramdump/mdm 0775
chown media_rw media_rw /storage_int/ramdump/mdm
删除掉即可

继续查找:

mkdir /data/media 0770 media_rw media_rw

在其下面添加以下代码:

chown media_rw media_rw /data/media

继续查找:

service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
class late_start
disabled

改后的代码:

# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
class late_start

继续查找:

service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
class late_start
disabled

改后的代码:

service fuse_usbotg /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/usbotg /storage/usbotg
class late_start
disabled

然后在其下面添加以下的代码:

# Binding fuse mount point to /storage/emulated/legacy
on property:init.svc.sdcard=running
wait /mnt/shell/emulated/0
mount none /mnt/shell/emulated/0 /storage/emulated/legacy bind
以上就是boot.img配置文件的修改。

开始修改framework-res.apk

所修改的文件路劲是res/xml/storage_list.xml

修改后的代码是:

<storage android:mountPoint="/storage/sdcard0" android:storageDescription="@string/storage_internal" android:primary="true" android:removable="false" android:emulated="true" android:mtpReserve="100" />
<storage android:mountPoint="/storage/usbotg" android:storageDescription="@string/storage_usb" android:primary="false" android:removable="true" />