[Xiaomi Mi Max Guides, News, & Discussion] yshalsager:
Hi guys, since i got mi max (hydrogen) i noticed that there is few custom ROMs for helium, even the two devices is nearly same. but helium is using different camera firmware and need some edits to enable 2 big cores. so let's go ! :D

You'll need some tools:

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

- Boot image Extractor, you can use Android Image Kitchen

- APKTool, get it here

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

Part 0: Preparing:

1- Open superr's kitchen and create new project, then copy hydrogen 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:

Due to difference in camera firmware and cpu configuration as i explained you'll need to copy these files to "system" folder in kitchen.

.
├── etc
│** ├── cpu
│** │** └── cpu.conf
│** └── firmware
│** ├── venus.b00
│** ├── venus.b01
│** ├── venus.b02
│** ├── venus.b03
│** ├── venus.b04
│** ├── venus.mbn
│** ├── venus.mdt
│** ├── venus-v1.b00
│** ├── venus-v1.b01
│** ├── venus-v1.b02
│** ├── venus-v1.b03
│** ├── venus-v1.b04
│** ├── venus-v1.mbn
│** └── venus-v1.mdt
├── lib
│** ├── hw
│** │** └── camera.msm8952.so
│** ├── libcamera2ndk.so
│** ├── libcamera_client.so
│** ├── libcameraservice.so
│** ├── libmmcamera_interface.so
│** ├── libmmjpeg_interface.so
│** └── libmm-qcamera.so
├── lib64
** ├── libcamera2ndk.so
** ├── libcamera_client.so
** └── libcameraservice.so

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

Part 2: Editing Boot.img :

After unpacking hydrogen boot.img using Android Image Kitchen You'll need to copy Helium zImage and edit init.qcom.power.rc

* i prefer editing init.qcom.power.rc even you can just copy it from helium boot.img *

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

- Open init.qcom.power.rc and edit the following lines:

Change:

write /dev/cpuset/foreground/cpus 0-2,4-5
write /dev/cpuset/foreground/boost/cpus 4-5
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0-2
write /dev/cpuset/top-app/cpus 0-5

To:

write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 4-7
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0-2
write /dev/cpuset/top-app/cpus 0-7

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

And

# Bring CPUs offline
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu4/online 0
write /sys/devices/system/cpu/cpu5/online 0

To:

# Bring CPUs offline
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu4/online 0
write /sys/devices/system/cpu/cpu5/online 0
write /sys/devices/system/cpu/cpu6/online 0
write /sys/devices/system/cpu/cpu7/online 0

- 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 helium boot.img or from my Github Repo Here

Zimage - init.qcom.power.rc

Part 3: Editing Framework-res.apk :

Make sure you've installed apktool then copy system/framework/framework-res.apk to new folder (apktool folder for windows users) and:

- install framework-res.apk using command:

apktool if framework-res.apk

- decompile framework-res.apk using command:

apktool d framework-res.apk

- Copy this power_profile.xml to framework-res/res/xml folder in apktool.

- Now recompile framework-res apk using command:

apktool b -f framework-res

- You'll find the edited apk in framework-res/build/apk folder, copy it to "system/framework/" in superr's kitchen project folder.

Part 4: Finalizing :

Now you've finished porting hydrogen ROM to helium, 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 hydrogen ROM to your helium :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: