[SOLVED] Kernel compilation - DVB-T drivers and HW decoding

Post Reply
pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

[SOLVED] Kernel compilation - DVB-T drivers and HW decoding

Unread post by pichljan » Sat Jan 20, 2018 8:26 pm

I am trying to compile Linux kernel on Odroid C2 and install DVB-T drivers using media_build. I followed steps described on the official wiki and forum. According to the forum, it is necessary to make `Device Drivers -> Amlogic Device Drivers -> Multimedia Support` compile as modules if I want to use the backported media_build DVB-T drivers.

First, I obtained Linux source:

Code: Select all

git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
Then I set the configuration for Odroid C2:

Code: Select all

make odroidc2_defconfig

And finally, I followed the steps for kernel compilation and disabled V4L dependencies as follows:

Code: Select all

 $make menuconfig
    Device Drivers
        Amlogic Device Drivers
      ION Support
         ION memory management support = no
      Amlogic ion video support
         videobuf2-ion video device support = no
         Amlogic ion video devic support = no
      V4L2 Video Support
         Amlogic v4l video device support = no
         Amlogic v4l video2 device support = no
      Amlogic Camera Support
         Amlogic Platform Capture Driver = no
      Multimedia support = m
This configuration compiles without errors, and then I can compile and install media_build drivers. The problem is that with this configuration, Odroid C2 is not capable of playing video files in Kodi with hardware decoding. My impression is that I disabled a dependency which is necessary for amlogic hardware decoding. I tried to modify the config and marked as modules all the dependencies which I previously disabled. Unfortunately, with this configuration, the kernel could not be compiled, and the compilation failed with following error:

Code: Select all

drivers/built-in.o: In function `v4l2_device_release':
    odroid-battery.c:(.text+0x1731c0): undefined reference to 
    `media_device_unregister_entity'
    odroid-battery.c:(.text+0x1731c0): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_device_unregister_entity'
    drivers/built-in.o: In function `__video_register_device':
    odroid-battery.c:(.text+0x173c4c): undefined reference to 
    `media_device_register_entity'
    odroid-battery.c:(.text+0x173c4c): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_device_register_entity'
    drivers/built-in.o: In function `v4l2_device_register_subdev':
    odroid-battery.c:(.text+0x1797b0): undefined reference to 
    `media_device_register_entity'
    odroid-battery.c:(.text+0x1797b0): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_device_register_entity'
    drivers/built-in.o: In function `v4l2_device_unregister_subdev':
    odroid-battery.c:(.text+0x179a58): undefined reference to 
    `media_entity_remove_links'
    odroid-battery.c:(.text+0x179a58): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_entity_remove_links'
    odroid-battery.c:(.text+0x179a60): undefined reference to 
    `media_device_unregister_entity'
    odroid-battery.c:(.text+0x179a60): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_device_unregister_entity'
    drivers/built-in.o: In function `subdev_close':
    odroid-battery.c:(.text+0x180c10): undefined reference to `media_entity_put'
    odroid-battery.c:(.text+0x180c10): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_entity_put'
    drivers/built-in.o: In function `subdev_open':
    odroid-battery.c:(.text+0x1814f4): undefined reference to `media_entity_get'
    odroid-battery.c:(.text+0x1814f4): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_entity_get'
    odroid-battery.c:(.text+0x181540): undefined reference to `media_entity_put'
    odroid-battery.c:(.text+0x181540): relocation truncated to fit: 
    R_AARCH64_CALL26 against undefined symbol `media_entity_put'
    Makefile:831: recipe for target 'vmlinux' failed
    make: *** [vmlinux] Error 1
How can I compile the kernel with Multimedia Support as modules and still be able to use hardware decoding for video files?
Last edited by pichljan on Sun Feb 18, 2018 11:27 pm, edited 1 time in total.

moon.linux
Posts: 1162
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by moon.linux » Sun Jan 21, 2018 2:58 am

Best way to look into Kconfig option for dependent modules.

crashoverride
Posts: 4225
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by crashoverride » Sun Jan 21, 2018 4:15 am

None of those modules are used for hardware decoding. You should check the Kodi logs for information detailing why it is not using hardware acceleration. It may require the ION driver.

pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by pichljan » Sun Jan 21, 2018 9:37 pm

I compared Kodi logs using default kernel configuration and my modified configuration. I noticed that with modified configuration there is a following line in the log file:

Code: Select all

ERROR: AML: no rw on /dev/video10
There is no video10 in `ls /dev/` output. When I switch back to default kernel, I can see video10 and video13 in `ls /dev/` output.

Here is output of command `dmesg | grep video` using default kernel:

Code: Select all

[    0.192818] Linux video capture interface: v2.00                                                                                                                                           [    0.613486] hdmitx: video: get current mode: null                                                                                                                                          [    3.509979] hdmitx: video: get current mode: custombuilt                                                                                                                                   [    3.515196] hdmitx: video: get current mode: custombuilt                                                                                                                                   [    3.952062] codec:create_ge2d_work_queue video task ok                                                                                                                                     [    3.954413] ionvideo-000: V4L2 device registered as video13                                                                                                                                [    3.954707] amlvideo_init called                                                                                                                                                           [    3.954707] amlvideo_create_instance called                                                                                                                                                [    3.954710] v4l2_dev.name=:amlvideo-000                                                                                                                                                    [    3.954766] amlvideo-000: V4L2 device registered as video10                                                                                                                                [   16.964951] ionvideo open                                                                                                                                                                  [   17.164319] ionvideo_stop_generating!!!!                                                                                                                                                   [   17.164339] ionvideo release                                                                                                                                                               [  262.544031] vfm_map_store:add default decoder ppmgr deinterlace amlvideo amvideo                                                                                                           [  262.578078] codec:video first pts = 0                                                                                                                                                      [  262.579524] codec:vdec1 video changed to 1920 x 1080 23 fps clk->166MHZ                                                                                                                    [  262.678001] codec:video first checkin pts = 12510b64                                                                                                                                       [  262.678305] codec:video first pts = 12510b64                                                                                                                                               [  271.368137] codec:video first pts = 0                                                                                                                                                      [  271.378157] codec:vdec1 video changed to 0 x 0 0 fps clk->166MHZ                                                                                                                           [  271.380172] vfm_map_store:add default  decoder ppmgr deinterlace amvideo 
It seems like a really need to include the video support in the kernel configuration.

crashoverride
Posts: 4225
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by crashoverride » Mon Jan 22, 2018 12:11 am

pichljan wrote:[ 3.954766] amlvideo-000: V4L2 device registered as video10
https://github.com/hardkernel/linux/blo ... ideo.c#L72

That is a video capture device that is unrelated to hardware accelerated video presentation. Its absence does not affect video decoding. You may need to patch Kodi to ignore it. You can ask in the LibreElec section of the forum since they provide a working media_build image.

pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by pichljan » Mon Jan 22, 2018 12:25 am

crashoverride wrote:
pichljan wrote:[ 3.954766] amlvideo-000: V4L2 device registered as video10
https://github.com/hardkernel/linux/blo ... ideo.c#L72

That is a video capture device that is unrelated to hardware accelerated video presentation. Its absence does not affect video decoding. You may need to patch Kodi to ignore it. You can ask in the LibreElec section of the forum since they provide a working media_build image.
Oh, my mistake. Thank you for the clarification.

pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by pichljan » Sat Jan 27, 2018 6:14 pm

I am sorry if I am going in a completely wrong direction. I saw this pull request in LibreELEC repository which builds media support as modules. I applied all the changes in kernel configuration a during the kernel compilation I ended up with the following error.

Code: Select all

LD      vmlinux
SORTEX  vmlinux
SYSMAP  System.map
arch/arm64/boot/Image
Building modules, stage 2.
MODPOST 1184 modules
GZIP    arch/arm64/boot/Image.gz
ERROR: "get_ppmgr_buf_info" [drivers/amlogic/video_dev/amlvideodri.ko] undefined!
ERROR: "omx_secret_mode" [drivers/amlogic/video_dev/amlvideodri.ko] undefined!

pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

Re: Kernel compilation - DVB-T drivers and HW video decoding

Unread post by pichljan » Sun Feb 18, 2018 11:26 pm

I finally make it work. I created a git repository with a script, patches, and instructions. If someone is also dealing with this issue please clone this repository and do the following steps (these are also described in the README in the repository):

Linux

Clone Hardkernel Linux repository

Code: Select all

git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
cd linux
Apply patch which allows you to compile aml video driver as a module (I took this step from LibreELEC media_build edition)

Code: Select all

patch -p1 < ../odroidC2-kernel/allow_amlvideodri_as_module.patch
Apply default Odroid C2 config

Code: Select all

make odroidc2_defconfig
Now modify the config

Code: Select all

make menuconfig
And set the following values (press Y to select, N to remove and M to select it as a module)

Code: Select all

Device Drivers
   Amlogic Device Drivers
      ION Support
         ION memory management support = Yes
      Amlogic ion video support
         videobuf2-ion video device support = M
         Amlogic ion video devic support = no
      V4L2 Video Support
         Amlogic v4l video device support = M
         Amlogic v4l video2 device support = no
      Amlogic Camera Support
         Amlogic Platform Capture Driver = no
   Multimedia support = M
Compile the kernel

Code: Select all

make -j5 LOCALVERSION=""
The LOCALVERSION parameter is only to avoid "+" sign in the name of the kernel.
After the successful compilation, install the modules, kernel and reboot the system

Code: Select all

sudo make modules_install
sudo cp -f arch/arm64/boot/Image arch/arm64/boot/dts/meson64_odroidc2.dtb /media/boot/
sudo sync
sudo reboot
Media build

Clone media_build repository and try to build it.

Code: Select all

git clone https://git.linuxtv.org/media_build.git
cd media_build
./build
The build command probably fails. Ignore this error and continue with following steps.
Following script is also inspired by LibreELEC media_build edition and it just includes the video driver into media module.

Code: Select all

../odroidC2-kernel/add_video_driver_module.sh
To avoid potential issues with compilation, try to disable Remote controller support and all the USB adapter you don't need to.
Try to run:

Code: Select all

make menuconfig
It will probably result in an error similar to the following one:

Code: Select all

./Kconfig:694: syntax error
./Kconfig:693: unknown option "Enable"
./Kconfig:694: unknown option "which"
You need to edit the file v4l/Kconfig and align with spaces the lines printed in the error. The lines need to be aligned with the previous ones. Then, run the make menuconfig again. Probably, you need to do this step multiple times.

If you see a menu instead of the error, you can modify the config in the following way:

Code: Select all

Remote Controller support = no
Multimedia support
    Media USB Adapters
        ## Disable all driver you don't need ##
Apply the following patch

Code: Select all

patch -p1 < ../odroidC2-kernel/warning.patch
Make the following change to avoid error and compile kernel

Code: Select all

sed -i 's/#define NEED_PM_RUNTIME_GET 1/\/\/#define NEED_PM_RUNTIME_GET 1/g' v4l/config-compat.h
make -j5
Possibly, you need to run previous step (both sed and make) multiple times before it succeeds.

After the compilation, install the modules and reboot the system

Code: Select all

sudo make install
sudo reboot
The final step is to add amlvideodri module into /etc/modules to make it load on boot.

Code: Select all

sudo echo "amlvideodri" >> /etc/modules
That's all. You can now enjoy your DVB-T TV and HW accelerated videos in Kodi.

User avatar
odroid
Site Admin
Posts: 29651
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: [SOLVED] Kernel compilation - DVB-T drivers and HW decod

Unread post by odroid » Mon Feb 19, 2018 9:06 am

Great!

Can you tell me which DVB-T tested?
Brand/model name?

pichljan
Posts: 6
Joined: Sat Jan 20, 2018 8:15 pm
languages_spoken: english, czech
ODROIDs: Odroid C2
Contact:

Re: [SOLVED] Kernel compilation - DVB-T drivers and HW decod

Unread post by pichljan » Sat Feb 24, 2018 8:53 pm

This is the name of my USB TV stick listed in lsusb command: Integrated Technology Express, Inc. IT9135 BDA Afatech DVB-T HDTV Dongle.
I believe it can be also called Evolve Mars.

User avatar
odroid
Site Admin
Posts: 29651
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: [SOLVED] Kernel compilation - DVB-T drivers and HW decod

Unread post by odroid » Sat Feb 24, 2018 9:00 pm

Thank you for the information.
The IT1935 chipset seems to be very compatible with Linux devices.
https://www.linuxtv.org/wiki/index.php/ITE_IT9135

outhudd9
Posts: 33
Joined: Wed May 02, 2018 10:52 pm
languages_spoken: english
Contact:

Re: [SOLVED] Kernel compilation - DVB-T drivers and HW decod

Unread post by outhudd9 » Sun May 27, 2018 4:18 pm

Hi,

Thanks for the tutorial.

I hit a problem in the media build section.

When I try to run menu makeconfig, the error I get is:

Code: Select all

1 out of 4 hunks FAILED
Makefile:130: recipe for target 'apply_patches' failed
make[2]: *** [apply_patches] Error 1
make[2]: Leaving directory '/home/odroid/media_build/linux'
Makefile:353: recipe for target 'Kconfig' failed
make[1]: *** [Kconfig] Error 2
make[1]: Leaving directory '/home/odroid/media_build/v4l'
Makefile:26: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
And for the step of editing v4l/Kconfig, I don't see the same type of error in the tutorial to know which lines to edit.

(Also I don't see a file called Kconfig at that point, I see:

Code: Select all

odroid@odroid64:~/media_build$ ls v4l/Kconfig*
v4l/Kconfig.misc  v4l/Kconfig.mm  v4l/Kconfig.sound  v4l/Kconfig.staging

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: Google [Bot] and 2 guests