[TOOLS] Necessary tools for building the Pixel 2 (XL) Kernel - Google Pixel 2 XL Guides, News, & Discussion

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"

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

[LOLLIPOP] Xperia AOSP Project

hi all
we have included this device in open devices project
you can check news about project on
http://developer.sonymobile.com/knowledge-base/open-source/open-devices/
feel free to fork, build, fix and push back
Br
J
jerpelea said:
hi all
we have open up gits for Xperia Z,Z1,Z2 devices
http://developer.sonymobile.com/201...-aosp-for-xperia-on-github-video-open-source/
feel free to fork, build and push back
J
XDA:DevDB Information
Xperia AOSP Project, ROM for the Sony Xperia Z1
Contributors
jerpelea
Version Information
Status: Testing
Created 2014-10-16
Last Updated 2014-10-16
Click to expand...
Click to collapse
WHooop Whooop WHHHHOOOOP!! :victory::victory::highfive::fingers-crossed::good::cyclops::victory:
Thank you jerpelea!!!! :victory:
ps; sorry for OT, Just so SUPER excited by this news!!!!!
would this lead to a better generation of AOSP roms for Z1? with good battery and camera functionality?
jerpelea said:
hi all
we have open up gits for Xperia Z,Z1,Z2 devices
http://developer.sonymobile.com/201...-aosp-for-xperia-on-github-video-open-source/
feel free to fork, build and push back
J
XDA:DevDB Information
Xperia AOSP Project, ROM for the Sony Xperia Z1
Contributors
jerpelea
Version Information
Status: Testing
Created 2014-10-16
Last Updated 2014-10-16
Click to expand...
Click to collapse
Like the guy above me asked. How does the camera react on this one? Same functionality? Or loss of important parts like bionz etc..
Very Nice
Read somewhere that modem and camera are disabled.
So we can't know how the camera react at this moment.
Thank you very much! Will such devices as amami, togari etc. be added too?
Attention: "For example, the camera is not working and the modem is not enabled, which means you cannot make phone calls."
Von meinem Sony Xperia Z1 gesendet. Mit Hirn.
Please @jerpelea can you put up a tut for building this! :crying:
I have downloded the source, and setup the build environment like you said on github but having issues with the final out directory.
It builds 100%, no issues whatsover, but mkbootimg fails to build the boot.img and it doesnt build the system.img :crying: I only have the userdata.img, kernel, and a system folder (others as well but these three are the important ones, oh theres also the ramdisk.img as well)
I have tried compiling the system folder using mkfs.yaffs2 to a system.img file and that flashes fine, userdata.img flashes too but the kernel I have tried a few combos and I can flash the boot.img file using files I have compiled before but it never boots. Its hard to see whats going on because I think the system folder never flashes properly so I dont have access to adb or anything. Its hard to trouble shoot this as well because it "bricks" my device everytime and its time consuming getting it up and running again. The build.prop looks fine and all folders in system folder look spot on but I am clearly missing something. I tried the fastboot flashall as well but that didtnt do anything, it gives me an error saying something about it must be an OUT_DIRECTORY... or something (yes I have tried it from the out/target/product/honami/ directory but same error, I think its because its looking for a system.img file..)
Please can you give me a kick in the right direction? I have been pulling my hair out trying to flash this but its a no go.
Desperately want to get it up and running (I am prepared to even go a few days without the radio just to test it and I can live without the camera as well)
PS: Sorry for being such a noob!
NanoSurfer said:
Please @jerpelea can you put up a tut for building this! :crying:
I have downloded the source, and setup the build environment like you said on github but having issues with the final out directory.
It builds 100%, no issues whatsover, but mkbootimg fails to build the boot.img and it doesnt build the system.img :crying: I only have the userdata.img, kernel, and a system folder (others as well but these three are the important ones, oh theres also the ramdisk.img as well)
I have tried compiling the system folder using mkfs.yaffs2 to a system.img file and that flashes fine, userdata.img flashes too but the kernel I have tried a few combos and I can flash the boot.img file using files I have compiled before but it never boots. Its hard to see whats going on because I think the system folder never flashes properly so I dont have access to adb or anything. Its hard to trouble shoot this as well because it "bricks" my device everytime and its time consuming getting it up and running again. The build.prop looks fine and all folders in system folder look spot on but I am clearly missing something. I tried the fastboot flashall as well but that didtnt do anything, it gives me an error saying something about it must be an OUT_DIRECTORY... or something (yes I have tried it from the out/target/product/honami/ directory but same error, I think its because its looking for a system.img file..)
Please can you give me a kick in the right direction? I have been pulling my hair out trying to flash this but its a no go.
Desperately want to get it up and running (I am prepared to even go a few days without the radio just to test it and I can live without the camera as well)
PS: Sorry for being such a noob!
Click to expand...
Click to collapse
Sent from my GT-I9505 using XDA Free mobile app
Try using the new mkqcdtbootimg repo for kernel building, put it in system/extra. I've compiled successfully with aosp l-preview branch. Haven't tested the compiled rom though
krabappel2548 said:
Sent from my GT-I9505 using XDA Free mobile app
Try using the new mkqcdtbootimg repo for kernel building, put it in system/extra. I've compiled successfully with aosp l-preview branch. Haven't tested the compiled rom though
Click to expand...
Click to collapse
Thank you Sir!!! Yes! :highfive: That makes perfect sense! *doh* :silly: (i feel silly now)
Will try that. Really appreciate it!!! Thank you for the heads up and responding :good:
@NanoSurfer did you manage to build boot.img after copying the repo source to system/extras/ ? I wasn't able to Let me know if you did. I must be doing something wrong
tejaswi.rohit said:
@NanoSurfer did you manage to build boot.img after copying the repo source to system/extras/ ? I wasn't able to Let me know if you did. I must be doing something wrong
Click to expand...
Click to collapse
Hey bro
Nope. I put mkqcdtbootimg in my /bin folder so I could execute it from anywhere but it still wouldnt work (by the way, you have to compile mkqcdtbootimg using "make mkqcdtbootimg", wish someone told me that before ). So I compiled the kernel seperately and got a boot.img, put that in /out folder and tried fastboot flashall, nope no go. Useless.
I cannot make a system.img during compile time! I managed to make a system.img though by executing "make snod". I tried flasing that, with my userdata.img, boot.img, system.img. NOPE ,ALWAYS BRICKS!!!! Arrrgh!!!! Wtf?? Btw fastboot flashall simply does not work.
Anyway, I wish I knew how @jerpelea did it because I have tried EVERYTHING! Im super frustrated by this because it seems there is either
a) critical stuff missing to succesfully build.
b) information is way to vague.
Ive wasted a lot of time on this and Im getting tired of having to recover my phone everytime. So do yourself a favour bro and rather leave this until a proper tut is posted or someone can explain the steps in more detail.
Cheers
NanoSurfer said:
Hey bro
Nope. I put mkqcdtbootimg in my /bin folder so I could execute it from anywhere but it still wouldnt work (by the way, you have to compile mkqcdtbootimg using "make mkqcdtbootimg", wish someone told me that before ). So I compiled the kernel seperately and got a boot.img, put that in /out folder and tried fastboot flashall, nope no go. Useless. ............
Cheers
Click to expand...
Click to collapse
@NanoSurfer I compiled the ROM successfully and flashed it too. It booted up just fine. This is what I did.
I downloaded the sources of mkqcdtbootimg and then extracted the openssl libraries from Android Source and placed it in the mkqcdtbootimg source folder (place it inside libdtd folder too, not sure of the exact folder name)and typed "make". Initially I had an error regarding some linker error got it fixed by installing this package libssl-dev I'm running Ubuntu 14.04. Ok, so that resulted me in a mkqcdtbootimg executable. What I realized what while compile the compiler is calling mkbootimg when mkqcdtbootimg isn't there, so I renamed mkqcdtbootimg executable to mkbootimg and placed it in out/host/linux-x86/bin . I replaced the original mkbootimg.
Once I did that my compilation went smooth. I got all the required images in the out folder. I tried fastboot flashall that didn't work for me either. So these are the partitions are flashed manually.
1. userdata
2. cache
3. system
4. boot
5. recovery
Crossed my fingers and typed "fastboot reboot" and BAM! it booted right to the home screen
P.S. I have a Xperia Z2. I downloaded the Android Source for 4.4.4_r2 but the blobs seem to be for 4.4.2 as of now at least for Z2 so I had some issues regarding sensors. Going to change my branch and compile again. But other than that the ROM was smooth as silk
Don't give up
tejaswi.rohit said:
@NanoSurfer I compiled the ROM successfully and flashed it too. It booted up just fine. This is what I did.
I downloaded the sources of mkqcdtbootimg and then extracted the openssl libraries from Android Source and placed it in the mkqcdtbootimg source folder (place it inside libdtd folder too, not sure of the exact folder name)and typed "make". Initially I had an error regarding some linker error got it fixed by installing this package libssl-dev I'm running Ubuntu 14.04. Ok, so that resulted me in a mkqcdtbootimg executable. What I realized what while compile the compiler is calling mkbootimg when mkqcdtbootimg isn't there, so I renamed mkqcdtbootimg executable to mkbootimg and placed it in out/host/linux-x86/bin . I replaced the original mkbootimg.
Once I did that my compilation went smooth. I got all the required images in the out folder. I tried fastboot flashall that didn't work for me either. So these are the partitions are flashed manually.
1. userdata
2. cache
3. system
4. boot
5. recovery
Crossed my fingers and typed "fastboot reboot" and BAM! it booted right to the home screen
P.S. I have a Xperia Z2. I downloaded the Android Source for 4.4.4_r2 but the blobs seem to be for 4.4.2 as of now at least for Z2 so I had some issues regarding sensors. Going to change my branch and compile again. But other than that the ROM was smooth as silk
Don't give up
Click to expand...
Click to collapse
Ahhhhhh dude!!! A 1000 thanks to you mate!!! :highfive: YESSS VICTORY! :victory: She works... FINALLY :victory:
Man THANK YOU!!! I love you bro! :laugh: You made my day :good:
And a SPECIAL thanks to @jerpelea!!!!! Flip it was painful trying to figure this out but finally I've got it. I owe you @tejaswi.rohit
NanoSurfer said:
Ahhhhhh dude!!! A 1000 thanks to you mate!!! :highfive: YESSS VICTORY! :victory: She works... FINALLY :victory:
Man THANK YOU!!! I love you bro! :laugh: You made my day :good:
And a SPECIAL thanks to @jerpelea!!!!! Flip it was painful trying to figure this out but finally I've got it. I owe you @tejaswi.rohit
Click to expand...
Click to collapse
Congratulations @NanoSurfer Glad I could help How's the build ? Do you face any issues regarding screen brightness,rotation, sound and mobile network ? Those were the problems I had on my 4.4.4 build
tejaswi.rohit said:
Congratulations @NanoSurfer Glad I could help How's the build ? Do you face any issues regarding screen brightness,rotation, sound and mobile network ? Those were the problems I had on my 4.4.4 build
Click to expand...
Click to collapse
Same issues as you here are the problems I found:
1) mobile network broken
2) wifi not working
3) screen rotation not working
4) sound not working
5) brightness slider has no affect
6) internal storage showing as about 70mb
7) phone resets when restarted (like it does a factory wipe)
8) camera broken
9) Bluetooth broken
I managed to get the sound working though by flashing the aosp kernel from Sony's github I think I can fix wifi as well because I compiled the prima module, but I couldn't push it to system/lib as adb wouldn't allow it (read only file system) I'm still trying to figure out how to compile that module inline.
I think a lot of the problems are kernel related.
Interestingly tho, the performance is way better than I expected! Graphics and scrolling are very smooth.
Busy working on the issues. Will let you if I make any breakthroughs
I think I fixed the sound, just busy doing another build to test a few more things...
I'm struggling though to get the sim to work :crying: Also trying to fix wifi but I'm crossing fingers that the build I'm doing at the moment fixes that :fingers-crossed:
By the way, I was wrong previously about a few things, the data partition is actually displaying 100% correct and it doesn't reset after each boot. However, this was happening to me after I flashed a boot.img I compiled, I think maybe because I used a stock ramdisk Im just guessing but I don't know why. The kernel it builds with works just fine. If the next build is ok, I will post my device config files for others to play around with...
krabappel2548 said:
Sent from my GT-I9505 using XDA Free mobile app
Try using the new mkqcdtbootimg repo for kernel building, put it in system/extra. I've compiled successfully with aosp l-preview branch. Haven't tested the compiled rom though
Click to expand...
Click to collapse
working on the guide
br
J
to be able to build kernel you need
cd build && git cherry-pick 612e2cd0e8c79bc6ab46d13cd96c01d1be382139 && cd ..
before building
br
J
tejaswi.rohit said:
@NanoSurfer I compiled the ROM successfully and flashed it too. It booted up just fine. This is what I did.
I downloaded the sources of mkqcdtbootimg and then extracted the openssl libraries from Android Source and placed it in the mkqcdtbootimg source folder (place it inside libdtd folder too, not sure of the exact folder name)and typed "make". Initially I had an error regarding some linker error got it fixed by installing this package libssl-dev I'm running Ubuntu 14.04. Ok, so that resulted me in a mkqcdtbootimg executable. What I realized what while compile the compiler is calling mkbootimg when mkqcdtbootimg isn't there, so I renamed mkqcdtbootimg executable to mkbootimg and placed it in out/host/linux-x86/bin . I replaced the original mkbootimg.
Once I did that my compilation went smooth. I got all the required images in the out folder. I tried fastboot flashall that didn't work for me either. So these are the partitions are flashed manually.
1. userdata
2. cache
3. system
4. boot
5. recovery
Crossed my fingers and typed "fastboot reboot" and BAM! it booted right to the home screen
P.S. I have a Xperia Z2. I downloaded the Android Source for 4.4.4_r2 but the blobs seem to be for 4.4.2 as of now at least for Z2 so I had some issues regarding sensors. Going to change my branch and compile again. But other than that the ROM was smooth as silk
Don't give up
Click to expand...
Click to collapse

[Utility] Android Image Kitchen & Flasher APK

Hi all , I'm new here and I would like to present to you this simple application which backup, edit, repack and flash kernel.img or recovery img with a single click.
This apk need root.
All credit of unpak/repack tools used in my apk are to @osm0sis
atoxyd said:
Hi all , I'm new here and I would like to present to you this simple application which backup, edit, repack and flash kernel.img or recovery img with a single click.
This apk need root.
Click to expand...
Click to collapse
can I use this on snapdragon 615 stock kernel
Sent from my 6045X using Tapatalk
Yes, you can try
tested on htc desire 816, cm13
unpacks and repacks kernel and ramdisk successfully, but didn't extract or repack the dtbs (device tables image, kernel 3.4) so the repacked image won't boot.
Well I use in my apk AIK.mobile tools proposed by osm0sis.
atoxyd said:
Well I use in my apk AIK.mobile tools proposed by osm0sis.
Click to expand...
Click to collapse
https://github.com/osm0sis/AnyKernel2/ ?
from http://forum.xda-developers.com/showthread.php?t=2670512
bigsupersquid said:
tested on htc desire 816, cm13
unpacks and repacks kernel and ramdisk successfully, but didn't extract or repack the dtbs (device tables image, kernel 3.4) so the repacked image won't boot.
Click to expand...
Click to collapse
Hi, I test it on cm13 and I unpack recovery.img for HTC desire 816, I think it work fine.
If the apk didn't work properly that's means the boot image doesn't not following Google's standard format so you'll need to find other tools to unpack and edit your image.
atoxyd said:
Hi, I test it on cm13 and I unpack recovery.img for HTC desire 816, I think it work fine.
If the apk didn't work properly that's means the boot image doesn't not following Google's standard format so you'll need to find other tools to unpack and edit your image.
Click to expand...
Click to collapse
I can unpack, edit, and repack successfully.
but, it wont boot.
I used official twrp 3.0.0-0 recovery.img and cm13 boot.img both, tried without editing.
just unpack/repack/flash.
boots straight into hboot, which is what happens if I build a boot.img or recovery.img without dtbs.
I pointed to the anykernel2 link because I know its scripting handles dtbs.
the whole kernel device table thing is new to me, and so far only on this device, so I'm not very savvy with dtb work. been lucky enough that it was preconfigured in the build system for cm.
nero curin said:
can I use this on snapdragon 615 stock kernel
Sent from my 6045X using Tapatalk
Click to expand...
Click to collapse
Hi, did my apk work for you?
atoxyd said:
Hi, did my apk work for you?
Click to expand...
Click to collapse
only unpacking and repacking,didnt help on my device but yet again nothing else helps me compile kernel for this idol 3 so i guess this app works just not for me, bad luck :/
Sent from my 6045X using Tapatalk
Well, this is a beta version of my apk, only for testing, I use @osm0sis tools ,this doesn't mean that you have bad luck my friend, this is due to the limitation of @osm0sis tools, but I will find another way to make it universal apk. Okay
atoxyd said:
Well, this is a beta version of my apk, only for testing, I use @osm0sis tools ,this doesn't mean that you have bad luck my friend, this is due to the limitation of @osm0sis tools, but I will find another way to make it universal apk. Okay
Click to expand...
Click to collapse
The scope of my tools is for Google's Android image standard as defined in the bootimg.h header from AOSP/CM. My tool forks have the widest support available for images which are standards compliant, supporting all commonly used ramdisk compression formats.
Supporting Sony's ELF, MTK's labeled and Samsung's headerless image formats along with the standard images (not to mention Samsung's and others' various deviations based on the standard header) and having the script/app differentiate between them would be a very large and difficult undertaking indeed. If that's your plan then I wish you the best of luck in your efforts.
hey, ran more tests.
no issues with the dtb or other functions either.
backup and flash functions working fine too.
here, for your devices.xml
Code:
<!-- Desire 816 a5 (710C) added by bigsupersquid -->
<device>
<model>710C</model>
<kernel>/dev/block/mmcblk0p40</kernel>
<recovery>/dev/block/mmcblk0p41</recovery>
<cache>/dev/block/mmcblk0p42</cache>
</device>
thanks for your work.
eagerly awaiting your open source as well
atoxyd said:
Hi all , I'm new here and I would like to present to you this simple application which backup, edit, repack and flash kernel.img or recovery img with a single click.
This apk need root.
All credit of unpak/repack tools used in my apk are to @osm0sis
Click to expand...
Click to collapse
Thank you for adding the appropriate credit back to your post. Patching, cross-compiling and scripting has taken significant work. :good:
The only other thing that I'd ask is that you do not use the name of Android Image Kitchen or AIK in the title of your app. I'd like to suggest maybe "Image Editor and Flasher" as a snappy alternative?
bigsupersquid said:
hey, ran more tests.
no issues with the dtb or other functions either.
backup and flash functions working fine too.
here, for your devices.xml
Code:
<!-- Desire 816 a5 (710C) added by bigsupersquid -->
<device>
<model>710C</model>
<kernel>/dev/block/mmcblk0p40</kernel>
<recovery>/dev/block/mmcblk0p41</recovery>
<cache>/dev/block/mmcblk0p42</cache>
</device>
thanks for your work.
eagerly awaiting your open source as well
Click to expand...
Click to collapse
Thank you my friend , you are the only one who supported me , and from the beginning.
atoxyd said:
Thank you my friend , you are the only one who supported me , and from the beginning.
Click to expand...
Click to collapse
it's a useful project, definitely worth a little testing and feedback.
besides, i remember what a pain it was getting my xda account eligible for posting the project i was all gung-ho about sharing (optimus v boot from sd card if i remember correctly)
sharing is cool, but a lot of the feedback tends to be annoying when there's no logs or other usable information, just "it's broken" or "can you implement for me on device XYZ."
bigsupersquid said:
I can unpack, edit, and repack successfully.
but, it wont boot.
I used official twrp 3.0.0-0 recovery.img and cm13 boot.img both, tried without editing.
just unpack/repack/flash.
boots straight into hboot, which is what happens if I build a boot.img or recovery.img without dtbs.
I pointed to the anykernel2 link because I know its scripting handles dtbs.
the whole kernel device table thing is new to me, and so far only on this device, so I'm not very savvy with dtb work. been lucky enough that it was preconfigured in the build system for cm.
Click to expand...
Click to collapse
Did you have an unlocked bootloader ?
nothing changed on the device, unlocked and still s-on, I'm not sure what went wrong the first try.
PEBKAC error probably
(problem exists between keyboard and chair)
I release AIK&Flasher v2 , I use @xiaolu unpack/repack tools.
atoxyd said:
I release AIK&Flasher v2 , I use @xiaolu unpack/repack tools.
Click to expand...
Click to collapse
Please use a different name for your app as I have requested.

