How to Enable Hardware Decoding for the ODROID-C2

hardware decoding

For hardware decoding, user @pichljan has created a git repository with a script, patches, and instruction. This git repository has fixes intended to help user enable Hardware Decoding for the ODROID-C2. So, if someone is also dealing with this issue please clone this repository and do the following steps. Additionally, these steps are also described in the README in the repository. First, you need to clone the Hardkernel Linux repository:

$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
$ cd linux
Apply a 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 configuration, then modify the configuration settings:
$ make odroidc2_defconfig
$ make menuconfig
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 device 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
Next, we need to compile the kernel:
$ make -j5 LOCALVERSION=""
The LOCALVERSION parameter is only to avoid "+" sign in the name of the kernel. After a successful compilation, install the modules and kernel, then 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 the media_build repository and try to build it:

$ git clone https://git.linuxtv.org/media_build.git
$ cd media_build
$ ./build
The build command will probably fail, but you can ignore this error and continue with following steps. The 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 adapters you don't need:
$ make menuconfig
This command 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, which may need to be done several times. If you see a menu instead of the error, you can modify the config 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 errors 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 the previous steps (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 the amlvideodri module into /etc/modules to make it load on boot:
$ sudo echo "amlvideodri" >> /etc/modules
You can now enjoy your DVB-T TV and HW accelerated videos in Kodi. For more information or further assistance on this topic please see the original thread on the ODROID forums at https://forum.odroid.com/viewtopic.php?f=136&t=29619#p215565.

Be the first to comment

Leave a Reply