[Q] Porting CyanogenMod on MSM8610 Handset. - Android Q&A, Help & Troubleshooting

Hi Team,
Was trying to port CyanogenMod 11 || CAF 8610 KK on MSM8610 handset.
I have a partial kernel source for the device, but am unable to compile the dt.img from it.
Using the dt.img from the Stock Boot.img gives me display, but using my created dt.img gives me no display.
When i try to create a DT.IMG using the mkbootimg_tools i get :-
DTB combiner:
Input directory: './arch/arm/boot/'
Output file: 'dt.img'
=> Found 0 unique DTB(s)
I want to know how to create the dt.img from the kernel. Tried various dtbTools with the same result. Am wondering if there is something else wrong.
Any help would be greatly appreciated.

adityaxavier said:
Hi Team,
Was trying to port CyanogenMod 11 || CAF 8610 KK on MSM8610 handset.
I have a partial kernel source for the device, but am unable to compile the dt.img from it.
Using the dt.img from the Stock Boot.img gives me display, but using my created dt.img gives me no display.
When i try to create a DT.IMG using the mkbootimg_tools i get :-
DTB combiner:
Input directory: './arch/arm/boot/'
Output file: 'dt.img'
=> Found 0 unique DTB(s)
I want to know how to create the dt.img from the kernel. Tried various dtbTools with the same result. Am wondering if there is something else wrong.
Any help would be greatly appreciated.
Click to expand...
Click to collapse
Guys !?

like this
if u see a bunch of .dtb files in arch/arm/boot
then
./dtbToolCM -s 2048 -o arch/arm/boot/dt.img -p scripts/dtc/ arch/arm/boot/

Yeah, I made the mistake of doing it before compiling the zimage.
Got the DT.IMG. but there is a problem.
Compiled zimage + compile DT.IMG = no display, no adb.
Compiled zimage + stock DT.IMG = display and adb
As far as I understand the problem might be because the compiled DT.IMG is not having the right dtb.
My device has otm9608c qhd display.

adityaxavier said:
Yeah, I made the mistake of doing it before compiling the zimage.
Got the DT.IMG. but there is a problem.
Compiled zimage + compile DT.IMG = no display, no adb.
Compiled zimage + stock DT.IMG = display and adb
As far as I understand the problem might be because the compiled DT.IMG is not having the right dtb.
My device has otm9608c qhd display.
Click to expand...
Click to collapse
maybe , try make clean , and again build , actually dtbToolCM finds the right dtb files from scripts/dtc , it shouldnt go wrong unless u did it wrong or if ur source has problems

Related

[ROM] Build Your Own Dell Venue Rom > Froyo > Gingerbread > Ice Cream

I wish to open New Thread for enable focus into developing custom rom for dell venue and expecting get some suggestion, comment, help from other members of this forum :
I have wrote brief guide to prepare build environment and build kernel & rom for dell venue HERE
I do test to emulator and device all build result before posting to this thread, but need other user/member willing to test the build and post any suggestion, comment etc.
Starting by building froyo base rom, to test and ensure the buiild process is correct and exepcting to build further base i.e gingerbread and ice cream sandwich
since I'm terrible noob in android development, help, guide, suggestions are very welcome
-update-
Kernel Build
I have been succesfully "build" a kernel HERE
I splited 408-kernel to "borrow" the ramdisk (To make it easy I renamed file boot.img of 408-kernel into boot408.img.
Code:
[[email protected] venimg-1]$ split_bootimg.pl boot408.img
Page size: 2048 (0x00000800)
Kernel size: 3092536 (0x002f3038)
Ramdisk size: 168270 (0x0002914e)
Second size: 0 (0x00000000)
Board name:
Command line: androidboot.hardware=venue
Writing boot408.img-kernel ... complete.
Writing boot408.img-ramdisk.gz ... complete.
extracted ramdisk
Code:
[[email protected] ramdisk]$ gzip -dc ../boot408.img-ramdisk.gz | cpio -i
561 blocks
edited ro.secure=1 to re.secure=0
recreate cpio archive
Code:
$ mkbootfs ./ramdisk | gzip > ramdisk-408-2.gz
recreate boot image by using new build kernel named zImage-05
Code:
$ mkbootimg --cmdline 'androidboot.hardware=venue console=null' --kernel zImage-05 --ramdisk ramdisk-408-2.gz -o boot408-2.img
flash boot408-2.img > NO LUCKS > NOT BOOTING .. I'm clueless. Anybody give an idea ?
-update-
My failed to make "succesfull build kernel" to "boot" is the absent of info : BOARD_KERNEL_BASE (address) for dell venue. Someone can appoint me where I can get this info?
please test
changkho1908 said:
please test
Click to expand...
Click to collapse
this is very early stage of development build with available source. As I found HERE available ICS Chocolate Branch Manifest for msm7627. I will personally do experiment to build this ICS branch for dell venue.
I still need help from someone to understand and appoint a clue to this information at the end of build process :
Code:
.....
APK certs list: out/target/product/msm7627_surf/obj/PACKAGING/apkcerts_intermediates/msm7627_surf-apkcerts-eng.x.txt
Package target files: out/target/product/msm7627_surf/obj/PACKAGING/target_files_intermediates/msm7627_surf-target_files-eng.x.zip
Package OTA: out/target/product/msm7627_surf/update.zip
./build/tools/releasetools/ota_from_target_files:63: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
unzipping target target-files...
using device-specific extensions in device/qcom/common
[B][I][COLOR="Red"]unable to load device-specific module; assuming none[/COLOR][/I][/B]
done.
sysmtem is alive but boot (kenel) is still NON BOOTABLE ... I believed by working together we will have "something" for this device
The 40x roms are based off of the MSM8x60 branches, as they dont implicitly list 8260 they likely used 8660 as their base.
I dont know if the 8x60 is closer to the 8x50 then the 7627, but just pointing it out.
You might be better off at least getting 2.2/2.3 to boot first, you may very well need to deal with the drivers and at least 2.2/2.3 have working binary-only drivers.
TheManii said:
The 40x roms are based off of the MSM8x60 branches, as they dont implicitly list 8260 they likely used 8660 as their base.
I dont know if the 8x60 is closer to the 8x50 then the 7627, but just pointing it out.
You might be better off at least getting 2.2/2.3 to boot first, you may very well need to deal with the drivers and at least 2.2/2.3 have working binary-only drivers.
Click to expand...
Click to collapse
Dear TheManii,
I believed you are one who having well understanding on this funky smart phone. please let me know qsd8x50 : is the name of processor isnt it > qualcom snap dragon (qsd) and how about MSM8x60 <-- this is name of BOARD of Name or Processor. When coming into building kernel I need to have correct understanding. So far I know only the ARCH. Is there any wiki or site page to refer. This is example when I was on old time with gentoo linux on compiling kernel for PC > Safe Cflags. Board understanding will help in configure config file, processor understanding will help in overclocking or set best and safe for building kernel.
binary only available driver will always make head-ache in open source community. Hopefully vendor releasing the driver copy sorry for the question, I'm really new to this embedded device
Snapdragon is the device family, 8250 is the specific SOC used in the venue.
Like I stated earlier, dell used the 8x60 branch as their base as qualcomm/CAF no longer supports 8x50 devices. I dont know if it's better or worse as the group that makes the roms pretty much does a terrible job at it, the venue has only a fraction of the issues of the streak 5 (due mainly to drivers), but there's not much you can say to defend them when it takes over a year to release GB (in fact it was just days after ICS was released) for the venue.
Dell cant and wont release the drivers to any of their devices, most of them except the streak 5 arent unusual anyway. The reason ICS has a beta for the S7 is this very fact.
You can likely base it on the nexus one/passion as it's likely not terribly different from it.
I dont expect the GB drivers to simply work in ICS, and since we dont have them you'd pretty much need to rewrite/port from a similar device using the same hardware.
At least with the current drivers, you could theoretically build the rest of the system and drop in the current ones. I've never had the time to try so myself but this is pretty much how cyanogen is ported to some devices.
That's pretty much ALL the info for the venue, as I'm the closest to a dev for it (at least on xda, there's other devs but they dont speak english much/visit xda much so it doesnt really make much of a difference in the end) and that's about as much as I can offer.
I cant really offer much more as I've never attempted to build android itself. Most I've done is build the makefiles to compile CWM. The makefiles for android is a lot more complex then merely porting CWM
dear all,
can someone appoint me out to have correct GB manifest on codeaurora ? I tried
Code:
[email protected]:~/dell-venue$ gingerbread_rel -m M7630AABBQMLZA404020.xml ^C
[email protected]:~/dell-venue$ repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread_rel -m M7630AABBQMLZA404020.xml --repo-url=git://codeaurora.org/tools/repo.git
.repo/manifests/: manifest switched gingerbread_chocolate...gingerbread_rel
.repo/manifests/: discarding 70 commits removed from upstream
fatal: manifest 'M7630AABBQMLZA404020.xml' not available
fatal: cannot link manifest M7630AABBQMLZA404020.xml
I did many googling, still No lucks I agree to Guru TheManii advise to make GB kernel booting first then investigate to port ICS into dell venue.
***dell venue make me very currious (and also fustating)***
x1123 said:
dear all,
can someone appoint me out to have correct GB manifest on codeaurora ? I tried
Code:
[email protected]:~/dell-venue$ gingerbread_rel -m M7630AABBQMLZA404020.xml ^C
[email protected]:~/dell-venue$ repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread_rel -m M7630AABBQMLZA404020.xml --repo-url=git://codeaurora.org/tools/repo.git
.repo/manifests/: manifest switched gingerbread_chocolate...gingerbread_rel
.repo/manifests/: discarding 70 commits removed from upstream
fatal: manifest 'M7630AABBQMLZA404020.xml' not available
fatal: cannot link manifest M7630AABBQMLZA404020.xml
I did many googling, still No lucks I agree to Guru TheManii advise to make GB kernel booting first then investigate to port ICS into dell venue.
***dell venue make me very currious (and also fustating)***
Click to expand...
Click to collapse
good luck for you, we are always support you
changkho1908 said:
good luck for you, we are always support you
Click to expand...
Click to collapse
cũng chỉ biết good luck for you àh
nguyen_vh said:
cũng chỉ biết good luck for you àh
Click to expand...
Click to collapse
đệt, chú muốn thế nào nữa
I tested to build android and using three source : codeaurora, cyanogen, aosp. To build GB on codeaurora I just can not find correct manifest. On cyanogen just wont build (for certain device) without proper propreitary binary drivers. On aosp ... well, build is easier. From TheManii advise I build GB aosp > passion and will not boot to be flashed to dell venue. I change the kernel with 408, rom is alive on device, but No wireless functionality work, either gsm or wifi. Anyone can give a clue where to get radio.img for dell venue? to build booting customs android kernel for venue still no lucks for me.
if someone want to take a look please download passion build packed with 408 kernel HERE flashable via cwm recovery. This will not brick your device.
To turn back device into normal android usage just flash TheManii StreakDroid4-250 without wipe anything. I put StreakDroid4-250 file also HERE just for make easier to download from my region (Indonesia).
split / unpack / repack boot.img
Hi Guys,
My biggest problem to determine how to pack kernel into boot image is solved. I optimistic to have booting kernel and pack into boot image. I cant determine the board kernel base address. Now I found out the base address is 0x20000000 (twenty million). I have test the coomand line and work well. This is the test procedure > download live boot.img (mean its proved bootable). I toke 408-boot image from many Streakdriod4 rom ... thanks to TheManii :
Code:
$ split_bootimage.pl 408boot.img
(I renamed boot.img to 408boot.img for easy remember)
output
Code:
Page size: 2048 (0x00000800)
Kernel size: 3092536 (0x002f3038)
Ramdisk size: 168270 (0x0002914e)
Second size: 0 (0x00000000)
Board name:
Command line: androidboot.hardware=venue
Writing 408boot.img-kernel ... complete.
Writing 408boot.img-ramdisk.gz ... complete.
...
Now I have in the folder > 3 files : 408boot.img 408boot.img-kernel 408boot.img-rakdisk.gz. We test our command line > to repack kernel and ramdisk into boot image and must be flashable to device and booting :
Code:
$ mkbootimg --kernel 408boot.img-kernel --ramdisk 408boot.img-ramdisk.gz --pagesize 2048 --cmdline "androidboot.hardware=venue" --board venue --base 0x20000000 -o new408boot.img <ENTER>
You should have new408boot.img bootable into our venue viat fastboot > test >
Code:
$sudo fastboot earse boot (to ensure existing boot is clean)
$sudo fastboot flash boot new408boot.img
$sudo fastboot reboot
...
Mu dell venue with TheManii rom booting properly.
But we need to ensure everything work well. Let us utilize second procedure well known in the world
Code:
$rm 408boot.img-kernel 408boot.img-ramdisk.gz new408boot.img [B][COLOR="Red"](to clean the folder).[/COLOR][/B]
$unpack-bootimg.pl 408boot.img [ENTER]
OUTPUT WILL BE
Code:
kernel written to 408boot.img-kernel.gz
ramdisk written to 408boot.img-ramdisk.cpio.gz
561 blocks
extracted ramdisk contents to directory 408boot.img-ramdisk/
By using UNPACK method we will have THREE file (four including 408boot.img) in folder
408boot.img 408boot.img-ramdisk 408boot-ramdisk.cpio.gz 408boot.img-kernel.gz
I choose unpack method since I wanna to test all command line available in internet is working properly. I change initlogo.rle with one I download from internet and edit default.prop file.
Code:
$nano -w 408boot.img-ramdisk/default.prop
EDIT THE text > ro.secure=1 TO ro.secure=0.
change initlogo.rle with other FILENAME.rle (You can download from internet)
Now we have ramdisk file (folder) with different default.prop file and initlogo.rle file (different image .. default is dell logo)
Create new ramdisk file to enable us create bootable image
Code:
$mkbootfs 408boot.img-ramdisk | gzip > new408-ramdisk [ENTER]
we should have file named new408-ramdisk gziped
Now repack kernel and new ramdisk >
Code:
$mkbootimg --kernel 408boot.img-kernel.gz --ramdisk new408-ramdisk --pagesize 2048 --board venue --cmdline "androidboot.hardware=venue --base 0x20000000 -o realynewboot.img [ENTER]
...
flash realynewboot.img via fastboot my boot splash changed into image attached ...
for step by step ... i put on MY BLOG
I share this to have someone try together to compile a kernel and convert into bootable image. with this kernel proble tackled ... build ROM is easier
Booting kernel
Hi Folks,
attached is booting kernel for dell venue. I tried on GB Rom (TheManii Rom) Steakdroid4-2.5.0.
Build info :
- Build from source tree : DJSteve-StreakKernel-92bf64f
- using 408config > extracted from 408boot.img
- switched off back cover awareness (I dont know what exact name) feature
- ramdisk > splitted ramdisk from 408-boot image.
- flashable via fastboot
- download atachement
- boot to fastboot
-$ sudo fastboot erase boot
-$ sudo fastboot flash boot djsteveboot.img
-$ sudo fastboot reboot
NOTE
This is development stage kernel. so please only try if you can tackle all problem. Good news flash the boot WILL NOT brick Your device
share here the result
x1123 said:
- switched off back cover awareness (I dont know what exact name) feature
Click to expand...
Click to collapse
It's redundant on the V at least, as it has no door sensor/doesnt care if the back cover is off. I do that all the time to hot swap memory cards.
Even the stock kernel will allow you to remove the door and not complain
Hi, I built a kernel too but based on Venue (4.06) sources.
http://forum.xda-developers.com/showthread.php?p=23544539#post23544539
You can check my sources here :
https://github.com/adridu59/dell-venue-kernel
The Venue codename is 'toucan'.
There are Venue-specific files and I do not know whether they are present in the Streak source you used.
I am developing a CM7 build myself. In fact, things are OK except the fact that the kernel is still stock 408 (things about setting up the working environment is here: http://forum.xda-developers.com/showthread.php?t=1687679).
After being able to build CM7 myself, I will turn back with the kernel issue for 2.3.x. Then, proceed to Android 4 ICS. God bless all of us!

All my compiled kernels cause bootloops

I have been trying unsuccessfully to build the GoogyMax3 and Alucard kernels for my CM11 Samsung Galaxy S4 (I9505). I've tried many different toolchains and followed all the tutorials and threads I can find. I also tried two separate Linux boxes as my compilation machine in case the first had an issue.
The kernel will compile and the .zip is created, but they never work when I flash them with TWRP. So I suspect I'm doing something fundamentally wrong or missing an important step. Is there any way to identify what architecture a kernel has been compiled for? Do toolchains (such as the Christopher83 Linaro ones) require any configuration after git cloning? I think my environment is not correct.
Ultimately I'd just like to compile some additional modules and this is taking me far too much effort without any progress.
I'm having EXACTLY the same problem.
I have tried EVERY tute and guide I can find.
Iv tried different toolchains on different source code, most building fine, but flashing in fastboot or installing a .zip in TWRP results in bootloop, never getting past the splash screen.
I thought it was my install method, I tried varying methods of any kernel, compiling my on boot.img, different zip signing tools, Nothing gets me past the bootloop.
NOTE: Attempting to build Kangaroo Kernel for htc-m7. The best guide for me so far has been http://pete.akeo.ie/2013/10/compiling-and-running-your-own-android.html?m=1 especially after the heading "Crafting an Android Boot.img" where the author supplies a new unmkboot tool that gives you the full set of parameters for compiling your custom boot. img.
Good luck man, if you figure it out let me know, I'll do likewise for you.
I've worked out what I was doing wrong. My ramdisk was invalid. I cloned https://github.com/Alucard24/Ramdisk into the folder the build script for the Alucard kernel was expecting to use and rebuilt the kernel with the 2015.02 Cortex A7-optimised toolchain. This time it worked. So you should be investigating that your ramdisk is correct.
Hmm. Got my ramdisk from (1st time) extracting the boot.img from the .zip file of my rom and (2nd time) a backup of boot. img from my phone using TWRP. I know the parameters I set when re joining ramdisk to my zImage are correct, but it never gets past the splash screen i.e the kernel isn't loading, which suggests to me it is as you say the ramdisk.
I'm wondering if I need to alter the Makefile of my kernel for Christopher's tool chain in any way.??
Thanks for letting me know.
Joeisgood99 said:
Hmm. Got my ramdisk from (1st time) extracting the boot.img from the .zip file of my rom and (2nd time) a backup of boot. img from my phone using TWRP. I know the parameters I set when re joining ramdisk to my zImage are correct, but it never gets past the splash screen i.e the kernel isn't loading, which suggests to me it is as you say the ramdisk.
I'm wondering if I need to alter the Makefile of my kernel for Christopher's tool chain in any way.??
Thanks for letting me know.
Click to expand...
Click to collapse
I didn't have to modify anything for the toolchain. I download and extracted it and then updated the build script. The Alucard script creates the image with this:
./mkbootimg --cmdline 'console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3' --kernel $PACKAGEDIR/zImage --ramdisk $PACKAGEDIR/ramdisk.gz --base 0x80200000 --pagesize 2048 --ramdisk_offset 0x02000000 --output $PACKAGEDIR/boot.img
I have the same problem,
Im learning for making custom kernels and I use for a try working kernel without anychange - only compiling from working source - and... after compiling flash and bootloop - always , flash ziped by another person - works .....

Packing boot image for Desire 610 A3UL

I am following this tutorial on my desire 610: http://http://whiteboard.ping.se/Android/Debian
All has gone well so far, the system works in chroot, etc etc etc, thats not the problem. My problem is that i cant seem to pack a boot image that works for the phone. I know the problem is with my boot image, because if the init script had been initalised, I had a line at the start which would start a log file, and the system would bootloop. Instead it takes me to the fastboot menu when i power on.
I have used the tool to unpack the boot image, found at http://whiteboard.ping.se/Android/Unmkbootimg , and its output was this:
Code:
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 6004624
Kernel address 0x8000
Ramdisk size 1017204
Ramdisk address 0x2008000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x1e00000
Flash page size 2048
Board name is ""
Command line "console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3"
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFE208100
OFF_RAMDISK_ADDR is 0x00208100
OFF_SECOND_ADDR is 0xFF100100
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3' -o new_boot.img
---------------
I have tried doing as it says and compiling mkbootimg with those settings, however it still does not work. Could anyone possibly see what im doing wrong? And if not, does anyone have a copy of mkbootimg that works for the Desire 610?
Thanks in advance
falseascension said:
I am following this tutorial on my desire 610: http://http://whiteboard.ping.se/Android/Debian
All has gone well so far, the system works in chroot, etc etc etc, thats not the problem. My problem is that i cant seem to pack a boot image that works for the phone. I know the problem is with my boot image, because if the init script had been initalised, I had a line at the start which would start a log file, and the system would bootloop. Instead it takes me to the fastboot menu when i power on.
I have used the tool to unpack the boot image, found at http://whiteboard.ping.se/Android/Unmkbootimg , and its output was this:
Code:
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
Kernel size 6004624
Kernel address 0x8000
Ramdisk size 1017204
Ramdisk address 0x2008000
Secondary size 0
Secondary address 0xf00000
Kernel tags address 0x1e00000
Flash page size 2048
Board name is ""
Command line "console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3"
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFE208100
OFF_RAMDISK_ADDR is 0x00208100
OFF_SECOND_ADDR is 0xFF100100
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3' -o new_boot.img
---------------
I have tried doing as it says and compiling mkbootimg with those settings, however it still does not work. Could anyone possibly see what im doing wrong? And if not, does anyone have a copy of mkbootimg that works for the Desire 610?
Thanks in advance
Click to expand...
Click to collapse
I just use Blobtools and linux's standard abootimg. I'll find some links and do a quick Howto when I get home tonight.
MiniBlu
MiniBlu said:
I just use Blobtools and linux's standard abootimg. I'll find some links and do a quick Howto when I get home tonight.
MiniBlu
Click to expand...
Click to collapse
Cheers! looking forward to getting this thing actually working
Aha! Using abootimg made it work. Wish i knew about that earlier...
There's still a few errors though, need to fix that. Thanks for your help, you literally saved probably hours and hours more work if I hadnt known about this. Much appreciated

Kernel compiled from Sony sources won't boot...help

I'm not an active developer but I'm also not a *total* noob -- I've successfully compiled usable kernels for Nexus 4, Moto G, HP TouchPad -- but I'm not making much headway on my Z5C kernel.
I want to run an otherwise stock Sony ROM on my phone, but make a couple of minor tweaks to the kernel. With that in view, I downloaded the source tree from Sony's dev site for the kernel that matches the one that shipped with the ROM I am currently running (at the moment, for Reasons, it's a Lollipop one, and I'm not really interested in debating that point anyway), and then I started by building a kernel with ZERO changes applied first. But it will not boot. Instead, with my first attempt at a kernel compiled from scratch, after the Sony Xperia boot logo and before the boot animation would normally kick in, the screen goes black and the notification LED blinks red 4 times, and then it reboots and starts over (bootloop).
I'm not sure what I am supposed to do to diagnose the problem since the screen doesn't display anything and it never gets far along enough in the boot process to where the USB port is initialized. And, yes, the bootloader is unlocked (I can flash a stock kernel to the phone with the DRM fix applied, and that boots and works just fine).
Here is what I have done so far:
Downloaded the kernel sources that match my ROM's kernel at https://developer.sonymobile.com/do...rchives/open-source-archive-for-32-0-a-6-200/
Downloaded the GCC 4.9 for ARM64 cross-compiler / toolchain from https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/
Applied kitakami_defconfig and suzuran_diffconfig, and built the kernel. It compiled cleanly without any errors.
Extracted kernel.elf from my ROM's kernel.sin, and then unpacked the binary image, initramfs, and device tree blob from that.
Re-packaged a new kernel into .img format for Fastboot flash by substituting in my kernel image binary for the official Sony one, but keeping the original ramdisk and DTB.
Flashed image to boot partition with Fastboot == bootloop
Flashed original kernel back == works fine
Decided to try creating a new DTB instead of reusing the one from the original kernel...but dtbTool spits out this:
Code:
Found file: msm8994-v2.0-kitakami_suzuran_generic.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8994-v2.1-kitakami_suzuran_generic.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Grabbed dtbToolCM from https://github.com/xiaolu/mkbootimg_tools instead, which seems to work.
Substituted in the new DTB image for the original Sony one, repackaged up a new boot.img, flashed that == bootloop
Tested my mkbootimg and the parameters I was using by extracting kernel, ramdisk, and DTB from original kernel.elf, then repackaging them all together into a boot.img and flashing that to the phone with Fastboot == works just fine
Hypothesized that perhaps my kernel didn't like the Sony kernel modules on the system partition because of version magic mismatch, so I changed CONFIG_LOCALVERSION from "-perf" to "-perf-g75e6207" in .config and rebuilt kernel, repackaged, reflashed with Fastboot == bootloop ... ARGH
So at this point, I'm at a loss. I've proven that it's not the way I am packaging up the boot image because if I repack the original Sony kernel binary up with the original ramdisk and DTB and then flash that file to the boot partition, that has no problem booting the phone. Is there some modification that I need to make to the contents of the ramdisk? I'd think I should just be able to use the stock Sony ramdisk unmodified, especially if the kernel itself doesn't differ at all (same sources, same .config) from the one Sony compiled, but...?
Any leads that any experienced Xperia Z-series kernel hackers out there can supply before I end up tearing my hair out would be greatly appreciated.
Thanks so so so much,
-- Nathan
[UPDATE]: Just tried assembling with mkqcdtbootimg instead. No go. Also unpacked the image made by that utility and verified that everything (e.g. offsets, etc.) looked sane. GARGH.
Oh, good grief...I answered my own question.
The version of the compiler has to match EXACTLY with what was used to build the rest of the system. I'm guessing because the compiler version has to match between kernel and kernel modules.
The git repo on googlesource.com that contains the prebuilt arm64 x-chain has been updated since the release of 32.0.A.6.200. Version string for gcc of most recent pull was "4.9.x-google 20150123 (prerelease)", but original kernel binary built by Sony had been compiled by gcc version "4.9.x-google 20140827 (prerelease)".
I finally found a version I could roll back to that contained that version string (commit hash 4b341df712969ca2ac0c3cf6294260d406b9d9be), and it worked.
Hopefully this helps someone else out someday,
-- Nathan
nlra said:
Oh, good grief...I answered my own question.
The version of the compiler has to match EXACTLY with what was used to build the rest of the system. I'm guessing because the compiler version has to match between kernel and kernel modules.
The git repo on googlesource.com that contains the prebuilt arm64 x-chain has been updated since the release of 32.0.A.6.200. Version string for gcc of most recent pull was "4.9.x-google 20150123 (prerelease)", but original kernel binary built by Sony had been compiled by gcc version "4.9.x-google 20140827 (prerelease)".
I finally found a version I could roll back to that contained that version string (commit hash 4b341df712969ca2ac0c3cf6294260d406b9d9be), and it worked.
Hopefully this helps someone else out someday,
-- Nathan
Click to expand...
Click to collapse
I think that cannot be possible. There are lots of kernels out there compiled with toolchains different than the stock one (e.g. Androplus kernel is compiled with UBERTC 4.9)
I am in the same situation as you, but with the Xperia X Compact:
-Untouched copyleft source code
-Untouched ramdisk
-Using AOSP mkbootimg (the new one written in Python: https://android.googlesource.com/platform/system/core/+/nougat-release/mkbootimg/mkbootimg) with arguments specified in README_Xperia (https://github.com/bamsbamx/BMSBMX_kernel_kugo/blob/master/README_Xperia)
And still no boot... I am about to give up on this as I cannot find any other solution...
You can see my build script here for reference: https://github.com/bamsbamx/BMSBMX_kernel_kugo/blob/master/utils/build.sh
bamsbamx said:
I think that cannot be possible.
Click to expand...
Click to collapse
*shrug* I don't know what to tell you. All I know is that I changed one variable at a time, and then when I finally changed the version of the compiler I was using, eureka.
That's not to say that there couldn't have been more than one variable in the equation, and that I happened to knock each pin down one at a time without knowing it. For example, I can tell you that the size of the DTB varied slightly between what dtbToolCM came up with, and what mkqcdbootimg generated, and that the DTB that was generated by mkqcdbootimg was EXACTLY the same size as the one in Sony's official kernel image while dtbToolCM's was not. But changing to mkqcdbootimg alone did not fix my issue.
My theory in the end -- which could be completely wrong -- was that maybe the kernel module version magic includes either part or all of the compiler version string, so until I found the compiler that matched the one that Sony used, the kernel modules that Sony built were unable to load when my kernel was booting. If that wasn't the problem, then maybe there was some other reason the kernel modules couldn't load...maybe a subtle GCC bug that was fixed between the version Sony used and the latest binaries on Google's git server that ended up generating code that is slightly incompatible between binaries produced by the two versions. Or maybe I'm completely cold and it had nothing to do with the kernel modules at all. I guess we will never know unless someone else feels like soldering serial console leads on their Z5's system board, 'cause I sure ain't gonna...
I can tell you that, in the end, I retained all of the following changes, and that with my build environment I no longer have problems producing kernels that will boot a stock Sony ROM:
- I still use what I believe to be the same compiler Sony used
- I still build kernels with CONFIG_LOCALVERSION set to match the exact version string that the stock Sony kernel for my ROM has
- I still continue to use mkqcdbootimg to assemble my DTB + my final image instead of any version of mkbootimg and dtbTool
I haven't tried changing out things other than the GCC version to see if that ends up breaking things again. If I manage to find some spare time to kill in the future, I may do so in order to satisfy my curiosity. If I ever get around to doing that, I'll be sure to update this thread with my results.
FWIW, the Z5 boot image is assembled slightly differently than it appears the X Compact's is for whatever reason. I can tell you, for example, that the Z5's bootloader (at least the stock one...I hear that there is an updated version obtainable through Sony's AOSP program) does not support gzipped kernels. Also, the DTB is assembled and kept separately from the kernel up until the final mkbootimg stage, whereas it appears that the DTB and kernel are concatenated together somehow during the build for the X Compact. The fact that differences like these exist may mean that none of my findings or experiences are necessarily applicable to you and your situation.
I also will note that although you said you are using the Python mkbootimg utility, your build script that you linked to claims otherwise...
Good luck, and if you happen to figure out what the problem ended up being in your case, I'd be very interested to get an update from you!
-- Nathan
nlra said:
*shrug* I don't know what to tell you. All I know is that I changed one variable at a time, and then when I finally changed the version of the compiler I was using, eureka.
That's not to say that there couldn't have been more than one variable in the equation, and that I happened to knock each pin down one at a time without knowing it. For example, I can tell you that the size of the DTB varied slightly between what dtbToolCM came up with, and what mkqcdbootimg generated, and that the DTB that was generated by mkqcdbootimg was EXACTLY the same size as the one in Sony's official kernel image while dtbToolCM's was not. But changing to mkqcdbootimg alone did not fix my issue.
My theory in the end -- which could be completely wrong -- was that maybe the kernel module version magic includes either part or all of the compiler version string, so until I found the compiler that matched the one that Sony used, the kernel modules that Sony built were unable to load when my kernel was booting. If that wasn't the problem, then maybe there was some other reason the kernel modules couldn't load...maybe a subtle GCC bug that was fixed between the version Sony used and the latest binaries on Google's git server that ended up generating code that is slightly incompatible between binaries produced by the two versions. Or maybe I'm completely cold and it had nothing to do with the kernel modules at all. I guess we will never know unless someone else feels like soldering serial console leads on their Z5's system board, 'cause I sure ain't gonna...
I can tell you that, in the end, I retained all of the following changes, and that with my build environment I no longer have problems producing kernels that will boot a stock Sony ROM:
- I still use what I believe to be the same compiler Sony used
- I still build kernels with CONFIG_LOCALVERSION set to match the exact version string that the stock Sony kernel for my ROM has
- I still continue to use mkqcdbootimg to assemble my DTB + my final image instead of any version of mkbootimg and dtbTool
I haven't tried changing out things other than the GCC version to see if that ends up breaking things again. If I manage to find some spare time to kill in the future, I may do so in order to satisfy my curiosity. If I ever get around to doing that, I'll be sure to update this thread with my results.
FWIW, the Z5 boot image is assembled slightly differently than it appears the X Compact's is for whatever reason. I can tell you, for example, that the Z5's bootloader (at least the stock one...I hear that there is an updated version obtainable through Sony's AOSP program) does not support gzipped kernels. Also, the DTB is assembled and kept separately from the kernel up until the final mkbootimg stage, whereas it appears that the DTB and kernel are concatenated together somehow during the build for the X Compact. The fact that differences like these exist may mean that none of my findings or experiences are necessarily applicable to you and your situation.
I also will note that although you said you are using the Python mkbootimg utility, your build script that you linked to claims otherwise...
Good luck, and if you happen to figure out what the problem ended up being in your case, I'd be very interested to get an update from you!
-- Nathan
Click to expand...
Click to collapse
Yeah, sorry about that, I didnt push the new commits to Github yet because of the kernel not booting, the current script I am using is this one:
Code:
#!/bin/bash
RED=1
GREEN=2
BLUE=4
colorPrint() {
tput setaf $2
echo $1
tput sgr0
}
colorPrint "Initializing workspace..." $BLUE
#Device config
device=kugo
#Workspace directories
workdir="$(pwd)"
outputfolder=${workdir}/OUTPUT
outputdir=${outputfolder}/${device}
toolchains=${workdir}/toolchains
ramdisk=${workdir}/ramdisks/${device}/ramdisk
export ARCH=arm64
export CROSS_COMPILE=${toolchains}/aarch64-linux-android-4.9-kernel/bin/aarch64-linux-android-
export KBUILD_DIFFCONFIG=kugo_diffconfig
colorPrint "Cleaning previous builds..." $BLUE
rm -rf $outputdir
mkdir -p $outputdir
colorPrint "Configuring kernel..." $BLUE
make msm-perf_defconfig O=$outputdir
colorPrint "Building kernel..." $BLUE
time make -j8 O=$outputdir 2>&1
if [ ! -f $outputdir/arch/arm64/boot/Image.gz-dtb ]; then
colorPrint "ERROR: kernel image not found. Kernel build failed" $RED
exit 1
fi
if [ ! -e $outputdir/ramdisk.cpio.gz ]; then
colorPrint "ERROR: ramdisk image file not found. Compression failed" $RED
exit 1
fi
colorPrint "Packaging boot image file" $BLUE
${workdir}/utils/mkbootimg \
--kernel $outputdir/arch/arm64/boot/Image.gz-dtb \
--ramdisk $outputdir/ramdisk.cpio.gz \
--base 0x20000000 \
--ramdisk_offset 0x02000000 \
--pagesize 2048 \
--tags_offset 0x01E00000 \
--cmdline "androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 zram.backend=z3fold earlyprintk" \
--output $outputdir/boot.img
if [ ! -f $outputdir/boot.img ]; then
colorPrint "ERROR: boot image file not found. boot packaging failed" $RED
exit 1
fi
colorPrint "DONE" $GREEN
colorPrint "boot image file can be found at ${outputdir}/boot.img" $GREEN
This one is for the build 34.3.A.0.217... However, I already had managed to boot copyleft kernel builds in other versions (such as 34.2.A.0.XXX) using the Github script, the UBERTC 4.9 Toolchain and not changing the GCC version, although I had to set # CONFIG_MODULE_SIG_FORCE is not set There must be something strange here
I think there must be something with kernel files permissions, or... maybe this? https://forum.xda-developers.com/an...signing-boot-images-android-verified-t3600606
@bamsbamx as usual, you have dm verity and sony RIC / security disabled, right ?
also hackery is possible to block modules from loading but since it comes at a later stage that most likely is not responsible for the kernel not booting
As alternative you could try https://github.com/sonyxperiadev/mkqcdtbootimg
Usually the instructions don't work with the copyleft kernel source, some fixes or adjustments are normally needed (at least my experience)
zacharias.maladroit said:
@bamsbamx as usual, you have dm verity and sony RIC / security disabled, right ?
also hackery is possible to block modules from loading but since it comes at a later stage that most likely is not responsible for the kernel not booting
As alternative you could try https://github.com/sonyxperiadev/mkqcdtbootimg
Usually the instructions don't work with the copyleft kernel source, some fixes or adjustments are normally needed (at least my experience)
Click to expand...
Click to collapse
Hi,
Nope, I didnt disable RIC neither dm-verity, the only thing I changed was CONFIG_MODULE_SIG_FORCE to 'is not set'. But I guess that wasnt the cause of kernel not booting since my /system partition is untouched. I tried both with mkqcdtbootimg and mkbootimg but still nothing
Hey @nlra, I figured out the problem (finally). The ramdisk I was using had been extracted from a .elf file (obtained via Flashtool through an .ftf file's kernel.sin). Somehow the extraction from the kernel.elf file is broken (resulting in a 7.0MB ramdisk.cpio.gz file)
I managed to pull up the boot.img from the device (via dd if=/dev/block/mmcplk0p33 of=/sdcard/boot.img) and then extract the ramdisk from it, resulting in a 11.4MB file
Then, I was able to boot it BOTH USING mkqcdtbootimg file and mkbootimg python script from AOSP nougat-release branch
Thats it
bamsbamx said:
The ramdisk I was using had been extracted from a .elf file (obtained via Flashtool through an .ftf file's kernel.sin). Somehow the extraction from the kernel.elf file is broken
Click to expand...
Click to collapse
Nice! Glad you figured out what was going on in your case, and thanks for confirming that both mkqcdbootimg and mkbootimg both work for building the X Compact boot image.
-- Nathan

Building Samsung Open-Source Kernel and disable DEFEX

I'm going to show you how to build a custom kernel, and a custom boot.img.
Requirements
A linux OS
Kernel source code from Samsung
Android Image Kitchen (Required for the SEANDROID metadata it appends automatically)
GCC Cross Compilation Toolchain 4.8 (You may just clone the repo with git, or download a zip)
Hypothetical workspace directory on the filesystem: /workspace, now prepare it like this:
/workspace/kernel - this is where the kernel source code will be, this is what we will build. Extract the downloaded Kernel.tar.gz here
/workspace/build - this is the kernel compilation result, populated by the build
/workspace/toolchain - this is the required cross-compilation toolchain you download or check-out from the google link
/workspace/kitchen - Extract Android Image Kitchen here
Click to expand...
Click to collapse
Go to http://opensource.samsung.com/reception.do and search for SM-J415, download one of the results, extract Kernel.tar.gz to /workspace/kernel. I believe SWA stands for South West Asia, and MAE - Middle-east Africa, it doesn't matter which you pick, it is related to radio regulations.
Now overwrite the file /workspace/kernel/build_kernel.sh with:
Code:
#!/bin/bash
# The cross compilation toolchain path
export TOOLCHAIN=$(pwd)/../toolchain/arm-linux-androideabi-4.8
# This is the directory for the compiled kernel
export OUTDIR="O=$(pwd)/../build"
export PATH=$TOOLCHAIN/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
export THREADS=$(nproc --all)
export COMMON_ARGS="-j$THREADS $OUTDIR arch=arm CFLAGS_MODULE=-fno-pic arch=arm"
if [ "$1" == "build" ]; then
make $COMMON_ARGS j4primelte_sea_open_defconfig
make $COMMON_ARGS
elif [ "$1" == "rebuild" ]; then
make $COMMON_ARGS
elif [ "$1" == "clean" ]; then
make $COMMON_ARGS distclean
make $COMMON_ARGS clean
else
echo "./build_kernel.sh build|rebuild|clean"
fi
Building kernel source code
Run the script:
$ cd /workspace/kernel/
edit: /workspace/kernel/arch/arm/configs/j4primelte_sea_open_defconfig
change CONFIG_SECURITY_DEFEX=y to CONFIG_SECURITY_DEFEX=n
$ bash build_kernel.sh build
It should build normally, if it fails there's something wrong with your OS setup. After a long time, you should see the compiled and compressed kernel with the DTP appended at:
/workspace/target/arch/arm/boot/zImage-dtb
The kernel configuration it created from the defconfig files in the kernel source tree is at
/workspace/target/.config
Build a new boot.img
$ cd /workspace/kitchen
$ bash unpackimg.sh /path/to/a/boot/or/recovery.img
Now you will have the unpacked kernel in: /workspace/kitchen/split_img/boot.img-zImage
Delete it
$ rm split_img/boot.img-zImage
Link the built custom kernel there instead
$ ln -s /workspace/target/arch/arm/boot/zImage-dtb /workspace/kitchen/split_img/boot.img-zImage
Now each time you create the boot.img, it will include your custom kernel instead.
Tweak the files and ramdisk as much as you want, and repackage the boot.img
$ bash repackimg.sh
Now you have a boot.img at /workspace/kitchen/image-new.img that is ready to flash to the device. You can unpack custom recoveries the same way as you unpacked boot.img to make them use your custom kernel.
Kernel configurations tried
CONFIG_SECURITY=n - boot loop
CONFIG_SECURITY_SELINUX=n - boot loop
CONFIG_SECURITY_DEFEX=n - works
CONFIG_DM_VERITY=n - works, does not prevent initramfs from using DM-VERITY, you still need some sort of ramdisk hack to disable verification of the next boot phase after initrd.
Often when editing the defconfig files, the same variables are declared in many different files so you might be better off using "sed' to change the variables, example:
$ grep -lr "CONFIG_SECURITY=y" | while read line; do sed -i 's/CONFIG_SECURITY=y/CONFIG_SECURITY=n/g' $line; done
When running "build_kernel.sh build", it will print "configuration written to .config" so verify that the variable was actually changed in the final config /workspace/build/.config
kapmino269 said:
and I think ,They aren't kernel see
Click to expand...
Click to collapse
No that is the latest kernel source code running on the latest firmware. You can use either of those 2 downloads from opensource.samsung.com
kapmino269 said:
it isn't working .
Click to expand...
Click to collapse
The kernel source code is on the Samsung opensource website.... there are two versions one that is MEA ( for Middle East and Africa roms) and the other one for SWA. It works if compiled properly
kapmino269 said:
ok
i have questions loop device depend on kernel and if it is .
How to add support?
Click to expand...
Click to collapse
It seems it depends on the kernel support but I haven't actually tried messing around that stuff
kapmino269 said:
it isn't working .
Click to expand...
Click to collapse
You need to install gcc, python and make before you run the command bash build_kernel.sh build
sudo apt install gcc make python
kapmino269 said:
I knew steps man I used Ubuntu for 2 years without windows .
thank you .
Click to expand...
Click to collapse
Do you tried make mrproper and make clean before you run build_kernel.sh?
kapmino269 said:
ok
i have questions loop device depend on kernel and if it is .
How to add support?
Click to expand...
Click to collapse
Type "make xconfig" in the kernel directory, and a window will open for configuring the .config file in that same directory.
Search for "Loopback device support" and add a checkmark (not a dot, so that the module is built into the kernel.)
kapmino269 said:
it isn't working .
Click to expand...
Click to collapse
Can you please provide a log or something? It sounds like you are missing dependencies in your operating system for building kernels.
how do you flash the new boot.img with a samsung device?
kapmino269 said:
By twrp
Click to expand...
Click to collapse
Thanks!!
I ended up using https://forum.xda-developers.com/showthread.php?t=2446269 which is pretty easy as well.
I am now stuck on how to enable wifi after flashing a different kernal.
Kernal = samsung opensource
Rom = nouget 7.1.1 (different to opensource kernal)
Any suggestions?
heavy load said:
Thanks!!
I ended up using https://forum.xda-developers.com/showthread.php?t=2446269 which is pretty easy as well.
I am now stuck on how to enable wifi after flashing a different kernal.
Kernal = samsung opensource
Rom = nouget 7.1.1 (different to opensource kernal)
Any suggestions?
Click to expand...
Click to collapse
Install the Magisk module LIBSECURE_STORAGE COMPANION
ashyx said:
Install the Magisk module LIBSECURE_STORAGE COMPANION
Click to expand...
Click to collapse
Thanks Ashyx, I had a play with your kernal on github, nice work there!
I ended up downloading a stock rom matching the samsung opensource kernal build number, worked out of the box.
kapmino269 said:
See that :
@ashyx any help
I NEED TO ADD SOME MODULES.
Click to expand...
Click to collapse
It's telling you the path to the defconfig doesn't exist.
Either the name is wrong or it doesn't exist in the config directory.
kapmino269 said:
This, I solved it yesterday, Thanks .
But I have 2 problems :
1- Device is arm and at bulid_kernel.sh tell me to use toolchain arch64 ,
Which I should Use arm or arm64 ,
I confused as cpu is arm64 .
https://www.qualcomm.com/products/snapdragon/processors/425
Or
Ndk
https://developer.android.com/ndk/downloads/index.html
2- Which command I should write after menuconfig
./build_kernel.sh
Or
make -jX .
Click to expand...
Click to collapse
Just use whichever is in the build script.
You will need to add menuconfig to build_kernel.sh before make or your changes will be lost.
Then run build_kernel.sh
kapmino269 said:
@ashyx ,all is ok .
The error from clang and there is 2 config files .
Fixed and I will test kernel but I have problem when compiling I choose lz4 type ,do U see I should choose another .
Also where is zimage now ,i compiled manually not with build_kernel.sh .
Click to expand...
Click to collapse
You don't need the export arguments which are contradictory anyway, as you have already defined your toolchain and architecture before hand.
Also the boot image does not need to be lz4. The compiler will tell you where the finished zImage is when completed. You should find it in the boot directory of the arm64 directory if you are not using OUT_DIR statements.
kapmino269 said:
Sorry ashyx this is last thing ,
-You told me later that device is arm not arm64 .
In Your twrp thread .
-Also defconfig of device in /arch/arm .
-Arch=arm in build_kernel.sh .
-Gsi system armaonly only work on the device .
-All apps told that device is arm .
I confused ,
Please tell that it is right to use arm64 tool chain .
Or How did U build it ?
By arm64 toolchain or arm toolchain ?
Very Thank U .
Click to expand...
Click to collapse
I was just going by the screen shot you posted. Like I said your commands are contradictory.
You have both arm and arm64 toolchains defined in the same script.
You also have an export statement for arm64 directly under a statement for an arm toolchain.
Not sure why you added both?
As far as I can see the architecture you're compiling for is arm, so you need an arm toolchain.
kapmino269 said:
It contains errors
Click to expand...
Click to collapse
This is the script I use.
You will need to modify the path to your toolchain.
can i use the source code to build kernel for android 10 one ui if the source built for mm

Categories

Resources