OrangePi: Installing OpenELEC chroot into Armbian (Updated 15. Jul 2017)

Hi all,

since I found, that Debian chroot on OpenELEC is not the best solution, I tried to do it vice-versa. This is what I needed to do.

Compile mali modules

In case you are running following kernel, you can download precompiled modules here and skip this chapter (if you trust me :).

Linux armbian 3.4.113-sun8i #28 SMP PREEMPT Thu Feb 2 02:01:28 CET 2017 armv7l armv7l armv7l GNU/Linux

Otherwise:

  1. Clone jernejs H3 linux source
    git clone --depth=1 https://github.com/jernejsk/linux jernejsk-linux
    Cloning into 'jernejsk-linux'...
    remote: Counting objects: 44430, done.
    remote: Compressing objects: 100% (39536/39536), done.
    remote: Total 44430 (delta 4436), reused 44091 (delta 4364), pack-reused 0
    Receiving objects: 100% (44430/44430), 126.04 MiB | 2.76 MiB/s, done.
    Resolving deltas: 100% (4436/4436), done.
    Checking connectivity... done.
    Checking out files: 100% (42891/42891), done.
  2. cd to ump folder
    cd jernejsk-linux/drivers/gpu/mali/ump/
  3. comment out CROSS_COMPILE in Makefile
    #export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
  4. make
    KDIR=/lib/modules/$(uname -r)/build BUILD=release make
    make -C /lib/modules/3.4.113-sun8i/build M=/mnt/backup/jernejsk-linux/drivers/gpu/mali/ump modules
    make[1]: Entering directory '/usr/src/linux-headers-3.4.113-sun8i'
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/common/ump_kernel_common.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/common/ump_kernel_descriptor_mapping.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/common/ump_kernel_api.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/common/ump_kernel_ref_drv.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_kernel_linux.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_kernel_memory_backend_os.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_kernel_memory_backend_dedicated.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_memory_backend.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_ukk_wrappers.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_ukk_ref_wrappers.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_osk_atomics.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_osk_low_level_mem.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_osk_misc.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/linux/ump_kernel_random_mapping.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/../mali/linux/mali_osk_atomics.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/../mali/linux/mali_osk_locks.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/../mali/linux/mali_osk_memory.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/../mali/linux/mali_osk_math.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/../mali/linux/mali_osk_misc.o
     LD [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/ump.o
     Building modules, stage 2.
     MODPOST 1 modules
     CC /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/ump.mod.o
     LD [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/ump.ko
    make[1]: Leaving directory '/usr/src/linux-headers-3.4.113-sun8i'
  5. copy ump.ko to modules
    cp ump.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/mali/ump/ump.ko
  6. cd to mali
    cd ../mali/
  7. comment out CROSS_COMPILE in Makefile
    #export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
  8. make
    KDIR=/lib/modules/$(uname -r)/build USING_UMP=1 BUILD=release make
    Makefile:76: /mnt/backup/jernejsk-linux/drivers/gpu/mali/ump/Module.symvers
    make ARCH=arm -C /lib/modules/3.4.113-sun8i/build M=/mnt/backup/jernejsk-linux/drivers/gpu/mali/mali modules
    make[1]: Entering directory '/usr/src/linux-headers-3.4.113-sun8i'
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_atomics.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_irq.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_wq.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_locks.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_wait_queue.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_low_level_mem.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_math.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_memory.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_misc.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_mali.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_notification.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_time.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_timers.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory_os_alloc.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory_external.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory_block_alloc.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_mem.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_gp.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_pp.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_core.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_soft_job.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_timeline.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_platform.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_kernel_core.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_kernel_linux.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_kernel_descriptor_mapping.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_session.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_device_pause_resume.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_kernel_vsync.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_vsync.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_kernel_sysfs.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_mmu.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_mmu_page_directory.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_mem_validation.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_hw_core.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_gp.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pp.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pp_job.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_gp_job.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_soft_job.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_scheduler.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_gp_scheduler.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pp_scheduler.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_group.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_dlbu.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_broadcast.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pm.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pmu.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_user_settings_db.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_kernel_utilization.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_l2_cache.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_dma.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_timeline.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_timeline_fence_wait.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_timeline_sync_fence.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_spinlock_reentrant.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/common/mali_pm_domain.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_pm.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_pmu_power_up_down.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/__malidrv_build_info.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_ukk_profiling.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_osk_profiling.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory_dma_buf.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_sync.o
     CC [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/linux/mali_memory_ump.o
     LD [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/mali.o
     Building modules, stage 2.
     MODPOST 1 modules
     CC /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/mali.mod.o
     LD [M] /mnt/backup/jernejsk-linux/drivers/gpu/mali/mali/mali.ko
    make[1]: Leaving directory '/usr/src/linux-headers-3.4.113-sun8i'
  9. copy mali.ko to modules
    cp mali.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/mali/mali/mali.ko

Installing OpenELEC

  1. If you haven’t compiled your own mali modules, download this zip and copy mali.ko and ump.ko to modules
    cp mali.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/mali/mali/mali.ko
    cp ump.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/mali/ump/ump.ko
  2. Download and untar OpenELEC .tar upgrade file onto your device
    root@orangepipc:~# wget https://down.nu/updates/OpenELEC-H3.arm-7.0-devel-20170221190834-r23330-g94644893c.tar
    --2017-03-04 12:44:48--  https://down.nu/updates/OpenELEC-H3.arm-7.0-devel-20170221190834-r23330-g94644893c.tar
    Resolving down.nu (down.nu)... 138.68.124.4, 2a03:b0c0:3:d0::1231:4001
    Connecting to down.nu (down.nu)|138.68.124.4|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 144998400 (138M) [application/x-tar]
    Saving to: ‘OpenELEC-H3.arm-7.0-devel-20170221190834-r23330-g94644893c.tar’
    
    OpenELEC-H3.arm-7.0-devel-20170221190834-r 100%[========================================================================================>] 138.28M  8.13MB/s    in 22s     
    
    2017-03-04 12:45:11 (6.15 MB/s) - ‘OpenELEC-H3.arm-7.0-devel-20170221190834-r23330-g94644893c.tar’ saved [144998400/144998400]
    
    root@orangepipc:~# tar -xf OpenELEC-H3.arm-7.0-devel-*.tar
  3. Move OE root to /opt and create moutpoint
    root@orangepipc:~# mv OpenELEC-H3.arm-7.0-devel-*/target/SYSTEM /opt/openelec-root
    root@orangepipc:~# mkdir /opt/openelec
  4. Set video resolution
    root@orangepipc:~# h3disp -m 1080p60
    Now trying to patch script.bin with your settings. Successfully finished. Please reboot for changes to take effect
  5. Install pulseaudio
    root@orangepipc:~# apt install pulseaudio
  6. Create home for kodi
    root@orangepipc:~# mkdir /storage
  7. Create chroot startup file /storage/start.sh
    mount -t devtmpfs /dev /dev
    mount -t proc /proc /proc
    mount -t devtmpfs /dev /dev
    mount -t sysfs /sys /sys
    
    mkdir /run/connman/
    echo "nameserver 8.8.8.8" > /run/connman/resolv.conf
    
    export HOME=/storage
    /usr/lib/kodi/kodi.sh --standalone -fs &
    
    
  8. Create chroot starter file /root/kodi-start.sh
    mount -o loop /opt/openelec-root /opt/openelec
    mount -o bind /storage /opt/openelec/storage
    mount -o bind /var /opt/openelec/var
    mount -o bind /run /opt/openelec/run
    
    modprobe mali
    
    pulseaudio --system --daemonize
    
    chroot /opt/openelec/ /storage/start.sh
    
    
  9. Make them both executable
    root@orangepipc:~# chmod +x /storage/start.sh
    root@orangepipc:~# chmod +x /root/kodi-start.sh
  10. Edit /etc/rc.local
    # disable console cursor blinking
    echo 0 > /sys/class/graphics/fbcon/cursor_blink
    
    /root/kodi-start.sh &
    
    exit 0
  11. Disable kernel messages on screen (they sometimes mess with kodi output). Set console=serial into /boot/armbianEnv.txt
  12. Reboot

And that’s it. HW accelerated kodi should start after boot.

Enjoy!

21 thoughts on “OrangePi: Installing OpenELEC chroot into Armbian (Updated 15. Jul 2017)”

  1. Please write that this method works only on armbian desktop, on armbian server it hangs on kernel.

  2. Thank you, very detailed instructions, works ok!
    Some questions: is it safe to do upgrades via apt-get, even when there is a new Armbian kernel available?
    And, how to enable Samba sharing?

      1. Thanks, but what do you mean “replace the kernel after upgrading”?
        And, after “apt install samba”, the setup/configuration is done in Openelec or in the native Armbian system?

        1. * step 5 replaces kernel
          * in native armbian, you can’t do anything in openelec since it’s mounted read-only

  3. having a problem here. it shows “starting Kernel” than the screen goes black for a minute and than reboots. rinse and repeat.

    Have tried many SDcards and redone the image many times.
    boxes is a BX2(H3 board)

    anyone have any ideas to fix this?

    1. I’ve had something like that while trying to install openelec on a Opi (A20)… kernel was not starting, machid error IIRC.

  4. Try your mali.ko, but:

    # modprobe mali
    modprobe: ERROR: could not insert ‘mali’: Exec format error

    my system:
    # uname -a
    Linux armbian 3.4.113-sun8i #18 SMP PREEMPT Thu Jun 15 02:16:06 CEST 2017 armv7l armv7l armv7l GNU/Linux

  5. Zdravím, až nyní jsem si všiml, že můžu psát česky…Každopádně bylo by možné udělat již hotový image ke stažení. A instalace by se provedla klasicky přes etcher/win32disk imager. …

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.