[Galaxy S6 Q&A, Help & Troubleshooting] some_galaxy_user:
Hi everyone, was hoping some of you wonderful people might be able to help me to compile a simple kernel for the Galaxy S6 Sprint variant, G920P.

My ultimate goal is to add UVC and CH341 driver so certain devices can be plugged in and recognized with USB.

I tried just compiling a stock kernel before making any changes following various tutorials but still had errors.

The S6 is running an older stock ROM G920PVPS4DQK1, since it's the latest one that Samsung released the kernel sources for.

I'm compiling on a virtual machine with Ubuntu 18.04 and using Android NDK Rev.16b (December 2017). I downloaded the kernel from Samsung Open Source and extracted it to a folder next to the toolchain.

In kernel directory I edit "Makefile" with correct toolchain path: CROSS_COMPILE ?=/TOOLCHAIN/PATH/aarch64-linux-android-

Then in terminal from kernel folder: export ARCH=arm64 && export SUBARCH=arm64 && export ANDROID_MAJOR_VERSION=7 && export CROSS_COMPILE=/TOOLCHAIN/PATH/aarch64-linux-android-

Then I run "make zerofltespr_02_defconfig" and start compiling with "make -j2"

It starts fine at the beginning except for these warnings:

HOSTCC scripts/sortextable

scripts/sortextable.c:68:1: warning: ‘succeed_file’ defined but not used [-Wunused-function]

succeed_file(void)

^~~~~~~~~~~~

In file included from scripts/sortextable.c:166:0:

scripts/sortextable.c: In function ‘main’:

scripts/sortextable.h:158:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized]

memset(relocs, 0, relocs_size);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scripts/sortextable.h:104:6: note: ‘relocs_size’ was declared here

int relocs_size;

^~~~~~~~~~~

In file included from scripts/sortextable.c:164:0:

scripts/sortextable.h:158:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized]

memset(relocs, 0, relocs_size);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scripts/sortextable.h:104:6: note: ‘relocs_size’ was declared here

int relocs_size;

^~~~~~~~~~~

HOSTLD scripts/mod/modpost

Then it continues for 30 minutes before stopping/finishing with the following errors:

LD drivers/usb/storage/usb-storage.o

LD drivers/usb/storage/built-in.o

LD drivers/usb/built-in.o

LD drivers/built-in.o

LINK vmlinux

LD vmlinux.o

MODPOST vmlinux.o

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

GEN .version

CHK include/generated/compile.h

UPD include/generated/compile.h

CC init/version.o

LD init/built-in.o

KSYM .tmp_kallsyms1.o

KSYM .tmp_kallsyms2.o

LD vmlinux

SORTEX vmlinux

SYSMAP System.map

FIPS : Generating hmac of fmp and updating vmlinux...

HMAC-SHA256(builtime_bytes.bin)= 318ee1d2da4a06b2f899343927a0f9fb442e58c7608c8adea68d01eea6e2b70f

FIPS : Generating hmac of crypto and updating vmlinux...

HMAC-SHA256(builtime_bytes.bin)= f2624113496d6769195d5ca935e1de3b7dfcdaba4e4c29f7c4838c5c1b89637e

Building modules, stage 2.

OBJCOPY arch/arm64/boot/Image

MODPOST 2 modules

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_unregister' exported twice. Previous export was in vmlinux

WARNING: vmlinux: 'remove_af_noise_register' exported twice. Previous export was in vmlinux

CC net/ipv4/tcp_htcp.mod.o

GZIP arch/arm64/boot/Image.gz

CC net/ipv4/tcp_westwood.mod.o

LD [M] net/ipv4/tcp_htcp.ko

LD [M] net/ipv4/tcp_westwood.ko

/home/somek/work/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/tsp_stm/stm_z1.fw' given more than once in the same rule

/home/somek/work/kernel/scripts/Makefile.fwinst:45: target '/lib/firmware/abov/abov_valley.fw' given more than once in the same rule

I got the same results with older versions of the toolchain, and newer versions of NDK didn't work since they don't come with gcc file anymore.

Is "OBJCOPY arch/arm64/boot/Image" my finished kernel, or did compiling stop because of errors? How can this be fixed?

Thanks for checking this out and any ideas someone might have. :D