Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

module not load #34

Closed
maximst opened this issue Feb 20, 2018 · 17 comments
Closed

module not load #34

maximst opened this issue Feb 20, 2018 · 17 comments

Comments

@maximst
Copy link

maximst commented Feb 20, 2018

on armbian

modprobe mali

modprobe: FATAL: Module mali not found in directory /lib/modules/4.14.18-sunxi

insmod /lib/modules/4.14.18-sunxi/extra/mali.ko

insmod: ERROR: could not insert module /lib/modules/4.14.18-sunxi/extra/mali.ko: Invalid module format

@giuliobenetti
Copy link
Contributor

Can you provide build log? And also a objdump -h of KO module? Thanks

@sergey-suloev
Copy link

sergey-suloev commented Feb 20, 2018

@Marx86 can you check that depmod was successful for mali.ko ?
Why on earth you need to load it manually instead of using the device tree?

@maximst
Copy link
Author

maximst commented Feb 20, 2018

I compiled the module like this:

apt install quilt linux-source-4.14.18-next-sunxi
untar the linux source archive
export KDIR=/usr/src/linux-source-4.14.18-sunxi
./build.sh -r r6p2 -b
./build.sh -r r6p2 -i

Maybe I сan do something wrong?

Mali installed in to /lib/modules/4.14.18+ and i created symlink /lib/modules/4.14.18-sunxi/extra -> /lib/modules/4.14.18+/extra

dmesg says:
mali: version magic '4.14.18+ SMP mod_unload ARMv7 thumb2 p2v8 ' should be '4.14.18-sunxi SMP mod_unload ARMv7 thumb2 p2v8 '

Build log:

