Hello ,everyone
I meet some problems when I compile the mali-400 kernel drivers
I copy the mali0400 drivers to the linux kernel and config the linux kernel .but when I compile the kernel the compiler just generate errors
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here is the .config of my linux kernel :.
#
# Graphics support
CONFIG_DRM=y
CONFIG_DRM_KMS_HELPER=y
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
# I2C encoder or helper chips
# CONFIG_DRM_I2C_CH7006 is not set
# CONFIG_DRM_I2C_SIL164 is not set
# CONFIG_DRM_MALI is not set
CONFIG_DRM_EXYNOS=y
CONFIG_DRM_EXYNOS_DMABUF=y
CONFIG_DRM_EXYNOS_VIDI=y
CONFIG_DRM_EXYNOS_G2D=y
# CONFIG_DRM_UDL is not set
CONFIG_MALI400=y
# CONFIG_MALI450 is not set
CONFIG_MALI400_DEBUG=y
CONFIG_MALI400_PROFILING=y
CONFIG_MALI400_INTERNAL_PROFILING=y
CONFIG_MALI400_UMP=y
# CONFIG_MALI400_POWER_PERFORMANCE_POLICY is not set
CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
# CONFIG_MALI_SHARED_INTERRUPTS is not set
# CONFIG_MALI_PMU_PARALLEL_POWER_UP is not set
CONFIG_UMP=y
# CONFIG_UMP_DEBUG is not set
CONFIG_ION=y
CONFIG_ION_EXYNOS=y
# CONFIG_VGASTATE is not set
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
CONFIG_FB=y
# Frame buffer hardware drivers
CONFIG_FB_S3C=y
CONFIG_FB_S3C_NR_BUFFERS=3
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=y
Here is the errors when I make :.
LD drivers/gpu/mali_r4p0-00rel1/built-in.o
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_break':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_misc.c:53: multiple definition of `_mali_osk_break'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_misc.c:53: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `fls':
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/bitops.h:268: multiple definition of `_mali_osk_clz'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/bitops.h:268: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_memcpy':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:47: multiple definition of `_mali_osk_memcpy'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:47: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_valloc':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:37: multiple definition of `_mali_osk_valloc'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:37: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `current_thread_info':
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/thread_info.h:97: multiple definition of `_mali_osk_get_pid'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/thread_info.h:97: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_read':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:49: multiple definition of `_mali_osk_atomic_read'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:49: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_inc_return':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:36: multiple definition of `_mali_osk_atomic_inc_return'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:36: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_memset':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:52: multiple definition of `_mali_osk_memset'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:52: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_abort':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_misc.c:45: multiple definition of `_mali_osk_abort'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_misc.c:45: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_mem_check_allocated':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:61: multiple definition of `_mali_osk_mem_check_allocated'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:61: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `map_errcode':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/linux/ump_kernel_linux.c:360: multiple definition of `map_errcode'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_kernel_linux.c:552: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_calloc':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:21: multiple definition of `_mali_osk_calloc'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:21: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `atomic_add':
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/atomic.h:44: multiple definition of `_mali_osk_atomic_inc'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/atomic.h:44: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_term':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:55: multiple definition of `_mali_osk_atomic_term'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:55: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `atomic_sub':
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/atomic.h:82: multiple definition of `_mali_osk_atomic_dec'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/atomic.h:82: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_xchg':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:58: multiple definition of `_mali_osk_atomic_xchg'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:58: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `kmalloc':
/home/larrychen/kernel-src/linux-3.5/include/linux/slub_def.h:283: multiple definition of `_mali_osk_malloc'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/include/linux/slub_def.h:283: first defined here
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/thread_info.h:97: multiple definition of `_mali_osk_get_tid'
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_dec_return':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:26: multiple definition of `_mali_osk_atomic_dec_return'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:26: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_snprintf':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_misc.c:33: multiple definition of `_mali_osk_snprintf'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_misc.c:33: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_atomic_init':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_atomics.c:42: multiple definition of `_mali_osk_atomic_init'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_atomics.c:42: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_dbgmsg':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_misc.c:24: multiple definition of `_mali_osk_dbgmsg'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_misc.c:24: first defined here
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_vfree':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:42: multiple definition of `_mali_osk_vfree'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:42: first defined here
/home/larrychen/kernel-src/linux-3.5/arch/arm/include/asm/bitops.h:268: multiple definition of `_mali_osk_fls'
drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/built-in.o: In function `_mali_osk_free':
/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/../mali/linux/mali_osk_memory.c:32: multiple definition of `_mali_osk_free'
drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/built-in.o:/home/larrychen/kernel-src/linux-3.5/drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/linux/mali_osk_memory.c:32: first defined here
Thanks ,Jerome
My host is ubuntu 14.0 32bit, and my toolchain is gcc version 4.5.1 (ctng-1.8.1-FA) .and I also tried the gcc gcc version 4.8.1 which met the same problem when I compiled the kernel drivers.
I keep the original structure of mali 400 kernel drivers files .
+gpu/mali_r4p0-00rel1/
+--mali/
+--ump/
+--umplock/
I just rename the file of `src` with `mali_r4p0-00rel1`, And I add the the Kconfig and the Makefile to point the directory of `mali` and the `ump`.`
The $KDIR/drivers/gpu/Makefile and the $KDIR/drivers/gpu/Kconfig just are the following.
The Makefile is :
--------------------------------------------------------------------------------------------
obj-$(CONFIG_MALI400)+= mali_r4p0-00rel1/devicedrv/mali
obj-$(CONFIG_UMP)+= mali_r4p0-00rel1/devicedrv/ump
The Kconfig is :
source "drivers/gpu/mali_r4p0-00rel1/devicedrv/mali/Kconfig"
source "drivers/gpu/mali_r4p0-00rel1/devicedrv/ump/Kconfig"
regards
Larry Chen
Hi Chen,
The problem is that the sources showing issues such as mali_osk_misc.c are in multiple places; mali/ and ump/.
It is necessary to build ump.ko first, and THEN build mali.ko as mali.ko will attempt to link against ump.ko if UMP support is enabled.
This should help solve the issue.
Hope this helps!
Rich
Thank you,Rich
But when I compiled them to Modules to insert the kernel , I got following errors:
--------------------------------------------------------------------------------------------------------------
/usr # insmod ump.ko
[ 66.960000] UMP: UMP device driver loaded
/usr # insmod mali.ko [ 226.710000] Mali<2>: Inserting Mali v401 device driver. [ 226.710000] Mali<2>: Compiled: Aug 22 2015, time: 14:31:54.[ 226.710000] Mali<2>: Driver revision: r4p0-00rel1[ 226.710000] Mali<2>: mali_module_init() registering driver[ 226.710000] Mali<2>: mali_probe(): Called for platform device mali-utgard[ 226.720000] Mali<2>: Using device defined memory settings (dedicated: 0x00000000@0x00000000, shared: 0x40000000)[ 226.730000] Mali<2>: Using device defined frame buffer settings (0x00000000@0x00000000)[ 226.735000] Mali: ERR: drivers/gpu/mali_r4p0-00rel1/devicedrv/malinux/mali_osk_pm.c[ 226.745000] _mali_osk_pm_dev_ref_add() 50 Mali OSK PM: pm_runtime_get_sync() returned error code -13[ 226.755000] [ 226.755000] Mali: ERR: drivers/gpu/mali_r4p0-00rel1/devicedrv/malinux/mali_kernel_linux.c[ 226.765000] mali_probe() 437 mali_probe(): Failed to initialize Mali device driver.[ 226.775000] mali-utgard: probe of mali-utgard.0 failed with error -14[ 226.780000] Mali: Mali device driver loaded
And do you know how to compile the Mali drivers into the kernel ?
It looks like the kernel drivers you have built might have been using default platform configuration.
[ 226.710000] Mali<2>: mali_probe(): Called for platform device mali-utgard
[ 226.720000] Mali<2>: Using device defined memory settings (dedicated: 0x00000000@0x00000000, shared: 0x40000000)
[ 226.730000] Mali<2>: Using device defined frame buffer settings (0x00000000@0x00000000)
This won't build a working driver. It is necessary to use hardware OEM defined platform files specific to the platform you intend to run on (which ARM itself does not provide) to give the driver memory map regions etc.
The best starting point to do what you're doing is to take a working kernel tree for your target platform and replace the Mali drivers in the source with the ones you want to build; then to fix any mismatches between the mali driver version and kernel to get it building.
Hope this helps,