UN40H5201
T-N14M6AKUC-1110
Linux version 3.8.13 (a.vishwakarm@DELL-BUILD25) (gcc version 4.7.4 (VDLinux.v7a8.GA3.2013-10-11) ) #1 PREEMPT Tue Sep 11 13:55:41 IST 2018
vermagic=0146, product preempt mod_unload ARMv7
Toolchain: VDLinux-armv7a8-toolchain-lite_20100630.tar.xz edit: This is a bad toolchain to use. It has an old gcc version (4.4.1), which has a bug, which causes kernel build to detect CC_HAVE_ASM_GOTO=n, HAVE_JUMP_LABEL=n and ultimately breaks the struct layout of 'struct module'. Use arm-v7a8v4r3.tar.xz, which matches the kernel.
I am trying to build a custom (very small) kernel module that will work on my device.
In general I am following this procedure (viewtopic.php?p=80976#p80976):
1) download toolchain (done)
2) download kernel sources
My model is too old, there is nothing on opensource.samsung.com.
Instead I have downloaded mainline kernel 3.8.13 and extracted.
3) "make ARCH=arm CROSS_COMPILE=arm-v7a8v4r3-linux-gnueabi- menuconfig"
Selected "ARM system type (TI OMAP)" (one of the few system types that produces "ARMv7" vermagic)
also through many attempts, found other config options that are necessary (details below)
4) some hack to force the needed vermagic on compilation
5) in my module directory, "make -C ../linux-3.8.13 ARCH=arm CROSS_COMPILE=arm-v7a8v4r3-linux-gnueabi- M=$(pwd)"
The module builds successfully, but I had many issues loading it on the device. See below.
Kernel configuration (.config)
The kernel options (eg. CONFIG_PREEMPT=y) make a huge difference in compatibility of module with the Samsung kernel. For example, I found the following are necessary:
Code: Select all
CONFIG_UNUSED_SYMBOLS=n
CONFIG_MODULE_SIG=n
CONFIG_GENERIC_BUG=y
CONFIG_KALLSYMS=n
CONFIG_SMP=n
CONFIG_FTRACE=n
CONFIG_JUMP_LABEL=y
CONFIG_PREEMPT=y
CONFIG_MODULE_UNLOAD=y
CONFIG_ARM_PATCH_PHYS_VIRT=n
CONFIG_FUNCTION_TRACER=n
mtd_exe/WIFI_LIB/QCA/ath6kl_usb.ko
Code: Select all
$ readelf -a rootfs//mtd_exe/WIFI_LIB/QCA/ath6kl_usb.ko -W
Relocation section '.rel.gnu.linkonce.this_module' at offset 0xc7114 contains 2 entries:
Offset Info Type Sym. Value Symbol's Name
000000bc 00099f02 R_ARM_ABS32 0003a85c init_module
00000114 00095202 R_ARM_ABS32 0003a9dc cleanup_module
0x114 - offset of module.exit.
0x11c - section size of .gnu.linkonce.this_module - should match sizeof(struct module)
I guess the Samsung kernel has many code modifications, and it would really help to know the combination of CONFIG.
As I mentioned, opensource.samsung.com no longer has any source code for my device (UN40H5201 / T-N14M6AKUC-1110). Does anyone still have these files and would be able to share? It would greatly help my work.