make: Entering directory '/root/sunxi-mali/r6p2/src/devicedrv/mali'
make -j4 ARCH=arm -C /usr/src/linux-source-4.14.18-sunxi M=/root/sunxi-mali/r6p2/src/devicedrv/mali modules
make[1]: Entering directory '/usr/src/linux-source-4.14.18-sunxi'
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_atomics.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_irq.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_wq.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_locks.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_wait_queue.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_low_level_mem.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_math.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_memory.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_misc.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_mali.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_notification.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_time.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_timers.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_bitmap.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_os_alloc.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_external.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_block_alloc.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_swap_alloc.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_manager.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_virtual.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_util.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_cow.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_defer_bind.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_mem.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_gp.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_pp.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_core.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_soft_job.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_timeline.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_devfreq.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pm_metrics.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_kernel_core.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_kernel_linux.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_session.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_device_pause_resume.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_kernel_vsync.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_ukk_vsync.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_kernel_sysfs.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_mmu.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_mmu_page_directory.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_mem_validation.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_hw_core.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_gp.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pp.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pp_job.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_gp_job.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_soft_job.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_scheduler.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_executor.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_group.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_dlbu.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_broadcast.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pm.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pmu.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_user_settings_db.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_kernel_utilization.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_control_timer.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_l2_cache.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_timeline.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_timeline_fence_wait.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_timeline_sync_fence.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_spinlock_reentrant.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_pm_domain.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_osk_pm.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_pmu_power_up_down.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/platform/sunxi/sunxi.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_dma_buf.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/linux/mali_memory_secure.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/common/mali_dvfs_policy.o
  CC [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/__malidrv_build_info.o
  LD [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/mali.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/sunxi-mali/r6p2/src/devicedrv/mali/mali.mod.o
  LD [M]  /root/sunxi-mali/r6p2/src/devicedrv/mali/mali.ko
make[1]: Leaving directory '/usr/src/linux-source-4.14.18-sunxi'
make: Leaving directory '/root/sunxi-mali/r6p2/src/devicedrv/mali'

objdump:

mali.ko:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .note.gnu.build-id 00000024  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         000165b0  00000000  00000000  00000058  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  2 __ksymtab     00000028  00000000  00000000  00016608  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  3 .rodata       0000159c  00000000  00000000  00016630  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  4 .alt.smp.init 00000208  00000000  00000000  00017bcc  2**1
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  5 __mcount_loc  00000b40  00000000  00000000  00017dd4  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  6 .rodata.str1.4 00003839  00000000  00000000  00018914  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rodata.str   00001cc8  00000000  00000000  0001c14d  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .modinfo      00000677  00000000  00000000  0001de18  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 __ksymtab_strings 00000066  00000000  00000000  0001e48f  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 __param       000000dc  00000000  00000000  0001e4f8  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 11 .ARM.extab    0000057c  00000000  00000000  0001e5d4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 .data         00000288  00000000  00000000  0001eb50  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 13 __bug_table   00000570  00000000  00000000  0001edd8  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 14 .gnu.linkonce.this_module 00000240  00000000  00000000  0001f380  2**6
                  CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD
 15 .ARM.exidx    000016e0  00000000  00000000  0001f5c0  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 16 .plt          00000001  000016e0  000016e0  00020ca0  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 17 .init.plt     00000001  000016e1  000016e1  00020ca1  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 18 .bss          00000950  00000000  00000000  00020ca8  2**3
                  ALLOC
 19 .comment      000010e0  00000000  00000000  00020ca8  2**0
                  CONTENTS, READONLY
 20 .note.GNU-stack 00000000  00000000  00000000  00021d88  2**0
                  CONTENTS, READONLY
 21 .ARM.attributes 00000031  00000000  00000000  00021d88  2**0
                  CONTENTS, READONLY

@giuliobenetti
Copy link
Contributor

You need exactly same kernel version 4.14.18+ sources. This is why it refuses to load

@giuliobenetti
Copy link
Contributor

And keep in mind that next branch is not stable, it's only a patch collector. You should use mainline versions.

@maximst
Copy link
Author

maximst commented Feb 21, 2018

@giuliobenetti
I try build module with kernel /usr/src/linux-source-4.11.12-sun8i but module compiled into /lib/modules/4.11.12+ not in /lib/modules/4.11.12-sun8i

# uname -a
Linux orangepipc 4.11.12-sun8i #2 SMP Wed Nov 22 13:50:32 CET 2017 armv7l armv7l armv7l GNU/Linux

@maximst
Copy link
Author

maximst commented Feb 21, 2018

Maybe i need rebuild kernel from /usr/src/linux-source-4.11.12-sun8i and install it?

@maximst
Copy link
Author

maximst commented Feb 21, 2018

Or i need build mainline kernel from kernel.org without all sunxi patches?
But then the specific periphery will not work, like HDMI, IR receiver, etc. or i wrong?

@giuliobenetti
Copy link
Contributor

I've never faced this kind of problem. But if you build using 4.15 you should have almost every peripheral working. Which SoC are you using?

@giuliobenetti
Copy link
Contributor

Sun8i seems A23 or A33. So there should be everything you need. Take a look at Linux-sunxi. Org on mainline effort section to see what is supported or not by which version.

1 similar comment
@giuliobenetti
Copy link
Contributor

Sun8i seems A23 or A33. So there should be everything you need. Take a look at Linux-sunxi. Org on mainline effort section to see what is supported or not by which version.

@maximst
Copy link
Author

maximst commented Feb 22, 2018

I changed kernel version in files include/generated/utsrelease.h and include/config/kernel.release
and module has loaded with insmod after build, but i dont understand how configure of xorg.conf for using mali driver r6p2.
I think what this is wrong config, which the work with p3r0:

Section "Monitor"
        Identifier              "Monitor0"
        Option                  "DPMS" "false"
EndSection
Section "ServerFlags"
        Option                  "BlankTime" "0"
        Option                  "StandbyTime" "0"
        Option                  "SuspendTime" "0"
        Option                  "OffTime" "0"
EndSection

Section "Screen"
        Identifier        "Screen0"
        Device          "Allwinner A10/A13 FBDEV"
        Monitor         "Monitor0"
EndSection

Section "Device"
        Identifier        "Allwinner A10/A13 FBDEV"
        Driver          "fbturbo"
        Option          "fbdev" "/dev/fb0"
        Option          "SwapbuffersWait" "true"
        Option          "AccelMethod" "G2D"
EndSection

@giuliobenetti
Copy link
Contributor

Good to know the hack of kernel version.

For X11 you need some more steps:

Then you should have it working.

@maximst
Copy link
Author

maximst commented Feb 22, 2018

This is commit for sun4i (A10)? But i use the sun8i (H3) and kernel 4.14.18. And xf86-video-armsoc supported only pl111, exynos, sun4i. Or i wrong?
Sorry, if i asking stupid questions.

@giuliobenetti
Copy link
Contributor

Nobody is stupid if ask something. If someone thinks to know everything is stupid :)

Philosophy apart, sun4i is compatible with Sun8i, you can check that inside drm kernel sources. Idem for xf86-video-armsoc x11 driver. This avoid having every SoC family using different files and inside driver you can distinguish which SoC you're using by checking quirks.

@maximst
Copy link
Author

maximst commented Feb 22, 2018

Thank, You!
I builded and installed armsoc with this steps:

apt install m4 xutils-dev libudev-dev autoconf autogen libudev-dev libtool xorg-dev
git clone https://github.com/mripard/xf86-video-armsoc
cd xf86-video-armsoc
./autogen.sh
make -j5
make install
cp /usr/local/lib/xorg/modules/drivers/* /usr/lib/xorg/modules/drivers/
cp xorg.conf /etc/X11/
cd ..
git clone https://github.com/free-electrons/mali-blobs.git
cd mali-blobs
cp -a r6p2/x11_dma_buf/lib_x11_dma_buf/ /usr/lib

The commit (nextthingco/linux@e390023) already existed in my kernel.

Load the module
insmod /lib/modules/4.14.18-sunxi/extra/mali.ko
Run startx and run glxgears:

DISPLAY=:0 glxgears 
libGL error: unable to load driver: sun4i-drm_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: sun4i-drm
362 frames in 5.0 seconds = 72.337 FPS
484 frames in 5.0 seconds = 96.673 FPS
476 frames in 5.0 seconds = 95.073 FPS

But i get the errors, and i think is slow.

# DISPLAY=:0 glxinfo  
name of display: :0
libGL error: unable to load driver: sun4i-drm_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: sun4i-drm
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_create_context, GLX_ARB_create_context_profile, 
    GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample, 
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, 
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, 
    GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, GLX_OML_swap_method, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
    GLX_SGIX_visual_select_group, GLX_SGI_make_current_read
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4

Xorg log without errors:

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-97-generic armv7l Ubuntu
Current Operating System: Linux orangepipc 4.14.18-sunxi #31 SMP Fri Feb 9 11:11:15 CET 2018 armv7l
Kernel command line: root=UUID=37031002-c65e-4113-b451-f4b61a52ca54 rootwait rootfstype=ext4 console=tty1 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 loglevel=1 ubootpart=5fabfc8f-01 ubootsource=mmc   sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16 cgroup_enable=memory swapaccount=1
Build Date: 13 October 2017  01:59:44PM
xorg-server 2:1.18.4-0ubuntu0.7 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.33.6
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Feb 22 15:29:16 2018
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

@giuliobenetti
Copy link
Contributor

Try to follow #23 issue.
There they make it working, then there is a branch to test because it goes slow even with sun4i-armsoc.so installed correctly.
Try with master branch if everything works ok,
if yes, go on commenting on that issue.

I think you can close this, since topic is changed. Thanks!

@maximst maximst closed this as completed Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants