Linux 3.16 LTS Kernel for Odroid C2

Moderators: mdrjr, odroid

Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Fri Jan 26, 2018 7:46 am

Patchset and build scripts:
http://seafile.servator.de/sbc/odroid/build/

Ready to use linux image for Debian/Ubuntu:
http://seafile.servator.de/sbc/odroid/kernel/

Alternative xorg driver:
http://seafile.servator.de/sbc/odroid/fbturbo/

# info
As 3.14 does not get security patches anymore an 4.14 has a different driver architecture and needs a new uboot I decied to integrate the hardkernel drivers into kernel 3.16.
Why 3.16? It is close enough to 3.14 so the patches to be made are small and we can just copy the missing drivers into the kernel tree.
Th second reason 3.16 has longterm support by linux mainline (currently longer than 4.9) and Debian.
The prepare script downloads and unpacks the latest debian 3.16 kernel and fetches the latest hardkernel odroidc2-3.14.y from github.
In the next step c2 drivers (drivers/amlogic, drivers/gpu/arm, drivers/gpu/drm/mali, drivers/hardkernel and others) will be copied into the 3.16 kernel and patches applied.

The patchset is divided into the main and the optional part.
To enable the optional part just open prepare-linux.sh and change the line doOptional=false to doOptional=true

Contains refreshed patches of my earlier work (optional):
viewtopic.php?f=139&t=23361
viewtopic.php?f=139&t=23765

You can run the prepare script on any current Debian or Ubuntu with bash and use your own build environment, but the build scripts are made to work directly on Odroid C2.

# 1. prepare
Code: Select all
wget http://seafile.servator.de/sbc/odroid/build/linux-3.16-odroidc2-build.tar.gz
mkdir linux-c2
cd linux-c2

tar xzf ../linux-3.16-odroidc2-build.tar.gz

sudo ./build-deps.sh

./update-debian-linux.sh
bash -e prepare-linux.sh


# 2.1 build with debian scripts ...
Code: Select all
./build-debian-linux.sh

sudo ./install-debian-linux.sh


# 2.2 ...or build with mainline scripts
Code: Select all
./config-linux.sh

./build-linux.sh

sudo ./install-linux.sh



Test setup:
- Odroid C2
- Class 10 micro SD card
- LG FHD TV (HDMI) and HP 1600x1200 LCD (via passive DVI to HDMI adapter)
- Tested with 720p50, 1080p60, 1600x900, 1600x1200
- USB keyboard and mouse
- 2.5" USB HDD (only for kernel build)
- Network Port connected to gigabit switch
- Debian 9 XFCE
- Partitions
/dev/mmcblk0p1 /media/boot vfat
/dev/mmcblk0p2 / ext4

Test software:
- fbset
- glmark2-es2
- mpv
- xfce4-sensors-plugin
- freerdp and others in daily use
Last edited by scpcom on Sat Jan 27, 2018 7:23 am, edited 1 time in total.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Fri Jan 26, 2018 8:40 am

Great news!
We will try it and share our test results early next week.
3.16 seems to be maintained until April 2020. :o
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby moon.linux » Fri Jan 26, 2018 5:44 pm

@scpcom.
Excellent work dont but you.
their were some error in the script but I use to get over them.
Code: Select all
# bash -e scripts
moon.linux
 
Posts: 976
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sat Jan 27, 2018 7:11 am

Yes, sorry I forgot to say that the scripts are made to run under bash.
Any other shell may show errors because of some syntax that is bash specific.
I fixed also some lines so all scripts work with "bash -e" now.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Sun Jan 28, 2018 10:42 am

Kodi UI and video playback are working well. So all the basic GPU and VPU functionality looks fine.
Some official USB WiFi modules work too.
Very promising LTS Kernel. :D
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Mon Jan 29, 2018 4:17 am

Nice to hear, did not test Kodi myself yet.

Changes 20180128
- cleaned up linux-3.16.y-arm64_kernel.patch, added assignment of machine_name
- removed linux-3.16.y-of_fdt_initial_boot_params.patch
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Mon Jan 29, 2018 9:50 am

Nice update.
We will try to upload your kernel into GitHub for a debugging party with other forum members within a couple of weeks.

PS. I've moved this thread to Project sub-forum and made it "STICKY".
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Thu Feb 01, 2018 5:30 am

Changes 20180131
- moved kernel offset, size and flags below #endif (linux-3.16.y-arm64_kernel.patch)
- moved dtb append to optional (linux-3.16.y-arm64_boot_dtb_append.patch)
- added optional armv7 compat patch (linux-3.16.y-arm64_kernel_armv7_compat.patch)
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby stmicro » Thu Feb 01, 2018 10:45 am

@scpcom,
Great job! I like your development approach.
I hope we can run Ubuntu 18.04 with 3.16 LTS kernel in May. :mrgreen:
stmicro
 
Posts: 219
Joined: Tue Apr 28, 2015 4:23 pm
Location: shenzhen
languages_spoken: english, chinese
ODROIDs: 2 x C1+, 2 x C2
1 x XU-L, 2 x XU3-L, 3 x U3, 2 x U2, 9 x XU4

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sun Feb 04, 2018 9:56 am

Changes 20180203
- Removed mm/cma.c because it has some redundant/conflicting code with drivers/base/dma-contiguous.c
- Improved linux-3.16.y-dma-contiguous.patch and linux-3.16.y-of_reserved_mem.patch to make shared-dma-pool (cma) work
- Added serial drivers section to config-odroidc2 to fix "cannot create duplicate filename" in debian kernel
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby soulrebell » Wed Feb 07, 2018 6:14 am

Hi,
i want to update the kernel. I am using Debian Stretch image from meveric.
When i am using the script "build-deps.sh", i got the following message

./build-deps.sh: 51: ./build-deps.sh: Bad substitution

Any idea?
soulrebell
 
Posts: 13
Joined: Thu Oct 13, 2016 12:41 pm
languages_spoken: german

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby meveric » Wed Feb 07, 2018 7:10 am

try starting it with bash -x to see more debug messages to find out what could be the issue.
Also there are other tools to create kernels, for example make-kpkg or simply make bindeb-pkg should work as well.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 8217
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Wed Feb 07, 2018 8:27 am

@soulrebell
if you get "Bad substitution" you need to run the scripts with bash. If real bash is missing, you need to install it:
Code: Select all
apt-get install bash

You can just run the script with:
Code: Select all
bash build-deps.sh

If you are not logged in as root you can run:
Code: Select all
sudo apt-get install bash
sudo bash build-deps.sh


@stmicro
The kernel works fine with current Alpha 2 of Xubuntu 18.04. Newer systemd needs syscall 279 (memfd_create) which is part of 3.16
You can also compile the kernel with gcc-7, just need this small patch:
linux-3.16.y-gcc-7_give_up_on_gcc_ilog2_constant_optimizations.patch
See https://patchwork.kernel.org/patch/9643505/

The show stopper on bionic is newer libc6, which causes crash in fb while initializing mali drm
- normal fbdev driver without mali works fine
- Keeping old zesty libc6 (and 43 other old depending on it), upgrading all possible packages works fine with fbturbo and mali, so newer xorg is not the problem
I will try to debug this
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sat Feb 10, 2018 7:10 am

Update to side-topic: Xubuntu 18.04 works fully now. I needed to fix fbturbo (fbturbo-fix-depth.patch). You can download updated version on links above.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby moon.linux » Sat Feb 10, 2018 11:41 am

@scpcon Thanks you very much, I will check you changes at my end.
moon.linux
 
Posts: 976
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby soulrebell » Tue Feb 13, 2018 4:39 am

Sorry for my late answer.
@scpcon: Your hint solve my problem, thank you.

But for the compiling of the kernel, i have consider the following things.

In build-deps.sh
apt-get update
and the install of the following packages.
bc
zip (required for the script build_debian_linux.sh)

In build-debian-linux.sh
Change line 115
from ./build-meta.sh
to bash build-meta.sh

In install-debian-linux.sh
considering
mkdir /media/boot

The kernel compiling successfully and the installing works without errors or warnings.
I wanted to use the kernel, because i have an usb dvb-c stick which is suported since kernel 3.16.
Unfortunately the odroid hang up, if i plug in the dvb-c stick and i have no access to the odroid anymore (i see only the red light, the blue light is out).
Therefore it is difficult for me to search for the failure.
If i unplug the dvb-c stick and reboot, the odroid runs without problems.
soulrebell
 
Posts: 13
Joined: Thu Oct 13, 2016 12:41 pm
languages_spoken: german

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Tue Feb 13, 2018 7:07 am

Thank you for feedback. I changed the scripts (will upload them next time I add other changes).
I had a similar problem in earlier development while plugging an Arduino board via USB to C2, I will debug this now.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby soulrebell » Wed Feb 14, 2018 4:53 am

Ok.
I would be glad, if I can support somehow.
I will have a look at your thread.
soulrebell
 
Posts: 13
Joined: Thu Oct 13, 2016 12:41 pm
languages_spoken: german

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sun Feb 18, 2018 12:34 pm

Changes 20180218
- Added atomic pool (linux-3.16.y-arm64_mm_dma-mapping.patch)
- Added firmware

Freeze on some USB devices is fixed now, tested with Cinergy HTC USB XS DVB-C/T stick (em28xx).

PS: You may need to get extra firmware if your device does not work.
On Debian 9 first try:
Code: Select all
sudo apt-get install firmware-misc-nonfree

If this does not work look in dmesg which firmware is missing and get it from other source like OpenELEC:
Code: Select all
dmesg
sudo wget -N https://github.com/OpenELEC/dvb-firmware/blob/master/firmware/dvb-usb-terratec-htc-stick-drxk.fw?raw=true -O /lib/firmware/dvb-usb-terratec-htc-stick-drxk.fw
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby soulrebell » Mon Feb 19, 2018 4:47 am

You are my hero.
Thank you very much!!!
i have tried it in the past to get the stick to run.
After some tests i see no problems.
Thanks
soulrebell
 
Posts: 13
Joined: Thu Oct 13, 2016 12:41 pm
languages_spoken: german

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Mon Feb 19, 2018 7:03 pm

can we create a branch (odroidc2-3.16.y) on github.com/hardkernel/linux so we all can collaborate ? I am interested inintegrating this with Yocto/OE
Khem
 
Posts: 5
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Tue Feb 20, 2018 2:29 am

I can not add it to github.com/hardkernel/linux, but I think this is already planned:
odroid wrote:Mon Jan 29, 2018
We will try to upload your kernel into GitHub for a debugging party with other forum members within a couple of weeks.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Feb 20, 2018 3:19 pm

We are still testing scpcom's Kernel 3.16.51.
Code: Select all
odroid@odroid64:~$ uname -a
Linux odroid64 3.16.0-6-c2 #1 SMP Ubuntu 3.16.51-3+deb9 (2018-01-08) aarch64 aarch64 aarch64 GNU/Linux


The "fbturbo" seems to be working well with OpenGL-ES2 applications on X11.

Kodi 17.4 worked well with 4K H.265 sample videos thanks to the well ported GPU and VPU drivers.
But after upgrading Kodi to 17.6, I could see only a black screen. :(
We need to find what's wrong.

The 3D GPU acceleration(for webgl) on Chromium browser also worked well after fixing some broken links.
viewtopic.php?f=141&t=29296&p=209237#p209196

The eMMC driver seems to be missing or broken. We will be working on it soon.

Any sysfs nodes for CPU freq control is not available yet. Or, I couldn't find it.

Once the basic features are implemented well, we will gather our resources to polish this Kernel to make a new Ubuntu 18.04 image a few months later.
In fact, we considered Kernel 4.15 and 4.16, but there is no proper VPU driver yet. So many people will not use new Ubuntu 18.04 image if there is no Kodi.
Therefore, we have to go with 3.16 in this year probably.

@scpcom,
Can you please put your Kernel 3.16 code into your Github repo until we officially support Kernel 3.16?
We will send you some updates via pull-request.
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby kszaq » Tue Feb 20, 2018 4:52 pm

@scpcom Have you considered looking at 4.9 kernel? S905X and S912 are supported, adding S905 should not be that hard.

Here you can find the kernel with full git history: https://github.com/Owersun/linux-amlogic

It is extracted from the latest Amlogic buildroot. As far as I can tell it is missing headers and device trees for gxbb (S905).
kszaq
 
Posts: 18
Joined: Thu Jan 28, 2016 5:35 pm
languages_spoken: english
ODROIDs: C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Feb 20, 2018 5:09 pm

There are two reasons why we have to avoid it.
OverSun tested the kernel 4.9 with S905X only, not S905.
So there is no way to predict how much resources and time to invest to make it work on C2.
Additionally, Kernel 4.9 life cycle is much shorter than Kernel 3.16.

Anyway, if anybody can make the Kernel 4.9 work with C2 Ubuntu and Kodi, we will be on the same board definitely.
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby OverSun » Tue Feb 20, 2018 6:53 pm

This would be _not_ an easy task at all.
AML Kernel 4.9 is heavily modified and contains a lot of parts that are specific for gxl boards without mentioning gxbb. So although things are pretty similar, making it run on S905 would be a lot of researching and porting things from gxl to gxbb even if this would be a copy-paste. Unfortunately it is not just a matter of .dts only. =( Even in the .dts for some reason a lot of names were changed by amlogic, for example from "compatible = <pinctrl, aml-gxl>" to "compatible = <pinctrl, gxl-aml>" with corresponding changes to code. So C2 .dtb wouldn't even fit without thorough review.
I'd gladly investigate possibility to run 4.9 on S905 and create a corresponding branch and stuff, if I wouldn't see how huge this job is needed to be... =(
Nevertheless I did make it running on S905X and it runs flawlessly, there are no issues that are needed to be "fixed" for a S905X board, everything works.
User avatar
OverSun
 
Posts: 1303
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby memeka » Tue Feb 20, 2018 7:20 pm

Isn’t it possible to copy the vpu drivers from 4.9 to mainline?
User avatar
memeka
 
Posts: 3856
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby OverSun » Tue Feb 20, 2018 7:38 pm

Seriously not sure about this. VPU drivers draw on a specific surface that lays under EGL video output and I'm not sure there is such a thing like this in mainline kernel. So it could be that these drivers has nothing to connect to.
But there are already works going on to rewrite aml codecs to v4l2.
User avatar
OverSun
 
Posts: 1303
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Wed Feb 21, 2018 2:15 am

odroid wrote:...
Kodi 17.4 worked well with 4K H.265 sample videos thanks to the well ported GPU and VPU drivers.
But after upgrading Kodi to 17.6, I could see only a black screen. :(
We need to find what's wrong.
....
The eMMC driver seems to be missing or broken. We will be working on it soon.

Any sysfs nodes for CPU freq control is not available yet. Or, I couldn't find it.

...
@scpcom,
Can you please put your Kernel 3.16 code into your Github repo until we officially support Kernel 3.16?
We will send you some updates via pull-request.


I have no 4K display or eMMC, so I can not help on this parts.

CPU freq control is available at /sys/devices/system/cpu/cpu?/cpufreq
Example:
Code: Select all
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
echo "1296000" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq


I am not familiar with github, Last use was five or more years ago, I will see if I can remember how it works :-)

EDIT: Something about Linux 4.9:
I already did some short tests with the S905X kernel on C2 without success. The problem are not only the changes by amlogic itself. linux-amlogic is linux-mainline+linux-linaro+amlogic and all of them do massive changes each version which is hard to track. The amlogic changes look very small if you look at all the other changes that are done. Each kernel has game changes in very sensible parts (clock handling, cpu handling, memory handling, header/entry points for boot loader etc.). Even if you try a simple looking step like going two steps from 3.14 to 3.16 this is not easy. For example the next step from 3.16 to 3.18 even did not work for me currently.
scpcom
 
Posts: 25
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Wed Feb 21, 2018 9:48 am

Ah.. I can find "cpufreq" today. I have no idea why it didn't exist yesterday. I was crazy perhaps. :)

BTW, I will send you a PM very soon to send you a couple of eMMC samples.
User avatar
odroid
Site Admin
 
Posts: 26416
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Projects

Who is online

Users browsing this forum: No registered users and 2 guests