@dorimanx @daniel.stuart14 @REV3NT3CH @savoca @RenderBroken
Hi devs i would to learn how to build rom and kernel for d802 variant for myself.
I have build cm12 with success and it works flawlessly.
Now i want to build kernel compatible with cm 12.
I downloaded kernel from this source: https://github.com/CyanogenMod/android_kernel_lge_msm8974/tree/cm-12.0
I have used linaro toolchain 4.9.2 for a15 cpu, during the build i had a few of errors but i have fixed it, after that i have my zImage and dtb files prepared...
So i have used boot.img from previously cm 12 build(i take it from zip file to flash) to get ramdisk and zImage.
Then i have switch the original zImage with my zImage-dtb from my build and i modified files from ramdisk.
I have flashed this kernel through loki_tool but i'm stuck on lg logo...
So my question is i have to use zImage or zImage-dtb from my build?
What about creating dt.img, its obligatory?
Can i use this offset to build my kernel or i have to change it?
Code:
base=0x00000000
pagesize=2048
ramdisk_offset=0x05000000
tags_offset=0x04800000
Sorry for disturb but im curious and i want to do it by myself, so i hope you can help me!
Thanks in advance
Use this script to compile and create your image. (put in root folder of kernel)
You'll need edit it, and change:
build path. (in my script is: build=/home/daniel/android-dev/kernel_test)
Cross compile path
You'll need change the defconfig path, too.
Change the config="xxx_defconfig", to the defconfig's name of all the g2 variants in "arch/arm/configs".
And put it in your kernel root directory, too. (It's the open_bump, so you don't need loki it again, you can use my installation script + lcd.sh, in ozip folder.)
And, if for some reason you haven't installed the mkbootimg yet, download it, extract. Then, go to the folder that you've extracted, and do that:
Code:
sudo cp mkbootimg /bin/mkbootimg
sudo chmod 755 /bin/mkbootimg
sudo cp dtbToolCM /bin/dtbToolCM
sudo chmod 755 /bin/dtbToolCM
sudo cp mkbootfs /bin/mkbootfs
sudo chmod 755 /bin/mkbootfs
sudo cp mkboot /bin/mkboot
sudo chmod 755 /bin/mkboot
You'll need extract the ramdisk in ramdisk folder on root kernel folder, so you can use "mkboot" for it.
It'll say to you the ramdisk_offset, tags_offset and cmdline. So, change this in export.sh if there's a difference between.
After this. go to your kernel folder, and then: ./export.sh
OBS: In the first time you execute the script, it create the zimage, if everything goes right, execute the script again, and it'll create a zip with boot.img inside.
Hi thanks for your reply i will try this !
Which configs i have to use those one cyanogenmod_d802_config or open_g2 and so on?
I think is the cyanogenmod_d802_config.
@daniel.stuart14
i have updater-script like this:
ui_print("ebreo kernel for lg g2 d802 variant");
ui_print("Installing modules...");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
delete_recursive("/system/lib/modules");
package_extract_dir("system", "/system");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib/modules");
unmount("/system");
package_extract_file("lcd.sh", "/tmp/lcd.sh");
package_extract_file("boot.img", "/tmp/boot.img");
ui_print("Installing boot.img...");
show_progress(0.500000, 10);
set_perm(0, 0, 0755, "/tmp/lcd.sh");
assert(run_program("/tmp/lcd.sh") == 0);
delete("/tmp/lcd.sh");
ui_print("Done!");
show_progress(1.000000, 10);
Click to expand...
Click to collapse
But i have an error when i flash this by twrp...are there an errors?
Ok i have resolve problem with updater-script, device boot but after a cyanogenmod lho my phone reboot again....how can i debug it?
ebreo said:
Ok i have resolve problem with updater-script, device boot but after a cyanogenmod lho my phone reboot again....how can i debug it?
Click to expand...
Click to collapse
Okay, you should use logcat.
But first, try compile without the changes in kernel that you did.
daniel.stuart14 said:
Okay, you should use logcat.
But first, try compile without the changes in kernel that you did.
Click to expand...
Click to collapse
I didn't any changes its clean kernel from source....i will post logs from build.sh script.
How can i use logcat?
Thanks very much daniel!
Result from build.sh script:
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
CAT arch/arm/boot/zImage-dtb
Kernel: arch/arm/boot/zImage-dtb is ready
[email protected]:~/android/kernel/cm_msm8974$ ./build.sh
TEST Build
Pick variant...
1) d800
2) d801
3) d802
4) ls980
5) vs980
#? 3
Checking for build...
Extracting files...
Modules found.
Making dt.img...
DTB combiner:
Input directory: 'arch/arm/boot/'
Output file: 'out/dt.img'
Found file: msm8974-v2-g2-open_com.dtb ... chipset: 126, rev: 131072, platform: 118, subtype: 0
Found file: msm8974-g2-open_com.dtb ... chipset: 126, rev: 0, platform: 118, subtype: 0
Found file: msm8974-v2-2-g2-open_com.dtb ... chipset: 126, rev: 131074, platform: 118, subtype: 0
=> Found 3 unique DTB(s)
Generating master DTB... completed
dt.img created
Making ramdisk...
Making boot.img...
Bumping...
bumped image: ozip/boot_bumped.img
Zipping...
adding: boot.img (deflated 7%)
adding: system/ (stored 0%)
adding: system/lib/ (stored 0%)
adding: system/lib/modules/ (stored 0%)
adding: system/lib/modules/scsi_wait_scan.ko (deflated 57%)
mv: „../ebreo_Kernel-1.0_d802_signed.zip” i „/home/marcio/android/kernel/cm_msm8974/ebreo_Kernel-1.0_d802_signed.zip” to ten sam plik
Done...
Output zip: /home/marcio/android/kernel/cm_msm8974/ebreo_Kernel-.zip
[email protected]:~/android/kernel/cm_msm8974$
Click to expand...
Click to collapse
So all is gone good
oh, okay.
You can boot, and after some minutes it reboot? Or are you in bootloop?
You can only use logcat if the rom starts.
For it, you must enable ADB, and install adb interface in your linux. (can be in windows too.)
After it, connect the device on PC, open the terminal, and put:
adb logcat
You'll need allow it in your device. So, it will start to show a lot of mensages in terminal.
For save it, do a ctrl + c. (to stop the messages), and put it:
adb logcat -c
It'll be saved on you current folder.
daniel.stuart14 said:
oh, okay.
You can boot, and after some minutes it reboot? Or are you in bootloop?
You can only use logcat if the rom starts.
For it, you must enable ADB, and install adb interface in your linux. (can be in windows too.)
After it, connect the device on PC, open the terminal, and put:
adb logcat
You'll need allow it in your device. So, it will start to show a lot of mensages in terminal.
For save it, do a ctrl + c. (to stop the messages), and put it:
adb logcat -c
It'll be saved on you current folder.
Click to expand...
Click to collapse
My problem is that im in bootloop....
Related
here is a tutorial by Mr. Rager on using your own rom in dual boot rom. Just substitute "squished" with your rom.
Okay, first you need to download the CM-AOSP-GB-shell.zip.
1. Open up both of the zips (I'm using Ubuntu 10.10, I think Windows uses 7zip). Now two windows should be displayed, respectively.
2. Drag-n-drop the /sdcard folder from the CM-AOSP-GB-shell.zip (the shell) straight into the other window. It should add it without issues. So, now the squished.zip has the following folders: META-INF, system, boot.img, and sdcard.
3. Now copy the boot.img from the shell into the other .zip. It should over-write the boot.img in the squished.zip.
4. In the shell, go into dualrom/app and copy the DRSettingsv1.apk file to system/app in the squished.zip.
5. In the shell, go into dualrom/bin and copy the symlink.sh file to system/bin in the squished.zip.
6. In the shell, go into dualrom/etc and copy the reboot AND the vold.fstab files to system/etc in the squished.zip
7. In the shell, go into dualrom/lib/modules and copy the bcm4329.ko file to system/lib/modules in the squished.zip.
8.1 Now, in the squished.zip, go to META-INF/com/google/android/ and open up the updater-script. In the resulting window, look for the line:
Code:
getprop("ro.product.board") == "inc");
It's the second line, but below it type:
Code:
run_program("/sbin/mount", "/dev/block/mmcblk0p3", "/system");
This tells the phone to mount the emmc. Just in case you didn't know. ;-)
8.2 Now, look for the lines:
Code:
format("yaffs2", "MTD", "system");
mount("yaffs2", "MTD", "system", "/system");
Delete those two lines, and add:
Code:
package_extract_dir("sdcard", "/sdcard");
8.3 In the same window, look for:
Code:
set_perm(0, 0, 06755, "/system/xbin/tcpdump");
It's towards the bottom, and add below it type:
Code:
set_perm(0, 0, 0777, "/system/etc/reboot");
Now the DR app works. Save and close. It should update the squished.zip, but to make sure open the updater-script back up, and check to see if those two lines are there. (Yeah, no more problems for me with SR4 and Salvage as far as the DR app ^-^, thanks to you treken. I can now go back and forth to my hearts content, no pun intended.)
9. Now you can close the zip back up and follow the 1,2,3 flash steps, except replace 3 with your squished.zip. I tested it and it works, for me at least. If you are in Ubuntu, and it asks you to update after you close the text editor, update it.
1. Preparing environment and building
1.1. Installing bootloader and recovery
This step can be done only in Windows (can be done on Linux too, but I didn't find right version of Linux nvflash):
Run MS Windows (tested even on Windows 7) on host PC
Download this package (Size=12592367 MD5=EA890A3B3E1CEDBBD820D1A798A365A2). Inside package:
Windows drivers for nVidia USB device
nvflash tool and required libraries
Unlocked bootloader, see details here
Batch for automatic update, see original batch here
Generate your SBK with your CPUID by this link
Connect tablet to PC through USB
Turn-off tablet
Press and hold reset button on tablet
Press power and wait until new USB device will be detected
Install USB drivers (can be find in package)
Run script run.bat and follow recommendations
1.2. Downloading sources and building Android
Create directory for AOSP sources
Code:
mkdir aosp && cd aosp
Initializing repo
Code:
repo init -u [url]https://android.googlesource.com/platform/manifest[/url] -b ics-mr1
Downloading sources
Code:
repo sync
Download sources of Acer Picasso device
Code:
git clone git://github.com/shchers/afs_device_acer_picasso.git device/acer/picasso
Download sources of MBM RIL library
Code:
git clone git://github.com/shchers/afs_vendor_mbm_mbm-ril.git vendor/mbm/mbm-ril
Download sources of MBM GPS library
Code:
git clone git://github.com/shchers/afs_vendor_mbm_libmbm-gps.git vendor/mbm/libmbm-gps
Download sources of MBM GPS service
Code:
git clone git://github.com/shchers/afs_vendor_mbm_mbmservice.git vendor/mbm/mbmservice
Setting-up build environment
Code:
source build/envsetup.sh
Configuring target (Acer A500/A501 == full-picasso)
Code:
lunch full_picasso-userdebug
Building with using all available CPU cores
Code:
m -j`grep -c processor /proc/cpuinfo`
2. Installing Android to device
2.1. Updating through CWM recovery
2.1.1. Creating update archive
Go to target output directory
Code:
cd ${ANDROID_PRODUCT_OUT}
Create folder for updater script. Run in console:
Code:
mkdir -p META-INF/com/google/android
Copy updater script there
Code:
show_progress(0.400000, 0);
ui_print("> Formating system partition");
format("ext4", "EMMC", "/dev/block/mmcblk0p3", "0");
ui_print("> Mounting system partition");
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");
ui_print("> Extracting system directory");
package_extract_dir("system", "/system");
ui_print("> Creating symlinks");
show_progress(0.200000,0);
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("mksh", "/system/bin/sh");
symlink("toolbox",
"/system/bin/ls","/system/bin/mount","/system/bin/cat",
"/system/bin/ps","/system/bin/kill","/system/bin/ln",
"/system/bin/insmod","/system/bin/rmmod","/system/bin/lsmod",
"/system/bin/ifconfig","/system/bin/setconsole","/system/bin/rm",
"/system/bin/mkdir","/system/bin/rmdir","/system/bin/reboot",
"/system/bin/getevent","/system/bin/sendevent","/system/bin/date",
"/system/bin/wipe","/system/bin/sync","/system/bin/umount",
"/system/bin/start","/system/bin/stop","/system/bin/notify",
"/system/bin/cmp","/system/bin/dmesg","/system/bin/route",
"/system/bin/hd","/system/bin/dd","/system/bin/df",
"/system/bin/getprop","/system/bin/setprop","/system/bin/watchprops",
"/system/bin/log","/system/bin/sleep","/system/bin/renice",
"/system/bin/printenv","/system/bin/smd","/system/bin/chmod",
"/system/bin/chown","/system/bin/newfs_msdos","/system/bin/netstat",
"/system/bin/ioctl","/system/bin/mv","/system/bin/schedtop",
"/system/bin/top","/system/bin/iftop","/system/bin/id",
"/system/bin/uptime","/system/bin/vmstat","/system/bin/nandread",
"/system/bin/ionice","/system/bin/touch","/system/bin/lsof");
ui_print("> Applying permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
set_perm(0, 0, 0544, "/system/etc/install-recovery.sh");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 0, 0644, "/system/vendor/fake.txt");
show_progress(0.200000, 10);
package_extract_file("boot.img", "/dev/block/mmcblk0p2");
NOTE: Don't rename file! It should be updater-script!
Download this archive (Size=149342 MD5=9497D5087FEF04C1EA4EE215A3DC83B8) and extract there
Create ZIP archive. Run in console:
Code:
zip -r9 full-pack.zip boot.img system META-INF
Generate keys. Run in console:
Code:
openssl genrsa -out key.pem 1024
openssl req -new -key key.pem -out request.pem
openssl x509 -req -days 3650 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
Run signing archive. Run in console:
Code:
java -jar ${ANDROID_HOST_OUT}/framework/signapk.jar certificate.pem key.pk8 full-pack.zip full-pack-sign.zip
2.1.2. Using CWM recovery
Upload full-pack-sign.zip on FAT32 formated microSD card
Turn-off tabled
Insert microSD
Press Power button while hold Volume Down button
Release Power button when you'll see text in top left corner, some like "cleaning cache partition..."
From opened menu select "wipe data/factory reset"
Select "Yes -- delete all user data"
Press on "install zip from sdcard" menu
Select "choose zip from sdcard"
In this menu select "full-pack-sign.zip"
After installing press "Go back"
Press "reboot device"
2.2. Updating through Android debug
2.2.1. Updating system partition
Get a root access
Code:
adb root && adb wait-for-device
Remount system partition with R/W permitions
Code:
adb shell mount -o remount,rw -t ext4 /dev/block/mmcblk0p3 /system/
Sync binaries
Code:
adb shell stop && adb sync && adb reboot
2.2.2. Updating boot partition
Reboot to fastboot
Code:
adb reboot bootloader
Select one of possible methods to use new boot partition
Boot with custom kernel and ramdisk without flashing (boot partition will not be rewrote) - this mode useful for debugging kernel/root
Code:
fastboot boot ${ANDROID_PRODUCT_OUT}/kernel ${ANDROID_PRODUCT_OUT}/ramdisk.img
Boot with custom boot.img without flashing (boot partition will not be rewrote) - this mode also can be used for debugging kernel/root
Code:
fastboot boot ${ANDROID_PRODUCT_OUT}/boot.img
Flashing new boot.img to boot partition
Code:
fastboot flash:raw boot ${ANDROID_PRODUCT_OUT}/kernel ${ANDROID_PRODUCT_OUT}/ramdisk.img
2.3. Enabling Google services
To enable Google services on new system, should be copied several Google binaries to /system/app. To do it should b done several steps:
Get a root access
Code:
adb root && adb wait-for-device
Remount system partition with R/W permitions
Code:
adb shell mount -o remount,rw -t ext4 /dev/block/mmcblk0p3 /system/
Download this (i.e. GAPPS) archive (Size=16449776 MD5=C7E6FAAFE7223A17DE93DD1D7A968734)
Extract it somewhere
Code:
mkdir GooglePack && cd GooglePack
unzip googlepack.zip
Stop dalvik virtual machine
Code:
adb shell stop
Upload APK files
Code:
for f in `ls *.apk`; do echo "Uploading $f" && adb push $f /system/app/; done
Remove Provision.apk - it looks like setup wizard, but SetupWizard.apk much powerful
Reboot device to recovery and wipe data partition (use CWM "Wipe" menu for it)
Code:
adb reboot recovery
Reboot device after wiping
Use wizard on system start-up to configure your account
Use Android Market to install GMail and other apps
3. Debugging
3.1. RILD
To see rild log should be done:
Code:
adb logcat -b radio
4. FAQ
Q: WiFi scanner show few AP, but can't connect anywhere...
A: Try to make factory reset.
Click to expand...
Click to collapse
Q: Is it thor2002ro sources?
A: No, it is my own port.
Click to expand...
Click to collapse
Q: What is the version?
A: ICS MR1 (Current version: 4.0.4).
Click to expand...
Click to collapse
5. Supported features
2D/3D acceleration
Photo/Video Camera
2G/3G
GPS
AGPS
SMS (tested only in GSM networks)
WiFi
Bluetooth
Audio/Video playback
Image viewing
External SD Card
External USB storage
Compass
Gyroscope
6. To do
[rild] Add support for USSD
[rild] Add support/check for MMS
[libsensors] Implement libsensors and replace Acer binaries
[audio] Add support for USB audio devices
[audio] Add support for modem audio input
7. Screenshots
Version
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
EDGE connection
Speed test results on HSDPA+
8. Pre-builds
Build #1 (Size=114409141 MD5=11C9E0BE468B21BF061C7ECF6673C9B4)
Build #2 (Size=119899802 MD5=4CB798A28B38D02217752C6E09F0E226)
[reserved]
Reserved for further updates, if it will be necessary...
Well, thanks to my Ukraine neighbor
Should be an interesting project for the weekend!
Would be great if someone could post a .zip
Holy sweet meatballs!
I have a A501, and I'm pleased to hear that the 3G Iconia is getting some love. Makes me wonder if I should sell it with the ICS ROM loaded on it, or keep it now it has ICS love since I have a Galaxy Tab...
Decisions Decisions.
Eagerly waiting a ZIP so we can all be eating some delicious Ice Cream Sandwich.
That's great, also the steps are really clean, maybe you should give some tips to acer
@shchers: aren't you thinking about submitting your work to CyanogenMod so our tables could get official support from CM team? I think there is no Acer Iconia maintainer right now at all in the CM team so you could try and join them as Iconia maintainer. This would be really great.
Hm, forgive me for asking but where is the kernel to use with it?
macia10 said:
Hm, forgive me for asking but where is the kernel to use with it?
Click to expand...
Click to collapse
After I've written above reply, I've checked shchers' git repo and there is a kernel but in a binary form.
@shchers: did you build this kernel yourself? GPL licence requires that you need to publish its sources as well.
yaworski said:
After I've written above reply, I've checked shchers' git repo and there is a kernel but in a binary form.
@shchers: did you build this kernel yourself? GPL licence requires that you need to publish its sources as well.
Click to expand...
Click to collapse
ONLY if he modified it from Acer's released source. If he didn't, he doesn't have to add the sources to his git (though it'd be handy for conveniences sake). Best we wait and see what he says before jumping to ANY conclusions.
Either way, FANTASTIC work shchers! Thank you VERY much!
@shchers: did you build this kernel yourself? GPL licence requires that you need to publish its sources as well.
Click to expand...
Click to collapse
No, I used Acer kernel. But thanks for reminder
When my kernel will be ready I'll share it with community
About ZIP... I see that many people asking about update package, so I started building and it will be ready in a one hour.
shchers said:
No, I used Acer kernel. But thanks for reminder
When my kernel will be ready I'll share it with community
About ZIP... I see that many people asking about update package, so I started building and it will be ready in a one hour.
Click to expand...
Click to collapse
Awesome. Have you thought about the CyanogenMOD suggestion made earlier? If you added your source to that, we could get official support for it on our devices which would rock, and it'd also make life easier for those wanting to get MIUI ported over.
yaworski said:
@shchers: aren't you thinking about submitting your work to CyanogenMod so our tables could get official support from CM team? I think there is no Acer Iconia maintainer right now at all in the CM team so you could try and join them as Iconia maintainer. This would be really great.
Click to expand...
Click to collapse
Good point, but unfortunately I'd never seen CM source code. May be you can share link to CM Gerrit/Git with me?
shchers said:
Good point, but unfortunately I'd never seen CM source code. May be you can share link to CM Gerrit/Git with me?
Click to expand...
Click to collapse
You should find all you need through the following link...
http://www.cyanogenmod.com/community
There's also a link to their Git hub on there.
shchers said:
Good point, but unfortunately I'd never seen CM source code. May be you can share link to CM Gerrit/Git with me?
Click to expand...
Click to collapse
All you need is here:
http://wiki.cyanogenmod.com/wiki/Building_from_source
http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
(just replace gingerbread branch with ics)
But you probably need working kernel source for the device to submit vendor specific code to CM.
Is this kernel just a binary from Acer's leak? I'm asking because I'm not aware of a working kernel source for a500.
shchers said:
About ZIP... I see that many people asking about update package, so I started building and it will be ready in a one hour.
Click to expand...
Click to collapse
thx man! i really want to give it a try!
and thx for showing some love to us a501 users nobody cares about us
To yaworski and FloatingFatMan:
Guys, thanks a lot for links! I'll try to build CM tonight
shchers said:
To yaworski and FloatingFatMan:
Guys, thanks a lot for links! I'll try to build CM tonight
Click to expand...
Click to collapse
What, that would be very nice, even though i own an A500! If you need an testing, I'll volunteer.
Taptalked u see
tosomax said:
thx man! i really want to give it a try!
and thx for showing some love to us a501 users nobody cares about us
Click to expand...
Click to collapse
See link in comment #1
Well, I guess I can forget about configuring ubuntu for now
cygwin never could get working.
Great job on compiling and getting the link up!
RapidShare.... not so rapid Probably getting flooded by all the 501 users
You 500 users go play with the 500 roms and stop sucking all the bandwidth!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Introduction:-
Hey guys! Here's a complete tutorial for building or porting MIUI to your device! I know there are already some guides for it but I felt none of them were noob-friendly and many were confusing and missing some important instructions. So I decided to share this complete guide which will teach you how to build MIUI from scratch. This is a basic guide in which I have taken building latest MIUI v7 as example. So let's start!
POST 1- Guide to build MIUI using PatchROM Sources
POST 2- Modifying boot.img
POST 3- Guide to port MIUI from another device
Basically,There are two methods by which you can build MIUI ROM for your device.
Build from source using PatchROM Method
Port manually from another device which already has MIUI
Let's start with PatchROM Method:-
Requirements:-
Ubuntu 14.04 64-bit. (Installed as virtual machine like in VMware will also work)
Base ROM for your device.
NOTE- Preferably take pure AOSP built for your device as base ROM rather than CyanogenMod. You'll get less rejects while patching MIUI framework. But CM works too! Your choice..
Apktool. You can use Advanced Apktool by BDFreak. It's easier to use.
Working brain and a lot of patience!!
Prerequisites:-
First of all, take framework-res.apk, framework.jar, framework2.jar, services.jar, android.policy.jar and telephony-common.jar from your base ROM zip.
Now using apktool, decompile all above files.
If you're using advanced apktool then go to 3-Out folder and rename the respective folders to-
PHP:
framework-res
framework.jar.out
framework2.jar.out
services.jar.out
android.policy.jar.out
telephony-common.jar.out
We'll need these folders further for MIUI framework patching.
STEP-1: Preparing build environment
Switch to Ubuntu 14.04. We'll have to prepare ROM building environment.
Next step is to setup android sdk. Follow THIS guide. (Look at 2nd answer graphical image explanation. Follow till step 5.)
Now run the following commands as superuser from terminal-
PHP:
sudo apt-get update
Then after run this-
sudo apt-get install bison build-essential curl flex git git-core gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev unzip lib32readline-gplv2-dev lib32z1-dev make python-networkx zlib1g-dev:i386 phablet-tools
Click to expand...
Click to collapse
All the necessary packages are now installed. Now the next step is to configure repository.
In terminal,run following commands-
PHP:
mkdir -p ~/bin
PHP:
PATH=~/bin:$PATH
PHP:
cd ~/bin
PHP:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
PHP:
chmod a+x ~/bin/repo
PHP:
mkdir ~/patchrom
PHP:
cd ~/patchrom
PHP:
repo init -u git://github.com/MiCode/patchrom.git -b miui-7 -m android-4.4.4.xml
Now you'll have to configure git. Run following commands in terminal-
Code:
git config --global user.email [COLOR="Red"]ENTER_YOUR_EMAIL_ID_HERE[/COLOR]
Code:
git config --global user.name [COLOR="Red"]ENTER_YOUR_REAL_NAME_HERE[/COLOR]
Now it's time to download the MIUI source code! Run the following command in terminal-
PHP:
repo init -u git://github.com/MiCode/patchrom.git -b miui-7 -m android-4.4.4.xml
PHP:
repo sync
Now grab a cup of coffee while the MIUI source gets downloaded. Required time depends on speed of your internet connection. The MIUI source is of size about 600-700 MB (With .repo total is 1.5 GB).
After the source is downloaded,create a new directory in /home. Name it whatever you want. (Preferably codename of your device) In my case, it's taoshan.
PHP:
cd /home/stryder/
PHP:
mkdir taoshan
PHP:
cd taoshan
Now create a makefile for your device. If you want, you can make changes to this my makefile and use.
PHP:
gedit makefile
You can copy the following content in makefile (Don't forget to make changes in it according to your device) and save it.
Code:
#
# Makefile for taoshan
#
# The original zip file, MUST be specified by each product
local-zip-file := stockrom.zip
# The output zip file of MIUI rom, the default is porting_miui.zip if not specified
local-out-zip-file := MIUI7_taoshan.zip
# All apps from original ZIP, but has smali files chanded
local-modified-apps :=
local-modified-priv-apps :=
local-modified-jars :=
# All apks from MIUI
local-miui-removed-apps :=
local-miui-removed-priv-apps :=
local-miui-modified-apps :=
# All apps need to be removed from original ZIP file
local-remove-apps := Gallery2 Exchange2
# Config density for co-developers to use the aaps with HDPI or XHDPI resource,
# Default configrations are HDPI for ics branch and XHDPI for jellybean branch
local-density := XHDPI
PORT_PRODUCT := taoshan
# To include the local targets before and after zip the final ZIP file,
# and the local-targets should:
# (1) be defined after including porting.mk if using any global variable(see porting.mk)
# (2) the name should be leaded with local- to prevent any conflict with global targets
#local-pre-zip := local-pre-zip-misc
#local-after-zip:= local-put-to-phone
# The local targets after the zip file is generated, could include 'zip2sd' to
# deliver the zip file to phone, or to customize other actions
#include phoneapps.mk
include $(PORT_BUILD)/porting.mk
local-pre-zip-misc:
@echo Update boot.img
cp other/boot.img $(ZIP_DIR)/boot.img
@echo Update build.prop
cp other/build.prop $(ZIP_DIR)/system/build.prop
@echo Delete some unneeded files
rm -rf $(ZIP_DIR)/system/etc/.has_su_daemon
rm -rf $(ZIP_DIR)/system/priv-app/Dialer.apk
rm -rf $(ZIP_DIR)/system/priv-app/Keyguard.apk
rm -rf $(ZIP_DIR)/system/priv-app/SystemUI.apk
rm -rf $(ZIP_DIR)/system/priv-app/VoiceDialer.apk
rm -rf $(ZIP_DIR)/system/priv-app/Launcher3.apk
rm -rf $(ZIP_DIR)/system/priv-app/ParanoidOTA.apk
rm -rf $(ZIP_DIR)/system/priv-app/ThemeChooser.apk
rm -rf $(ZIP_DIR)/system/priv-app/ThemesProvider.apk
Explanations:-
'local-zip-file' = Name of your original Base ROM zip
'local-out-zip-file' = Name for your finished MIUI rom
'local-modified-apps' = Apps that will be modified to fit in with the framework. They need to be modified because they contact with the system
'local-remove-apps' = Apps that will be removed from the original ROM
'local-pre-zip' = Refers to code-block that should be executed before the zip is done.
'local-after-zip' = Refers to code-block executed after the zip is completed
'local-zip-misc' = The code-block just described at 'local-pre-zip'. It adds some Google Apps and a build.prop
'local-test' = Another code-block
Now, manually copy the previously decompiled framework folders to your device folder.
PHP:
framework-res
framework.jar.out
framework2.jar.out
services.jar.out
android.policy.jar.out
telephony-common.jar.out
Next,copy your Base ROM zip in your device folder.
Now move to patchrom folder.
PHP:
cd ~/patchrom
PHP:
source build/envsetup.sh
Again move to your device folder and start MIUI framework patching.
PHP:
cd /home/stryder/taoshan
PHP:
make firstpatch
Now a new folder folder temp will be created. In that you'll find the reject folder in which there will be rejects which you have to fix manually. Follow THIS excellent guide by @JavierAlonso to fix rejects. Also see THIS guide.
After fixing all the rejects, type following command to create a flashable zip of your MIUI ROM.
PHP:
make fullota
or you can also use
PHP:
make zipfile
With this, the flashable zip file is built. Now follow the tutorial from next post to modify your boot.img and include this new boot.img in your flashable MIUI ROM zip. Then flash the zip from recovery and enjoy your source built MIUI ROM!
Sometimes, your device might get stuck on bootanimation so in this case, take LOGCAT and look for the error and solve it. You can use some tools like Advanced Logcat Viewer to read the log.
Modifying boot.img
Now, let's modify the boot.img from base ROM zip to it make compatible with our MIUI ROM.
First of all, download any boot image kitchen or editor. I used Android Image Kitchen for Windows.
Assuming you're using the same kitchen, Extract the files from Android Image Kitchen in a separate folder. Copy your base ROM boot.img in that folder.
Now drag and drop the boot.img on unpackimg. The kernel files will be extracted in ramdisk and split_img folder.
We have to modify the ramdisk so move to that. In sbin folder, you'll see the extracted files.
Now there are two chances- First, Your ramdisk is already extracted with various folders and files. In that case ignore the next steps and directly modify in respective files using Notepad++.
While in second case, you'll get the ramdisk as ramdisk.cpio file. If you get this the you'll have to move to Ubuntu again for extracting it.
Now in Ubuntu, copy your ramdisk.cpio in a seperate folder (suppose in stryder folder) in your home directory.
Now, open terminal and run the following command-[No need as superuser]
PHP:
cd stryder
PHP:
cpio -i -F ramdisk.cpio
Some output will be shown in terminal as 2320 blocks or something like that!
Now in your folder, you'll see the extracted ramdisk files.
Now comes the actual modification.
First of all, download attached zip and extract the files in appropriate folders. (If the folder is not present, add that folder).
Open default.prop and edit the lines like this-
PHP:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.adb.secure=0
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=1
persist.sys.usb.config=mtp,adb
persist.service.adb.enable=1
persist.service.debuggable=1
Save the changes and open init.cm.rc (In case of CyanogenMod) or init.pa.rc (In case of AOSPA). Add # before the import line like this-
PHP:
# Superuser
#import /init.superuser.rc
Save this file and now open init.rc.
At the end of init.rc file, add these lines-
PHP:
#service for shelld
service shelld /system/xbin/shelld
class main
#service for su
service su_daemon /system/xbin/su --daemon
class main
oneshot
service lbesec /system/xbin/lbesec
class main
oneshot
Save this file and then open seapp_contexts.
In that file, add at the end-
PHP:
user=theme seinfo=platform domain=platform_app type=platform_app_data_file
user=backup seinfo=platform domain=platform_app type=platform_app_data_file
user=updater seinfo=platform domain=platform_app type=platform_app_data_file
user=theme_man domain=system_app type=system_data_file
Also modify these lines (if present) to look like this-
PHP:
user=_app domain=untrusted_app type=app_data_file
user=_app seinfo=platform domain=platform_app type=app_data_file
user=_app seinfo=shared domain=shared_app type=app_data_file
user=_app seinfo=media domain=media_app type=app_data_file
user=_app seinfo=release domain=release_app type=app_data_file
Save this file and if present, open init.qcom.rc.
And before this line (at the end)-
PHP:
on property:sys.boot_completed=1
Add these lines-
PHP:
service shelld /system/xbin/shelld
class main
Save the file. Now it's time to repack your ramdisk.
First, move your original ramdisk.cpio from the extracted folder to /home. That is, if your extracted ramdisk is in
PHP:
/home/stryder/
Move original ramdisk.cpio file to-
PHP:
/home/
After that, run this command in terminal-
PHP:
cpio -i -t -F ../ramdisk.cpio | cpio -o -H newc -O ../ramdisk_new.cpio
Now a new file ramdisk_new.cpio will be created. Take a look if it's of the same size as the original one just a few bytes difference.
Also open this ramdisk_new.cpio and make sure you have the newly added files in it. (Ex. otad in bin folder etc.)
Now move this ramdisk_new.cpio to previously extracted Android Image kitchen ramdisk/sbin/ directory.
Delete the original ramdisk.cpio from it and rename the ramdisk_new.cpio to ramdisk.cpio.
Now come back and directly run repackimg. The modified image_new will be generated. Rename it to boot and include this modified boot.img in your MIUI ROM zip. Now you can proceed to flash your MIUI ROM!
Special Thanks- @Zenamp
Port MIUI from another device
Requirements:-
7-zip, Winrar or similar software
Notepad++
Instructions:-
First of all, make 2 folders- 1. BASE ROM 2. PORT ROM
What is Base ROM: It is the ROM which is built for your device. (AOSP or CM etc.)
What is Port ROM: MIUI ROM of other device which you want to port to your device.
NOTE- It's better if the port device and your device has same CPU architecture and specifications. If you couldn't find same specification device then try the device having almost similar specification of your device.
Now extract the Base ROM zip in BASE ROM folder and Port ROM zip in PORT ROM folder.
Next, Delete addon.d (If present), app, framework, fonts, media and priv-app folder in System folder of BASE ROM.
Now copy addon.d (If present), app, framework, fonts, media and priv-app folder from system folder of PORT ROM to system folder of BASE ROM.
Now open etc folder in both ROMs folder. Go to init.d folder of PORT and copy and replace any extra files except 00banner to init.d of BASE ROM.
Now open permissions folder in etc of both ROMs and copy and replace all the permissions files from PORT ROM to your BASE ROM folder except handheld_core_hardware.xml and platform.xml. (In case of CM based BASE ROM, also don't replace org.cyanogenmod.hardware.xml).
Also copy any extra folder available in PORT ROM etc/ to BASE ROM etc/ e.g. miui_feature folder.
Now open your system_fonts.xml in etc folder of BASE ROM and copy this before </familyset> end of file
PHP:
<family>
<nameset>
<name>miui</name>
</nameset>
<fileset>
<file>Miui-Regular.ttf</file>
<file>Miui-Bold.ttf</file>
</fileset>
</family>
<family>
<nameset>
<name>miuiex</name>
</nameset>
<fileset>
<file>MiuiEx-Regular.ttf</file>
<file>MiuiEx-Bold.ttf</file>
</fileset>
</family>
<family>
<nameset>
<name>miuiex-light</name>
</nameset>
<fileset>
<file>MiuiEx-Light.ttf</file>
</fileset>
</family>
Now copy all the extra files from PORT ROM bin, lib and xbin folder to BASE ROM respective folders. Remember, DO NOT REPLACE anything. Just copy and paste and skip the files with same name.
Now, open build.prop of BASE ROM. You can change these value to anything you like-
PHP:
ro.build.id=
ro.build.display.id=
ro.build.date=
ro.build.date.utc=
ro.product.locale.language=en
ro.product.locale.region=US
ro.cm.version=
ro.modversion=
Now copy paste these values at the end of your BASE ROM build.prop. You can edit the fields but keep the structure same.You can look at PORT ROM build.prop for reference.
PHP:
ro.build.description=devicename-user 4.4.2 yourname C2104XXUCNG1 release-keys
ro.build.fingerprint=devicemanufacturer/devicemodel/device:4.4.2/yourname/C2104XXUCNG1:user/release-keys
ro.product.model=Xperia L
ro.product.device=taoshan
ro.build.characteristics=default
#MIUI_Features
ro.miui.has_real_blur=0
ro.miui.has_handy_mode_sf=1
ro.config.sms_received_sound=FadeIn.ogg
ro.config.sms_delivered_sound=MessageComplete.ogg
ro.product.manufacturer=Xiaomi
ro.config.elder-ringtone=Angel.mp3
persist.sys.mitalk.enable=true
ro.miui.ui.version.code=5
ro.miui.ui.version.name=V7
persist.sys.strictmode.disable=true
ro.product.mod_device=yourdevice
Change these fields in BASE ROM build.prop according to PORT ROM build.prop-
PHP:
ro.config.notification_sound=
ro.config.alarm_alert=
ro.config.ringtone=
If your device has On-screen buttons, then add this value at the end of BASE ROM build.prop-
PHP:
qemu.hw.mainkeys=0
Now we're done with build.prop.
Next, open META-INF/com/google/android/updater-script from BASE ROM using Notepad++ and change, compare and replace all the symlink and set_metadata lines in updater-script according to PORT ROM updater-script.If some extra lines are there in BASE ROM updater-script, keep it as it is.
NOTE:-I have attached one sample updater-script with this post. Look below. You can refer from that if you feel any difficulty.
Add these before unmount("/system"); at the end of updater-script-
PHP:
set_perm(0, 1000, 06750, "/system/xbin/shelld");
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
package_extract_file("META-INF/com/miui/relink", "/tmp/relink");
set_perm(0, 0, 0555, "/tmp/relink");
run_program("/tmp/relink");
delete("/tmp/relink");
set_perm_recursive(1000, 1000, 0755, 0644, "/data/miui");
set_metadata("/system/bin/debuggerd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/bin/debuggerd_vendor", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:debuggerd_exec:s0");
set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 06755, "capabilities", 0x0, "selabel", "u:object_r:su_exec:s0");
delete_recursive("/data/miui/preinstall_apps");
delete_recursive("/data/miui/cust/preinstall_apps");
ui_print("Installation finished...Enjoy!");
unmount("/data");
Also copy META-INF/com/miui and data folder to BASE ROM from PORT ROM.
Now modify your BASE ROM boot.img using the tutorial from previous post and put that new boot.img in BASE ROM folder.
Finally, select META-INF, system, boot.img, file_contexts(If present) and data folder in BASE ROM.
Right click and select Add to Archive. Select Zip. Type the name of zip. (Don't delete ".zip" at the end!) Click OK.
Now you're ready to flash this zip from recovery.
Sometimes, your device might get stuck on bootanimation so in this case, take LOGCAT and look for the error and solve it. You can use some tools like Advanced Logcat Viewer to read the log. Look HERE for fixing bootloop.
I hope you guys understood how to build and port MIUI. I wish you good luck! If you get stuck anywhere, If you become successful building MIUI, feel free to post here. Also if you succeed, I'll appreciate if you give me credits and add link to this thread in your ROM thread on XDA.
Frequently Asked Questions
Shepard62700FR said:
The PatchROM technique (post #1 tutorial) works for Android 4.4 KitKat, meaning that you have to find a KitKat AOSP or CyanogenMod 11 ROM for your device as a base, STRYDER said that he doesn't recommend the OEM Stock ROM as a base due to vendor stuff that might cause more rejects (and I think if the stock ROM is not deodexed, it's worse).So preferably take aosp kitkat rom as base. Patchrom method won't work for Android 5.0 Lollipop and higher.
If you want to port a MIUI Lollipop/Marshmallow ROM to a Lollipop/Marshmallow based device, you will have to do the "port from other device" technique (post #3), which is to find MIUI ROM for another device with the same Android version, chipset, screen resolution and follow the port method. Use this guide for porting to qualcomm and broadcom devices preferably. For mediatek devices, I suggest following porting guides from MIUI forums. Though this guide might work as well.
Click to expand...
Click to collapse
Question:- Can I port MIUI to XXX device?
Answer:- You'll never know if you don't try!
Question:- Can you please port/help porting MIUI to XXX device?
Answer:- Sorry, I won't port. It's not possible for me to accept port requests, that's why I wrote this guide so that you can port it yourself and test it out on the device you own! About helping, post your issues/logs here in this thread. Me or any other members will help you as they can.
Its awesome bro.
Thanks for sharing with us.....
wolfmannight said:
Its awesome bro.
Thanks for sharing with us.....
Click to expand...
Click to collapse
You're welcome bro!
A perfect guide! Many Thanks!
abhatia1435 said:
A perfect guide! Many Thanks!
Click to expand...
Click to collapse
You're welcome bro! It's the most simplified guide you'll ever find...You can try porting MIUI 7 to your Xperia M!
Heyyy Bro, sorry for the noob questions but will all our Sony stuffs like XReality, DSEE HX HD audio, headphone settings will be lost or not, can we mix MIUI with Sony's stuffs
STRYDER~007 said:
You're welcome bro! It's the most simplified guide you'll ever find...You can try porting MIUI 7 to your Xperia M!
Click to expand...
Click to collapse
Yes bro. Was thinking of that only Can I use the method mentioned in 3rd post? Using XL's ROM for porting to XM? Have you released it for XL?
Black Plague said:
Heyyy Bro, sorry for the noob questions but will all our Sony stuffs like XReality, DSEE HX HD audio, headphone settings will be lost or not, can we mix MIUI with Sony's stuffs
Click to expand...
Click to collapse
Well some features may be lost but i have seen my friend @gamzekal has built MIUI with Sony stuffs HERE..So yeah..Probably we can include those stuffs..I'm not sure though!
abhatia1435 said:
Yes bro. Was thinking of that only Can I use the method mentioned in 3rd post? Using XL's ROM for porting to XM? Have you released it for XL?
Click to expand...
Click to collapse
Yeah you can use any method..I have not yet released MIUI for XL..There are some issues with RIL which I'm fixing now..But you can take any other device and port from it..Visit MIUI site and download latest v7! Try taking the device which has similar specification with your XM.. But not necessarily..I ported the one from HTC One S and it still worked!!
Sad but true, I tried to ask him about how he do that stuff but xda won't allow me to send message zzz coz his inbox if full
Black Plague said:
Sad but true, I tried to ask him about how he do that stuff but xda won't allow me to send message zzz coz his inbox if full
Click to expand...
Click to collapse
Yeah I know! Probably he's too lazy to delete his old msgs!!
@STRYDER~007 You did it again bro!!! Thanks for sharing this with us!
sebastiandg7 said:
@STRYDER~007 You did it again bro!!! Thanks for sharing this with us!
Click to expand...
Click to collapse
Happy to share bro! Enjoy!
This is a nice guide... But only for 4.4.4, correct @STRYDER~007?
repo init -u git://github.com/MiCode/patchrom.git -b miui-7 -m android-4.4.4.xml
Click to expand...
Click to collapse
I wan't to port this for eagle (D2303), but all 4.4.4 AOSP / CM / Omni roms are fuc*** up, none of them works properly to be used as base, and all devs went directly into CM12.1 / Omni 5.1.1, which work fantastic. Any ideas?
linuxct said:
This is a nice guide... But only for 4.4.4, correct @STRYDER~007?
I wan't to port this for eagle (D2303), but all 4.4.4 AOSP / CM / Omni roms are fuc*** up, none of them works properly to be used as base, and all devs went directly into CM12.1 / Omni 5.1.1, which work fantastic. Any ideas?
Click to expand...
Click to collapse
Yep.. Only for 4.4 since MIUI 7 patchrom source is based on 4.4.. Try to find base ROM which will be somewhat stable to be used as base.. There's no alternative to that!
Thanks for giving this guide bro.. I am trying your second method, I am using V7.0.5.0.KXDMICI (MIUI7) (downloaded from official site)(for Mi3) rom as a port rom, but i noticed that there is no init.d folder in the etc folder, Am i selected the wrong rom to port? or there is another problem?
dineshkumareswaran said:
Thanks for giving this guide bro.. I am trying your second method, I am using V7.0.5.0.KXDMICI (MIUI7) (downloaded from official site)(for Mi3) rom as a port rom, but i noticed that there is no init.d folder in the etc folder, Am i selected the wrong rom to port? or there is another problem?
Click to expand...
Click to collapse
For which device are you porting? What is your base rom?(You can find it in build.prop) Explain in detail..Also if there's no init.d, it doesn't matter..Go ahead with further procedure..
STRYDER~007 said:
For which device are you porting? What is your base rom?(You can find it in build.prop) Explain in detail..Also if there's no init.d, it doesn't matter..Go ahead with further procedure..
Click to expand...
Click to collapse
I am trying it for xperia L, I am using nyx rom as my base rom(if you recommend any other i can go with it), I am noob in porting (i can't find init.d in build prop, i try further steps and inform you and thanks
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 !
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.
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
Code:
# 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
Code:
# 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
Code:
# 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:
Code:
# 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
Code:
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
Code:
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
Code:
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
Code:
start_copying_prebuilt_qcril_db
And this line at the end of file
Code:
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:
Code:
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
Special Thanks:
SuperR. for his great kitchen
osm0sis for amazing image tools script
iBotPeaches for apktool
@nijel8 for helium device tree
@Davehimself for helium vendor
@Ahmed Hady & @androidlover5842 my great friends & helpers
And me for typing this guide :good:
Reversed 1
Reversed 2
yshalsager said:
In my previous guide
Click to expand...
Click to collapse
Can u plz port sailfish os of kenzo for MiMAX hydrogen please?
https://forum.xda-developers.com/redmi-note-3/development/rom-sailfish-os-2-0-5-6-kenzo-t3571258/
afridi.shahriar said:
Can u plz port sailfish os of kenzo for MiMAX hydrogen please?
https://forum.xda-developers.com/redmi-note-3/development/rom-sailfish-os-2-0-5-6-kenzo-t3571258/
Click to expand...
Click to collapse
I think it can't be ported. Need to built from sources
yshalsager said:
I think it can't be ported. Need to built from sources
Click to expand...
Click to collapse
Then leave it
yshalsager said:
I think it can't be ported. Need to built from sources
Click to expand...
Click to collapse
Can u port nubia or funtouch os for kenzo or tell me name of device from which I can try to port these ui
Criston said:
Can u port nubia or funtouch os for kenzo or tell me name of device from which I can try to port these ui
Click to expand...
Click to collapse
I don't have kenzo, try with any MSM8956 device or MSM8976
What if rom does not contain some files in the system folder?
psbankar said:
What if rom does not contain some files in the system folder?
Click to expand...
Click to collapse
Forget it
yshalsager said:
I don't have kenzo, try with any MSM8956 device or MSM8976
Click to expand...
Click to collapse
Devices Based On MSM8976 Can Be used R U Sure though the difference is only core base
Criston said:
Devices Based On MSM8976 Can Be used R U Sure though the difference is only core base
Click to expand...
Click to collapse
Yes. As we can port from helium
can similarly kenzo roms can be ported to leeco le with sd652 ??
ankk98 said:
can similarly kenzo roms can be ported to leeco le with sd652 ??
Click to expand...
Click to collapse
yes
yshalsager said:
yes
Click to expand...
Click to collapse
i am a beginner
can u plz explain how this port can work? i mean both devices have different soc?
I want to try it by porting some oreo kenzo rom to leeco le 2 with msm8976
ankk98 said:
i am a beginner
can u plz explain how this port can work? i mean both devices have different soc?
I want to try it by porting some oreo kenzo rom to leeco le 2 with msm8976
Click to expand...
Click to collapse
Follow the guide and take files from your stock/working rom to kenzo rom
Part 3: Finalizing :
Now you've finished porting hydrogen ROM to helium, but you need to repack ROM into zip to be able to use it.
I dont get it, porting rom from hydrogen to helium?
raymondsanusi said:
Part 3: Finalizing :
Now you've finished porting hydrogen ROM to helium, but you need to repack ROM into zip to be able to use it.
I dont get it, porting rom from hydrogen to helium?
Click to expand...
Click to collapse
lol, sorry i was typo mistake
You can port from H2 to He but follow my another guide.
Is this guide can be used for porting Oreo roms?
Hello @yshalsager the file of hydrogen you have uploaded on GitHub are from which MIUI version?
The maximum and minimum cpu frequencies allow by the Kernel can be set to all the Android ROM ever made for the HP TOUCHPAD until now and forever!
This is apply as a native setting ( as shipped from the factory, we could say )
The ROM will not be modify, no need for ROOT access or install SuperSu or any Apps.
It can be done to an existing installed ROM, no need to re-flash, is safe and will not damage your installation or prevent you from using your TP. Even if you do not do it right, you will get your TP running as always.
This is only done in a Linux OS, I am using ubuntu, which it can also be run under a Virtual Machine in any other OS.
1. Get the boot.img from the zip ROM or the current uImage from the TP boot directory.
(The boot.img must be copy to the root/hpboot directory of the PC, not on the tablet)
2. Run each of this commands separately in terminal in the directory the boot.img is.
dumpimage -i boot.img kernel.uImage
dumpimage -i boot.img -p 1 ram
dd if=ram of=ramdisk.img.gz bs=64 skip=1
gunzip ramdisk.img.gz
mkdir ramdisk; cd ramdisk
cpio -i < ../ramdisk.img
3. Go to the ramdisk direcoty and open this file in a text editor:
init.tenderloin.power.rc
Copy and Paste under # CPU Scaling and # CPU boost the following:
Note: You can add different settings to each cpu0 or cpu1.
Different frequencies to each and also assigned different Governors to each cpu.
You have total and individual control.
# CPU Scaling
# Replace the numbers at the first two lines at the end with the frequencies your TP can handle.
# Replace the numbers at the last two lines at the end with the frequencies your TP can handle.
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 192000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 192000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1782000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq 1782000
# Configure Performance Governor
# This is optional, but it will speed boot time using both CPU at maximum frequencies.
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "performance"
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "performance"
# CPU boost
# Set your desire speed can not be higher than your maximum frequencies.
write /sys/module/cpu_boost/parameters/boost_ms 20
write /sys/module/cpu_boost/parameters/sync_threshold 1782000
write /sys/module/cpu_boost/parameters/input_boost_freq 1782000
You can configure the type of governor after the system finished booting on this line. Is all up to the Kernel and your choice, but interactive is good.
# Configure Interactive
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "interactive"
4. Save the changes and repack the ramdisk with kernel.
Open Terminal in the ramdisk folder and paste:
find . | cpio --create --format='newc' | gzip > ../ramdisk_Pack.img
5. Go to the folder where the original boot.img file is and you should have a file ( ramdisk_Pack.img )
Paste the following two commands:
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -n "TENDERLOIN MAX CPU" -d ./ramdisk_Pack.img ./ramdisk.uImage
mkimage -A arm -T multi -C none -n "Tenderloin Android MAX CPU" -d kernel.uImage:ramdisk.uImage uImage.Android_MAX_CPU
6. There is a file name uImage.Android_MAX_CPU in the same folder as your original boot.img, copy it to your TP boot directory and reboot.
If you enter a wrong frequency and it did not finished then do a hard reset and select the other boot image and use it as always. If it finished booting then you are running faster than ever!
To take in consideration:
The Kernel in the ROM has the frequencies that supports, most of the ROM comes with a top frequencies of 1782000. The SKZ kernel allows for a maximum frequency of 1890000.
The HP Touchpad where made with different suppliers of components. Due to this differences not all supports the same maximum frequencies. Very few can work under 1890000 or 18360000. But you can get lucky and have one. You should know and test the maximum speed that it will take, you can do that with Kernels apps before making modifications to the Boot Image, also the minimum frequencies are important as well.
The advantages of creating your own personal Maximum Speed Boot Image:
1 You will get faster boot time as the CPUs are set to work after the system starts the booting process and do not have to wait until the GUI starts and the Kernel app applies the settings.
2. Keep your ROM secure, no ROOT and no Super User, use it as is.
3. Less apps to install to take space and waste of Memory. Kernel apps and Super User have background services that are all time running just to give you the extra speed. Other apps can get the extra Ram for more processing.
4. There is more benefits of running the device at a higher frequency with no extra processing power, than have multiple apps to fine tune your CPU and governors but use resources.
View attachment 4613960
I don't know how to do with this, please help.
[email protected]:/mnt/g/devices/tenderloin/12.5.1/ramdisk$ find . | cpio –create –format=’newc’ | gzip > ../rak_Pack.img
cpio: You must specify one of -oipt options.
Try `cpio --help' or `cpio --usage' for more information.
Try 'cpio --help' or 'cpio --usage' for more information.
In this post I did a detail explanation on how to unpack the boot image.
https://forum.xda-developers.com/hp-touchpad/development/make-root-permanet-read-write-to-t3846567
Create a directory on root ( hpboot ) copy and paste the command on terminal as is on the post and it should work.
View attachment 4614596
[email protected]:/mnt/g/devices/tenderloin$ cd ./hpboot/
[email protected]:/mnt/g/devices/tenderloin/hpboot$ ls
boot.img
[email protected]:/mnt/g/devices/tenderloin/hpboot$ dumpimage -i boot.img kernel.uImage
[email protected]:/mnt/g/devices/tenderloin/hpboot$ dumpimage -i boot.img -p 1 ram
[email protected]:/mnt/g/devices/tenderloin/hpboot$ dd if=ram of=ramdisk.img.gz bs=64 skip=1
28781+1 records in
28781+1 records out
1842017 bytes (1.8 MB, 1.8 MiB) copied, 0.431285 s, 4.3 MB/s
[email protected]:/mnt/g/devices/tenderloin/hpboot$ gunzip ramdisk.img.gz
[email protected]:/mnt/g/devices/tenderloin/hpboot$ mkdir ramdisk; cd ramdisk
[email protected]:/mnt/g/devices/tenderloin/hpboot/ramdisk$ cpio -i < ../ramdisk.img
6819 blocks
[email protected]:/mnt/g/devices/tenderloin/hpboot/ramdisk$ find . | cpio –create –format=’newc’ | gzip > ../rakRW.img
cpio: You must specify one of -oipt options.
Try `cpio --help' or `cpio --usage' for more information.
Try 'cpio --help' or 'cpio --usage' for more information.
[email protected]:/mnt/g/devices/tenderloin/hpboot/ramdisk$
I did it due to https://forum.xda-developers.com/hp-...te-to-t3846567 , but it stuck just like last time I did it.
What does this mean?
cpio: You must specify one of -oipt options.
I can not see the picture you attached and the link does not work.
Are you doing all the commands inside a Linux machine?
zcarrt said:
--SNIP--
[email protected]:/mnt/g/devices/tenderloin/hpboot/ramdisk$ find . | cpio –create –format=’newc’ | gzip > ../rakRW.img
cpio: You must specify one of -oipt options.
Try `cpio --help' or `cpio --usage' for more information.
--SNIP--
Click to expand...
Click to collapse
It may be copied wrong. It should be: cpio --create -–format=’newc’ (not one dash but two, i.e. not -create, -format, but --create, --format)
The working path shows: [email protected]:/mnt/g/devices/tenderloin/hpboot$
I am not a Linux guru, but it look the boot.img is on the root of the tablet and not the PC.
The commands will only work properly if the directory is created in the root of the PC no where else.
((correction))
Yes, you are correct, is something about pasting a double dash that it turns into a hyphen (single dash). When editing the post it shows as intended, double dash. When publish, shows as a single dash, unless the font size is change on here and type again.
How I did it:
Enter the command in ubuntu terminal ( worked ) then copy and paste into LibreOffice Writer.
Write the guide, then copy and paste into the forum, to avoid any mistakes.
Then surprise ! a double dash is change to a hyphen and I am not even aware of it..!
Thanks for correcting!
HP_TOUCHPAD said:
The working path shows: [email protected]:/mnt/g/devices/tenderloin/hpboot$
I am not a Linux guru, but it look the boot.img is on the root of the tablet and not the PC.
The commands will only work properly if the directory is created in the root of the PC no where else.
Click to expand...
Click to collapse
I thought that, too, but there wouldn't be enough room for the dd command to work, and the error message wouldn't have been a cpio error.
my path:
[email protected]:~/hpboot$
There should not be any mounted device anywhere.
HP_TOUCHPAD said:
I can not see the picture you attached and the link does not work.
Are you doing all the commands inside a Linux machine?
Click to expand...
Click to collapse
I did it in windows 10 Ubuntu bash last time , I will try it properly in a Linux machine again. Thanks.
zcarrt said:
I did it in windows 10 Ubuntu bash last time , I will try it properly in a Linux machine again. Thanks.
Click to expand...
Click to collapse
The problem was on the formatting on my post. When I paste the guide for some reason it shows as a hyphen instead of a double dash.
I corrected the error. This is how it should be, also should work in the windows10 linux subsystem.
find . | cpio --create --format='newc' | gzip > ../ramdisk_Pack.img
Stuck on step 5.
Not clear where to "paste" the 2 lines. I "pasted" them in terminal but get the following:
Usage: mkimage -l image
-l ==> list image header information
mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
mkimage [-D dtc_options] [-f fit-image.its|-F] fit-image
-D => set all options for device tree compiler
-f => input filename for FIT source
Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)
mkimage -V ==> print version information and exit
Use -T to see a list of available image types
Any help please?
Thanks.
kojam said:
Stuck on step 5.
Not clear where to "paste" the 2 lines. I "pasted" them in terminal but get the following:
go to this post and run the script, if all work on your system then you have everything to build it.
https://forum.xda-developers.com/showpost.php?p=78028080&postcount=4
Click to expand...
Click to collapse
HP_TOUCHPAD said:
kojam said:
Stuck on step 5.
Not clear where to "paste" the 2 lines. I "pasted" them in terminal but get the following:
5. Go to the folder where the original boot.img file is and you should have a file ( ramdisk_Pack.img )
Paste the following two commands:
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -n “TENDERLOIN MAX CPU” -d ./ramdisk_Pack.img ./ramdisk.uImage
mkimage -A arm -T multi -C none -n “Tenderloin Android MAX CPU” -d kernel.uImage:ramdisk.uImage uImage.Android_MAX_CPU
go to this post and run the script, if all work on your system then you have everything to build it.
https://forum.xda-developers.com/showpost.php?p=78028080&postcount=4
Click to expand...
Click to collapse
Thanks for your reply.
I was in that folder (where ramdisk_Pack.img is) in terminal, then I entered/pasted those commands in terminal...
What am I doing wrong? Explain it to me like I'm 5yrs old please. LOL :laugh::silly:
Thanks a million!
Click to expand...
Click to collapse
kojam said:
HP_TOUCHPAD said:
Thanks for your reply.
I was in that folder (where ramdisk_Pack.img is) in terminal, then I entered/pasted those commands in terminal...
What am I doing wrong? Explain it to me like I'm 5yrs old please. LOL :laugh::silly:
Thanks a million!
Click to expand...
Click to collapse
My apologies, you did everything right. The error was in the command I posted which is now corrected.
This is how it happen:
I created the commands in ubuntu text editor, then wrote the instructions in LibreOffice Writer, then copy and paste everything to this forum. Then the apostrophe character got changed and that is why the command was not working.
I tested the commands one by one and I was able to finish the process, you should be able to do it also. This is a learning process and I thank you for trying it and finding out the errors.
Redo everything again as I also corrected the changes for the CPU speed.
Click to expand...
Click to collapse
HP_TOUCHPAD said:
kojam said:
My apologies, you did everything right. The error was in the command I posted which is now corrected.
This is how it happen:
I created the commands in ubuntu text editor, then wrote the instructions in LibreOffice Writer, then copy and paste everything to this forum. Then the apostrophe character got changed and that is why the command was not working.
I tested the commands one by one and I was able to finish the process, you should be able to do it also. This is a learning process and I thank you for trying it and finding out the errors.
Redo everything again as I also corrected the changes for the CPU speed.
Click to expand...
Click to collapse
Quite alright friend.
It is I who thanks you for this.
I was able to get create the file after following your update/corrected instructions.
Thanks again!
Click to expand...
Click to collapse
HP_TOUCHPAD said:
kojam said:
My apologies, you did everything right. The error was in the command I posted which is now corrected.
This is how it happen:
I created the commands in ubuntu text editor, then wrote the instructions in LibreOffice Writer, then copy and paste everything to this forum. Then the apostrophe character got changed and that is why the command was not working.
I tested the commands one by one and I was able to finish the process, you should be able to do it also. This is a learning process and I thank you for trying it and finding out the errors.
Redo everything again as I also corrected the changes for the CPU speed.
Click to expand...
Click to collapse
Thanks!
Worked!
Click to expand...
Click to collapse