Hi,
When trying to strip down kernel options to reduce the size of the generated zImage, I came across the following compilation errors:
----------------------------------------
/home/manu/Develop/IOT-AP-CTRL/OS/Sources/buildroot-20240201_iMX6ULLevk-20240501_manu/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld: arch/arm/mach-imx/busfreq_ddr3.o: in function `init_mmdc_ddr3_settings_imx6_up':
busfreq_ddr3.c:(.text+0x598): undefined reference to `imx6_up_ddr3_freq_change_end'
/home/manu/Develop/IOT-AP-CTRL/OS/Sources/buildroot-20240201_iMX6ULLevk-20240501_manu/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld: busfreq_ddr3.c:(.text+0x59c): undefined reference to `imx6_up_ddr3_freq_change'
/home/manu/Develop/IOT-AP-CTRL/OS/Sources/buildroot-20240201_iMX6ULLevk-20240501_manu/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld: busfreq_ddr3.c:(.text+0x5a0): undefined reference to `imx6_up_ddr3_freq_change_start'
/home/manu/Develop/IOT-AP-CTRL/OS/Sources/buildroot-20240201_iMX6ULLevk-20240501_manu/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld: arch/arm/mach-imx/busfreq_lpddr2.o: in function `init_mmdc_lpddr2_settings':
busfreq_lpddr2.c:(.text+0x18c): undefined reference to `imx6_up_lpddr2_freq_change'
make[3]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 1
----------------------------------------
I tracked the problem down to making the following changes in the kernel ".config":
----------------------------------------
# CONFIG_ARCH_MULTIPLATFORM is not set
#
# Cortex-A platforms
#
# CONFIG_SOC_IMX50 is not set
# CONFIG_SOC_IMX51 is not set
# CONFIG_SOC_IMX53 is not set
CONFIG_SOC_IMX6=y
# CONFIG_SOC_IMX6Q is not set
# CONFIG_SOC_IMX6SL is not set
# CONFIG_SOC_IMX6SLL is not set
# CONFIG_SOC_IMX6SX is not set
CONFIG_SOC_IMX6UL=y
# CONFIG_SOC_LS1021A is not set
----------------------------------------
The problem goes away just by re-enabling the "CONFIG_SOC_IMX6SX=y"
Why compiling for a "IMX6UL" requires the "IMX6SX" to be enabled too ?
I don't need the kernel to be compatible across multi-platform.
My application uses a "iMX6ULL" with a small QSPI flash as bootable device and I am trying to make the smallest kernel to provide as much space as possible for the "initrd" .
After further digging I found the following in "arch/arm/mach-imx/common.c"
----------------------------------------
#if !defined(CONFIG_SOC_IMX6SX) && !defined(CONFIG_SOC_IMX6UL)
u32 imx6_up_ddr3_freq_change_start, imx6_up_ddr3_freq_change_end;
struct imx6_busfreq_info {
} __aligned(8);
void imx6_up_ddr3_freq_change(struct imx6_busfreq_info *busfreq_info) {}
void imx6_up_lpddr2_freq_change(u32 freq, int bus_freq_mode) {}
#endif
----------------------------------------
Changing the "&&" in the code above by a "||" allows the compile the kernel with the "CONFIG_SOC_IMX6SX is not set".
Is this an error in the code or is there a reason that the kernel must be compiled for multiple "iMX" models to operate properly ?
Thanks