[Tutorial] How to back up Mediatek firmware using Miracle Box
[Tutorial] How to back up Mediatek firmware using Miracle Box
(18-10-2016, 02:10 PM)djtetei I have an Allview X3 Soul Style on MT6753 platform, 3 GB RAM, Dual Sim, running Android 6.0 Marshmallow.
I managed to make a full ROM backup, as scatter, with Miracle Box 2.27A.
The resulting scatter file is as follows:
Now in order to make the scatter file (V1.1.1) compliant with SP Flash Tool you have to change the "config_version" line from V1.1.1 to V1.1.2 to enable SP Flash Tool region detection.Code:############################################################################################################
#
# General Setting
#
############################################################################################################
- general: MTK_PLATFORM_CFG
info:
- config_version: V1.1.1
platform: MT6753
project: mtk_android
storage: EMMC
boot_channel: MSDC_0
block_size: 0x20000
############################################################################################################
#
# Layout Setting
#
############################################################################################################
- partition_index: SYS0
partition_name: PRELOADER
file_name: preloader.bin
is_download: true
type: SV5_BL_BIN
linear_start_addr: 0x0
physical_start_addr: 0x0
partition_size: 0x400000
region: EMMC_BOOT_1
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: BOOTLOADER
reserve: 0x00
- partition_index: SYS1
partition_name: PGPT
file_name: pgpt.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x0
physical_start_addr: 0x0
partition_size: 0x80000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS2
partition_name: PROINFO
file_name: proinfo.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x80000
physical_start_addr: 0x80000
partition_size: 0x300000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS3
partition_name: NVRAM
file_name: nvram.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x380000
physical_start_addr: 0x380000
partition_size: 0x500000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS4
partition_name: PROTECT1
file_name: protect1.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x880000
physical_start_addr: 0x880000
partition_size: 0xA00000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS5
partition_name: PROTECT2
file_name: protect2.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x1280000
physical_start_addr: 0x1280000
partition_size: 0xA00000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS6
partition_name: LK
file_name: lk.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x1C80000
physical_start_addr: 0x1C80000
partition_size: 0x80000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS7
partition_name: PARA
file_name: para.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x1D00000
physical_start_addr: 0x1D00000
partition_size: 0x80000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS8
partition_name: BOOT
file_name: boot.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x1D80000
physical_start_addr: 0x1D80000
partition_size: 0x1000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS9
partition_name: RECOVERY
file_name: recovery.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x2D80000
physical_start_addr: 0x2D80000
partition_size: 0x1000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS10
partition_name: LOGO
file_name: logo.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x3D80000
physical_start_addr: 0x3D80000
partition_size: 0x800000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS11
partition_name: EXPDB
file_name: expdb.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x4580000
physical_start_addr: 0x4580000
partition_size: 0xA00000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS12
partition_name: SECCFG
file_name: seccfg.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x4F80000
physical_start_addr: 0x4F80000
partition_size: 0x80000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS13
partition_name: OEMKEYSTORE
file_name: oemkeystore.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x5000000
physical_start_addr: 0x5000000
partition_size: 0x200000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS14
partition_name: SECRO
file_name: secro.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x5200000
physical_start_addr: 0x5200000
partition_size: 0x600000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS15
partition_name: KEYSTORE
file_name: keystore.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x5800000
physical_start_addr: 0x5800000
partition_size: 0x800000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS16
partition_name: TEE1
file_name: tee1.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x6000000
physical_start_addr: 0x6000000
partition_size: 0x500000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS17
partition_name: TEE2
file_name: tee2.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x6500000
physical_start_addr: 0x6500000
partition_size: 0x500000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS18
partition_name: FRP
file_name: frp.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x6A00000
physical_start_addr: 0x6A00000
partition_size: 0x100000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS19
partition_name: NVDATA
file_name: nvdata.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x6B00000
physical_start_addr: 0x6B00000
partition_size: 0x2000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS20
partition_name: METADATA
file_name: metadata.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x8B00000
physical_start_addr: 0x8B00000
partition_size: 0x2500000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS21
partition_name: SYSTEM
file_name: system.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0xB000000
physical_start_addr: 0xB000000
partition_size: 0x10C000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS22
partition_name: CACHE
file_name: cache.bin
is_download: true
type: YAFFS_IMG
linear_start_addr: 0x117000000
physical_start_addr: 0x117000000
partition_size: 0x19000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS23
partition_name: USERDATA
file_name: userdata.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x130000000
physical_start_addr: 0x130000000
partition_size: 0x616B80000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
- partition_index: SYS24
partition_name: FLASHINFO
file_name: flashinfo.bin
is_download: true
type: NORMAL_ROM
linear_start_addr: 0x746B80000
physical_start_addr: 0x746B80000
partition_size: 0x1000000
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: false
is_reserved: true
operation_type: UPDATE
reserve: 0x00
At the same time you have to make the following modifications:
- change the extension from ".bin" to ".img" for the following partitions: boot, recovery, secro, system, cache and userdata.
- remove the ".bin" extension for the following partitions: pgpt, proinfo, nvram, protect1, protect2, para, expdb, seccfg, oemkeystore, keystore, frp, nvdata, metadata and flashinfo.
- unpack "recovery.img" to find the proper file system type (e.g. EXT4) for the following partitions: protect1, protect2, nvdata, system, cache, userdata. If you look at the scatter file created by Miracle Box you will notice that the "system" partition type is "YAFFS". After I unpacked recovery.img, i discovered that "system" partition type is actually "EXT4" (look at fstab.mt6735 file)
Code:# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6735/fstab.in"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6735/fstab.in"
# 20 "vendor/mediatek/proprietary/hardware/fstab/mt6735/fstab.in"
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,forceencrypt=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata,
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/nvdata /nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable
# 37 "vendor/mediatek/proprietary/hardware/fstab/mt6735/fstab.in"
/devices/mtk-msdc.0/11230000.msdc0* auto vfat defaults voldmanaged=sdcard0:auto
/devices/mtk-msdc.0/11240000.msdc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
/devices/platform/mt_usb* auto vfat defaults voldmanaged=usbotg:auto
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/frp /persistent emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/nvram /nvram emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/proinfo /proinfo emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/lk /bootloader emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/para /misc emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/boot /boot emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/logo /logo emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/expdb /expdb emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/secro /secro emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/seccfg /seccfg emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/tee1 /tee1 emmc defaults defaults
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/tee2 /tee2 emmc defaults defaults
I have only one question: Is preloader.bin (extracted with Miracle Box) compatible with SP Flash Tool?
Off course you do not have to flash it if your phone is not dead, but preloader.bin must be present in the ROM folder in order for SP FLash Tool to perform a succesful flash.