Building arm64 kernel for Galaxy S7 Edge (SM-G935F) question.

Hello,
First of all, im new to android modding and linux. I tried to build a kernel from stock G935FXXU1BPH6 source based on their readme file. My problem is, I don't have a zImage file after build that I could put into a flashable zip. I only have Image and Image.gz (I guess thats normal for arm64 kernels?) and I don't know how to make them flashable. I found a youtube video where the dude placed the Image file in a directory called "tools" in his flashable zip, I tried it and TWRP said I installed it successfully but when I start up my phone and check kernel version its still the previous one not mine.
Used this toolchain: aarch64-linux-android-4.9/bin/aarch64-linux-android-
I've set up CROSS_COMPILE path, then I set up configuration:
make ARCH=arm64 exynos8890-hero2lte_defconfig
make menuconfig (to tweak it a little bit more, like custom kernel version string so I can see if it worked)
Then I started build:
make ARCH=arm64
Output when build finished:
>>>>> Time used for generated all hashes is 6 sec
OBJCOPY arch/arm64/boot/Image
GZIP arch/arm64/boot/Image.gz
DTC arch/arm64/boot/dts/exynos8890-smdk8890.dtb
DTC arch/arm64/boot/dts/exynos8890-universal8890.dtb
Anyone knows how could I make it flashable? Thanks.
keezay said:
Hello,
First of all, im new to android modding and linux. I tried to build a kernel from stock G935FXXU1BPH6 source based on their readme file. My problem is, I don't have a zImage file after build that I could put into a flashable zip. I only have Image and Image.gz (I guess thats normal for arm64 kernels?) and I don't know how to make them flashable. I found a youtube video where the dude placed the Image file in a directory called "tools" in his flashable zip, I tried it and TWRP said I installed it successfully but when I start up my phone and check kernel version its still the previous one not mine.
Used this toolchain: aarch64-linux-android-4.9/bin/aarch64-linux-android-
I've set up CROSS_COMPILE path, then I set up configuration:
make ARCH=arm64 exynos8890-hero2lte_defconfig
make menuconfig (to tweak it a little bit more, like custom kernel version string so I can see if it worked)
Then I started build:
make ARCH=arm64
Output when build finished:
>>>>> Time used for generated all hashes is 6 sec
OBJCOPY arch/arm64/boot/Image
GZIP arch/arm64/boot/Image.gz
DTC arch/arm64/boot/dts/exynos8890-smdk8890.dtb
DTC arch/arm64/boot/dts/exynos8890-universal8890.dtb
Anyone knows how could I make it flashable? Thanks.
Click to expand...
Click to collapse
This particular chipset (64-bit Exynos) uses the uncompressed Image and a separate dtb.img file made from combining all the dtb revisions of your device codename and region into a DTBH format.
You can flash them using my LazyFlasher project.
See: https://github.com/jcadduono/lazyflasher
You will want to use the kernel-flasher branch. The kernel-flasher-samsung branch isn't fully ready and adds additional patch files to remove TIMA/Knox. I've yet to find out everything that needs to be changed from stock state to allow a bootable custom kernel without disabling encryption, unfortunately.
You can simply git clone it, then place your Image and optionally dtb.img in the root folder of the repository, then type "make" to build a TWRP flashable zip. They will be dynamically replaced in the current boot image on the device when the zip is flashed. You can check out the README.md for more info.
If you want to generate your own dtb.img to include in the installer, you can use a script I made from my universal8890 kernel sources on GitHub:
https://github.com/jcadduono/android_kernel_samsung_universal8890/blob/stock-6.0/dtbgen.sh
(correct the toolchain location for your build in the script)
It also requires the scripts/dtbTool folder (from the same git linked above) to be present in your repository. It's not the same as the Qualcomm dtbTool, and the sources are included (and fairly clean!) if you're interested in learning the Exynos dtb.img (DTBH) format.
./dtbgen.sh hero2lte xx
Now, there's still quite a bit that needs to be done to make the device actually boot successfully and be stable with a custom kernel. While the kernel is perfectly stable, the Samsung customized Android OS will absolutely freak out. That's a bit beyond me, and the reason I haven't really worked on any custom kernels for it myself.
Have fun!
jcadduono said:
This particular chipset (64-bit Exynos) uses the uncompressed Image and a separate dtb.img file made from combining all the dtb revisions of your device codename and region into a DTBH format.
You can flash them using my LazyFlasher project.
See: https://github.com/jcadduono/lazyflasher
You will want to use the kernel-flasher branch. The kernel-flasher-samsung branch isn't fully ready and adds additional patch files to remove TIMA/Knox. I've yet to find out everything that needs to be changed from stock state to allow a bootable custom kernel without disabling encryption, unfortunately.
You can simply git clone it, then place your Image and optionally dtb.img in the root folder of the repository, then type "make" to build a TWRP flashable zip. They will be dynamically replaced in the current boot image on the device when the zip is flashed. You can check out the README.md for more info.
If you want to generate your own dtb.img to include in the installer, you can use a script I made from my universal8890 kernel sources on GitHub:
https://github.com/jcadduono/android_kernel_samsung_universal8890/blob/stock-6.0/dtbgen.sh
(correct the toolchain location for your build in the script)
It also requires the scripts/dtbTool folder (from the same git linked above) to be present in your repository. It's not the same as the Qualcomm dtbTool, and the sources are included (and fairly clean!) if you're interested in learning the Exynos dtb.img (DTBH) format.
./dtbgen.sh hero2lte xx
Now, there's still quite a bit that needs to be done to make the device actually boot successfully and be stable with a custom kernel. While the kernel is perfectly stable, the Samsung customized Android OS will absolutely freak out. That's a bit beyond me, and the reason I haven't really worked on any custom kernels for it myself.
Have fun!
Click to expand...
Click to collapse
Thank you very much!
@jcadduono couldn't make the kernel boot after packing it with lazyflasher. I built a completely stock kernel from the mentioned source, pasted the "Image" (not the Image.gz) file in lazyflasher root and then used make command. Tried including "exynos8890-smdk8890.dtb" file as well. Same story. Not sure if I need anything else in the package or I made user mistake. Do you have any ideas how could I debug what makes it stuck on that screen?
Thanks!
EDIT: Solved Problem.
keezay said:
@jcadduono couldn't make the kernel boot after packing it with lazyflasher. I built a completely stock kernel from the mentioned source, pasted the "Image" (not the Image.gz) file in lazyflasher root and then used make command. Tried including "exynos8890-smdk8890.dtb" file as well. Same story. Not sure if I need anything else in the package or I made user mistake. Do you have any ideas how could I debug what makes it stuck on that screen?
Thanks!
EDIT: Solved Problem.
Click to expand...
Click to collapse
Can you help me set up an environment to build a kernel, arm64, for s7? I'm on Ubuntu having a heel of a time..
Galaxy S7 Edge Kernel Flashing Issues
I am currently trying to flash a different kernel into a galaxy s7 edge (SM-G935S).
I have gone as far as building a kernel and extracting a Image file from it, but every time I try flashing a boot.img with a replaced kernel image file, it seems to never work.
A mkbootimg tool that I am currently using requires a dtb file, but I cannot find where to get it from.
I have tried using @jcadduono's git code, but the dtb file created from it doesn't seem to work as well.
Can anyone tell me what I should do to flash a kernel successfully?
kernel panic after flashing
Hi @ll,
with this guide I was able to compile my own kernel and also flashing it to my phone. Unfortunatelly I'm getting kernel panic after rebooting the phone. is there any possibility to get the reason for this? Or do you have any hint, what I may have done wrong?
Thanks for your help.
Kind regards
v0ti

