Android13 GKI export symbol failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android13 GKI export symbol failed

4,262 Views
nxp_linhsh
Contributor I

what i used is:

Hardware: i.MX 8M NANO 8MNANOD4-EVK

Software: imx-android-13.0.0_1.0.0

I want to add a new device driver into kernel, and I follow the steps of the document "Android user guide.pdf " to export symbol. But i got errors when i run "BUILD_FOR_GKI=yes BUILD_CONFIG=common/build.config.imx EXT_MODULES_MAKEFILE="verisilicon_sw_isp_vvcam/vvcam/v4l2/Kbuild" EXT_MODULES="nxp-mwifiex/mxm_wifiex/wlan_src" build/build_abi.sh --update-symbol-list -j8"

 

error log:

symbol 'filp_open' is not allowed: Drivers should not open files directly
symbol 'kernel_read' is not allowed: Drivers should never read from a file

nxp_linhsh_0-1677483866076.png

How can i fix it ? 

thanks.

 

0 Kudos
9 Replies

3,420 Views
Adi99
Contributor I

Hi @aber @Sanket_Parekh 

 

I am facing same issue while brinup the can driver in imx8mp.

 

because those symbol is not added in abi_gki_aarch64.xml and abi_gki_aarch64_imx

i have updated in both file manually. but now my question is what is the command to build both file and all that symbol also will updated in my os.

Thanks, 

0 Kudos

4,246 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @nxp_linhsh 

I hope you are doing well.

->Please make sure to Set the driver configuration to m in the configuration fragment file of the board
->Please make sure to Add the driver .ko files to the board.

If some symbols are not exported but are used by the added driver modules, perform the following steps to export them:

a. Export symbols with EXPORT_SYMBOL_GPL(xxx).
Note: If symbols are in core kernel code (which means not in loadable modules), such changes must be upstream to the AOSP GKI Kernel tree.
b. Add symbols to the AOSP GKI Kernel tree android/abi_gki_aarch64.xml.

Please refer to section 9 Generic Kernel Image (GKI) Development
https://www.nxp.com/docs/en/user-guide/ANDROID_USERS_GUIDE.pdf

Thanks & Regards.
Sanket Parekh
0 Kudos

4,215 Views
aber
Contributor III

Hi Sanket_Parekh

    Add +CONFIG_SERIAL_IMX_EARLYCON=y to the reference document, what is wrong with the configuration? tks!

   https://www.nxp.com/docs/en/user-guide/ANDROID_USERS_GUIDE.pdf

make[1]: Leaving directory '/work/android12/gki/out/android13-5.15/common'
+ set +x
========================================================
Running pre-make command(s):
+ eval check_defconfig
++ check_defconfig
++ cd /work/android12/gki/out/android13-5.15/common
++ make LLVM=1 DEPMOD=depmod DTC=/work/android12/gki/build/kernel/build-tools/path/linux-x86/dtc O=/work/android12/gki/out/android13-5.15/common savedefconfig
GEN Makefile
++ '[' arm64 = x86_64 -o arm64 = i386 ']'
++ RES=0
++ [[ -f common/arch/arm64/configs/gki_defconfig ]]
++ diff -u common/arch/arm64/configs/gki_defconfig /work/android12/gki/out/android13-5.15/common/defconfig
--- common/arch/arm64/configs/gki_defconfig 2023-03-09 07:27:24.560180607 +0000
+++ /work/android12/gki/out/android13-5.15/common/defconfig 2023-03-09 08:01:45.625565577 +0000
@@ -388,7 +388,6 @@
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SAMSUNG=y
CONFIG_SERIAL_SAMSUNG_CONSOLE=y
-CONFIG_SERIAL_IMX_EARLYCON=y
CONFIG_SERIAL_QCOM_GENI=y
# CONFIG_SERIAL_QCOM_GENI_CONSOLE_DEFAULT_ENABLED is not set
CONFIG_SERIAL_QCOM_GENI_CONSOLE=y
++ RES=1
++ '[' 1 -ne 0 ']'
++ echo ERROR: savedefconfig does not match common/arch/arm64/configs/gki_defconfig
ERROR: savedefconfig does not match common/arch/arm64/configs/gki_defconfig
++ return 1

 

 

 

0 Kudos

4,185 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @aber 

->Please try the below steps to export symbols.

1)Generate the device symbol list (android/abi_gki_aarch64_imx) -> Then, common/android/abi_gki_aarch64_imx is updated.
2)Update the AOSP symbol list (android/abi_gki_aarch64.xml). -> Then, common/android/abi_gki_aarch64.xml is updated
3)Build Android boot.img locally.
4)If you want AOSP released GKI image to export these symbols, upstream the two files to AOSP:
android/abi_gki_aarch64_imx android/abi_gki_aarch64.xml

This Should work as it is mentioned in the Android user guide.

->Please make sure that as GKI requires, all vendor drivers need to be built as modules. Their configurations are set to m in the above-mentioned board-specific configuration file.
For example:
– BOARD_VENDOR_RAMDISK_KERNEL_MODULES
– BOARD_VENDOR_KERNEL_MODULES

Please share the observation.

Thanks & Regards.

Sanket Parekh

0 Kudos

4,181 Views
aber
Contributor III

Hi Sanker_Parekh

   Thank you very much for your reply。

The following is my gki code modification, adding two interfaces and opening debug。

   /work/android12/gki/common$ git diff .
diff --git a/android/abi_gki_aarch64_imx b/android/abi_gki_aarch64_imx
index 3069e6706cdf..d0a5edb39473 100644
--- a/android/abi_gki_aarch64_imx
+++ b/android/abi_gki_aarch64_imx
@@ -2473,3 +2473,7 @@
unlock_page
unregister_shrinker
wait_on_page_bit
+
+# required by snd-soc-arizona.ko
+ snd_soc_component_enable_pin
+ snd_soc_dapm_del_routes
diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig
index f661dfe5cc4b..fd2a9e29df40 100644
--- a/arch/arm64/configs/gki_defconfig
+++ b/arch/arm64/configs/gki_defconfig
@@ -391,6 +391,7 @@ CONFIG_SERIAL_SAMSUNG_CONSOLE=y
CONFIG_SERIAL_QCOM_GENI=y
# CONFIG_SERIAL_QCOM_GENI_CONSOLE_DEFAULT_ENABLED is not set
CONFIG_SERIAL_QCOM_GENI_CONSOLE=y
+CONFIG_SERIAL_IMX_EARLYCON=y
CONFIG_SERIAL_SPRD=y
CONFIG_SERIAL_SPRD_CONSOLE=y
CONFIG_HVC_DCC=y
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 029210f4ae55..6a741b26a7b1 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -496,7 +496,6 @@ config SERIAL_IMX_CONSOLE

config SERIAL_IMX_EARLYCON
bool "Earlycon on IMX serial port"
- depends on ARCH_MXC || COMPILE_TEST
depends on OF
select SERIAL_CORE
select SERIAL_EARLYCON

I refer to Android_User's_Guide.pdf:

BUILD_CONFIG=common/build.config.gki.aarch64 build/
build_abi.sh LTO=thin --update -j8  

update abi_gki_aarch64.xml  

copy abi_gki_aarch64_imx abi_gki_aarch64.xml  to android12/android_build/vendor/nxp-opensource/kernel_imx/android/ directory

BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh update gki boot.img replace android12/android_build/vendor/nxp/fsl-proprietary/gki/boot.img 

Re-update the android image and burn it into the board, but it still prompts that no method can be found

[ 7.335168][ T208] snd_soc_arizona: Unknown symbol snd_soc_component_enable_pin (err -2)
[ 7.343305][ T7] imx-hdmi sound-hdmi: snd_soc_register_card failed (-517)
[ 7.351135][ T208] snd_soc_arizona: Unknown symbol snd_soc_dapm_del_routes (err -2)

 

Please help me to analyze which step I have a problem with. Thank you so much.

0 Kudos

4,172 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hello @aber 

The steps are followed correctly.

I have a query to ask just to make clear that this function that uses the symbols is declared correctly and implemented in respective .c file & that file is correctly added into the make file & then after that symbol is should be exported via EXPORT_SYMBOL_GPL(xxx).

Can you please confirm this?

Thanks & Regards.

Sanket Parekh

0 Kudos

4,072 Views
aber
Contributor III

Hi Sanket_Parekh

   I found the problem. The boot.img of my newly compiled GKI did not run normally. Now the boot is stuck here. What is the problem? Please help analyze it, thank you.

 

[ 1.350500][ T1] Bluetooth: RFCOMM socket layer initialized
[ 1.356346][ T1] Bluetooth: RFCOMM ver 1.11
[ 1.360766][ T1] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 1.367390][ T1] Bluetooth: HIDP socket layer initialized
[ 1.373093][ T1] l2tp_core: L2TP core driver, V2.0
[ 1.378123][ T1] l2tp_ppp: PPPoL2TP kernel driver, V2.0
[ 1.383605][ T1] 8021q: 802.1Q VLAN Support v1.8
[ 1.388509][ T1] tipc: Activated (version 2.0.0)
[ 1.393615][ T1] NET: Registered PF_TIPC protocol family
[ 1.399064][ T1] tipc: Started in single node mode
[ 1.404307][ T1] NET: Registered PF_IEEE802154 protocol family
[ 1.410432][ T1] NET: Registered PF_VSOCK protocol family
[ 1.416768][ T1] registered taskstats version 1
[ 1.420609][ T1] Loading compiled-in X.509 certificates
[ 1.426486][ T64] cryptomgr_probe (64) used greatest stack depth: 13896 bytes left
[ 1.429185][ T1] Loaded X.509 cert 'Build time autogenerated kernel key: 2e0154917a3fb950a081d67dd52ce25f8da85010'
[ 1.444862][ T1] page_owner is disabled
[ 1.448756][ T1] Key type .fscrypt registered
[ 1.453200][ T1] Key type fscrypt-provisioning registered
[ 1.461956][ T1] ALSA device list:
[ 1.462767][ T1] No soundcards found.
[ 1.466998][ T1] Warning: unable to open an initial console.
[ 1.473909][ T1] Freeing unused kernel memory: 2432K
[ 1.497648][ T1] Run /init as init process
[ 1.503094][ T1] init: init first stage started!
[ 1.506802][ T1] init: alias lines in modules.alias must have 3 entries, not 4
[ 1.513133][ T1] init: alias lines in modules.alias must have 3 entries, not 4
[ 1.522049][ T1] init: Loading module /lib/modules/zsmalloc.ko with args ''
[ 1.527951][ T1] zsmalloc: module verification failed: signature and/or required key missing - tainting kernel
[ 1.538981][ T1] init: Loaded kernel module /lib/modules/zsmalloc.ko
[ 1.544446][ T1] init: Loading module /lib/modules/zram.ko with args ''
[ 1.553339][ T1] zram: Added device: zram0
[ 1.555664][ T1] init: Loaded kernel module /lib/modules/zram.ko
[ 1.562022][ T1] init: Loading module /lib/modules/soc-imx8m.ko with args ''
[ 1.570123][ T1] SoC: i.MX8MQ revision 2.1
[ 1.573683][ T1] Config NOC for VPU and CPU
[ 1.578036][ T1] init: Loaded kernel module /lib/modules/soc-imx8m.ko
[ 1.584865][ T1] init: Loading module /lib/modules/mxc-clk.ko with args 

0 Kudos

4,169 Views
aber
Contributor III

Hi Sanket_Parekh

  The two methods not found have export under the kernel.

  /work/android12/android_build/vendor/nxp-opensource/kernel_imx/sound$ grep "snd_soc_component_enable_pin" ./ -Rn
./soc/soc-component.c:151:int snd_soc_component_enable_pin(struct snd_soc_component *component,
./soc/soc-component.c:158:EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
./soc/soc-component.c:160:int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,

/work/android12/android_build/vendor/nxp-opensource/kernel_imx/sound$ grep "snd_soc_dapm_del_routes" ./ -Rn
./soc/soc-dapm.c:3121: * snd_soc_dapm_del_routes - Remove routes between DAPM widgets
./soc/soc-dapm.c:3128:int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
./soc/soc-dapm.c:3142:EXPORT_SYMBOL_GPL(snd_soc_dapm_del_routes);

0 Kudos

4,225 Views
aber
Contributor III

Hi Sanket_Parekh

   I refer to section 9 Generic Kernel Image (GKI) Development    

update android/abi_gki_aarch64.xml and boot.img no effect。

 

0 Kudos