• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Compiling kernel v20a (lollipop) LG ms395

Incakola

Android Enthusiast
Nov 1, 2012
537
183
Lake Worth, FL
This is probably more tuned for xda but I was hoping I catch a dev's attention here. Basically LG released some source files (vendors, kernel, etc.) for lollipop v20a and I'm not even sure an OTA has come out for you guys who are still on LG stock. I tried to compile the source files with NDK but I get errors. I managed to get the default config for e2nam and made a menuconfig but I get a vague error message.

My setup is fedora 21 64-bit with the supposed packages . Using 32-bit ndk files. Used toolchain arm-linux-androideabi-4.6 for this.

Code:
[root@localhost kernel]# make e2nam_mpcs_us_defconfig ARCH=arm
arch/arm/configs/e2nam_mpcs_us_defconfig:533:warning: override: reassigning to symbol IP_MULTICAST
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
#
# configuration written to .config
#
[root@localhost kernel]# make menuconfig ARCH=arm
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
#
# configuration written to .config
#


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[root@localhost kernel]# make -j5 ARCH=arm
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
include/config/auto.conf:203:warning: symbol value 'elf64-x86-64' invalid for OUTPUT_FORMAT
include/config/auto.conf:297:warning: symbol value 'arch/x86/configs/x86_64_defconfig' invalid for ARCH_DEFCONFIG
include/config/auto.conf:656:warning: symbol value '-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11' invalid for ARCH_HWEIGHT_CFLAGS
warning: (SND_SOC_MSM8226) selects DOLBY_DAP which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_MSM8974)
  CHK     include/linux/version.h
objcopy: '.ihex': No such file
  CHK     include/generated/utsrelease.h
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/genksyms/genksyms.o
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/genksyms/parse.tab.o
  CC      scripts/mod/empty.o
make[1]: 'include/generated/mach-types.h' is up to date.
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/mod/mk_elfconfig
  HOSTLD  scripts/genksyms/genksyms
  HOSTCC  scripts/dtc/flattree.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/util.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/dtc/dtc
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTLD  scripts/mod/modpost
  CC      init/main.o
  CHK     include/generated/compile.h
  CC      init/do_mounts.o
  HOSTCC  usr/gen_init_cpio
  CC      arch/arm/vfp/vfpmodule.o
  CC      init/do_mounts_rd.o
  GEN     usr/initramfs_data.cpio
  AS      arch/arm/vfp/entry.o
  AS      usr/initramfs_data.o
  AS      arch/arm/vfp/vfphw.o
  CC      arch/arm/vfp/vfpsingle.o
  LD      usr/built-in.o
  CC      init/do_mounts_initrd.o
  CC      arch/arm/kernel/elf.o
  CC      init/calibrate.o
  CC      init/initramfs.o
  CC      init/version.o
  LD      init/mounts.o
  CC      arch/arm/mm/dma-mapping.o
  AS      arch/arm/kernel/entry-armv.o
  AS      arch/arm/kernel/entry-common.o
  CC      arch/arm/vfp/vfpdouble.o
  CC      arch/arm/common/gic.o
  CC      arch/arm/kernel/irq.o
  LD      init/built-in.o
  LD      arch/arm/net/built-in.o
  CC      arch/arm/mm/extable.o
  CC      arch/arm/kernel/opcodes.o
  CC      arch/arm/kernel/process.o
  CC      arch/arm/mm/fault.o
  CC      arch/arm/kernel/ptrace.o
  LD      arch/arm/vfp/vfp.o
  LD      arch/arm/vfp/built-in.o
  CC      arch/arm/common/cpaccess.o
  CC      arch/arm/mach-msm/io.o
  CC      arch/arm/mach-msm/dma.o
  LD      arch/arm/common/built-in.o
  CC      arch/arm/mm/init.o
  CC      arch/arm/mm/iomap.o
  CC      arch/arm/kernel/return_address.o
  CC      arch/arm/kernel/sched_clock.o
