• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Kernel][D850|1|2|5/F400/LS990/VS985]Unified Kernel Source repository/compilation

Search This thread

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
Just for developers!

Hey guys and girls,

I fixed and uploaded the stock kernel source for the G3 to my github which other developers can use as base for their kernels or just take it as it is to build their roms, currently the source for the D855, D851, D850, D852, VS985, F400 and LS990 are merged.
As said, it's just the fixed stock source for now!
There is for sure still the bootloader lock problem, but anyways, when this is fixed (which is hopefully soon) this may be helpful for some and it may can speed up things a bit.

There may be some additional things coming, but for now, that's it.

Have fun.

Repository

https://github.com/tectas/android_kernel_lge_msm8974ac

Changelog

14.08.2014
  • include/asm-generic: Change per_cpu_offset to take last element of array instead of returning 0 if out of bounds
  • firmware: Fix to compile prebuild firmware only once

13.08.2014
  • kernel: quick fix
  • Fix -Warray-bounds warnings
  • Makefile: reenable -Wframe-larger-than
  • Makefile: ifeq y instead of ifdef at CONFIG_CC_OPTIMIZE_SPEED and CONFIG_CC_OPTIMZE_DEFAULT
  • init/Kconfig: Removed CC_OPTIMIZE_SIZE (default now) and added CC_OPTIMIZE_SPEED and CC_OPTIMIZE_DEFAULT
  • arch/sh/lib|arch/title:Changes for CC_OPTIMIZE_SPEED and CC_OPTIMIZE_DEFAULT

12.08.2014
  • arch/arm/mach-msm|fs|ipc|kernel|mm: fix uninitialized warnings
  • arch/arm/configs: CONFIG_FRAME_WARN added, CONFIG_CC_OPTIMIZE_SPEED disabled
  • Makefile: Options for -O3, -O2 and -Os added
  • Makefile: Disabled warnigs for array-bounds and uninitialized
  • Makefile: linaro build optimizations
  • Makefile: started to add flags for -O3 linaro builds
  • net: bluetooth: linaro fix
  • drivers: cpufreq: Fixes for linaro at interactive governor

11.08.2014
  • Fix Compiling Firmware
  • Cleanup of generated files
  • Reset of CONFIG_NF_CONNTRACK_SIP to default value
  • dtsi fix for VS985
  • Changes for D852
  • Changes for VS985
  • Changed CONFIG_NF_CONNTRACK_SIP to default value
  • Changes for F400

...

Full list of commits can be found here

Currently supported devices

  • D855
  • D851
  • D850
  • LS990
  • F400
  • VS985
  • D852

Bugs

  • You tell me

Toolchain

Currently just the default android toolchain is officially supported, but it should work with others fine as well, if not, just tell me and i will fix it for the given toolchain.

Credits

 
Last edited:

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
How to compile

Preperation

Check out aosp source and switch to it's directory (https://source.android.com/source/downloading.html)

In the terminal:
Code:
mkdir -p kernel/lge/msm8974ac
cd kernel/lge/msm8974ac
git clone https://github.com/tectas/android_kernel_lge_msm8974ac.git -b kitkat .

Compilation

All Variants

Code:
export PATH=$PATH:tools/lz4demo

D855

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-global_com-perf_defconfig zImage-dtb -j4


D851

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-tmo_us-perf_defconfig zImage-dtb -j4

D850

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-att-perf_defconfig zImage-dtb -j4

LS990

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-spr_us-perf_defconfig zImage-dtb -j4

F400

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-lgu-perf_defconfig zImage-dtb -j4

VS985

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-vzw-perf_defconfig zImage-dtb -j4

D852

Code:
make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-bell-perf_defconfig zImage-dtb -j4

Wait till it compiled

The resulting dtb zImage can be found at arch/arm/boot and is named zImage-dtb

Any suggestions for improvement? Feel free to comment :)
 
Last edited:

sooti

Recognized Developer
Jan 26, 2012
2,468
6,685
Now we just need a device config for D855 and let the CM game begin :D

BTW the bootloader may not be the biggest issue, the flashing of the rom may be able to be done using the tethered TWRP that was released.
 
  • Like
Reactions: robto

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
Now we just need a device config for D855 and let the CM game begin :D

BTW the bootloader may not be the biggest issue, the flashing of the rom may be able to be done using the tethered TWRP that was released.

