[Xiaomi Mi Max Guides, News, & Discussion] yshalsager:
In my previous guide i explained How to port hydrogen ROMs to helium, and in this simple guide i'll show you guys How to port ROMs from kenzo as it's the same SoC like hydrogen (MSM8956) let's start ! :D

You'll need some tools:

- ROM kitchen, i prefer superr's kitchen. :good:

- Boot image Extractor, you can use Android Image Kitchen

- Any text editor, Notepad++ is good choice for windows users. :cool:

Part 0: Preparing:

0- Get any Redmi Note 3 ROM (kenzo), you can find many in XDA or 4PDA

1- Open superr's kitchen and create new project, then copy kenzo ROM to project folder and Extract zip using kitchen (option 4). [when it asks for perm type choose sparse_dat]

2- Copy boot.img to Android Image Kitchen folder and run unpackimg.sh / unpackimg.bat (You can also drag and drop boot to unpackimg.bat if you're using windows).

Part 1: System files:

there's many differences between hydrogen and kenzo, like audio, camera and fingerprint, so you'll need to copy these files to "system" folder in kitchen.

File list

Then you have to edit build.prop replace kenzo with hydrogen and copy lines in hydrogen one like "fpc"

You can get this files from any working hydrogen ROM or from my Github Repo Here

Part 2: Editing Boot.img :

After unpacking kenzo boot.img using Android Image Kitchen You'll need to copy hydrogen zImage and edit somefiles:

* i prefer editing the following files even you can just copy it from hydrogen boot.img *

- Copy hydrogen zImage to "split_img" and make sure it's renamed as "boot.img-zImage"

- edit default.prop, change kenzo to hydrogen

- edit init.qcom.rc, you should use any compare program, like diff / meld / beyondcompare to check what code is in hydrogen and not in kenzo like

Line 204:216

# LED
chmod 0666 /sys/class/leds/led:torch_0/brightness
chmod 0666 /sys/class/leds/led:torch_1/brightness
chmod 0666 /sys/class/leds/led:switch/brightness
chown system system /sys/class/leds/red/blink
chown system system /sys/class/leds/green/blink
chown system system /sys/class/leds/blue/blink
chown system system /sys/class/leds/red/led_time
chown system system /sys/class/leds/green/led_time
chown system system /sys/class/leds/blue/led_time

on post-fs
start qseecomd

line 352:376

# Mark the copy complete flag to not completed
write /data/misc/radio/copy_complete 0
chown radio radio /data/misc/radio/copy_complete
chmod 0660 /data/misc/radio/copy_complete

# File flags for prebuilt ril db file
write /data/misc/radio/prebuilt_db_support 1
chown radio radio /data/misc/radio/prebuilt_db_support
chmod 0400 /data/misc/radio/prebuilt_db_support
write /data/misc/radio/db_check_done 0
chown radio radio /data/misc/radio/db_check_done
chmod 0660 /data/misc/radio/db_check_done

# Fingerprint
mkdir /data/fpc 0770 system system
mkdir /data/fpc/s 0770 system system
mkdir /data/tombstones 0771 system system
mkdir /tombstones/modem 0771 system system
mkdir /tombstones/lpass 0771 system system
mkdir /tombstones/wcnss 0771 system system
mkdir /tombstones/dsps 0771 system system
mkdir /persist/data/sfs 0700 system system
mkdir /persist/data/tz 0700 system system
mkdir /data/misc/dts 0770 media audio
mkdir /data/misc/audio_pp 0771 media audio

And

# Bring up all cores online
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1

To:

# Bring up all cores online
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1

Line 823:861

service fingerprintd /system/bin/fingerprintd
class late_start
user system
group drmrpc input system
socket fpce stream 0660 system system
writepid /dev/cpuset/system-background/tasks

service imsqmidaemon /system/bin/imsqmidaemon
class main
user system
socket ims_qmid stream 0660 system radio
group radio log diag

service imsdatadaemon /system/bin/imsdatadaemon
class main
user system
socket ims_datad stream 0660 system radio
group system wifi radio inet log diag
disabled

on property:sys.ims.QMI_DAEMON_STATUS=1
start imsdatadaemon

service ims_rtp_daemon /system/bin/ims_rtp_daemon
class main
user system
socket ims_rtpd stream 0660 system radio
group radio diag inet log
disabled

service imscmservice /system/bin/imscmservice
class main
user system
group radio diag inet log
disabled

on property:sys.ims.DATA_DAEMON_STATUS=1
start ims_rtp_daemon
start imscmservice

- Edit init.rc

Change

chown system system /sys/class/leds/green/brightness
chown system system /sys/class/leds/blue/brightness
chown system system /sys/class/leds/red/device/grpfreq

To

chown system system /sys/class/leds/green/brightness
chown system system /sys/class/leds/green/blink
chown system system /sys/class/leds/blue/brightness
chown system system /sys/class/leds/blue/blink
chown system system /sys/class/leds/red/device/grpfreq
chown system system /sys/class/leds/red/device/grppwm

- Edit init.qcom.sh

Add this line after start_sensors

start_copying_prebuilt_qcril_db

And this line at the end of file

chown radio:radio /data/misc/radio/copy_complete

- then Repack boot and copy image-new.img to superr's kitchen project folder then rename it to boot.img

You can get these files from any hydrogen boot.img

Part 3: Finalizing :

Now you've finished porting kenzo ROM to hydrogen, but you need to repack ROM into zip to be able to use it.

- Open superr's kitchen, choose 8) ROM Tools Menu then 7) Build Menu and finally 1) Build full ROM Zip

- Wait till it finishes (when it asks for sign zip press "y") then you'll have to edit META-INF/com/google/android/updater-script inside ROM Zip, so open ROM zip and head to META-INF/com/google/android/ to open updater-script file using text editor then change script to:

package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);

And Congratulations You've finished porting kenzo ROM to your hydrogen :D

Special Thanks:

SuperR. for his great kitchen

osm0sis for amazing image tools script

iBotPeaches for apktool

[MENTION=4399618]nijel8[/MENTION] for helium device tree

@Davehimself for helium vendor

[MENTION=6887229]Ahmed Hady[/MENTION] & [MENTION=7133498]androidlover5842[/MENTION] my great friends & helpers

And me for typing this guide :good: