Please, some tips about how compile kernel sources? :S - Xiaomi Redmi 3s Questions & Answers

Hey guys, I'm trying to compile and test the Xiaomi Redmi 3S kernel sources. I would like to know if someone could explain how we can compile it. Here I'm going to talk what steps I did and what result I got (bad bad xD).
I have to say that I'm a noob about ROM and kernel building, but I have some development skills.
Well, I followed this guide from Anik1199 (thanks!! ):
http://en.miui.com/thread-293285-1-1.html
After clone the git repository (of course, branch for "land" device) and compile the sources I had to do the following changes to fixes some errors:
Fixed some relative paths due a "no such file or directory" errors (about 5-6 files). At the moment I put my custom absoule path to see that I can compile
After that, I get this error
Code:
drivers/soc/qcom/subsystem_restart.c:1480:19: error: 'WT_SUBSYSTEM_REASTART_LEVEL' undeclared (first use in this function)
if (0 == strncmp(WT_SUBSYSTEM_REASTART_LEVEL, "SYSTEM", 6))
Following the instructions given by Anik1199 on this post:
http://en.miui.com/thread-293285-4-1.html
I fixed this error successfully . As he say, we have to define the WT_SUBSYSTEM_REASTART_LEVEL constant (by the way, it's a little strange the name right? "reastart" insted of "restart"? xD):
Code:
#define WT_SUBSYSTEM_REASTART_LEVEL "related"
After all this fixes the compilation process finished... but, instead to get "zImage" I get some files (in root_sources/arch/arm64/boot) with the following names:
Code:
drwxrwxrwx 1 ercea users 4096 ene 3 21:52 dts
-rwxrwxrwx 1 ercea users 28 ene 2 12:37 .gitignore
-rwxrwxrwx 1 ercea users 23465344 ene 3 22:00 Image
-rwxrwxrwx 1 ercea users 227 ene 3 22:00 .Image.cmd
-rwxrwxrwx 1 ercea users 9387806 ene 3 22:00 Image.gz
-rwxrwxrwx 1 ercea users 147 ene 3 22:00 .Image.gz.cmd
-rwxrwxrwx 1 ercea users 9387806 ene 3 22:00 Image.gz-dtb
-rwxrwxrwx 1 ercea users 145 ene 3 22:00 .Image.gz-dtb.cmd
-rwxrwxrwx 1 ercea users 1188 ene 2 12:37 install.sh
-rwxrwxrwx 1 ercea users 1243 ene 2 12:37 Makefile
"dts" is a folder, the rest are files. I don't know what is the kernel, "Image"? or "Image.gz"?
I assumed that the kernel file was "Image" (without extensions). So, following the guide, I can see that the next steps are:
Take my original/current boot.img. The ROM that I've installed is this modified MIUI version (based in beta 6.12.29):
https://forum.xda-developers.com/redmi-3/development/rom-redmi3-pro-ido-thunder-unofficial-t3435852
Unpack the boot.img file using mkbootimg
Rename my "Image" compiled file to "kernel"
Copy the renamed file "kernel" and paste inside the boot.img unpacked folder
Repack the folder to "boot.img"
After this process, I copy my original and compiled kernels in my phone and I restarted to recovery (TWRP). Then, I flashed my compiled kernel ("Install", then "Install Image", select my compiled kernel and select "boot" partition). When I restart my phone... I got bootloop :crying::crying::crying: Even I couldn't enter in Recovey/TWRP, I had to use my PC to flash again the TWRP recovery and enter it.
What am I doing wrong? The "Image" file is wrong and I have to get "Image.gz" file?. If someone could compile our Redmi 3s sources, please, could you explain how did you do it?
Sorry the big text (and my bad English), thanks in advantage
Cheers!

Please, anyone?
I think that my problem is unpacking and repacking the boot.img because if I unpack original boot.img and, without any modifications, repack the same boot folder, when I flash it, I get bootloop... I follow this instructions but I don't know what I'm doing wrong :
https://github.com/xiaolu/mkbootimg_tools
I tested packing boot.img with "Image", "Image.gz" and "Image.gz.-dtb" files (renamed to "kernel") without sucess :S. I don't know what to do....
Regards!

EDIT: Sorry double post :S

maybe you should ask personally to someone who know how to compile source code, like anik, zwliew, hriday etc. sorry for my bad english
Sent from my Redmi 3S using Tapatalk

Stuck
ercea said:
Please, anyone?
I think that my problem is unpacking and repacking the boot.img because if I unpack original boot.img and, without any modifications, repack the same boot folder, when I flash it, I get bootloop... I follow this instructions but I don't know what I'm doing wrong :
https://github.com/xiaolu/mkbootimg_tools
I tested packing boot.img with "Image", "Image.gz" and "Image.gz.-dtb" files (renamed to "kernel") without sucess :S. I don't know what to do....
Regards!
Click to expand...
Click to collapse
I am stuck on the same place as you're. But I tried it on Lineage OS and the one I compiled back using everything stock(no change of kernel) worked fine. So I think the problem isn't unpacking or repacking. There's something in the kernel.

ercea said:
Please, anyone?
I think that my problem is unpacking and repacking the boot.img because if I unpack original boot.img and, without any modifications, repack the same boot folder, when I flash it, I get bootloop... I follow this instructions but I don't know what I'm doing wrong :
https://github.com/xiaolu/mkbootimg_tools
I tested packing boot.img with "Image", "Image.gz" and "Image.gz.-dtb" files (renamed to "kernel") without sucess :S. I don't know what to do....
Regards!
Click to expand...
Click to collapse
@ercea
So I tweaked around a little bit and found out that the one we are gonna use to boot is Image.gz-dtb. But in our case the dtb(s) are not built itself by the kernel(i am still searching why). So I used spilt-append-tool and extracted dtb(s) from the unpacked kernel and pasted them in arch/arm64/boot/dts. I know this doesn't mean anything but still makes the kernel boot.
Edit : After a little more messing I found out that the dtb(s) required to make the booting kernel reside in arch/arm64/boot/dts/qcom. So I made a script that copies all the dtb(s) to arch/arm64/boot/dts.
And it is working.

aweosomeabhijeet said:
@ercea
So I tweaked around a little bit and found out that the one we are gonna use to boot is Image.gz-dtb. But in our case the dtb(s) are not built itself by the kernel(i am still searching why). So I used spilt-append-tool and extracted dtb(s) from the unpacked kernel and pasted them in arch/arm64/boot/dts. I know this doesn't mean anything but still makes the kernel boot.
Edit : After a little more messing I found out that the dtb(s) required to make the booting kernel reside in arch/arm64/boot/dts/qcom. So I made a script that copies all the dtb(s) to arch/arm64/boot/dts.
And it is working.
Click to expand...
Click to collapse
Wow!! Thank you! I will try it after work, I abandoned it after a few tests without success (and I very noob for fix this kind of problems xD). I will check your tips and tell if it works for me (I'm sure that yes ).
Regards and thanks again for your help!

Related

[DEV] Kernel Compiling

Hi all! I'm not a dev but i really want to do something for this phone so i'm trying to build a custom kernel.... if anyone have tried the same report here the issue, i will do the same!
I have the pre-requisites for compiling a kernel set up. However I am more interested in getting ClockworkMod Recovery working on our phone as that will encourage developers and we can then start looking at getting CyanogenMod 7. I made a topic here asking for help but I haven't received any replies yet.
I have just compiled a kernel but it doesn't work.... this because - i think - i used the initramfs provided by leshak for the i9000.... now i'm trying to extract from phone......
Kernel
Hi Skin1980, I also compiled a (stock) Kernel two weeks ago - problem is, Samsung does not use the "normal" way of storing it in a boot.img file. That is why I wasn't able to push it to the phone or at least fastboot it. I would be glad to hear from you how exactly this is possible, if you find out.
XDA_Bam said:
Hi Skin1980, I also compiled a (stock) Kernel two weeks ago - problem is, Samsung does not use the "normal" way of storing it in a boot.img file. That is why I wasn't able to push it to the phone or at least fastboot it. I would be glad to hear from you how exactly this is possible, if you find out.
Click to expand...
Click to collapse
I used the redbend_ua you can find here to write zImage to bml7.... how do you do with initramfs that is missed when you build the kernel?
Skin1980 said:
I used the redbend_ua you can find here to write zImage to bml7.... how do you do with initramfs that is missed when you build the kernel?
Click to expand...
Click to collapse
Have you managed to extract initramfs with redbend_ua?
If you don't mind, please take a look at this post. There is a step build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img. Because Samsung doesn't use this boot.img building a recovery looks tricky. Any suggestions would help.
rb210 said:
Have you managed to extract initramfs with redbend_ua?
If you don't mind, please take a look at this post. There is a step build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img. Because Samsung doesn't use this boot.img building a recovery looks tricky. Any suggestions would help.
Click to expand...
Click to collapse
I dumped the bml7 partition, i see that inside there's a zimage... but i'm not able to extract this f u c .......initramfs!!!!!
rb210 said:
Have you managed to extract initramfs with redbend_ua?
If you don't mind, please take a look at this post. There is a step build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img. Because Samsung doesn't use this boot.img building a recovery looks tricky. Any suggestions would help.
Click to expand...
Click to collapse
and if we can find the initramfs i think that is not difficult to modify the recovery to allow unsigned zip files installation
Perhaps, we could use parts of the following method:
h**p://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images
To extract the ramdisk from the boot.img, they do the following:
Then, look for a bunch of zeroes followed by the hex 1F 8B (which is the magic number of a gzip file). Copy everything from the first line of the file, through the zeroes, and stopping at the 1F 8B. That is the kernel. Everything from the 1F 8B through the end is the ramdisk. You could save each of these files separately. In order to see the contents of the ramdisk, you need to un-gzip it and then un-cpio it.
Click to expand...
Click to collapse
I know that we don't have a boot.img, but we do have an image including kernel and ramdisk - this should be very similar. And if you can locate the named headers in the file, the extraction should work. Further info and some useful commands can be found behind the link.
Sadly, I won't have time to try this before next weekend...
XDA_Bam said:
Perhaps, we could use parts of the following method:
h**p://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images
To extract the ramdisk from the boot.img, they do the following:
I know that we don't have a boot.img, but we do have an image including kernel and ramdisk - this should be very similar. And if you can locate the named headers in the file, the extraction should work. Further info and some useful commands can be found behind the link.
Sadly, I won't have time to try this before next weekend...
Click to expand...
Click to collapse
Which file are you referring to? I have some time, I can give it a shot.
EDIT: I found "initramfs.c" and its object file "initramfs.o" under GT-I9003_Kernel/kernel/Kernel/init from the Samsung opensource tarball. Don't think that helps us though.
@rb210: I mean the dumped bml7 partition. It's an image of a partition with a kernel and ramdisk in it, or did I misunderstand something?
PS: You could try "SGS kernel flasher" from the market. It's got a backup option - look if it does produce the same image of the bml7 partition (I tried it, it did a backup image of around 8MB on my SGSL, which is about the size of bml7, as far as I remember). It would be faster and easier to carry out than using a script.
XDA_Bam said:
@rb210: I mean the dumped bml7 partition. It's an image of a partition with a kernel and ramdisk in it, or did I misunderstand something?
PS: You could try "SGS kernel flasher" from the market. It's got a backup option - look if it does produce the same image of the bml7 partition (I tried it, it did a backup image of around 8MB on my SGSL, which is about the size of bml7, as far as I remember). It would be faster and easier to carry out than using a script.
Click to expand...
Click to collapse
But ramdisk=initramfs?
XDA_Bam said:
@rb210: I mean the dumped bml7 partition. It's an image of a partition with a kernel and ramdisk in it, or did I misunderstand something?
PS: You could try "SGS kernel flasher" from the market. It's got a backup option - look if it does produce the same image of the bml7 partition (I tried it, it did a backup image of around 8MB on my SGSL, which is about the size of bml7, as far as I remember). It would be faster and easier to carry out than using a script.
Click to expand...
Click to collapse
Ah I see what you mean. I was trying to figure out how to extract the initramfs from the opensource package from the Samsung website. I figure if they're providing the kernel and platform, there's got to be an initramfs somewhere. You'll are talking about trying to extract it from inside the phone itself.
I'm still not sure how this is going to fit in with porting Clockworkmod as per that method in the blog post because it's still an initramfs and not a boot.img. Getting custom recovery is vital to attracting development for this phone, we should not make the mistake of overlooking this.
Tools for extract initramfs from a zImage : https://github.com/project-voodoo/kernel_repack_utils

[GUIDE] All you need to know about the ramdisk of the kernel

WHAT'S IN THE RAMDISK
So anyone who has compiled a kernel (for the X8) or is about to step into the world of developing android awesomeness through kernel building, should know that there are 2 (two) parts to the kernel:
The kernel image compiled from source code, and
The ramdisk
Both are equally important and are inter-dependent; without the kernel, the ramdisk is nothing (unless of course the devs come up with any other use) and without the ramdisk, the kernel is incomplete (again, this may change in the near future).
You (XDA-ians as I like to call you guys), especially those in the X8 sub-forums must have read viper001's kernel building guide. If you haven't, and do not want to read just 4 posts because of your laziness, it tells you how to compile your kernel image. Hah, now you are almost dying to read it. Well go ahead, read it.
Done reading. Well if you followed that guide to the letter (which I am sure many of you haven't), you'll have compiled your kernel with the FXP ramdisk. Now you want to build it from another source. It's pretty much the same process. However the FXP ramdisk won't work with this kernel. Not a chance (maybe a little). You need the ramdisk so you unpack the kernel using DooMLorD's tool (and forget to thank him; go thank him right now) and see a folder named kernel.sin-unpacked. You open it and see a bunch of files that you've never even heard of. You drop the kernel-building project.
This guide will hopefully eradicate that fear, or ignorance (maybe), and cover up what's in the ramdisk.
The parent (or root) directory of the ramdisk folder itself contains a bunch of files and folsers, which also contain more files.
Let's look at the contents in the root directory:
1 “modules” folder – This one is pretty easy. It contains the kernel specific modules that are loaded up at boot.
2 “res” folder – This folder contains another folder named “images” which contains images to be used in the recovery (more on that later).
3 “sbin” folder – Inside this folder are about 200 files (may vary), most of which are responsible for basic functioning of the phone.
4 default.prop – This file contains only a few lines of code that allow adb to run (line 4) and also makes the kernel insecure to give us permanent root.
5 init – This program initializes elements of the android OS and looks at the two following files:
6 init.rc – This file contains generic initialization code
7 init.<machine_name>.rc – This file contains device-specific initialization code.
8 initlogo.rle – This is the bootlogo (not the bootanimation which comes with the ROM).
9 pre_hw_config.sh – This file is executed at boot to get settings like cpu freq and governors just right.
10 recovery.fstab – This file specifies how the different partitions and file systems are to be mounted.
11 ueventd.rc – This file sets user or group (or root?) permissions on /dev nodes. (I got this line from the Internet and have no idea myself what the hell this means o_0).
12 ueventd.goldfish.rc – This file is empty in our kernels. Dunno why, though.
Now for the files in the /res/images directory:
1 icon_clockwork.png – This is the background seen in CWM.
2 icon_error.png and icon_firmware_error.png – These images are displayed on the screen when there is an error. Not sure though as I have never encountered any such error before in my life.
3 icon_firmware_install.png and icon_installing.png – These images are displayed when installing anything via CWM.
4 indeterminateX.png (where X is a number from 1 to 6, both inclusive) – This is basically the animation of the progress bar (the grey stripes moving forwards, or backwards, or both).
5 progress_empty.png – This is the progress bar during the initial stages of flashing anything in CWM.
6 progress_fill.png – This is the progress bar fill.
These are the files in the /modules folder:
1 sdio.ko – This is a file related to WiFi.
2 tiwlan_drv.ko – This is the tiwlan WiFi driver module.
3 tiap_drv.ko – This is the tiap WiFi driver module.
4 x8uv.ko – This is the undervolting module.
5 synaptics_i2c_rmi4_no_dt.ko – This disables dual touch in Synaptics.
6 synaptics_i2c_rmi4_dt.ko – This enables dual touch in Synaptics.
NOTE: I am not an expert.
More to come soon. See you and I hope sincerely that I do not get banned for this.
THE DREADED SBIN DIRECTORY
Going into the /sbin directory, we see a lot of files, the names of each sending shivers down your spine. But fear not, for sgt. meow will help you understand the functions of some important ones:
1. adbd – The file that allows you to use the adb shell. “adbd” stands for “Android Debugging Bridge Daemon”.
2. bootlogo – This file starts the kernel bootlogo (according to some user on the androidcentral forum; just saw a snippet on google search, opened the page and there was no thread).
3. bootrec – This file basically tells a kernel how to boot up a recovery
4. busybox – It lets you run LINUX / UNIX based commands (ls, gzip, uname etc.) that are required for root-level tasks.
5. dmesg – It is the Linux kernel's own logging system and is similar to logcat.
6. fix_permissions – This file applies and fixes permissions on the Android data folders.
7. insmod – This file is basically what is executed when you type insmod /..../../../../ xxx.ko (or similar) to load up the modules. An alternative way to do this is to write the line in hw_config.sh of /system folder (I guess) to load up modules at every boot. Or you could place the modules in the /modules directory of the kernel.
8. killrecovery.sh – This file, as the name suggests, kills the recovery when you exit it and boots into Android.
9. nandroid – The file responsible for nandroid backups.
10. nandroid-md5.sh – This file generates MD5 checksums for nandroid backups to verify its integrity.
11. reboot – This file reboots the phone when prompted to.
12. recovery – This is the recovery binary. For our devices, it is CWM recovery. This file can be changed easily (what I did with oxydo ICS) to other recoveries for this device for that version of Android.
Most of the other files are LINUX / UNIX based commands and some are files the functions of which cannot be explained by me.
More to come soon. Hope you enjoyed it so far.
FILES YOU CAN EASILY EDIT IN THE RAMDISK
There are some files in the ramdisk that can be edited pretty easily. There are also other files editing which means you gotta be RD or gotta have similar talent. Let's not go into that for now. The easy ones are:
1. initlogo.rle - The file that is easiest to edit. Basically you can convert any image to .rle format and replace it. make sure it is the right resolution.
2. /sbin/recovery - You can use recovery from another kernel (for the same Android version)and replace it in yours. You can also compile your own recovery binary by issuing the make recovery command after a successful CM build.
3./sbin/bootrec - You may have to change this when you change the recovery. Just a simple copy paste, that's all.
4. /sbin/rec_input - This file may need changing too when you change recovery.
5. /res/images/.. - Every .png file in this directory can be easily changed to any other .png file. Just make sure the resolutions are right, or else you will not be able to navigate properly in recovery.
6. init.rc - This file is easily changeable but you need to know what you are doing, otherwise you may mess up the boot sequence.
You can have a shot at changing other files, too. Lemme know how it goes.
CREDITS:
1. Allah Almighty (yes I'm a Muslim)
2. All XDA-ians, especially those in the X8 sub-forum for help (and for pressing thanks)
3. The Internet (Google, Wikipedia and Github mostly) for info
4. Me, for spending hours behind this guide.
5. My family, for not disturbing me while I was doing this. LOL
thank you
that is what i'm trying to understand :good:
This is for sure a valuable thread. Thanks for this!!
Sent With My Brains To Yours. Duh.
Nice thread , Captain Meow Meow
Sent from my X8 using xda app-developers app
sbin will take some time to cover but i will try my best.
sgt. meow said:
sbin will take some time to cover but i will try my best.
Click to expand...
Click to collapse
Its good to see that you are working hard...
Keep it up
great thread.thanks
sent from my x8™ using gingerzaraki®
THREAD UPDATED WITH SBIN CONTENTS. OMG. :wink:
Dude, you should make an *updated* Kernel Building Guide with new sources (i.e. alfs kernel or nAa kernel). Old one still uses FXP kernel source and outdated toolchain instead of Linaro.
RohinZaraki said:
Dude, you should make an *updated* Kernel Building Guide with new sources (i.e. alfs kernel or nAa kernel). Old one still uses FXP kernel source and outdated toolchain instead of Linaro.
Click to expand...
Click to collapse
And link to your sources as an example for others..
Banned? And why? This is usefull =))
Sent from my E15i using xda premium
@Rohin
yeah I might
@Elmir
that was a joke
@all
THREAD UPDATED WITH FILES THAT CAN BE EDITED AND CREDITS. :BIG GRIN:

[Tutorial] Add TWRP to AOSP LP 5.0 boot.img

I've updated the boot.img for paxb build 504 with TWRP to replace CWM. Some were asking how to do this.
Always keep a backup of a file known as working. If your device doesn't boot after flashing a modified file, just reflash that backup.
To perform this mod on your own follow these steps:
1. Download and unpack the Android Image Kitchen
2. Extract the boot.img from the downloaded ROM to the kitchen directory
3. Unpack the image:
Code:
unpackimg.bat boot_cwm_pabx_504.img
Output:
Code:
Android Image Kitchen - UnpackImg Script by osm0sis @ xda-developers
Supplied image: boot_cwm_pabx_504.img
Removing old work folders and files . . .
Setting up work folders . . .
Splitting image to "/split_img/" . . .
BOARD_KERNEL_CMDLINE androidboot.hardware=sony user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=400M
BOARD_KERNEL_BASE 80200000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02000000
BOARD_TAGS_OFFSET 00000100
Unpacking ramdisk to "/ramdisk/" . . .
Compression used: gzip
9694 blocks
Done!
This process will overwrite previously extracted contents!!!
4. Create a directory for the original image content, e.g. "boot_cwm_pabx_504" and COPY the created directories "ramdisk" and "split_img" into it. This ensures you can recreate it if necessary or access its original contents
5. Repeat step 4 for a downloaded TWRP (or any other recovery) image, e.g. "openrecovery-twrp-2.8.0.1-yuga.img".
6. Locate the "*-ramdisk.cpio.gz" file in the dirs from step 5, most likely in "split_img".
7. Ensure the "ramdisk" and "split_img" directories in the kitchen root dir are those from the image you want to modify (i.e. copy back from the folder created in step 4. Then remove the "*.cpio" from the "ramdisk\recovery" directory
8. Extract the TWRP "*.cpio" file from the "*-ramdisk.cpio.gz" in step 6 to "ramdisk\recovery" and rename it to "ramdisk-recovery.cpio"
9. rebuilt the image with the updated content:
Code:
repackimg.bat
Output:
Code:
Android Image Kitchen - RepackImg Script
by osm0sis @ xda-developers
Packing ramdisk . . .
Using compression: gzip
Getting build information . . .
kernel = boot_cwm_pabx_504.img-zImage
cmdline = androidboot.hardware=sony user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=400M
board =
base = 80200000
pagesize = 2048
kernel_offset = 00008000
ramdisk_offset = 02000000
tags_offset = 00000100
Building image . . .
10. Step 9 creates a file called "image-new.img". Rename it to something more self-explanatory, i.e. "boot_twrp_2.8.0.1_pabx_504.img"
11. To flash the file flash it like any other file using the new name:
Code:
adb reboot bootloader
fastboot flash boot boot_twrp_2.8.0.1_pabx_504.img
fastboot reboot
That's it, enjoy your new recovery.
Note: I had issues getting TWRP 2.8.1.0 working, so I'm still using the predecessor 2.8.0.1.
The latest pabx "boot.img" modified with TWRP is attached.
Known issues
after restoring a Nandroid backup access to the internal storage isn't allowed anymore
Open a terminal or run through a adb shell:
Code:
restorecon -FR /data/media/0
Thank works dobře.TWRP I like long ....
cant understand what you mean in step 7 and 8..... i just unpacked boot.img (the img that i want to put a recovery on it) and then i created a folder and i copied split_img and ramdisk into it.....then i unpacked twrp.img and it replaced the previous split_img and ramdisk folders with the twrp ones..... i still have the folder i created with the original split_img and ramdisk folders from boot.img but i can understand what to do next....
well, sorry for that,...i think i got it now that i read it about 20 times..... one question though :
i copy ramdisk.cpio.gz from the twrp and i move it to the recovery folder of the boot img without extracting? just renaming it from ramdisk.cpio.gz to ramdisk-recovery.cpio ???
arismelachrinos said:
cant understand what you mean in step 7 and 8..... i just unpacked boot.img (the img that i want to put a recovery on it) and then i created a folder and i copied split_img and ramdisk into it.....then i unpacked twrp.img and it replaced the previous split_img and ramdisk folders with the twrp ones..... i still have the folder i created with the original split_img and ramdisk folders from boot.img but i can understand what to do next....
well, sorry for that,...i think i got it now that i read it about 20 times..... one question though :
i copy ramdisk.cpio.gz from the twrp and i move it to the recovery folder of the boot img without extracting? just renaming it from ramdisk.cpio.gz to ramdisk-recovery.cpio ???
Click to expand...
Click to collapse
Yeah I didn't fully understand that either, but i just tried it.
You delete ramdisk-recovery.cpio from /ramdisk.
You extract ramdisk.cpio.gz to the /ramdisk folder.
You rename it to ramdisk-recovery.cpio.
Repack image.
(note that when the kernel you use is already a dualrecovery kernel -lightning for example, cwm philz+twrp- and u want it to be multirom twrp, u need to edit init.sh also found in /ramdisk folder somewhere)
BTW thanks for this guide! I was messing with this a few days ago and I couldn't get it to work, thanks to you I now understand why!:thumbup:
I tried to put latest twrp into latest boot.IMG of Thomas lollipop 23/11/14 build and I thought it worked but I press volume up and down to enter the recovery and it does nothing....it doesn't boot,it just freezes with the led lighting.... please help I really want twrp to work with lollipop
arismelachrinos said:
I tried to put latest twrp into latest boot.IMG of Thomas lollipop 23/11/14 build and I thought it worked but I press volume up and down to enter the recovery and it does nothing....it doesn't boot,it just freezes with the led lighting.... please help I really want twrp to work with lollipop
Click to expand...
Click to collapse
Reread what I wrote.
You probably didn't extract ramdisk.cpio.gz, or you putted it into /split_img I think. Cuz I had that too, but if you follow the exact steps it will work!
no I did exactly what you said... I fully understood the instructions,I extracted it , I named it right and I moved it right... well, I will try again tomorrow but I don't think it will boot into it... Thomas boot.img has a cwm recovery ,does this have smthg to do with it?
arismelachrinos said:
no I did exactly what you said... I fully understood the instructions,I extracted it , I named it right and I moved it right... well, I will try again tomorrow but I don't think it will boot into it... Thomas boot.img has a cwm recovery ,does this have smthg to do with it?
Click to expand...
Click to collapse
What version of TWRP did you use? 2.8.1.0 will likely not work, use an older one instead.
arismelachrinos said:
cant understand what you mean in step 7 and 8..... i just unpacked boot.img (the img that i want to put a recovery on it) and then i created a folder and i copied split_img and ramdisk into it.....then i unpacked twrp.img and it replaced the previous split_img and ramdisk folders with the twrp ones..... i still have the folder i created with the original split_img and ramdisk folders from boot.img but i can understand what to do next....
well, sorry for that,...i think i got it now that i read it about 20 times..... one question though :
i copy ramdisk.cpio.gz from the twrp and i move it to the recovery folder of the boot img without extracting? just renaming it from ramdisk.cpio.gz to ramdisk-recovery.cpio ???
Click to expand...
Click to collapse
Adjusted the description of step 8, should be more clear now what to do.
I've also added a note to point out explicitly that each run of "unpackimg.bat" will overwrite existing data.
Thank you so much for the guide! Really appreciate it =D
mcfisch said:
What version of TWRP did you use? 2.8.1.0 will likely not work, use an older one instead.
Click to expand...
Click to collapse
I used the latest twrp...maybe that's why....I will try again and I will post here
thank you sooooo much.... i did it with the second try...the only thing i changed was that i downoaded a previous version of twrp because it wont work with the latest one...thanks a lot.... what about cwm? is it the same proccess?
CWM is included already. But you could split the latest cm boot.img and grab ramdisk-recovery.cpio from ramdisk/sbin to get the most up to date version
is this mean can add TWRP into .FTF files ?
that will be awesome
Can anyone share their twrp included boot.img for the latest thomas release?
i tried to do this on the cm12 expirimental build and the boot.img of that zip doesnt have a recovery folder inside ramdisk folder... i did create one just to see if it works and it didnt
arismelachrinos said:
i tried to do this on the cm12 expirimental build and the boot.img of that zip doesnt have a recovery folder inside ramdisk folder... i did create one just to see if it works and it didnt
Click to expand...
Click to collapse
Look for a *.cpio or *.cpio.gz file and replace that accordingly. The place doesn't really matter for you, the ROM knows where to find it. CM might expect it respectively at another place. Will take a look later if I can find something...
mcfisch said:
Look for a *.cpio or *.cpio.gz file and replace that accordingly. The place doesn't really matter for you, the ROM knows where to find it. CM might expect it respectively at another place. Will take a look later if I can find something...
Click to expand...
Click to collapse
can you please take look at this?because i did search all the ramdisk folder and i found nothing.... i uploaded the boot.img so that you dont have to download the rom zip
https://www.mediafire.com/?5d6swrdegr53iel
mcfisch said:
Look for a *.cpio or *.cpio.gz file and replace that accordingly. The place doesn't really matter for you, the ROM knows where to find it. CM might expect it respectively at another place. Will take a look later if I can find something...
Click to expand...
Click to collapse
Won't work like that. Needs a script to be inserted into the ramdisk, @pabx style, plus the recovery folder with ramdisk-recovery.cpio inside.
was thinking why the latest TWRP was not working, then realized that the TWRP is written to be loaded into the FotaKernal.
then it worked with TWRP flashed into FotaKernal.
have pabx_aosp_yuga-509 installed
1. Followed your steps exactly to create a new boot_pabx_aosp_yuga-509.img (with the latest TWRP image "recovery-twrp-2.8.4.1-yuga.img").
2. Flashed recovery-twrp-2.8.4.1-yuga.img into the FotaKernal.
3. Flashed the new boot_pabx_aosp_yuga-509.img
it works
Edit: On my Xperia Z c6002 (yuga)

Root Redmi Note 3 (SD) with GLOBAL build ! Fully working on 7.1.8.0 with TWRP!

Hello Everyone,
I've shown the complete procedure in above video, you can follow that else guide is down below too!
Unlocked bootloader is must in order to do this! If you do not have unlocked bootlaoder then here is How to Unlock bootloader-
Here are the steps-
Download these files
ADB folder- https://goo.gl/BYCvea
TWRP recovery- https://goo.gl/XfrRUY
Modified boot image - https://goo.gl/E5pGDw
[The above boot image is only for 7.1.8.0]
Do not flash this if you are not on 7.1.8.0, it will result in loss of wifi or device not booting! {:4_98:}
Huge thanks to @TheStrix from XDA for making the modified boot image! {:4_106:}
1- Boot into Fastboot mode by switching off your device & then holding Power button & Voume - button simultaneously!
2- Flash the modified boot image by using this command- " fastboot flash boot boot.img "
3- Flash TWRP recovery by using this command - " fastboot flash recovery twrp.img "
4- Now boot into TWRp recovery by pressing volume + button & power button together until you see Mi Logo!
5- Now select Install > Select SuperSU zip file > Swipe to install
6- Now hit Reboot System!
You have successfully Rooted your Redmi Note 3 PRO! Enjoy ROOT access now {:m018:}
Your Feedback will be most appreciated
I'll post the updates of boot image file in the description box so kindly keep checking that video if you do not see updates here!
Duplicated in thread here
http://forum.xda-developers.com/showthread.php?t=3341102
Please as of xda forum rules .please dont make thread if things that already posted.thanks
Not a duplicate thread as the thread you mentioned does not have modified boot images of Global build! I appreciate your work but you have not added modified boot images separately
If you dont know then, modified boot image will be different for China stable, developer, Global build ! @Perfectdevil
What exactly do the patched boot change?
Hit me with the juicy tech information please.
MrColdbird said:
What exactly do the patched boot change?
Hit me with the juicy tech information please.
Click to expand...
Click to collapse
boot.img contains the linux kernel and the ramdisk, while the default.prop in ramdisk can enable/disable the adb root permission. following is the default.prop contents for a droid product device:
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
droid product device with above default.prop has no adb root permissions if the device is not hacked. the default.prop with the following contents has the adb root permissions by default:
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=1
persist.service.adb.enable=1
to create a boot.img with such default.prop, here is the steps:
split the boot.img: split_bootimg.pl boot.img, after running the command, two files are generated: boot.img-kernel and boot.img-ramdisk.gz.
create a temp folder (e.g. ramdisk), change to that folder, run the following command to extract the boot.img-ramdisk.gz: cat ../boot.img-ramdisk.gz | gzip -d | cpio -idm.
make the changes to the ramdisk file system in ramdisk folder, e.g. change the default.prop file to get adb root permissions.
return the parent folder, and run the following command to recreate the ramdisk package: mkbootfs ./ramdisk | gzip > ramdisk-new.gz
recreate the boot image: mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img
done. flash the boot-new.img to the device with fastboot.
---------- Post added at 00:38 ---------- Previous post was at 00:23 ----------
TheDj408 said:
Not a duplicate thread as the thread you mentioned does not have modified boot images of Global build! I appreciate your work but you have not added modified boot images separately
If you dont know then, modified boot image will be different for China stable, developer, Global build ! @Perfectdevil
Click to expand...
Click to collapse
updated my thread wiith a NEW toolkit ALL IN ONE to root,TWRP,CRCKED BOOT.IMG for every version of MIUI.check it out
Perfectdevil said:
boot.img contains the linux kernel and the ramdisk, while the default.prop in ramdisk can enable/disable the adb root permission. following is the default.prop contents for a droid product device:
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
droid product device with above default.prop has no adb root permissions if the device is not hacked. the default.prop with the following contents has the adb root permissions by default:
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=1
persist.service.adb.enable=1
to create a boot.img with such default.prop, here is the steps:
split the boot.img: split_bootimg.pl boot.img, after running the command, two files are generated: boot.img-kernel and boot.img-ramdisk.gz.
create a temp folder (e.g. ramdisk), change to that folder, run the following command to extract the boot.img-ramdisk.gz: cat ../boot.img-ramdisk.gz | gzip -d | cpio -idm.
make the changes to the ramdisk file system in ramdisk folder, e.g. change the default.prop file to get adb root permissions.
return the parent folder, and run the following command to recreate the ramdisk package: mkbootfs ./ramdisk | gzip > ramdisk-new.gz
recreate the boot image: mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img
done. flash the boot-new.img to the device with fastboot.
---------- Post added at 00:38 ---------- Previous post was at 00:23 ----------
updated my thread wiith a NEW toolkit ALL IN ONE to root,TWRP,CRCKED BOOT.IMG for every version of MIUI.check it out
Click to expand...
Click to collapse
Essentially you just enabled unsecure and auto-enabled adb so that we can adb reboot edl in case of error.
Alright, I saw as much, just wondered if there was anything else that slipped past me.
Unlocked bootloader is must in order to do this! If you do not have unlocked bootlaoder then here is How to Unlock bootloader-
Here are the steps-
Download these files
ADB folder- https://goo.gl/BYCvea
TWRP recovery- https://goo.gl/XfrRUY
Modified boot image - https://goo.gl/E5pGDw
[The above boot image is only for 7.1.8.0]
Do not flash this if you are not on 7.1.8.0, it will result in loss of wifi or device not booting!
i am on Global 7.1.8.0 how to unlock bootloader for Global 7.1.8.0 as it is not supported by mi flash unlock tool
a sharma
sharing is power
asharma7 said:
i am on Global 7.1.8.0 how to unlock bootloader for Global 7.1.8.0 as it is not supported by mi flash unlock tool
a sharma
sharing is power
Click to expand...
Click to collapse
DEVELOPER ROM is a must to unlock bootloader
Perfectdevil said:
DEVELOPER ROM is a must to unlock bootloader
Click to expand...
Click to collapse
I myself unlocked on Chinese stable ROM!
TheDj408 said:
I myself unlocked on Chinese stable ROM!
Click to expand...
Click to collapse
here topic title says--Root Redmi Note 3 (SD) with GLOBAL build ! Fully working on 7.1.8.0 with TWRP!
perhaps its need updation
a sharma
sharing is power
---------- Post added at 05:15 PM ---------- Previous post was at 05:14 PM ----------
Perfectdevil said:
DEVELOPER ROM is a must to unlock bootloader
Click to expand...
Click to collapse
here topic title says--Root Redmi Note 3 (SD) with GLOBAL build ! Fully working on 7.1.8.0 with TWRP!
perhaps its need updation
a sharma
sharing is power
I'm in the global 7.1.8 and stopped working my wifi
Good job
Thanks! its working fine!
I'm the only one that this method will not work the wifi?
can we unlock bootloader on global 7.1.8 ? is is not required to flash china dev rom to unlock the bootloader ?
djixon said:
I'm in the global 7.1.8 and stopped working my wifi
Click to expand...
Click to collapse
I'm too" T_T
!!! WIFI Stopped Working !!!
My wifi is not working when using this boot.img file.....i have tried making one myself using Android Image Kitchen Tool....but that also didnt work.....I am using the snapdragon variant.....Help me as soon as possible.
bootloop any solution to recover
Download link for patched boot image
Guys, anyone can give the link of the mentioned patched boot.img. File is deleted from the Google drive location. Pls pls pls...........

[TOOLS] Necessary tools for building the Pixel 2 (XL) Kernel

THIS IS NOT A "HOW TO BUILD A KERNEL" POST
The Pixel 2, unlike other phones I've worked with, requires two extra tools: dtc (Device Tree Compiler) and mkdtimg.
Yes, dtc is available in the main repos for most linux distros, but the Pixel 2 kernel requires the AOSP modified version of dtc.
First, grab the Pixel 2 + XL Unified kernel source (wahoo) from https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-oreo-dr1
Then download wahoo-kernel-tools.zip file attatched to this post and unzip it. Make sure that the 2 files in the bin folder are available in your path (possibly by moving them to ~/bin) and symlink or move the libc++.so into an included library directory, such as /lib, /usr/lib, or /usr/local/lib.
These specific binaries were compiled on Arch Linux by me, so they may not work on every system. To build binaries compatible with your system, sync any android oreo source (AOSP, Lineage, Carbon, etc.) and run "make dtc mkdtimage -jX" instead of "make bacon" or your normal command. The binaries will be located in out/host/linux-x86/.
This is tested and working with the stock google 4.9 toolchain and the initial source as of Oct 23rd, 2017.
frap129 said:
THIS IS NOT A "HOW TO BUILD A KERNEL" POST
The Pixel 2, unlike other phones I've worked with, requires two extra tools: dtc (Device Tree Compiler) and mkdtimg.
Yes, dtc is available in the main repos for most linux distros, but the Pixel 2 kernel requires the AOSP modified version of dtc.
First, grab the Pixel 2 + XL Unified kernel source (wahoo) from https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-oreo-dr1
Then download wahoo-kernel-tools.zip file attatched to this post and unzip it. Make sure that the 2 files in the bin folder are available in your path (possibly by moving them to ~/bin) and symlink or move the libc++.so into an included library directory, such as /lib, /usr/lib, or /usr/local/lib.
These specific binaries were compiled on Arch Linux by me, so they may not work on every system. To build binaries compatible with your system, sync any android oreo source (AOSP, Lineage, Carbon, etc.) and run "make dtc mkdtimage -jX" instead of "make bacon" or your normal command. The binaries will be located in out/host/linux-x86/.
This is tested and working with the stock google 4.9 toolchain and the initial source as of Oct 23rd, 2017.
Click to expand...
Click to collapse
Thanks for the files dude, you saved me some serious time since I don't need to sync AOSP
DespairFactor said:
Thanks for the files dude, you saved me some serious time since I don't need to sync AOSP
Click to expand...
Click to collapse
No problemo, I figured I'd post this since my fastboot is being retarded and I can't do much else
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work
edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
skaforey said:
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work
edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
Click to expand...
Click to collapse
Maybe? It doesn't seem like how the boot image is packed has been changed, just how the actual kernel image is put together.
nathanchance said:
Maybe? It doesn't seem like how the boot image is packed has been changed, just how the actual kernel image is put together.
Click to expand...
Click to collapse
Strange. Thanks for the response though. In the Magisk thread here, someone has posted a boot image that was simply unpacked/repacked (no changes) and we can't get it to boot. I don't want to derail this thread any further though.
skaforey said:
Forgive me for being a noob, but would these new requirements for the Pixel 2 cause existing tools used to pack/unpack the boot image fail or at least partially fail? I'm wondering if this is why we can't get Magisk to work
edit: to be clear, when I unpack the boot.img file all I see are kernel and ramdisk. When I unpack the boot.img from the Pixel 1 XL, I see those same 2 files along with devicetree.dtb and kernelimage
Click to expand...
Click to collapse
skaforey said:
Strange. Thanks for the response though. In the Magisk thread here, someone has posted a boot image that was simply unpacked/repacked (no changes) and we can't get it to boot. I don't want to derail this thread any further though.
Click to expand...
Click to collapse
No they don't, these just build the dtb/dtbo. The magisk issue is with patching sepolicy likely.
frap129 said:
No problemo, I figured I'd post this since my fastboot is being retarded and I can't do much else
Click to expand...
Click to collapse
Did you try to flash a factory image and get stuck in the bootloader? If so, extract 'image-walleye-[build number].zip' and flash each image manually. fastboot -w update doesn't work for some reason. After you flash all the images, do fastboot format userdata, and you should be back to normal. Took me a couple hours to figure this out.
ryanbg said:
Did you try to flash a factory image and get stuck in the bootloader? If so, extract 'image-walleye-[build number].zip' and flash each image manually. fastboot -w update doesn't work for some reason. After you flash each image, do fastboot format userdata, and you should be back to normal. Took me a couple hours to figure this out.
Click to expand...
Click to collapse
Thanks! I don't get stuck in the bootloader, but it won't let me flash boot images. Fastboot either hangs or spits out "remote: error: max size not reported"

Categories

Resources