arch/arm/kernel/return_address.c:62:2: warning: #warning "TODO: return_address should use unwind tables" [-Wcpp]
  CC      arch/arm/mm/fault-armv.o
  CC      arch/arm/kernel/setup.o
  CC      arch/arm/kernel/signal.o
  CC      arch/arm/mm/flush.o
  CC      arch/arm/mach-msm/memory.o
  CC      arch/arm/mach-msm/clock.o
  CC      arch/arm/kernel/stacktrace.o
  CC      arch/arm/mm/idmap.o
  CC      arch/arm/mach-msm/clock-voter.o
  CC      arch/arm/mm/ioremap.o
  CC      arch/arm/kernel/sys_arm.o
  CC      arch/arm/kernel/time.o
  CC      arch/arm/mm/mmap.o
  CC      arch/arm/mach-msm/clock-dummy.o
  CC      arch/arm/mach-msm/clock-generic.o
  CC      arch/arm/mm/pgd.o
  CC      arch/arm/mm/mmu.o
  CC      arch/arm/mm/vmregion.o
  CC      arch/arm/kernel/traps.o
  CC      arch/arm/mm/proc-syms.o
  CC      arch/arm/mm/alignment.o
  CC      arch/arm/mach-msm/modem_notifier.o
  CC      arch/arm/mm/highmem.o
  CC      arch/arm/mach-msm/nohlt.o
  CC      arch/arm/mach-msm/board-dt.o
  AS      arch/arm/mm/abort-ev7.o
  CC      arch/arm/kernel/cpuidle.o
  AS      arch/arm/mm/pabort-v7.o
  CC      arch/arm/mach-msm/clock-debug.o
  CC      arch/arm/kernel/armksyms.o
  CC      arch/arm/mach-msm/acpuclock.o
  AS      arch/arm/mm/cache-v7.o
  CC      arch/arm/mm/copypage-v6.o
  CC      arch/arm/mach-msm/clock-a7.o
  CC      arch/arm/mm/context.o
  CC      arch/arm/kernel/module.o
  AS      arch/arm/mm/tlb-v7.o
  AS      arch/arm/mm/proc-v7.o
  CC      arch/arm/mach-msm/perf_trace_counters.o
  CC      arch/arm/mach-msm/perf_debug.o
  AS      arch/arm/mach-msm/headsmp.o
  LD      arch/arm/mm/built-in.o
  CC      arch/arm/mach-msm/platsmp.o
  CC      arch/arm/perfmon/perf-function-hooks.o
  AS      arch/arm/kernel/sleep.o
  CC      arch/arm/mach-msm/hotplug.o
  CC      arch/arm/kernel/suspend.o
  AS      arch/arm/mach-msm/idle-v7.o
  CC      arch/arm/mach-msm/smd.o
  CC      kernel/fork.o
  CC      arch/arm/mach-msm/smd_debug.o
  LD      arch/arm/perfmon/built-in.o
  CC      arch/arm/mach-msm/remote_spinlock.o
  CC      arch/arm/kernel/smp.o
/tmp/cc7EE4ue.s: Assembler messages:
/tmp/cc7EE4ue.s:167: Warning: swp{b} use is deprecated for this architecture
/tmp/cc7EE4ue.s:194: Warning: swp{b} use is deprecated for this architecture
  CC      arch/arm/mach-msm/smd_private.o
  CC      arch/arm/mach-msm/smem.o
  CC      arch/arm/kernel/smp_tlb.o
  CC      arch/arm/mach-msm/smd_init_dt.o
  CC      arch/arm/kernel/smp_scu.o
arch/arm/mach-msm/smd_init_dt.c:24:25: fatal error: smd_private.h: No such file or directory
compilation terminated.
scripts/Makefile.build:307: recipe for target 'arch/arm/mach-msm/smd_init_dt.o' failed
make[1]: *** [arch/arm/mach-msm/smd_init_dt.o] Error 1
make[1]: *** Waiting for unfinished jobs....
  CC      arch/arm/kernel/arch_timer.o
  CC      arch/arm/kernel/unwind.o
  CC      kernel/exec_domain.o
  CC      kernel/panic.o
  CC      arch/arm/kernel/devtree.o
  CC      arch/arm/kernel/swp_emulate.o
  CC      kernel/printk.o
