[OnePlus Nord CE 5G] jester1234:
Hi,

i'm trying to compile this kernel - android_kernel_oneplus_sm7225 ver. 4.19.125 - and i need some hints about how to proceed, because it fails.

After the fixes (see section "SOME FIXES" below), i get a lot of "Undefined reference" errors (below the related section) at the end of the procedure.

QUESTIONS:

What i'm doing wrong? The only way that i found to solve those errors is to add the missing code in each file, but i'm not sure this is the right way!

Do i have to add library path somewhere?

It's my first try and i would thank anyone who'll help me to get out of this!

Any useful (and detailed) guide?

thanks in advance

- All the info -

I've tried to build the kernel under Ubuntu ( 21.10, 18.04, 16.04 with also different kernel version on them) and Arch, but the result is the same.

Here there are:

the kernel sources

the compiler

the toolchain

the missing headers and some little variations made

the list of the undefined references found

###########################

# SOURCES - COMPILER - TOOLCHAIN

GitHub - OnePlusOSS/android_kernel_oneplus_sm7225

Contribute to OnePlusOSS/android_kernel_oneplus_sm7225 development by creating an account on GitHub.

github.com

clang:

https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/ee5ad7f5229892ff06b476e5b5a11ca1f39bf3a9/clang-r365631c.tar.gz

gcc32

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/+archive/5ac02a0ba9f39591758bab4516dd0725747af0c3.tar.gz

gcc64:

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/043dc0ad16a73e0e1973132d00fa6265ab4fa6ba.tar.gz

###########################

# THE SCRIPT

git clone --depth 1 https://github.com/OnePlusOSS/android_kernel_oneplus_sm7225 src

wget https://android.googlesource.com/pl...6b476e5b5a11ca1f39bf3a9/clang-r365631c.tar.gz -O clang.tar.gz

mkdir clang

tar -xvf clang.tar.gz -C clang

wget https://android.googlesource.com/pl...3dc0ad16a73e0e1973132d00fa6265ab4fa6ba.tar.gz -O gcc64.tar.gz

mkdir gcc64

tar -xvf gcc64.tar.gz -C gcc64

wget https://android.googlesource.com/pl...c02a0ba9f39591758bab4516dd0725747af0c3.tar.gz -O gcc32.tar.gz

mkdir gcc32

tar -xvf gcc32.tar.gz -C gcc32

export ARCH=arm64

export SUBARCH=arm64

export HEADER_ARCH=arm64

export DTC_EXT=dtc

PATH="${PWD}/clang/bin:${PWD}/gcc64/bin:${PWD}/gcc32/bin:${PATH}"

cd src

rm -rf out

make O=out clean && make mrproper

make O=out ARCH=arm64 vendor/lito-perf_defconfig

make CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_SECTION_MISMATCH_WARN_ONLY=y -j$(nproc --all) O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android- CROSS_COMPILE_ARM32=arm-linux-androideabi-

###########################

# SOME FIXES

/arch/arm64/configs/vendor/lito-perf_defconfig

CONFIG_ARCH_QCOM=y -> # CONFIG_ARCH_QCOM=y

/drivers/extcon/extcon-gpio.c

add #include <linux/pinctrl/consumer.h>

/drivers/input/touchscreen/focaltech_touch/focaltech_core.c

add #include <linux/pinctrl/consumer.h>

/drivers/input/touchscreen/synaptics_dsx/synaptics_dsx_core.c

add #include <linux/pinctrl/consumer.h>

/drivers/input/touchscreen/st/fts.c

add #include <linux/pinctrl/consumer.h>

/drivers/leds/leds.h

add #include <linux/pinctrl/consumer.h>

comment method static inline struct led_classdev *trigger_to_lcdev(struct led_trigger *trig)

/drivers/leds/led-core.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/input/fingerprint/fingerprint_detect/fingerprint_detect.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/input/touchscreen/touchpanel_common_driver.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/input/fingerprint/goodix/gf_spi.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/input/fingerprint/goodix/platform.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/misc/project_info.c

add #include <linux/io.h>

/drivers/oneplus/misc/op_rf_cable_monitor.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/misc/gpio_switch.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/power/oplus_chg/charger_ic/oplus_usbtemp.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/power/oplus_chg/warp_ic/oplus_warp_fw.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/power/oplus_chg/oplus_wireless.c

add #include <linux/pinctrl/consumer.h>

/drivers/oneplus/vibrator/aw8697.c

add #include <linux/pinctrl/consumer.h>

##################

# UNDEFINED REFERENCES (attached file)

...

WARNING: vmlinux.o(.text+0xa05f1c): Section mismatch in reference from the function bootloader_log_probe() to the function .init.text:eek:f_bootloader_log_platform_data()

The function bootloader_log_probe() references

the function __init of_bootloader_log_platform_data().

This is often because bootloader_log_probe lacks a __init

annotation or the annotation of of_bootloader_log_platform_data is wrong.

drivers/clk/clk.o: In function `clock_debug_print_enabled':

/src/out/../drivers/clk/clk.c:3956: undefined reference to `rpmhstats_statistics'

drivers/soc/qcom/subsys-pil-tz.o: In function `log_failure_reason':

/src/out/../drivers/soc/qcom/subsys-pil-tz.c:808: undefined reference to `qcom_smem_get'

drivers/soc/qcom/peripheral-loader.o: In function `msm_pil_init':

/src/out/../drivers/soc/qcom/peripheral-loader.c:1689: undefined reference to `qcom_smem_get'

drivers/soc/qcom/subsystem_restart.o: In function `subsystem_restart_dev':

/src/out/../drivers/soc/qcom/subsystem_restart.c:1500: undefined reference to `oem_get_modemdump_mode'

drivers/soc/qcom/microdump_collector.o: In function `microdump_modem_notifier_nb':

/src/out/../drivers/soc/qcom/microdump_collector.c:45: undefined reference to `qcom_smem_get'

/src/out/../drivers/soc/qcom/microdump_collector.c:57: undefined reference to `qcom_smem_get'

drivers/soc/qcom/icnss.o: In function `icnss_socinfo_get_serial_number':

/src/out/../drivers/soc/qcom/icnss.c:2579: undefined reference to `socinfo_get_serial_number'

drivers/soc/qcom/icnss_qmi.o: In function `wlfw_msa_mem_info_send_sync_msg':

/src/out/../drivers/soc/qcom/icnss_qmi.c:91: undefined reference to `qmi_txn_init'

/src/out/../drivers/soc/qcom/icnss_qmi.c:99: undefined reference to `qmi_send_request'

/src/out/../drivers/soc/qcom/icnss_qmi.c:109: undefined reference to `qmi_txn_wait'

/src/out/../drivers/soc/qcom/icnss_qmi.c:104: undefined reference to `qmi_txn_cancel'

drivers/soc/qcom/icnss_qmi.o: In function `wlfw_msa_ready_send_sync_msg':

vers/gpu/drm/drm_sysfs.c:325: undefined reference to `dsi_display_get_hbm_mode'

drivers/gpu/drm/drm_sysfs.o: In function `hbm_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:352: undefined reference to `dsi_panel_name'

aarch64-linux-android-ld: drivers/gpu/drm/drm_sysfs.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `dsi_panel_name' can not be used when making a shared object; recompile with -fPIC

/src/out/../drivers/gpu/drm/drm_sysfs.c:352: undefined reference to `dsi_panel_name'

/src/out/../drivers/gpu/drm/drm_sysfs.c:353: undefined reference to `dsi_display_get_stage_info'

/src/out/../drivers/gpu/drm/drm_sysfs.c:361: undefined reference to `dsi_display_set_hbm_mode'

drivers/gpu/drm/drm_sysfs.o: In function `hbm_brightness_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:416: undefined reference to `dsi_display_get_hbm_brightness'

drivers/gpu/drm/drm_sysfs.o: In function `hbm_brightness_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:435: undefined reference to `dsi_display_set_hbm_brightness'

drivers/gpu/drm/drm_sysfs.o: In function `op_friginer_print_hbm_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:448: undefined reference to `dsi_display_get_fp_hbm_mode'

drivers/gpu/drm/drm_sysfs.o: In function `op_friginer_print_hbm_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:470: undefined reference to `dsi_display_set_fp_hbm_mode'

drivers/gpu/drm/drm_sysfs.o: In function `aod_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:484: undefined reference to `dsi_display_get_aod_mode'

drivers/gpu/drm/drm_sysfs.o: In function `aod_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:503: undefined reference to `dsi_display_set_aod_mode'

drivers/gpu/drm/drm_sysfs.o: In function `aod_disable_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:516: undefined reference to `dsi_display_get_aod_disable'

drivers/gpu/drm/drm_sysfs.o: In function `aod_disable_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:538: undefined reference to `dsi_display_set_aod_disable'

drivers/gpu/drm/drm_sysfs.o: In function `DCI_P3_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:552: undefined reference to `dsi_display_get_dci_p3_mode'

drivers/gpu/drm/drm_sysfs.o: In function `DCI_P3_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:574: undefined reference to `dsi_display_set_dci_p3_mode'

drivers/gpu/drm/drm_sysfs.o: In function `night_mode_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:588: undefined reference to `dsi_display_get_night_mode'

drivers/gpu/drm/drm_sysfs.o: In function `night_mode_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:610: undefined reference to `dsi_display_set_night_mode'

drivers/gpu/drm/drm_sysfs.o: In function `native_display_p3_mode_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:624: undefined reference to `dsi_display_get_native_display_p3_mode'

drivers/gpu/drm/drm_sysfs.o: In function `native_display_p3_mode_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:646: undefined reference to `dsi_display_set_native_display_p3_mode'

...

drivers/gpu/drm/drm_sysfs.o: In function `native_display_srgb_color_mode_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:803: undefined reference to `dsi_display_get_native_display_srgb_color_mode'

drivers/gpu/drm/drm_sysfs.o: In function `native_display_srgb_color_mode_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:825: undefined reference to `dsi_display_set_native_display_srgb_color_mode'

...

drivers/gpu/drm/drm_sysfs.o: In function `panel_serial_number_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:943: undefined reference to `dsi_display_get_serial_number'

/src/out/../drivers/gpu/drm/drm_sysfs.c:945: undefined reference to `dsi_display_get_serial_number_year'

/src/out/../drivers/gpu/drm/drm_sysfs.c:946: undefined reference to `dsi_display_get_serial_number_mon'

...

aarch64-linux-android-ld: drivers/gpu/drm/drm_sysfs.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `dsi_panel_name' can not be used when making a shared object; recompile with -fPIC

/src/out/../drivers/gpu/drm/drm_sysfs.c:959: undefined reference to `dsi_panel_name'

/src/out/../drivers/gpu/drm/drm_sysfs.c:1078: undefined reference to `dsi_display_get_panel_ic_v_info'

/src/out/../drivers/gpu/drm/drm_sysfs.c:1066: undefined reference to `dsi_display_get_ddic_check_info'

...

aarch64-linux-android-ld: drivers/gpu/drm/drm_sysfs.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `buf_Lotid' can not be used when making a shared object; recompile with -fPIC

/src/out/../drivers/gpu/drm/drm_sysfs.c:1122: undefined reference to `buf_Lotid'

drivers/gpu/drm/drm_sysfs.o: In function `panel_serial_number_AT_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1175: undefined reference to `dsi_display_get_serial_number_at'

drivers/gpu/drm/drm_sysfs.o: In function `iris_recovery_mode_check_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1187: undefined reference to `iris_loop_back_test'

drivers/gpu/drm/drm_sysfs.o: In function `dsi_on_command_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1200: undefined reference to `dsi_display_get_dsi_on_command'

drivers/gpu/drm/drm_sysfs.o: In function `dsi_on_command_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1211: undefined reference to `dsi_display_update_dsi_on_command'

drivers/gpu/drm/drm_sysfs.o: In function `dsi_panel_command_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1224: undefined reference to `dsi_display_get_dsi_panel_command'

...

drivers/gpu/drm/drm_sysfs.o: In function `dsi_panel_reg_len_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1271: undefined reference to `reg_read_len'

aarch64-linux-android-ld: drivers/gpu/drm/drm_sysfs.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `reg_read_len' can not be used when making a shared object; recompile with -fPIC

...

drivers/gpu/drm/drm_sysfs.o: In function `dsi_panel_reg_read_store':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1313: undefined reference to `dsi_display_reg_read'

drivers/gpu/drm/drm_sysfs.o: In function `panel_mismatch_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1398: undefined reference to `dsi_display_panel_mismatch_check'

/src/out/../drivers/gpu/drm/drm_sysfs.c:1400: undefined reference to `dsi_display_panel_mismatch'

drivers/gpu/drm/drm_sysfs.o: In function `force_screenfp_show':

/src/out/../drivers/gpu/drm/drm_sysfs.c:1439: undefined reference to `dsi_display_get_fp_hbm_mode'

/src/out/../drivers/gpu/drm/drm_sysfs.c:397: undefined reference to `dsi_panel_name'

...

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: /src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:5496: more undefined references to `vote' follow

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `usbin_uv_irq_handler':

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:5865: undefined reference to `is_storming'

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:6006: undefined reference to `reset_storm_count'

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `icl_change_irq_handler':

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `smblib_set_sw_thermal_regulation':

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `smblib_handle_rp_change':

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:7200: undefined reference to `get_client_vote'

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `smblib_lpd_clear_ra_open_work':

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:7360: undefined reference to `vote'

drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.o: In function `typec_ra_ra_insertion':

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:7003: undefined reference to `vote'

/src/out/../drivers/oneplus/power/oplus_chg/charger_ic/oplus_battery_msm7225_R.c:7004: undefined reference to `vote'

... (and so on) ...

drivers/oneplus/vl53L1/stmvl53l1_module.o: /src/out/../drivers/oneplus/vl53L1/stmvl53l1_module.c:417: more undefined references to `cam_cci_control_interface' follow

/src/Makefile:1198: recipe for target 'vmlinux' failed

make[1]: *** [vmlinux] Error 1

make[1]: uscita dalla directory " /src/out"

Makefile:148: recipe for target 'sub-make' failed

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