N2+ Ubuntu + Kodi + VDR + hyperion.ng

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

N2+ Ubuntu + Kodi + VDR + hyperion.ng

Post by beta2 »

Dear all,

I am a new user to this forum and need your help. I am trying to set up Hyperion.ng ambilight for N2+ using Ubuntu 20.04 minimal. I have read all posts regarding ambilight in this and in other forums including C2.

What I did so far:

I downloaded Ubuntu minimal 20.04 Kernel 4.9 source code from github. I recognized that there was no device /dev/amvideocap for video capture. I patched this kernel using this patchset: https://github.com/hardkernel/linux/com ... 7615849524.
There are 2 rejects which I resolved manually. I activated the CAPTURE device in kernel and installed this new kernel. After reboot the capture device was there. So far so good.

I downloaded hyperion.ng from github and compiled it natively on Odroid N2+. I am using Odroid N2+ for VDR software (please see this thread (in German) for more information: https://www.vdr-portal.de/forum/index.p ... thdodroid/). The video output is full 4K.

I started hyperiond and tried to grab a picture using AML grabber, which resulted in an error message

2021-11-19T17:08:50.442 AMLOGICGRABBER : <ERROR> Capture failed to grab entire image [bytesToRead(24883200) != bytesRead(24876720)]


I commented out this error message in order to see what would have been grabbed:

Code: Select all

           rc = -1;
                }
                else
                {
                        //if (bytesRead != -1 && static_cast<ssize_t>(_bytesToRead) != bytesRead)
                        //{
                        //      // Read of snapshot failed
                        //      ErrorIf(_lastError != 4, _log,"Capture failed to grab entire image [bytesToRe...
                        //      _lastError = 4;
                        //      rc = -1;
                        //}
                if (0==2)
                {}
                        else {
The result can be seen in the attachment (A part of the grabbed picture is missing). I did some further investigation and read this forum post for C2: viewtopic.php?t=20901. It states that FORCE_MAX_ZONEORDER should be raised to 13 for grabbing full 4K image. I changed it. This kernel does not boot using the uboot on my eMMC. Only Petitboot was able to boot it. However, with this change, VDR does not run correctly any more.

I checked CoreElec Kernel and saw that FORCE_MAX_ZONEORDER is set to 11, the default value. CoreElec can grab correctly. I even build an Ubuntu 20.04 standard kernel where I replaced media and media_addons branch by the CoreElec ones with the some result. It seems that CoreElec is using ge2d to scale down the picture to be grabbed.

I also tried tobetters N2 Kernel 4.9.y but was not able to boot this kernel on N2+. It looks like more recent mainline kernels (tobetter 5.x) do not have the amvideocap device included or enabled.

Can someone with more kernel experience (e.g. @tobetter) guide me to a correct kernel implementation which allows 4k caputre of a down-sized picture for hyperion.ng? Maybe I am missing some patch sets? Any help is highly appreciated.

Kind regards
beta
Attachments
screenshot.png
screenshot.png (269.98 KiB) Viewed 1478 times

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Nov 28, 2021 8:45 pm
I checked CoreElec Kernel and saw that FORCE_MAX_ZONEORDER is set to 11, the default value. CoreElec can grab correctly. I even build an Ubuntu 20.04 standard kernel where I replaced media and media_addons branch by the CoreElec ones with the some result. It seems that CoreElec is using ge2d to scale down the picture to be grabbed.
Do you mean you have compiled CoreELEC kernel and boot from Ubuntu 20.04 image?
I also tried tobetters N2 Kernel 4.9.y but was not able to boot this kernel on N2+. It looks like more recent mainline kernels (tobetter 5.x) do not have the amvideocap device included or enabled.
My 4.9.y kernel branch would not work and will give you the same result, I think. Also 5.x kernel branch does not have amvideocap drivers yet.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Do you mean you have compiled CoreELEC kernel and boot from Ubuntu 20.04 image?
No, I just replaced the Ubuntu amlogic media and media_addon branches with the CoreElec ones, changed many headers and so on until I could conpile this kernel and boot it using Ubuntu 20.04. However, the result is the same as with my the minimum patched kernel.

If I change the grab size in amvidecap.c to e.g. 1920x1080, everything is working well with the exception that of course only a part of the 4K picture is grabbed. The only remaining problem is full 4K grab (#define CAP_WIDTH_MAX 3840 #define CAP_HEIGHT_MAX 2160). In my patched Ubuntu Kernel it is not possible to grab the full 4k picture. I read that this is related to FORCE_MAX_ZONEORDER. However, as mentioned, I cannot set it to 13.

I am wondering how CoreElec is doing it (without setting FORCE_MAX_ZONEORDER to 13 but leaving it at 11). Is there anything you can help me with, @tobetter? Any help is highly appreciated.

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Nov 28, 2021 10:35 pm
Do you mean you have compiled CoreELEC kernel and boot from Ubuntu 20.04 image?
No, I just replaced the Ubuntu amlogic media and media_addon branches with the CoreElec ones, changed many headers and so on until I could conpile this kernel and boot it using Ubuntu 20.04. However, the result is the same as with my the minimum patched kernel.
What about to use completely use CoreELEC kernel and their drivers? I guess you need to change a bit of kernel config but would not that difficult. Since Hardkernel's kernel branch have some tweaks to cover issues from users, it could break the functions unexpectedly.
If I change the grab size in amvidecap.c to e.g. 1920x1080, everything is working well with the exception that of course only a part of the 4K picture is grabbed. The only remaining problem is full 4K grab (#define CAP_WIDTH_MAX 3840 #define CAP_HEIGHT_MAX 2160). In my patched Ubuntu Kernel it is not possible to grab the full 4k picture. I read that this is related to FORCE_MAX_ZONEORDER. However, as mentioned, I cannot set it to 13.

I am wondering how CoreElec is doing it (without setting FORCE_MAX_ZONEORDER to 13 but leaving it at 11). Is there anything you can help me with, @tobetter? Any help is highly appreciated.
Actually, I've not tried Hyperion.ng yet...let me see if I can. The best would be anyone from CoreELEC can advice how they achieve this.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

tobetter wrote:
Sun Nov 28, 2021 10:57 pm
What about to use completely use CoreELEC kernel and their drivers?
It's not that easy. They are using minimalfs booting busybox.
Actually, I've not tried Hyperion.ng yet...let me see if I can. The best would be anyone from CoreELEC can advice how they achieve this.
This would be great. You can apply the patch I sent above, start hyperiond and grab with hyperion-aml --screenshot while playing some media in 4k. Then you will see my problem. I just tried to compile the kernel setting ARM64_64K_PAGES to force FORE_AMX_ZONEORDER to 14. However, this results in compile errors for aml audio soc.

Are any CoreElec team members reading this or do I need to post in their forum?

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Nov 28, 2021 11:31 pm
t's not that easy. They are using minimalfs booting busybox.
I was imaging to compile CoreELEC kernel and replace Image/device tree/drivers in the Ubuntu image.
Are any CoreElec team members reading this or do I need to post in their forum?
It would be also good idea if you post your issue to CoreELEC forum to know techincally how they figure out Hyperion issue. I believe some of them would response, it's not that bad even if no one response since the issue happens on Linux.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: Have you had a chance to take a look at kernel patch/amvideocap and hyperion?

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Fri Dec 03, 2021 8:37 pm
@tobetter: Have you had a chance to take a look at kernel patch/amvideocap and hyperion?
Sorry, not really. I tried to set up the test and not finished yet. Let me see if I can continue this weekend.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

That's most kind of you. Thank you very much!

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Fri Dec 03, 2021 8:53 pm
That's most kind of you. Thank you very much!
I spent several hours to test it and recognize the issue. Will see a bit more when my battery is charged again.

What I wonder is, is the video decoding capability important? I read the thread, thank you and another thank you to Google translator, you mentioned that kernel version is not important. My understand of Hyperion user is to enjoy the ambiant colors around their TV while watching it. So video capability is also important and which is only possible with 4.9 kernel.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Thank you for your time, tobetter.

Yes, video decoding at the same time is important, because we want to watch TV using VDR software and simultaneously illuminate the wall behind TV using hyperion.ng. Saying this, kernel version unfortunately is important. We would like to stick to the 4.9 kernel auf hardkernel in order o have the required video decoding capabilities in the kernel. Therefore, it would be great if we could find a way to properly implement amvideocap device into odroid 4.9 kernel.

Thank you once again for your kind support. It is highly appreciated!

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

I've spent some time to debug the issue and not figured out yet. :(

Firstly, I am not getting an size error what you metioned in the first post. So I didn't change anything on Hyperion.
Secondly, I was testing three videos, "bbb_sunflower_1080p_30fps_normal.mp4", "bbb_sunflower_2160p_30fps_normal.mp4" and "bbb-3840x2160-cfg02.mkv". As you said, I am able to run Hyperion with "bbb_sunflower_1080p_30fps_normal.mp4" but other two video gives different issues.
  • With "bbb_sunflower_2160p_30fps_normal.mp4", Hyperion shows broken/tiled pictures similar to the picture you attached. The issue is more visible when selecting the lower "Capture frequency" like 5, 30 also gives an error but I guess it's not very noticible for LED.
Screenshot from 2021-12-05 12-19-26.png
Screenshot from 2021-12-05 12-19-26.png (662.6 KiB) Viewed 1336 times
  • With "bbb-3840x2160-cfg02.mkv", it's totally different issue. It is even not properly capture a video. It's because, I believe, that the frame format to amvidcap with this video is not normal YUV frame whilist previous two video give YUV422 or NV21 format respectively. So color conversion to RGB is completely wrong.
Screenshot from 2021-12-05 12-06-52.png
Screenshot from 2021-12-05 12-06-52.png (834.41 KiB) Viewed 1336 times
I also had tried to boot up CoreELEC Linux kernel on top of Ubuntu 20.04 minimal OS, what I expected to work. For some reason, it does not boot up, specifically failed at starting systemd- I guess - and reboot.

I am not sure, :), I am capable to fix this but let me share my dirty/hacky debugging. Top first 2 commits are I made for this thread.
https://github.com/tobetter/linux/commi ... y-amvidcap

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Thank you once again, @tobetter. I will check out your kernel hack and try it with VDR. I will report back.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

With your hack I observe the same behaviour compared to my hack. hyperiond is working for h264 full HD content. However, h265 content does not work. Starting hyperiond while playing 4K content (h265) results in heavy picture disturbance (green stripes and area all through the original video, similar to the last picture you captured).

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: I generated a kernel based on Ubuntu 4.9, where I replaced all media modules with the ones CoreElec uses. You can find the kernel here: https://we.tl/t-zz969zWUPp
Maybe this can help? However, I am getting the behaviour as described in my previous post...

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Dec 05, 2021 8:20 pm
@tobetter: I generated a kernel based on Ubuntu 4.9, where I replaced all media modules with the ones CoreElec uses. You can find the kernel here: https://we.tl/t-zz969zWUPp
Maybe this can help? However, I am getting the behaviour as described in my previous post...
Hey, I've tried this kernel but looks like it's the same.

I made another version from CoreELEC Linux branch to run on Ubuntu, its version is 4.9.113 with CoreELEC media_modules. But...looks like the same. :)
https://github.com/tobetter/linux/tree/ ... -19_odroid

If you want to try this, run make odroidn2_defconfig and use Image.gz and Linux modules, but not device tree. Do not replace 'meson64_odroidn2_plus.dtb' with 'g12b_s922x_odroid_n2plus.dtb', otherwise it will caues a booting failure.

If this does not work, I guess the problem is not Linux kernel and its driver.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

I am currently compiing this kernel and will let you know the outcome once I am ready.
What I am wondering is that limiting the picture size in amvideocap.c (e.g. to full HD) helps in a way that I do not have any disturbance at all. Of cause the grabbed picture is not the one you see, but it works. This leads me again to FORCE_MAX_ZONEORDER which is set to 11 as default.
I need to set it to at least 13 in order to grab a full 4K frame. However, this kernel (set to 13) does not boot (only using Petitboot) and VDR is not running correctly. I am still thinking that FORCE_MAX_ZONEORDER=13 is the key...

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Dec 05, 2021 11:01 pm
I am currently compiing this kernel and will let you know the outcome once I am ready.
What I am wondering is that limiting the picture size in amvideocap.c (e.g. to full HD) helps in a way that I do not have any disturbance at all. Of cause the grabbed picture is not the one you see, but it works. This leads me again to FORCE_MAX_ZONEORDER which is set to 11 as default.
I need to set it to at least 13 in order to grab a full 4K frame. However, this kernel (set to 13) does not boot (only using Petitboot) and VDR is not running correctly. I am still thinking that FORCE_MAX_ZONEORDER=13 is the key...
One thing I am curious if it will have better performance if use mmap instead of read in AMLGrabber.
https://github.com/hyperion-project/hyp ... r.cpp#L134
https://github.com/tobetter/linux/blob/ ... cap.c#L948

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Your latest kernel does boot as you described. However, VDR does not run (I can't see the OSD)...

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

tobetter wrote:
Sun Dec 05, 2021 11:20 pm
One thing I am curious if it will have better performance if use mmap instead of read in AMLGrabber.
Can mmap read the entire picture (4K) without the need to set FORCE_MAX_ZONEORDER to 13?

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sun Dec 05, 2021 11:39 pm
tobetter wrote:
Sun Dec 05, 2021 11:20 pm
One thing I am curious if it will have better performance if use mmap instead of read in AMLGrabber.
Can mmap read the entire picture (4K) without the need to set FORCE_MAX_ZONEORDER to 13?
I am guessing that mmap will reduce the overhead of memory copy for 4K between kernel space and user space using copy_to_user, not sure how FORCE_MAX_ZONEORDER affects it yet. :)

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: If your time allows, could you please implement your idea in your kernel?

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: I detected one major difference between our implementation and CoreElec's. We try to grab a full 4K picture, which does not work due to kernel constraints. CoreElec only grabs a full HD picture. So my question is: How can the display buffer be 4K, while amvideocap can only grabs a full HD picture out of it?

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Sat Dec 11, 2021 5:43 am
@tobetter: I detected one major difference between our implementation and CoreElec's. We try to grab a full 4K picture, which does not work due to kernel constraints. CoreElec only grabs a full HD picture. So my question is: How can the display buffer be 4K, while amvideocap can only grabs a full HD picture out of it?
Do you mean this code which scale down the 4K decoded video buffer to 1920x1080?
https://github.com/tobetter/linux/blob/ ... cap.c#L578

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: I see. It's unfortunately already in.I also talked to Portisch. Obviously CoreElec can grab full 4K picture (depending on your OSD setting). Now I am really stuck, because my kernel (which I sent to you previously using WeTransfer) includes all CoreElec media modules and shows the same bad behavior (part of the grabbed image is missing). I don't have any idea any more. Do you?

User avatar
rooted
Posts: 9009
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 745 times
Been thanked: 423 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by rooted »

Not to discourage you as it would be nice if this was figured out and resolved but why not use CoreELEC?

It has entware and docker so you can run most anything possible on it and don't have to use Ubuntu.


beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

rooted wrote:
Sat Dec 11, 2021 7:59 pm
why not use CoreELEC?
I know CoreElec and yes, it is nice. However, docker containers do not allow access to hardware accelerated VPU access and I would like to use VDR with native video output plugin. And yes, I know I can use tvheadend...

User avatar
mad_ady
Posts: 10194
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 632 times
Been thanked: 824 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by mad_ady »

I think you can passthrough devices to the container, but they are no longer accessible to the host: https://stackoverflow.com/questions/242 ... ial-device

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

The problem is accelerated video decoding. This means I need to run odroid kernel in docker (which should be possible). It is also true that I can share devices (as you mentioned) with docker container. However, I don't think it's possible to expose accelerated VPU access through docker container. I really like CoreElec and I have a dual boot system set up which I can switch using remote control (Ubuntu on eMMC and CoreElec on SD). However, I really want to get hyperion working using Ubuntu. Another option could be to include VDR and the plugins I like into CoreElec build system...

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter

I am getting closer. I compiled a new kernel (https://we.tl/t-YatDzLQ58p). This kernel includes all CoreElec media driver and modules (no CoreElec patches yet). It is quick and dirty (I commented out all -Werror-entries in Makefile).

I can grab 4K and FullHD (tested with SES Astra UHD and FullHD 1080i) using c2play.
spectre_fhd.png
spectre_fhd.png (222.13 KiB) Viewed 1034 times
ses_astra4k.png
ses_astra4k.png (168.53 KiB) Viewed 1034 times
I need this in rc.local:

Code: Select all

echo 3 > /sys/module/amvdec_h265/parameters/double_write_mode
echo 3 > /sys/module/amvdec_vp9/parameters/double_write_mode
I have a remaining problem: When I change to another video, display output is switching off automatically. I need to reactivate it with

Code: Select all

echo 0 > /sys/class/video/disable_video
I have no idea what disables the video...
These users thanked the author beta2 for the post:
odroid (Fri Dec 17, 2021 9:51 am)

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Thu Dec 16, 2021 8:04 pm
@tobetter

I am getting closer. I compiled a new kernel (https://we.tl/t-YatDzLQ58p). This kernel includes all CoreElec media driver and modules (no CoreElec patches yet). It is quick and dirty (I commented out all -Werror-entries in Makefile).

I can grab 4K and FullHD (tested with SES Astra UHD and FullHD 1080i) using c2play.
spectre_fhd.png
ses_astra4k.png

I need this in rc.local:

Code: Select all

echo 3 > /sys/module/amvdec_h265/parameters/double_write_mode
echo 3 > /sys/module/amvdec_vp9/parameters/double_write_mode
I have a remaining problem: When I change to another video, display output is switching off automatically. I need to reactivate it with

Code: Select all

echo 0 > /sys/class/video/disable_video
I have no idea what disables the video...
Wow, you made it!!
This looks very promising and glad to know about double_write_mode.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

One final remark: If you save a new hyperion config using the web end, you need to issue the following commands in order to get this working using my latest kernel:

Code: Select all

sed -i 's/3839/1920/g' /root/.hyperion/db/hyperion.db
sed -i 's/2159/1080/g' /root/.hyperion/db/hyperion.db
@tobetter: Thank you once again for all your help. I really appreciated this!

Now I need to buy another N2+ for further kernel debugging...

User avatar
rooted
Posts: 9009
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 745 times
Been thanked: 423 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by rooted »


beta2 wrote:
I have a remaining problem: When I change to another video, display output is switching off automatically. I need to reactivate it with

Code: Select all

echo 0 > /sys/class/video/disable_video
I have no idea what disables the video...
Did you also resolve this and if so what was the issue?

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Did you also resolve this and if so what was the issue?
Not yet. In VDR we can use a workaround by enabling video again before starting the video decoder. My guess is that CoreElec Kodi will do the same, because I am using CoreElec kernel's media and media_modules tree. In the meantime I back-ported Ubuntu's HDMI driver in order to get rid of several warnings. This is running quite well.
These users thanked the author beta2 for the post:
tobetter (Tue Dec 21, 2021 5:54 am)

User avatar
rooted
Posts: 9009
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 745 times
Been thanked: 423 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by rooted »

Very nice debugging and hacking, I'm glad you continued on to find a resolution.

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Thank you, rooted. Now I need to find a place where I can host my kernel. There might be others interested in. Maybe I can also write a howto for Odroid wiki including dual boot option.
These users thanked the author beta2 for the post:
odroid (Tue Dec 21, 2021 3:15 pm)

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Tue Dec 21, 2021 3:06 pm
Thank you, rooted. Now I need to find a place where I can host my kernel. There might be others interested in. Maybe I can also write a howto for Odroid wiki including dual boot option.
Are you looking for host your kernel source or binaries? What options are required for dual option?

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

Are you looking for host your kernel source or binaries? What options are required for dual option?
I would like to provide the kernel source. This will help others to make changes easily. Compared to the last version I sent I implemented several changes in the meantime (e.g. back-portgin the CoreElec HDMI driver back to Ubuntu's to get rid of several warnings). My last version compiles now with even less warnings compared to the original Ubuntu kernel. Additionally, I haven't had any crash since this change. It would also be a good base to completely include all CoreElec changes. I friend of mine at www.vdr-portal.de even could use this kernel to run accelerated KODI in Ubuntu. However, there is currently a slight problem with A/V sync which I think is not kernel related.

Regarding dual boot options: I have Ubuntu on eMMC and CoreElec on an SD card. I saved the eMMC bootloader to a file and copied this file to SD card (CoreElec). Using VDR, I have a menu entry to boot KODI. In this case part of the bootloader is erased and Odroid rebooted. Because no valid boot signature is found, it will boot into CoreElec. In CoreElec I have a script which is flashing the bootloader back to eMMC. Thus, on the next boot eMMC is booted again. I do not know if this is of interest, but I am willing to share these scripts. I know you can do this using Petitboot and the Odroid remote. My method works with any remote...

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

I found a solution for the problem with the disabled video. Simply add a

Code: Select all

echo 0 > /sys/class/video/blackout_policy
in /etc/rc.local.

Now I will try to get accelerated KODI working with my kernel in Ubuntu...

User avatar
rooted
Posts: 9009
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 745 times
Been thanked: 423 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by rooted »


beta2 wrote:I found a solution for the problem with the disabled video. Simply add a

Code: Select all

echo 0 > /sys/class/video/blackout_policy
in /etc/rc.local.

Now I will try to get accelerated KODI working with my kernel in Ubuntu...
Awesome!

Best of luck with Kodi, I'm extremely hopeful you can accomplish this and share the method

User avatar
odroid
Site Admin
Posts: 38578
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2249 times
Been thanked: 1297 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by odroid »

Very exciting news!
I love to see a KodiBuntu OS. ;)

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@odroid: Please feel free to shift this post to a new topic if you feel it will not fit this one.

I would like to report back on my trials to get CoreElec's KODI running using Ubuntu and I made a big step forward using my hyperion kernel. This kernel features the complete CoreElec media und media_modules branch with the exception of HDMI TX driver. For this a backported the Ubuntu driver to get rid of several warnings.

I can run CoreElec's KODI in Ubuntu. It is not yet hardware accelerated but I know why and will change this soon. These are the steps I undertook:

1. I installed all kodi build-dep packages (and some more). You will see which ones are missing due to cmake errors.
2. I downloaded the complete CoreElec build system to my X86-64 PC and did a cross compile of CoreElec. This delivers me patched KODI source and much more which I will need later.
3. I zipped the KODI source code and transferred it to my odroid. I deleted the cross compile build. This is a hidden directory starting with a ".".
4. I made a build directory and used the following cmake:

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml \
	-DENABLE_X=OFF \
	-DAPP_RENDER_SYSTEM=gles -DENABLE_INTERNAL_FLATBUFFERS=ON \
	-DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON \
	-DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON \
	-DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF \
	-DVERBOSE=OFF -DENABLE_NEON=OFF \
	-DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 \
	-DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON \
	-DENABLE_INTERNAL_FFMPEG=ON \
	-DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF \
	-DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON \
	-DENABLE_VDPAU=OFF \
	-DENABLE_VAAPI=OFF \
	-DHAVE_LINUX_DMA_HEAP=0 \
	-DCMAKE_HAVE_LIBC_PTHREAD=1 \
	-DNFS_MOUNT_GETEXPORTS_TIMEOUT=0 \
	..
The build directory is within the KODI directory.

5. I need a link (as root): /xbmc -> /home/username/kodi.coreelec/xbmc
6. I needed to patch the file xbmc/windowing/amlogic/WinSystemAmlogic.cpp, around line 74 I commented out

Code: Select all

//CAESinkPULSE::Register();
This is registering Pulseaudio which I am not using yet.
7. Before invoking the above cmake command I download libamocodec (same version which CoreElEc is using).
You can find it here: https://sources.coreelec.org package name is f4cacd93b663c938fe596c5453dfe3ba40547fda
I copied the headers to /usr/include and the libs to /usr/lib (as root).
8. The cmake/make commands compiles and links kodi.bin which is located afterwards in build directory. There is no need to install.
9. I deleted my old .kodi directory in my root directory. If one CPU core is running out of memeory, you will need to use make instead of make -j4 until this has been passed. Afterwards, you can interrupt again (CTRL-C) and redo a make -j4.
10. I started kodi.bin as root. This will result in a black screen. I needed to re-enable my screen with

Code: Select all

echo 2160p50hz420 > /sys/class/display/mode
I guess you need to change my resolution to the one your monitor/TV supports.
11. It is real fun to see CoreElec's KODI running in Ubuntu including the CoreElec-logo. I tried to play FHD and 4K movies and they are all working (at high CPU).

Important note: This is NOT yet hardware accelerated as I am using the KODI internal FFMPEG version. I just wanted to have this as a base. From there I will now change to CoreElecs external ffmpeg version which should enable hardware acceleration in my KODI build. Additionally, I will replace all the internal libs to the external ones, CoreElec is using. Moreover, there are some libs which do not meet the CoreElec KODI requirements due to wrong versions. I will also compile these libs (/usr/local...) and use them instead of the Ubuntu libs.

For me this was the first real big step to get CoreElec's KODI running using Ubuntu and it took the whole day. I will probably be able to continue the work after Xmas. Otherwise my family will be upset ;) I wish you all a Merry Xmas. I will continue on my work as time allows and will post my results here.
I am also willing to share all the source code once I am ready.
Last edited by beta2 on Fri Dec 24, 2021 4:55 am, edited 2 times in total.

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

@beta2, thank you for sharing your effort. Would you be able to share the kernel tree and media_modules what you made in Github or others?

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter I can do so after Xmas or I can send you a download link. What do you prefer?

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Fri Dec 24, 2021 3:49 am
@tobetter I can do so after Xmas or I can send you a download link. What do you prefer?
When you are convinient. :)

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

@tobetter: Here is a download link for my current version: https://we.tl/t-hRGgPEBiqy
This should compile cleanly and also includes a .config. For me it's also OK, if you will host it in your github.
I think the wetransfer download link is only valid for 7 days.

User avatar
tobetter
Posts: 8964
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 521 times
Been thanked: 1441 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by tobetter »

beta2 wrote:
Fri Dec 24, 2021 3:56 am
@tobetter: Here is a download link for my current version: https://we.tl/t-hRGgPEBiqy
This should compile cleanly and also includes a .config. For me it's also OK, if you will host it in your github.
I think the wetransfer download link is only valid for 7 days.
Thanks, I will look into this if I can host and help you to build some.

See you after Xmas. :)

beta2
Posts: 63
Joined: Sun Nov 28, 2021 8:05 pm
languages_spoken: english, german
ODROIDs: N2+
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by beta2 »

I am hosting my kernel in Github: https://github.com/beta68/linux.
It is the latest Odroid 4.9 Ubuntu kernel. I replaced the media and media_modules tree with the ones of CoreElec. Additionally, I back-ported the HDMI driver in order to get rid of several warnings. The .config file is included.

In the meantime I have fully accelerated KODI running in Ubuntu using my kernel. This was (and still is) a bit tricky. 64bit KODI does not run due to a crash in aml_lib. Unfortunately, I cannot debug this bus error/segmentation fault, because aml_lib libamvcodec is stripped. armhf version does work with some aml_libs (not all) but crashes sometimes. Again, debugging is not possible due to stripped libraries.

What is working really well is CoreElec KODI in chroot Ubuntu environment. I tested UHD and FHD videos, which are in perfect sync and accelerated. I still have a few problems to solve (e.g. internet connection in chroot environment, add-ons etc.). The setup is principally very easy (just untar CoreElec directories, mount chroot environment and start KODI). If I have a first reliable version, I will share this version with @tobetter, who is willing to help me. Thank you for this, @tobetter. At the same time I will write a small step-by-step guide for those willing to test/help debugging. The final aim is a KODIBUNTU version.

Also hyperion is working together with chroot KODI.

@odroid: Thank you very much for your support!
These users thanked the author beta2 for the post:
odroid (Wed Dec 29, 2021 9:52 am)

User avatar
mad_ady
Posts: 10194
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 632 times
Been thanked: 824 times
Contact:

Re: N2+ Ubuntu hyperion.ng

Post by mad_ady »

e.g. internet connection in chroot environment
Make sure /etc/resolv.conf inside the chroot has a valid nameserver 8.8.8.8 in it and internet should work. Regular networking should already work...

User avatar
odroid
Site Admin
Posts: 38578
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2249 times
Been thanked: 1297 times
Contact:

Re: N2+ Ubuntu + Kodi + hyperion.ng

Post by odroid »

This is an amazing project !
I've slightly modified title of this topic and made it sticky.
These users thanked the author odroid for the post:
beta2 (Wed Dec 29, 2021 4:29 pm)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: beta2 and 1 guest