Makefile:950: recipe for target 'arch/arm/mach-msm' failed
make: *** [arch/arm/mach-msm] Error 2
make: *** Waiting for unfinished jobs....
  CC      arch/arm/kernel/hw_breakpoint.o
  CC      arch/arm/kernel/pmu.o
  CC      kernel/cpu.o
  CC      arch/arm/kernel/perf_event.o
  CC      arch/arm/kernel/topology.o
  CC      arch/arm/kernel/io.o
  AS      arch/arm/kernel/head.o
  CC      kernel/exit.o
  CC      arch/arm/kernel/init_task.o
  LDS     arch/arm/kernel/vmlinux.lds
  CC      kernel/itimer.o
  TIMEC   kernel/timeconst.h
defined(@array) is deprecated at kernel/timeconst.pl line 373.
    (Maybe you should just omit the defined()?)
  CC      kernel/softirq.o
  CC      kernel/resource.o
  CC      kernel/sysctl.o
  LD      arch/arm/kernel/built-in.o
  CC      kernel/sysctl_binary.o
  CC      kernel/capability.o
  CC      kernel/ptrace.o
  CC      kernel/timer.o
  CC      kernel/user.o
  CC      kernel/signal.o
  CC      kernel/sys.o
  CC      kernel/kmod.o
  CC      kernel/workqueue.o
  CC      kernel/pid.o
  CC      kernel/rcupdate.o
  CC      kernel/extable.o
  CC      kernel/params.o
  CC      kernel/posix-timers.o
  CC      kernel/kthread.o
  CC      kernel/wait.o
  CC      kernel/kfifo.o
  CC      kernel/sys_ni.o
  CC      kernel/posix-cpu-timers.o
  CC      kernel/mutex.o
  CC      kernel/hrtimer.o
  CC      kernel/rwsem.o
  CC      kernel/nsproxy.o
  CC      kernel/srcu.o
  CC      kernel/semaphore.o
  CC      kernel/notifier.o
  CC      kernel/ksysfs.o
  CC      kernel/cred.o
  CC      kernel/async.o
  CC      kernel/range.o
  CC      kernel/groups.o
  CC      kernel/events/core.o
  CC      kernel/irq/irqdesc.o
  CC      kernel/power/qos.o
  CC      kernel/sched/core.o
  CC      kernel/time/timekeeping.o
  CC      kernel/irq/handle.o
  CC      kernel/power/main.o
  CC      kernel/irq/manage.o
  CC      kernel/time/ntp.o
  CC      kernel/power/process.o
  CC      kernel/time/clocksource.o
  CC      kernel/irq/spurious.o
  CC      kernel/power/suspend.o
  CC      kernel/time/jiffies.o
  CC      kernel/irq/resend.o
  CC      kernel/irq/chip.o
  CC      kernel/events/ring_buffer.o
  CC      kernel/time/timer_list.o
  CC      kernel/power/autosleep.o
  CC      kernel/events/callchain.o
  CC      kernel/power/wakelock.o
  CC      kernel/time/timecompare.o
  CC      kernel/irq/dummychip.o
  CC      kernel/power/poweroff.o
  CC      kernel/time/timeconv.o
  CC      kernel/events/hw_breakpoint.o
  LD      kernel/power/built-in.o
  CC      kernel/irq/devres.o
  CC      kernel/trace/trace_clock.o
  CC      kernel/time/posix-clock.o
  CC      kernel/irq/autoprobe.o
  CC      kernel/trace/ring_buffer.o
  LD      kernel/events/built-in.o
  CC      kernel/time/clockevents.o
  CC      kernel/freezer.o
  CC      kernel/irq/irqdomain.o
  CC      kernel/time/tick-common.o
  CC      kernel/irq/proc.o
  CC      kernel/irq/pm.o
  CC      kernel/sched/clock.o
  CC      kernel/time/tick-broadcast.o
  LD      kernel/irq/built-in.o
  CC      kernel/trace/trace.o
  CC      kernel/sched/idle_task.o
  CC      kernel/profile.o
  CC      kernel/sched/fair.o
  CC      kernel/time/tick-oneshot.o
  CC      kernel/trace/trace_output.o
  CC      kernel/time/tick-sched.o
  CC      kernel/stacktrace.o
  CC      kernel/time/timer_stats.o
  CC      kernel/futex.o
  CC      kernel/trace/trace_stat.o
  LD      kernel/time/built-in.o
  CC      kernel/rtmutex.o
  CC      kernel/sched/rt.o
  CC      kernel/trace/trace_printk.o
  CC      kernel/trace/trace_sched_switch.o
  CC      kernel/smp.o
  CC      kernel/spinlock.o
  CC      kernel/trace/trace_nop.o
  CC      kernel/trace/blktrace.o
  CC      kernel/uid16.o
  CC      kernel/trace/trace_events.o
  CC      kernel/sched/stop_task.o
  CC      kernel/module.o
  CC      kernel/trace/trace_export.o
  CC      kernel/sched/sched_avg.o
  CC      kernel/kallsyms.o
  CC      kernel/sched/cpupri.o
  CC      kernel/trace/trace_event_perf.o
  CC      kernel/sched/stats.o
  CC      kernel/cgroup.o
  CC      kernel/trace/trace_events_filter.o
  CC      kernel/sched/debug.o
  CC      kernel/cgroup_freezer.o
  CC      kernel/res_counter.o
  LD      kernel/sched/built-in.o
  CC      kernel/stop_machine.o
  CC      kernel/trace/power-traces.o
  CC      kernel/trace/rpm-traces.o
  CC      kernel/audit.o
  CC      kernel/auditfilter.o
  CC      kernel/auditsc.o
  LD      kernel/trace/built-in.o
  CC      kernel/audit_watch.o
  CC      kernel/audit_tree.o
  CC      kernel/rcutree.o
  CC      kernel/relay.o
  CC      kernel/utsname_sysctl.o
  CC      kernel/tracepoint.o
  CC      kernel/elfcore.o
  CC      kernel/irq_work.o
  CC      kernel/cpu_pm.o
  CC      kernel/time.o
  LD      kernel/built-in.o
 