New file_contexts.bin format and make_ext4fs

Trying to alter a stock ROM and resign with my own custom key just for myself. This process will allow me to use a device with custom changes (NOT root), but still allow me to use Android Pay.
This process involves using the "make_ext4fs" tool. However, this tool (as far as I can tell) requires using the old plaintext version of "file_contexts". Android 7+ uses a new binary version of this file instead ("file_contexts.bin").
So if anyone can solve either of these questions, I would be very grateful:
1) Is there a tool to convert my device's binary "file_contexts.bin" to the old plaintext "file_contexts"? -OR-
2) Is there a build of "make_ext4fs" that accepts the new binary format "file_contexts.bin"? I tried to build the new nougat version myself from AOSP, but after a successful build of the tool, I can't get the thing to read files on either 64-bit or 32-bit systems. It yields an error "No such file or directory" when trying to point to file_contexts. I am not a great C developer, so I don't know if I built it wrong. For reference, no, I am not missing the lib32stdc++6 libraries. I have attached the binary if you want to see if you can get it to work. -OR-
3) If anyone has the file_contexts text file for the OnePlus 3, ROM version 7.X Nougat, that would work too!​
Any help anyone can offer in any way would be fantastic! Thank you so much for your time to look at this!
A good question
1) yes, see my signature
munjeni said:
1) yes, see my signature
Click to expand...
Click to collapse
I'm trying to do the same with a 7.1.1. rom. I convert the file_contexts.bin to file_contexts, unpack the rom, do the modifications to the rom, repack the rom then replace the original system.new.dat and system.transfer.list with the newly packed ones (original file_contexts.bin is still in the original zip) and when I go to flash it in TWRP it doesn't flash the system and I get a No OS installed Is there something I have to do to the file_contexts.bin after I repack the system.new.dat?
"file_contexts.bin" to the old plaintext "file_contexts" tool: http://blog.cofface.com/archives/2255.html
puargs said:
I tried to build the new nougat version myself from AOSP, but after a successful build of the tool, I can't get the thing to read files on either 64-bit or 32-bit systems. It yields an error "No such file or directory" when trying to point to file_contexts. I am not a great C developer, so I don't know if I built it wrong. For reference, no, I am not missing the lib32stdc++6 libraries.
Click to expand...
Click to collapse
Try building with the pie (Position Independent Executable) flag. Had this exact same problem when trying to compile a CVE for android.
Hopefully this should work for you and sorry for the Necro post

Categories

Resources