The flashing of the rom, yes, the boot.img is the problem i guess (and without proper kernel and ramdisk no aosp rom will work). It can be flashed as well, but if it doesn't match the stock one, the bootloader throws a security exception when you try to boot from it. At least that's what I faced, when i tried to boot up TWRP which I directly flashed to my device instead of temporarly booting it, so, I guess it's the same with the kernel.
 
Last edited:

sooti

Recognized Developer
Jan 26, 2012
2,468
6,685
The flashing of the rom, yes, the boot.img is the problem i guess (and without proper kernel and ramdisk no aosp rom will work). It can be flashed as well, but if it doesn't match the stock one, the bootloader throws a security exception when you try to boot from it. At least that's what I faced, when i tried to flash TWRP directly to my device instead of just temporarly booting it, so, I guess it's the same with the kernel.

This is true, I work with LG and they sent the company I work for a tool that loads code into the bootloader allowing unsigned code to run (we need it since we run vitual environments), I wonder if this tool is only for the LG device we test it on (can't tell you the model) or can be used on any device,
it allows fastboot to write code to kernel + bootloader, something that always fails with the default tot without this app.


I will test it on my g3, hope it doesn't brick it, if it doesn't on one hand this may be the key to unlock and develop ROMs, on the other hand since the software is company property that could get me fired, I won't be able to release it to everyone, maybe if I understand how it works, if it works at all on the g3, I can develop my own tool, but this is all wishful thinking.

EDIT: the special file that is loaded into the app (you choose a file, I think it overides bootloader security chain certificate), just causes the app to crash on the G3, so no luck there unless I get this file from LG (we are not working on the G3 at this time in my company), so no hope with that, but there is a way obviously since this app without root is able to bypass bootloader (it shows a warning about security on the bootloader after)
 
Last edited:

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
This is true, I work with LG and they sent the company I work for a tool that loads code into the bootloader allowing unsigned code to run (we need it since we run vitual environments), I wonder if this tool is only for the LG device we test it on (can't tell you the model) or can be used on any device,
it allows fastboot to write code to kernel + bootloader, something that always fails with the default tot without this app.


I will test it on my g3, hope it doesn't brick it, if it doesn't on one hand this may be the key to unlock and develop ROMs, on the other hand since the software is company property that could get me fired, I won't be able to release it to everyone, maybe if I understand how it works, if it works at all on the g3, I can develop my own tool, but this is all wishful thinking.

Well, then good luck, if you need someone to test, I happily will :)
I wanted to get my device unlocked through jtag in a shop (but unfortunately I haven't found one owning a board in my city yet), with it, it shouldn't be the problem and in theory it should be possible to flash those images at least with dd afterwards on to other d855 when I pull them from my device. With comparing the locked and unlocked bootloader images through a hexeditor it may could even be possible to find an unlock for other variants, but that's all theory for now as well.
 
Last edited:

sooti

Recognized Developer
Jan 26, 2012
2,468
6,685
Well, then good luck, if you need someone to test, I happily will :)
I wanted to get my device unlocked through jtag in a shop (but unfortunately I haven't found one owning a board in my city yet), with it, it shouldn't be the problem and in theory it should be possible to flash those images at least with dd afterwards on to other d855 when I pull them from my device. With comparing the locked and unlocked bootloader images through a hexeditor it may could even be possible to find an unlock for other variants, but that's all theory for now as well.

I don't think a jtag will unlock the bootloader as it is not a hard lock, its a security check that runs at boot, you'd need a bootloader image that bypasses the security check, flashing an unlocked bootlader is not the problem, its getting one that is the problem.

jtag is only useful in hard bricks of a device where the bootloader is bad. i could be wrong though.
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
I don't think a jtag will unlock the bootloader as it is not a hard lock, its a security check that runs at boot, you'd need a bootloader image that bypasses the security check, flashing an unlocked bootlader is not the problem, its getting one that is the problem.

jtag is only useful in hard bricks of a device where the bootloader is bad. i could be wrong though.

Sure it's "just" a security check, but there should be a flag at the bootloader indicating if it should be used or not (at least any watchdog I know of can be turned off in some way and this is basically just a watchdog), with jtag you're able to access the bootloader as you would with a serial port and you can get and set the variables of the bootloader, so when you find the fitting flag you should be able to turn it off, but as said, that's just theory for now.

Sent from my LG-D855
 
Last edited:

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
Just as notification, i've changed the repository name to reflect what i'm trying to achive with it.
I'm also working on including the other variants at the repository, D851 is allready added, but not finished yet, i've already updated the guide with the commands to compile for the d851.
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
can't we make a cm kernel like the lg g2 (kitkat bootloader)kernel, I mean just build a cm kernel on top af the stock one so that the security doesn't get triggered nevermind lg has caved in they are releasing an bootloader unlock soon

http://forum.xda-developers.com/showpost.php?p=54691624&postcount=1

Can't tell, I must confess, but can take a look at it. For now it is still possible to use custom kernels, when you boot it through fastboot, what for sure is far from being optimal, but at least something.
Hopefully lg won't wait too long till the unlock is released.

Sent from my LG-D855
 

jpeps3

Senior Member
Apr 5, 2011
703
67
Stock kernal for d851 please

---------- Post added at 11:50 PM ---------- Previous post was at 10:55 PM ----------

Can please. Add fast charger
 

badtzo

Senior Member
Dec 8, 2010
403
96
Mexico city
I have a question....

If I have a D855P model (Telcel Mexico) and I actually have tested TWRP for D855, rom SphinX G3 Neo V2.0 for D855 both of them with success and my stock build.prop says

ro.build.id=KVT49L
ro.product.model=LG-D855
ro.product.brand=lge
ro.product.name=g3_global_com
ro.product.device=g3
ro.product.board=MSM8974
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.board.platform=msm8974
ro.build.description=g3_global_com-user 4.4.2 KVT49L 1401998873 release-keys
ro.build.fingerprint=lge/g3_global_com/g3:4.4.2/KVT49L/1401998873:user/release-keys

Does it mean that I can flash the custom D855 kernels when available??
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
I have a question....

If I have a D855P model (Telcel Mexico) and I actually have tested TWRP for D855, rom SphinX G3 Neo V2.0 for D855 both of them with success and my stock build.prop says



Does it mean that I can flash the custom D855 kernels when available??

Yes, you can :)

Sent from my LG-D855
 
  • Like
Reactions: badtzo

helikido

Senior Member
Oct 23, 2010
613
99
Hey Tectas how hard would it be to enable over clocking and underclocking on the d851 since it has an unlocked bootloader?
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
Hey Tectas how hard would it be to enable over clocking and underclocking on the d851 since it has an unlocked bootloader?

Not really that hard, but it got nothing to do with the bootloader, that's just a kernel thing, because of the unlocked bootloader you're just able to successfully flash and use a custom kernel permanently and not just temporarily over fastboot (if you try it at a locked bootloader it won't boot).

Sent from my LG-D855
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 42
    Just for developers!

    Hey guys and girls,

    I fixed and uploaded the stock kernel source for the G3 to my github which other developers can use as base for their kernels or just take it as it is to build their roms, currently the source for the D855, D851, D850, D852, VS985, F400 and LS990 are merged.
    As said, it's just the fixed stock source for now!
    There is for sure still the bootloader lock problem, but anyways, when this is fixed (which is hopefully soon) this may be helpful for some and it may can speed up things a bit.

    There may be some additional things coming, but for now, that's it.

    Have fun.

    Repository

    https://github.com/tectas/android_kernel_lge_msm8974ac

    Changelog

    14.08.2014
    • include/asm-generic: Change per_cpu_offset to take last element of array instead of returning 0 if out of bounds
    • firmware: Fix to compile prebuild firmware only once

    13.08.2014
    • kernel: quick fix
    • Fix -Warray-bounds warnings
    • Makefile: reenable -Wframe-larger-than
    • Makefile: ifeq y instead of ifdef at CONFIG_CC_OPTIMIZE_SPEED and CONFIG_CC_OPTIMZE_DEFAULT
    • init/Kconfig: Removed CC_OPTIMIZE_SIZE (default now) and added CC_OPTIMIZE_SPEED and CC_OPTIMIZE_DEFAULT
    • arch/sh/lib|arch/title:Changes for CC_OPTIMIZE_SPEED and CC_OPTIMIZE_DEFAULT

    12.08.2014
    • arch/arm/mach-msm|fs|ipc|kernel|mm: fix uninitialized warnings
    • arch/arm/configs: CONFIG_FRAME_WARN added, CONFIG_CC_OPTIMIZE_SPEED disabled
    • Makefile: Options for -O3, -O2 and -Os added
    • Makefile: Disabled warnigs for array-bounds and uninitialized
    • Makefile: linaro build optimizations
    • Makefile: started to add flags for -O3 linaro builds
    • net: bluetooth: linaro fix
    • drivers: cpufreq: Fixes for linaro at interactive governor

    11.08.2014
    • Fix Compiling Firmware
    • Cleanup of generated files
    • Reset of CONFIG_NF_CONNTRACK_SIP to default value
    • dtsi fix for VS985
    • Changes for D852
    • Changes for VS985
    • Changed CONFIG_NF_CONNTRACK_SIP to default value
    • Changes for F400

    ...

    Full list of commits can be found here

    Currently supported devices

    • D855
    • D851
    • D850
    • LS990
    • F400
    • VS985
    • D852

    Bugs

    • You tell me

    Toolchain

    Currently just the default android toolchain is officially supported, but it should work with others fine as well, if not, just tell me and i will fix it for the given toolchain.

    Credits

    9
    How to compile

    Preperation

    Check out aosp source and switch to it's directory (https://source.android.com/source/downloading.html)

    In the terminal:
    Code:
    mkdir -p kernel/lge/msm8974ac
    cd kernel/lge/msm8974ac
    git clone https://github.com/tectas/android_kernel_lge_msm8974ac.git -b kitkat .

    Compilation

    All Variants

    Code:
    export PATH=$PATH:tools/lz4demo

    D855

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-global_com-perf_defconfig zImage-dtb -j4


    D851

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-tmo_us-perf_defconfig zImage-dtb -j4

    D850

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-att-perf_defconfig zImage-dtb -j4

    LS990

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-spr_us-perf_defconfig zImage-dtb -j4

    F400

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-lgu-perf_defconfig zImage-dtb -j4

    VS985

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-vzw-perf_defconfig zImage-dtb -j4

    D852

    Code:
    make ARCH=arm CROSS_COMPILE=../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi- g3-bell-perf_defconfig zImage-dtb -j4

    Wait till it compiled

    The resulting dtb zImage can be found at arch/arm/boot and is named zImage-dtb

    Any suggestions for improvement? Feel free to comment :)
    7
    Glad to see you are here too, couldn't wait to see a SD kernel for G3. ??

    Sent from my LG-D855 using XDA Premium 4 mobile app

    Yep, kernel and ROM are coming soon ;) already in testing!
    5
    The flashing of the rom, yes, the boot.img is the problem i guess (and without proper kernel and ramdisk no aosp rom will work). It can be flashed as well, but if it doesn't match the stock one, the bootloader throws a security exception when you try to boot from it. At least that's what I faced, when i tried to flash TWRP directly to my device instead of just temporarly booting it, so, I guess it's the same with the kernel.

    This is true, I work with LG and they sent the company I work for a tool that loads code into the bootloader allowing unsigned code to run (we need it since we run vitual environments), I wonder if this tool is only for the LG device we test it on (can't tell you the model) or can be used on any device,
    it allows fastboot to write code to kernel + bootloader, something that always fails with the default tot without this app.


    I will test it on my g3, hope it doesn't brick it, if it doesn't on one hand this may be the key to unlock and develop ROMs, on the other hand since the software is company property that could get me fired, I won't be able to release it to everyone, maybe if I understand how it works, if it works at all on the g3, I can develop my own tool, but this is all wishful thinking.

    EDIT: the special file that is loaded into the app (you choose a file, I think it overides bootloader security chain certificate), just causes the app to crash on the G3, so no luck there unless I get this file from LG (we are not working on the G3 at this time in my company), so no hope with that, but there is a way obviously since this app without root is able to bypass bootloader (it shows a warning about security on the bootloader after)
    5
    Is interactive the default gov? That's super weird for on demand not to work as its generally the best for balance of performance and battery life. Interactive has horrible battery life and ime is laggy. I wouldnt be surprised tho, this kernel source is horrible.. :/

    Interactive is the default governor for many devices since jellybean. On demand has better battery life, but interactive is more responsive.
    For my opinion the source isn't as bad, Sammy did worse, at least at the s3.

    -----------

    Added a new branch to the repository, it's the same as the default branch, except that I added ioscheduler (default is set to vr) and voltage control, will maybe add some additional stuff within the next days and release it in another thread, just to your knowledge, to those interested.

    Sent from my LG-D855