1

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:

git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y

Then I set the configuration for Odroid C2:

make odroidc2_defconfig

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

$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:

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?

  • When you tried to restore the dependencies as modules, did you use make menuconfig again, or did you edit the configuration file directly? – Stephen Kitt Jan 14 '18 at 17:44
  • I used make menuconfig again. – Jan Pichl Jan 14 '18 at 17:55
1

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

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)

patch -p1 < ../odroidC2-kernel/allow_amlvideodri_as_module.patch

Apply default Odroid C2 config

make odroidc2_defconfig

Now modify the config

make menuconfig

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

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

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

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.

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.

../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:

make menuconfig

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

./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:

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

Apply the following patch

patch -p1 < ../odroidC2-kernel/warning.patch

Make the following change to avoid error and compile kernel

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

sudo make install
sudo reboot

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

sudo echo "amlvideodri" >> /etc/modules

That's all. You can now enjoy your DVB-T TV and HW accelerated videos in Kodi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.