[X2 Android Development] SimonVN:
How to convert NAND ROM to SD-EXT ROM for MultiBootloader​

After following this guide, your ROM can be use with [URL="http://xdaforums.com/nokia-x2/development/sbl-multibootloader-v1-00-04-10-2015-t3217360"]MultiBootloader[/URL]

THIS GUIDE IS NOT FOR NOOBs

Requirements

Knowledge about Android Image Kitchen

Notepad ++

A nand ROM extracted

Instructions

Delete the RED COLOR

Add the BLUE COLOR

Step 1: Modifying boot.img (FOR STOCK KERNEL ONLY) - Check post #2 to download the modified boot image, you don't need to edit it yourself.

Use Android Image Kitchen's unpackimg command to unpack the boot.img file from the ROM your want to port.

Go to Android Image Kitchen\ramdisk folder, edit these files:

fstab.qcom

Change like this:

# 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

#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
[COLOR="Red"]/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer[/COLOR]
[COLOR="Blue"]/dev/block/platform/msm_sdcc.1/by-name/userdata /nanddata ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer[/COLOR]
/devices/msm_sdcc.2/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard:auto
#/dev/block/mmcblk0p11 /system ext4 ro,barrier=1 wait
#/dev/block/mmcblk0p12 /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc wait,check,encryptable=footer

init.rc

- Find this event:

on fs

- Change like this:

on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
[COLOR="Red"]mount yaffs2 mtd@system /system
mount yaffs2 mtd@system /system ro remount
mount yaffs2 mtd@userdata /data nosuid nodev[/COLOR]
[COLOR="Blue"] mount ext4 /dev/block/mmcblk1p2 /system
mount ext4 /dev/block/mmcblk1p2 /system ro remount
mount ext4 /dev/block/mmcblk1p3 /data nosuid nodev[/COLOR]
mount yaffs2 mtd@cache /cache nosuid nodev
[COLOR="Blue"]#mount nand data for sharing data/app
mkdir /nanddate 0771 system system
mount yaffs2 mtd@userdata /nanddata nosuid nodev
# mount sdcard
wait /dev/block/mmcblk1p1
wait /dev/block/mmcblk1p1
mount vfat /dev/block/mmcblk1p1 /storage/sdcard1[/COLOR]

​

init.target.rc

- Find this event:

on fs

- Change like this:

on fs
mount_all fstab.qcom

# Keeping following partitions outside fstab file. As user may not have
# these partition flashed on the device. Failure to mount any partition in fstab file
# results in failure to launch late-start class.

wait /dev/block/platform/msm_sdcc.1/by-name/cache
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/cache /cache nosuid nodev barrier=1

wait /dev/block/platform/msm_sdcc.1/by-name/persist
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/persist /persist nosuid nodev barrier=1

wait /dev/block/platform/msm_sdcc.1/by-name/modem
mount vfat /dev/block/platform/msm_sdcc.1/by-name/modem /firmware ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337

[COLOR="Red"] wait /dev/block/platform/msm_sdcc.1/by-name/custom
mount ext4 /dev/block/platform/msm_sdcc.1/by-name/custom /custom nosuid nodev barrier=1 ro[/COLOR]
[COLOR="Blue"] wait /dev/block/mmcblk1p4
mount ext4 /dev/block/mmcblk1p4 /custom nosuid nodev barrier=1 ro[/COLOR]

​

Repack boot.img and copy to the ROM folder.

Step 2: Modifying updater-script

Open ROM-name\META-INF\com\google\android\updater-script

Find:

mount("ext4", "EMMC", "/dev/block/mmcblk0p19", "/system");

or

mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

Add these lines above it:

[COLOR="blue"]ui_print("	Mounting Partitions	");
mount("ext4", "MMC", "/dev/block/mmcblk1p2", "/system-ext");
mount("ext4", "MMC", "/dev/block/mmcblk1p4", "/custom-ext");
mount("ext4", "EMMC", "/dev/block/mmcblk0p20", "/cache");
mount("ext4", "MMC", "/dev/block/mmcblk1p3", "/data-ext");

ui_print("	Formatting Partitions	");
delete_recursive("/system-ext");
delete_recursive("/custom-ext");
delete_recursive("/cache");
delete_recursive("/data/dalvik-cache");
delete_recursive("/data-ext");[/COLOR]

Find this line:

package_extract_file("boot.img", "/tmp/boot.img");

Change like this:

[INDENT][COLOR="Red"]package_extract_file("boot.img", "/tmp/boot.img");
run_program("/system/xbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/mmcblk0p10");
delete("/tmp/boot.img");[/COLOR][COLOR="Blue"]
package_extract_file("boot.img", "/emmc/kernels/[I]your_rom_name[/I].img");[/COLOR][/INDENT]

Find and change all /system/ to /system-EXT/

Find and change all /custom/ to /custom-EXT/

Save.

Step 3: Create the ZIP

Make sure you have copy the modified boot.img to the ROM folder

Select all the files and folders in the ROM folder (custom, system, META-INF, boot.img,etc..)

Compress into ZIP file.

Done.

<EDITTING>