[Omni Q&A] GreyLeshy:
The default kernel is compiled without errors for TWRP.

By default, the config of the kernel disabled the download of proprietary modules. To enable the proprietary kernel module I added a couple of lines in config suzuran.

CONFIG_MODULES=y
CONFIG_MODVERSIONS=y

Sources: kernel Sony; device profile: suzuran, kitakami platform, common.

Same problem for platform devices loire.

After adding the lines, the compilation of the kernel occurs with an error:

/home/samavar/omni/kernel/Makefile:807: the recipe is a mistake for the purpose of «vmlinux»

[ 97% 6416/6603] build /home/samavar/o.../target/product/suzuran/root/init.real

/init /home/samavar/omni/out/target/product/suzuran/root/init isn't a symlink

[ 99% 6589/6603] build /home/samavar/o...covery_intermediates/sepolicy.recovery

/home/samavar/omni/out/host/linux-x86/bin/checkpolicy: loading policy configuration from /home/samavar/omni/out/target/product/suzuran/obj/ETC/sepolicy.recovery_intermediates/policy_recovery.conf

/home/samavar/omni/out/host/linux-x86/bin/checkpolicy: policy configuration loaded

/home/samavar/omni/out/host/linux-x86/bin/checkpolicy: writing binary representation (version 30) to /home/samavar/omni/out/target/product/suzuran/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.tmp

[ 99% 6589/6603] host Java: bouncycast...uncycastle-host_intermediates/classes)

warning: [options] bootstrap class path not set in conjunction with -source 1.7

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

1 warning

[ 99% 6596/6603] build TARGET_KERNEL_BINARIES

FAILED: /bin/bash -c "(make -j1 CFLAGS_MODULE="-fno-pic" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=" aarch64-linux-android-" Image.gz-dtb ) && (if grep -q 'CONFIG_OF=y' /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/.config ;	then	echo -e "Building DTBs" ;	make -j1 CFLAGS_MODULE="-fno-pic" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=" aarch64-linux-android-" dtbs ;	else	echo "DTBs not enabled" ;	fi ) && (if grep -q 'CONFIG_MODULES=y' /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/.config ;	then	echo -e "Building Kernel Modules" ;	make -j1 CFLAGS_MODULE="-fno-pic" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=" aarch64-linux-android-" modules &&	make -j1 CFLAGS_MODULE="-fno-pic" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ INSTALL_MOD_PATH=../../system ARCH=arm64 CROSS_COMPILE=" aarch64-linux-android-" modules_install &&	mdpath=\`find /home/samavar/omni/out/target/product/suzuran/system/lib/modules -type f -name modules.order\`; if [ "\$mdpath" != "" ];then mpath=\`dirname \$mdpath\`; ko=\`find \$mpath/kernel -type f -name *.ko\`; for i in \$ko; do aarch64-linux-android-strip --strip-unneeded \$i; mv \$i /home/samavar/omni/out/target/product/suzuran/system/lib/modules/; done; fi &&	mdpath=\`find /home/samavar/omni/out/target/product/suzuran/system/lib/modules -type f -name modules.order\`; if [ "\$mdpath" != "" ];then mpath=\`dirname \$mdpath\`; rm -rf \$mpath; fi ;	else	echo "Kernel Modules not enabled" ;	fi )"

make: вход в каталог «/home/samavar/omni/kernel»

GEN /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/Makefile

scripts/kconfig/conf --silentoldconfig Kconfig

Using /home/samavar/omni/kernel as source for kernel

GEN /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/Makefile

CHK include/generated/uapi/linux/version.h

CHK include/generated/utsrelease.h

UPD include/generated/utsrelease.h

CC kernel/bounds.s

GEN include/generated/bounds.h

*****

*****

LD arch/arm64/crypto/aes-neon-blk.o

LD arch/arm64/crypto/built-in.o

/home/samavar/omni/kernel/kernel/Makefile:144: *** No X.509 certificates found ***

CC kernel/fork.o

*****

*****

CC drivers/net/wireless/bcmdhd/wl_roam.o

CC drivers/net/wireless/bcmdhd/wl_cfg80211.o

/home/samavar/omni/kernel/drivers/net/wireless/bcmdhd/wl_cfg80211.c:7723:2: warning: initialization from incompatible pointer type

.del_station = wl_cfg80211_del_station,

^

/home/samavar/omni/kernel/drivers/net/wireless/bcmdhd/wl_cfg80211.c:7723:2: warning: (near initialization for 'wl_cfg80211_ops.del_station')

CC drivers/net/wireless/bcmdhd/wl_cfgp2p.o

CC drivers/net/wireless/bcmdhd/wl_cfg_btcoex.o

CC drivers/net/wireless/bcmdhd/wldev_common.o

CC drivers/net/wireless/bcmdhd/wl_linux_mon.o

CC drivers/net/wireless/bcmdhd/dhd_linux_platdev.o

/home/samavar/omni/kernel/drivers/net/wireless/bcmdhd/dhd_linux_platdev.c:62:13: warning: 'dts_enabled' defined but not used [-Wunused-variable]

static bool dts_enabled = FALSE;

^

CC drivers/net/wireless/bcmdhd/dhd_rtt.o

*****

*****

CC drivers/pci/of.o

CC drivers/pci/host/pci-msm.o

/home/samavar/omni/kernel/drivers/pci/host/pci-msm.c: In function 'pcie_init':

/home/samavar/omni/kernel/drivers/pci/host/pci-msm.c:4897:7: warning: unused variable 'rc_name' [-Wunused-variable]

char rc_name[MAX_RC_NAME_LEN];

^

LD drivers/pci/host/built-in.o

*****

*****

CC drivers/platform/msm/sps/sps_bam.o

CC drivers/platform/msm/sps/sps.o

/home/samavar/omni/kernel/drivers/platform/msm/sps/sps.c: In function 'sps_register_bam_device':

/home/samavar/omni/kernel/drivers/platform/msm/sps/sps.c:2074:7: warning: unused variable 'bam_name' [-Wunused-variable]

char bam_name[MAX_MSG_LEN];

^

CC drivers/platform/msm/sps/sps_dma.o

*****

*****

CC drivers/platform/msm/pft.o

In file included from /home/samavar/omni/kernel/include/linux/kernel.h:14:0,

from /home/samavar/omni/kernel/drivers/platform/msm/pft.c:48:

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_inode_create':

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:867:4: note: in expansion of macro 'pr_debug'

pr_debug("key removed, registered uid %u is denied from creating new file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_inode_post_create':

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%d' expects argument of type 'int', but argument 5 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:920:5: note: in expansion of macro 'pr_debug'

pr_debug("key loaded, pid [%u] uid [%d] is creating file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_inode_rename':

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:992:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'kuid_t' [-Wformat=]

pr_err("access in-place-encryption file %s by uid [%d] pid [%d] is blocked.\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:998:3: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'kuid_t' [-Wformat=]

pr_err("unregistered app (uid %u pid %u) is trying to access encrypted file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_file_open':

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1044:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'kuid_t' [-Wformat=]

pr_err("Access in-place-encryption file %s by uid %d pid %d is blocked.\n",

^

In file included from /home/samavar/omni/kernel/include/linux/kernel.h:14:0,

from /home/samavar/omni/kernel/drivers/platform/msm/pft.c:48:

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1055:3: note: in expansion of macro 'pr_debug'

pr_debug("key not loaded. uid (%u) can not access file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1061:4: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'kuid_t' [-Wformat=]

pr_err("unregistered app (uid %u pid %u) is trying to access encrypted file %s\n",

^

In file included from /home/samavar/omni/kernel/include/linux/kernel.h:14:0,

from /home/samavar/omni/kernel/drivers/platform/msm/pft.c:48:

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_file_permission':

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%d' expects argument of type 'int', but argument 6 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1116:4: note: in expansion of macro 'pr_debug'

pr_debug("r/w [mask 0x%x] in-place-encryption file %s by PFM (UID %d, PID %d).\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1121:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'kuid_t' [-Wformat=]

pr_err("Access in-place-encryption file %s by App (UID %d, PID %d) is blocked.\n",

^

In file included from /home/samavar/omni/kernel/include/linux/kernel.h:14:0,

from /home/samavar/omni/kernel/drivers/platform/msm/pft.c:48:

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1134:3: note: in expansion of macro 'pr_debug'

pr_debug("key not loaded. uid (%u) can not access file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1140:4: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'kuid_t' [-Wformat=]

pr_err("unregistered app (uid %u pid %u) is trying to access encrypted file %s\n",

^

In file included from /home/samavar/omni/kernel/include/linux/kernel.h:14:0,

from /home/samavar/omni/kernel/drivers/platform/msm/pft.c:48:

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_file_close':

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:64:16: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'kuid_t' [-Wformat=]

static struct _ddebug __aligned(8) \

^

/home/samavar/omni/kernel/include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'

DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \

^

/home/samavar/omni/kernel/include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'

dynamic_pr_debug(fmt, ##__VA_ARGS__)

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1199:3: note: in expansion of macro 'pr_debug'

pr_debug("pid [%u] uid [%u] is closing in-place-encryption file %s\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c: In function 'pft_inode_unlink':

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1259:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'kuid_t' [-Wformat=]

pr_err("block delete in-place-encryption file %s by uid [%d] pid [%d], while encryption in progress.\n",

^

/home/samavar/omni/kernel/drivers/platform/msm/pft.c:1265:3: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'kuid_t' [-Wformat=]

pr_err("unregistered app (uid %u pid %u) is trying to access encrypted file %s\n",

^

LD drivers/platform/msm/built-in.o

LD drivers/platform/built-in.o

CC drivers/power/power_supply_core.o

*****

*****

LD drivers/soc/built-in.o

CC drivers/spi/spi.o

CC drivers/spi/spi_qsd.o

LD drivers/spi/built-in.o

CC drivers/spmi/spmi.o

/home/samavar/omni/kernel/drivers/spmi/spmi.c: In function 'spmi_add_device':

/home/samavar/omni/kernel/drivers/spmi/spmi.c:240:3: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' [-Wformat=]

dev_set_name(dev, "%02x-%s-%04x", spmidev->sid, spmidev->dev.of_node->name, spmidev->res.resource[0].start);

^

CC drivers/spmi/spmi-resources.o

CC drivers/spmi/spmi-pmic-arb.o

CC drivers/spmi/qpnp-int.o

CC drivers/spmi/spmi-dbgfs.o

LD drivers/spmi/built-in.o

CC drivers/staging/staging.o

CC drivers/staging/android/ion/ion.o

*****

*****

LINK vmlinux

LD vmlinux.o

MODPOST vmlinux.o

GEN .version

CHK include/generated/compile.h

UPD include/generated/compile.h

CC init/version.o

LD init/built-in.o

LD vmlinux

net/built-in.o: In function `qtaguid_mt':

ipc_router_security.c:(.text+0x6839c): undefined reference to `xt_socket_put_sk'

ipc_router_security.c:(.text+0x68440): undefined reference to `xt_socket_get6_sk'

ipc_router_security.c:(.text+0x68450): undefined reference to `xt_socket_get4_sk'

ipc_router_security.c:(.text+0x684ac): undefined reference to `xt_socket_put_sk'

net/built-in.o: In function `tcp_nuke_addr':

ipc_router_security.c:(.text+0x7ee60): undefined reference to `in6addr_any'

ipc_router_security.c:(.text+0x7ee70): undefined reference to `in6addr_any'

ipc_router_security.c:(.text+0x7efc8): undefined reference to `rt6_lookup'

/home/samavar/omni/kernel/Makefile:807: the recipe is a mistake for the purpose of «vmlinux»

make[1]: *** [vmlinux] error 1

Makefile:130: the recipe is a mistake for the purpose of «sub-make»

make: *** [sub-make] error 2

make: выход из каталога «/home/samavar/omni/kernel»

ninja: build stopped: subcommand failed.

build/core/ninja.mk:157: the recipe is a mistake for the purpose of «ninja_wrapper»

make: *** [ninja_wrapper] error 1

#### make failed to build some targets (25:00 (mm:ss)) ####

Repeat

#

# configuration written to .config

#

make: Exit from the catalog «/home/samavar/omni/kernel»

make: Entrance to the catalog «/home/samavar/omni/kernel»

CHK include/generated/uapi/linux/version.h

make: Exit from the catalog «/home/samavar/omni/kernel»

[ 83% 35/42] build TARGET_KERNEL_BINARIES

FAILED: /bin/bash -c "(make -j1 CFLAGS_MODULE=\"-fno-pic\" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\" aarch64-linux-android-\" Image.gz-dtb ) && (if grep -q 'CONFIG_OF=y' /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/.config ;	then	echo -e \"Building DTBs\" ;	make -j1 CFLAGS_MODULE=\"-fno-pic\" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\" aarch64-linux-android-\" dtbs ;	else	echo \"DTBs not enabled\" ;	fi ) && (if grep -q 'CONFIG_MODULES=y' /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/.config ;	then	echo -e \"Building Kernel Modules\" ;	make -j1 CFLAGS_MODULE=\"-fno-pic\" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\" aarch64-linux-android-\" modules &&	make -j1 CFLAGS_MODULE=\"-fno-pic\" -C kernel O=/home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ INSTALL_MOD_PATH=../../system ARCH=arm64 CROSS_COMPILE=\" aarch64-linux-android-\" modules_install &&	mdpath=\`find /home/samavar/omni/out/target/product/suzuran/system/lib/modules -type f -name modules.order\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; ko=\`find \$mpath/kernel -type f -name *.ko\`; for i in \$ko; do aarch64-linux-android-strip --strip-unneeded \$i; mv \$i /home/samavar/omni/out/target/product/suzuran/system/lib/modules/; done; fi &&	mdpath=\`find /home/samavar/omni/out/target/product/suzuran/system/lib/modules -type f -name modules.order\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; rm -rf \$mpath; fi ;	else	echo \"Kernel Modules not enabled\" ;	fi )"

make: Entrance to the catalog «/home/samavar/omni/kernel»

GEN /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/Makefile

scripts/kconfig/conf --silentoldconfig Kconfig

Using /home/samavar/omni/kernel as source for kernel

GEN /home/samavar/omni/out/target/product/suzuran/obj/KERNEL_OBJ/Makefile

CHK include/generated/uapi/linux/version.h

CHK include/generated/utsrelease.h

CALL /home/samavar/omni/kernel/scripts/checksyscalls.sh

<stdin>:1226:2: warning: #warning syscall sched_setattr not implemented [-Wcpp]

<stdin>:1229:2: warning: #warning syscall sched_getattr not implemented [-Wcpp]

CC scripts/mod/devicetable-offsets.s

GEN scripts/mod/devicetable-offsets.h

HOSTCC scripts/mod/file2alias.o

HOSTLD scripts/mod/modpost

CHK include/generated/compile.h

/home/samavar/omni/kernel/kernel/Makefile:144: *** No X.509 certificates found ***

LINK vmlinux

LD vmlinux.o

MODPOST vmlinux.o

GEN .version

CHK include/generated/compile.h

UPD include/generated/compile.h

CC init/version.o

LD init/built-in.o

LD vmlinux

net/built-in.o: In function `qtaguid_mt':

ipc_router_security.c:(.text+0x6839c): undefined reference to `xt_socket_put_sk'

ipc_router_security.c:(.text+0x68440): undefined reference to `xt_socket_get6_sk'

ipc_router_security.c:(.text+0x68450): undefined reference to `xt_socket_get4_sk'

ipc_router_security.c:(.text+0x684ac): undefined reference to `xt_socket_put_sk'

net/built-in.o: In function `tcp_nuke_addr':

ipc_router_security.c:(.text+0x7ee60): undefined reference to `in6addr_any'

ipc_router_security.c:(.text+0x7ee70): undefined reference to `in6addr_any'

ipc_router_security.c:(.text+0x7efc8): undefined reference to `rt6_lookup'

/home/samavar/omni/kernel/Makefile:807: the recipe is a mistake for the purpose of «vmlinux»

make[1]: *** [vmlinux] error 1

Makefile:130: the recipe is a mistake for the purpose of «sub-make»

make: *** [sub-make] error 2

make: выход из каталога «/home/samavar/omni/kernel»

ninja: build stopped: subcommand failed.

build/core/ninja.mk:157: the recipe is a mistake for the purpose of «ninja_wrapper»

make: *** [ninja_wrapper] error 1

#### make failed to build some targets (03:21 (mm:ss)) ####

Please help to solve this problem.