I am also struggling with building the kernel from the source but I am making a slow progress.
I am going to jot down stuff I found here so feel free to edit / comment.


It seems like either you have incorrect CONFIG file or incorrect TOOLCHAIN.

1. Instead of using default NDK, try to use DoomLord's mini Tool Chain version.
Type this command @ your kernel's root folder

git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains

Assuming you installed modified tool chain under root directory of kernel type below.

(X) Don't use 4.6.2.... it seems like it creates more errors...
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-

(O) Try 4.7 or 4.8
export CROSS_COMPILE=~/android/kernel/toolchains/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-

2. Go to kernel/arch/arm/configs to find various config files.
Find e2nam_mpcs_us_defconfig
Copy this file to your kernel's root folder (/kernel )

3. type make e2nam_mpcs_us_defconfig
4. type make menuconfig
5. type make -j1


Use -j1 to catch the error message. Once you see success result, you can increase the core#.



PS1) What are all these file not found errors... not sure if my environment is wrong but if you see file/directory not found errors, replace <> with ""

Before compile open up /kernel/arch/arm/mach-msm/smd_init_dt.c
Replace #include <smd_private.h> to #include "smd_private.h"

Ps2)
Go to /kernel/drivers/misc/tspdrv/tspdrv.c
Replace #include <tspdrv.h> to #include "tspdrv.h"
Replace ...... to #include "ImmVibeSPI.c"
#include "tspdrvOutputDataHandler.c"
#include "VibeOSKernelLinuxHRTime.c"

Ps3)
kernel/sound/soc/msm.msm8226.c
LN#35 - include "qdsp6v2/msm-pcm-routing-v2.h"

Ps4)
kernel/sound/soc/msm/qdsp6v2
LN#29 - #include "q6voice.h"

Ps5)
/kernel/kernel/printk.c
LN#47 - #include "mach/msm_rtb.h"
Copy /kernel/arch/arm/mach-msm/include/mach folder to /kernel/kernel

Ps6)
Remove /kernel/firmware/melfas - compile error, save it somewhere else just in case
 
Last edited:
  • Like
Reactions: Incakola
Upvote 0
any updates on this project? I cannot successfully build this kernel either -_-

Not much.. I am actually trying to compile KK Kernel / ROM at this moment, KK source has little more detail actually.
LG removed Lollipop link from their website so... not sure if it's even reliable source or not. They might upload accidentally?
 
Upvote 0
Edit: forgot to say this was kk source that I was attempting to compile.

Well I'm reporting again with my failures. Started again but with ubuntu 15.04 and checked source code that needed to be switched from template (< >) to local (' ') and they were already fixed to what Bard mentioned (except copying mach to kernel/kernel).

Almost compiled after cleaning and mrproper:
Code:
...
LD  vmlinux.o
MODPOST vmlinux.o
ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
/home/dm/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
make[1]: *** [vmlinux.o] Error 1
Makefile:936: recipe for target 'vmlinux.o' failed
make: *** [vmlinux.o] Error 2

I've tried compiling with the no error on mis and it's still a no go.

Second try using 4.8
Code:
...  
CC net/bluetooth/hci_conn.o
net/bluetooth/hci_conn.c: In function 'hci_le_ltk_reply':
net/bluetooth/hci_conn.c:407:28: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type '__u8 *' as the destination; expected '__u8' or an explicit length [-Wsizeof-pointer-memaccess]
error, forbidden warning: hci_conn.c:407
scripts/Makefile.build:307: recipe for target 'net/bluetooth/hci_conn.o' failed
make[2]: *** [net/bluetooth/hci_conn.o] Error 1
scripts/Makefile.build:443: recipe for target 'net/bluetooth' failed
make[1]: *** [net/bluetooth] Error 2
Makefile:950: recipe for target 'net' failed
make: *** [net] Error 2
 
Last edited:
  • Like
Reactions: jplsteel
Upvote 0
Well I'm reporting again with my failures. Started again but with ubuntu 15.04 and checked source code that needed to be switched from template (< >) to local (' ') and they were already fixed to what Bard mentioned (except copying mach to kernel/kernel).

Almost compiled after cleaning and mrproper:
Code:
...
LD  vmlinux.o
MODPOST vmlinux.o
ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
/home/dm/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
make[1]: *** [vmlinux.o] Error 1
Makefile:936: recipe for target 'vmlinux.o' failed
make: *** [vmlinux.o] Error 2

I've tried compiling with the no error on mis and it's still a no go.

Second try using 4.8
Code:
...  
CC net/bluetooth/hci_conn.o
net/bluetooth/hci_conn.c: In function 'hci_le_ltk_reply':
net/bluetooth/hci_conn.c:407:28: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type '__u8 *' as the destination; expected '__u8' or an explicit length [-Wsizeof-pointer-memaccess]
error, forbidden warning: hci_conn.c:407
scripts/Makefile.build:307: recipe for target 'net/bluetooth/hci_conn.o' failed
make[2]: *** [net/bluetooth/hci_conn.o] Error 1
scripts/Makefile.build:443: recipe for target 'net/bluetooth' failed
make[1]: *** [net/bluetooth] Error 2
Makefile:950: recipe for target 'net' failed
make: *** [net] Error 2
I should have it compiled soon going to take at least an hour to push it to github.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones