Odroid C2 mainline kernel support

Moderators: mdrjr, odroid

Re: Odroid C2 mainline kernel support

Unread postby cdu13a » Sun Dec 24, 2017 3:51 am

@tuxx: Hardkernel has used emmc chips from different manufactures over the years they have been making the emmc modules. So it may just be that the emmc chips on the two modules are different. It's possible that there are some emmc chips that might not be as well supported yet by the mainline drivers.
cdu13a
 
Posts: 9
Joined: Tue Jan 20, 2015 3:33 pm
languages_spoken: english
ODROIDs: C1, C2, XU4

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Dec 24, 2017 6:07 am

tuxx wrote:Ok, I really apologize, but I wrote a post full of mistakes. Just to clarify:

- My board is odroid C2
- My kernel is 4.14.8

I did my tests and I noticed something very strange. I have two emmc cards: one bought with my C2 and one bought years ago with my C1+.

- The C2 card is fully functional with hardkernel kernel but when I upgrade to mainline, I get all the above errors.
- I do the same procedure with the old C1+ emmc card (using Odroid C2 of course) and everything is perfect.

So either the cards are different and C2 card has issues with mainline, or the C2 emmc card is dying.


Hi tux, I too have an emmc card which produces errors with all the latest fixes (im using 4.14.5). My card that has issues is a 16Gb (its from the first orig batch) but I can get it working with some hacks to the current driver. Now that I know it might be related to specific card versions I will look into it some more.

Edit: for completeness and so I dont forget, 2 possible methods for a fix
2nd Edit: Option 1 below had some issues on 2 occasions for me (so I made it hard to read)
[color=#00FFBF]1) Edit "drivers/mmc/host/meson-gx-mmc.c" change the initialisation tx phase to 0 and recompile (sequential reads of 142Mb/s)....

clk_set_phase(host->tx_clk, 270);
should become
clk_set_phase(host->tx_clk, 0);
[/color]
2) teknoid's fix, edit your device tree as per this post viewtopic.php?f=135&t=22717&start=600#p203209

The "max-frequency = <100000000>;" is the key line, I had success with a value of 150,000,000 (approx 115Mb/s sequential read, 100,000,000 is about 95Mb/s read.
Last edited by brad on Mon Dec 25, 2017 8:18 pm, edited 3 times in total.
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Dec 24, 2017 6:16 am

gügü wrote:What? Are you saying that Odroid C1 can boot mainline kernel 4.18?

If it is so then create a new Thread for Odroid C1 mainline kernel support and we can follow in parallel.

Thanx for your input.


Hi gügü, I don't have an Odroid C1 and im not sure of the current status but the work has begun and it is possible to boot.
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby tuxx » Sun Dec 24, 2017 8:35 am

@cdu13a
@brad

thanks for your feedback!
User avatar
tuxx
 
Posts: 45
Joined: Fri Mar 11, 2016 6:42 am
languages_spoken: english
ODROIDs: C1+, C2

Re: Odroid C2 mainline kernel support

Unread postby brad » Mon Dec 25, 2017 8:21 pm

tuxx wrote:@cdu13a
@brad

thanks for your feedback!


I edited my post above, I think option 2 is only suitable now for emmc fix (my clock at 150000000). I had some issues today on 2 restarts which resulted in CRC errors on boot with option 1.
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby gügü » Wed Dec 27, 2017 4:50 pm

brad wrote:
gügü wrote:What? Are you saying that Odroid C1 can boot mainline kernel 4.18?

If it is so then create a new Thread for Odroid C1 mainline kernel support and we can follow in parallel.

Thanx for your input.


Hi gügü, I don't have an Odroid C1 and im not sure of the current status but the work has begun and it is possible to boot.


Please let me know because I want to test mainline kernel for Odroid C1. I have 2 boards and I'm looking for a compiled kernel I could test.

Thanx for the feedback!
gügü
 
Posts: 67
Joined: Sun Dec 20, 2015 6:35 am
languages_spoken: english
ODROIDs: C1 - C2

Re: Odroid C2 mainline kernel support

Unread postby Michi » Wed Dec 27, 2017 8:30 pm

I am using a C2 with Arch Linux and mainline kernel (4.14.8) and U-Boot mainline.
To make the eMMC module (black Hardkernel version) work, I reduced the max-frequency to 150000000 in meson-gxbb-odroidc2.dts to avoid CRC errors.
However, I don't have trim support under the mainline kernel anymore. "lsblk --discard" indicates a "0." With the Hardkernel kernel I could still use trim for the eMMC module. Does trim work for you under the mainline kernel?
Michi
 
Posts: 3
Joined: Wed Dec 27, 2017 8:20 pm
languages_spoken: english; german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Sat Jan 06, 2018 5:56 am

I am running archlinuxarm and upgraded to the mainline kernel with the advice in the archlinuxarm forums according to:

Code: Select all
pacman -R uboot-odroid-c2
pacman -S uboot-odroid-c2-mainline linux-aarch64
reboot


The system boots, and I can ssh in to this headless system, but I have several issues that I would appreciate any advice on.

1) haveged systemd service fails:

Code: Select all
[root@odroid-c2 ~]# systemctl status haveged             
* haveged.service - Entropy Harvesting Daemon
   Loaded: loaded (/usr/lib/systemd/system/haveged.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-01-05 20:29:59 UTC; 10min ago
     Docs: man:haveged(8)
  Process: 303 ExecStart=/usr/bin/haveged -F -w 1024 -v 1 (code=exited, status=1/FAILURE)
 Main PID: 303 (code=exited, status=1/FAILURE)

Jan 05 20:29:58 odroid-c2 systemd[1]: Started Entropy Harvesting Daemon.
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged: Couldn't initialize HAVEGE rng 5
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged starting up
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Main process exited, code=exited, status=1/FAILURE
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Failed with result 'exit-code'.


Is there a workaround?

2) systemd-modules-load also fails:

Code: Select all
[root@odroid-c2 ~]# systemctl status systemd-modules-load
* systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2017-12-21 13:33:56 UTC; 2 weeks 1 days ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 254 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 254 (code=exited, status=1/FAILURE)

Dec 21 13:33:55 odroid-c2 systemd-modules-load[254]: Failed to find module 'aml_i2c'
Dec 21 13:33:56 odroid-c2 systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAIL
Dec 21 13:33:56 odroid-c2 systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
Dec 21 13:33:56 odroid-c2 systemd[1]: Failed to start Load Kernel Modules.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.


Is there a workaround for this?

3) The RTC shield hardware clock is not working:

Code: Select all
[root@odroid-c2 ~]# hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
[root@odroid-c2 ~]# timedatectl
                      Local time: Fri 2018-01-05 20:31:46 UTC
                  Universal time: Fri 2018-01-05 20:31:46 UTC
                        RTC time: n/a
                       Time zone: UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
[root@odroid-c2 ~]# ./timeupd
Couldn't open blob from '/boot/dtbs/meson64_odroidc2.dtb': No such file or directory
modprobe: FATAL: Module aml_i2c not found in directory /lib/modules/4.14.11-1-ARCH


the content of timeupd is:

Code: Select all
#!/bin/bash
fdtput -t s /boot/dtbs/meson64_odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"
modprobe aml_i2c
#hwclock --systohc --utc
exit


that used to work previously with the old kernel ( linux-odroid-c2-3.14.79-28 ). The RTC and system-modules-load issue are related since the RTC needs the aml_i2c module!

It is now running 4.14.11-1-ARCH
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sat Jan 06, 2018 6:44 am

There is some work that needs to be done within the device tree to enable the RTC. Merely setting the status to okay isn't enough, because that whole section of the dtb doesn't exist. You need to add it to the dts file and recompile the dtb. I've done this before with the 4.14 kernel but it's not enabled right now. I'll do it again tonight and post the relevant changes.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sat Jan 06, 2018 6:56 am

mcloaked wrote:fdtput -t s /boot/dtbs/meson64_odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"

So instead of doing this, you have to do (in the /boot/dtbs/amlogic/ dir):
Code: Select all
dtc -I dtb -O dts meson-gxbb-odroidc2.dtb > meson-gxbb-odroidc2.dts

Add this section at the end of the i2c@8500 section:
Code: Select all
pcf8563@51 {
   status = "okay";
   compatible = "nxp,pcf8563";
   reg = <0x51>;
   #clock-cells = <0x0>;
};

and then rebuild the dtb:
Code: Select all
dtc -I dts -O dtb meson-gxbb-odroidc2.dts > meson-gxbb-odroidc2.dtb


If anyone knows how to do this with fdt commands in boot.ini PLEASE let me know.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Sat Jan 06, 2018 7:27 am

Thank you Campbell, I tried that but maybe I followed up by doing the next step wrong.

I changed timeupd

Code: Select all
#!/bin/bash
fdtput -t s /boot/dtbs/amlogic/meson-gxbb-odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"
modprobe aml_i2c
#hwclock --systohc --utc
exit


then trying to execute that:

Code: Select all
[root@odroid-c2 ~]# ./timeupd
Error at '/i2c@c1108500/pcf8563@51': FDT_ERR_NOTFOUND
modprobe: FATAL: Module aml_i2c not found in directory /lib/modules/4.14.11-1-ARCH


So I guess I need to get the aml_i2c module loaded?
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby brad » Sat Jan 06, 2018 8:31 am

mcloaked wrote:So I guess I need to get the aml_i2c module loaded?


Hi mcloaked,
mainline kernel has i2c drivers built into the kernel with default settings so there is no need to load any aml_i2c driver. What you are likely missing is the driver for the actual RTC chip which is not enabled by default. The guys from archlinux might be able to add this as an option for you to their kernel release or alternatively you can compile a new kernel with this module. Module would be named rtc-pcf8563 and it would somehow need to be added into the device tree similar to what campbell has suggested (or it might possibly be automatically detected). I haven't used RTC and not sure exactly what might be required int he devicetree.

Device Drivers > Real Time Clock ->
CONFIG_RTC_DRV_PCF8563: │
│ │
│ If you say yes here you get support for the │
│ Philips PCF8563 RTC chip. The Epson RTC8564 │
│ should work as well. │
│ │
│ This driver can also be built as a module. If so, the module │
│ will be called rtc-pcf8563. │
│ │
│ Symbol: RTC_DRV_PCF8563 [=n] │
│ Type : tristate │
│ Prompt: Philips PCF8563/Epson RTC8564 │
│ Location: │
│ -> Device Drivers │
│ -> Real Time Clock (RTC_CLASS [=y]) │
│ Defined at drivers/rtc/Kconfig:449 │
│ Depends on: RTC_CLASS [=y] && I2C [=y]
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sat Jan 06, 2018 8:48 am

Try creating /etc/modules-load.d/rtc.conf with:
Code: Select all
i2c_dev
rtc_pcf8563

"hwclock -r" is working for me even with those commented out, though. I'm using Arch Linux with the same kernel version you've got, although there may have been other hoops I had to jump through to get it working.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby tobetter » Sat Jan 06, 2018 7:24 pm

maxvirrozeito wrote:With mainline u-boot (2017.09), mainline kernel (4.13.9) and Ubuntu minimal rootfs (17.10), I cannot connect over Ethernet.

The interface eth0 is missing altogether (only lo is present when invoking ifconfig). Has anyone faced this problem? If so, how could I resolve it?
I already tried to set something in /etc/network/interfaces but to no avail.


I've observed that 'eth0' is not present in the mainline kernel 4.13.x and have tried 4.15.x recently. After fixing kernel configuration, finally I am able to make the on-board ethernet run on ODROID-C2.
Code: Select all
root@odroidc2:/home/tobetter# uname -a
Linux odroidc2 4.15.0-rc6 #2 SMP PREEMPT Sat Jan 6 04:53:52 EST 2018 aarch64 GNU/Linux
root@odroidc2:/home/tobetter# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1e:06:33:0d:3f 
          inet addr:192.168.0.14  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:6ff:fe33:d3f/64 Scope:Link
          inet6 addr: fd00:ac20:2e25:7682:21e:6ff:fe33:d3f/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2745 (2.6 KiB)  TX bytes:2174 (2.1 KiB)
          Interrupt:18


You can find my working kernel source tree at https://github.com/tobetter/linux/tree/odroidc2-v4.15, I am running U-boot (2017.11) plus Linux mainline (4.15-rc6) on Debian Jessie.
tobetter
 
Posts: 2086
Joined: Mon Feb 25, 2013 10:55 am
Location: Kitchener, ON, Canada
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Odroid C2 mainline kernel support

Unread postby Michi » Sat Jan 06, 2018 7:39 pm

mcloaked wrote:1) haveged systemd service fails:

Code: Select all
[root@odroid-c2 ~]# systemctl status haveged             
* haveged.service - Entropy Harvesting Daemon
   Loaded: loaded (/usr/lib/systemd/system/haveged.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-01-05 20:29:59 UTC; 10min ago
     Docs: man:haveged(8)
  Process: 303 ExecStart=/usr/bin/haveged -F -w 1024 -v 1 (code=exited, status=1/FAILURE)
 Main PID: 303 (code=exited, status=1/FAILURE)

Jan 05 20:29:58 odroid-c2 systemd[1]: Started Entropy Harvesting Daemon.
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged: Couldn't initialize HAVEGE rng 5
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged starting up
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Main process exited, code=exited, status=1/FAILURE
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Failed with result 'exit-code'.


Is there a workaround?



I use rng-tools instead of haveged with mainline kernel and i got an entropy value > 3400 with the hardware TRNG.
Michi
 
Posts: 3
Joined: Wed Dec 27, 2017 8:20 pm
languages_spoken: english; german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Sat Jan 06, 2018 9:02 pm

Michi wrote:
mcloaked wrote:1) haveged systemd service fails:

Code: Select all
[root@odroid-c2 ~]# systemctl status haveged             
* haveged.service - Entropy Harvesting Daemon
   Loaded: loaded (/usr/lib/systemd/system/haveged.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-01-05 20:29:59 UTC; 10min ago
     Docs: man:haveged(8)
  Process: 303 ExecStart=/usr/bin/haveged -F -w 1024 -v 1 (code=exited, status=1/FAILURE)
 Main PID: 303 (code=exited, status=1/FAILURE)

Jan 05 20:29:58 odroid-c2 systemd[1]: Started Entropy Harvesting Daemon.
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged: Couldn't initialize HAVEGE rng 5
Jan 05 20:29:58 odroid-c2 haveged[303]: haveged starting up
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Main process exited, code=exited, status=1/FAILURE
Jan 05 20:29:59 odroid-c2 systemd[1]: haveged.service: Failed with result 'exit-code'.


Is there a workaround?



I use rng-tools instead of haveged with mainline kernel and i got an entropy value > 3400 with the hardware TRNG.


Thank you Michi - I installed rng-tools, disabled and stopped the haveged systemd service, and then started and enabled the rngd service. Now this passes the test doing

Code: Select all
[root@odroid-c2 ~]# dd if=/dev/random of=/dev/null bs=1024 count=1 iflag=fullblock
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0013131 s, 780 kB/s


as suggested in the arch wiki and the output was instantaneous in response. I also updated to kernel 4.14.12-1-ARCH before doing this. So hopefully on reboot the rngd service will start and the only remaining issue is the RTC and associated module load problem that I have not yet been able to resolve.

Edit: after rebooting the rngd service started fine, and there is no longer a failed haveged service so the problem with haveged is resolved (by switching to rngd).
Also
Code: Select all
[root@odroid-c2 ~]# cat /proc/sys/kernel/random/entropy_avail
3101
Last edited by mcloaked on Sat Jan 06, 2018 9:23 pm, edited 2 times in total.
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Sat Jan 06, 2018 9:17 pm

campbell wrote:Try creating /etc/modules-load.d/rtc.conf with:
Code: Select all
i2c_dev
rtc_pcf8563

"hwclock -r" is working for me even with those commented out, though. I'm using Arch Linux with the same kernel version you've got, although there may have been other hoops I had to jump through to get it working.


This morning I did a system update which brought in kernel 4.14.12-1-ARCH - with the same issues as previously. I presume that the changes to the file you suggested ( rebuilding meson-gxbb-odroidc2.dtb ) don't need to be repeated?

However the hwclock -r command still fails - and the modules load service also still fails for aml_i2c (presume that can be switched to not attempt to load if it doesn't need to do so? What needs to be changed to do that?).

Code: Select all
[root@odroid-c2 ~]# hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
[root@odroid-c2 ~]# systemctl --failed
  UNIT                         LOAD   ACTIVE SUB    DESCRIPTION                       
* systemd-modules-load.service loaded failed failed Load Kernel Modules               

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@odroid-c2 ~]# systemctl status systemd-modules-load
* systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static; vendor
   Active: failed (Result: exit-code) since Thu 2017-12-21 13:34:08 UTC; 2 weeks 1 days
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 252 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FA
 Main PID: 252 (code=exited, status=1/FAILURE)

Dec 21 13:34:07 odroid-c2 systemd-modules-load[252]: Failed to find module 'aml_i2c'
Dec 21 13:34:08 odroid-c2 systemd-modules-load[252]: Inserted module 'i2c_dev'
Dec 21 13:34:08 odroid-c2 systemd-modules-load[252]: Inserted module 'rtc_pcf8563'
Dec 21 13:34:08 odroid-c2 systemd[1]: systemd-modules-load.service: Main process exited,
Dec 21 13:34:08 odroid-c2 systemd[1]: systemd-modules-load.service: Failed with result '
Dec 21 13:34:08 odroid-c2 systemd[1]: Failed to start Load Kernel Modules.
Warning: Journal has been rotated since unit was started. Log output is incomplete or un


Presumably I don't need to try to run my old timeupd file to use the RTC but perhaps I haven't jumped through the correct hoops to complete what is necessary so maybe there was something you did in the past that is a critical step that I am missing?

I found that the changes I made to meson-gxbb-odroidc2.dtb were overwridden since the time stamp on that file was from today at the time the new kernel was installed, so I re-did the changes you suggested last night, and then rebooted. Now the system-modules-load service still fails but without the aml_i2c module error:

Code: Select all
[root@odroid-c2 ~]# systemctl status systemd-modules-load
* systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static; vendor
   Active: failed (Result: exit-code) since Thu 2017-12-21 13:34:07 UTC; 2 weeks 1 days
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 250 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FA
 Main PID: 250 (code=exited, status=1/FAILURE)

Warning: Journal has been rotated since unit was started. Log output is incomplete or un
[root@odroid-c2 ~]# hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
[root@odroid-c2 ~]# timedatectl
                      Local time: Sat 2018-01-06 12:39:40 UTC
                  Universal time: Sat 2018-01-06 12:39:40 UTC
                        RTC time: n/a
                       Time zone: UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no


The RTC is still not accessible though.

If it is useful here is the hwdetect output:

Code: Select all
[root@odroid-c2 ~]# hwdetect --kernel_version=4.14.12-1-ARCH --show-modules
DRM      : drm drm_kms_helper meson-drm
MEDIA    : meson-ir rc-core
NET      : dwmac-generic dwmac-meson8b stmmac-platform stmmac
WATCHDOG : meson_gxbb_wdt
OTHER    : nvmem_meson_efuse pps_core ptp rtc-pcf8563 fb_sys_fops syscopyarea sysfillrect sysimgblt


So presumably there is another step missing? So it would be nice to find the steps needed to get this working again, but also as you said in your post yesterday that it would be good to know how to automate it once it is working.
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Jan 07, 2018 7:43 am

mcloaked wrote:So presumably there is another step missing? So it would be nice to find the steps needed to get this working again, but also as you said in your post yesterday that it would be good to know how to automate it once it is working.


Looks like you have the rtc driver included so try to modify your device tree file like below for the i2c_A entry. I don't have a RTC to test sorry.

Code: Select all
&i2c_A {
   status = "okay";
   pinctrl-0 = <&i2c_a_pins>;
   pinctrl-names = "default";

   pcf8563: pcf8563@51 {
      compatible = "nxp,pcf8563";
      reg = <0x51>;
   };
};
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sun Jan 07, 2018 11:58 am

There is no aml_i2c driver in the mainline kernel. There IS an i2c_dev driver, but its not clear to me whether it's necessary.

It's entirely possible for pacman to replace your modified dtb file with a newer version without the mods in it, so in general you may have to repeat that step after updating.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Sun Jan 07, 2018 11:44 pm

brad wrote:
mcloaked wrote:So presumably there is another step missing? So it would be nice to find the steps needed to get this working again, but also as you said in your post yesterday that it would be good to know how to automate it once it is working.


Looks like you have the rtc driver included so try to modify your device tree file like below for the i2c_A entry. I don't have a RTC to test sorry.

Code: Select all
&i2c_A {
   status = "okay";
   pinctrl-0 = <&i2c_a_pins>;
   pinctrl-names = "default";

   pcf8563: pcf8563@51 {
      compatible = "nxp,pcf8563";
      reg = <0x51>;
   };
};


If adding this entry does it have to go in a specific place in the dts file, and then processing to create the new dtc file, as Cambell suggested previously? I am not an expert with device tree changes so I am reliant on more expert knowledge that others have. Once this change has been made does the system need to be rebooted to bring the change in - and once that has been done should the RTC access then just work without any further action? Thanks for any additional input.
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby gügü » Sun Jan 14, 2018 6:14 am

Can someone confirm my thoughts about Odroid C1 running mainline kernel?

I found this link and it shows that it pass all tests.

https://kernelci.org/boot/meson8b-odroidc1/

Thank you!
gügü
 
Posts: 67
Joined: Sun Dec 20, 2015 6:35 am
languages_spoken: english
ODROIDs: C1 - C2

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Jan 14, 2018 7:15 am

gügü wrote:Can someone confirm my thoughts about Odroid C1 running mainline kernel?

I found this link and it shows that it pass all tests.

https://kernelci.org/boot/meson8b-odroidc1/

Thank you!


I recall the developers debugging some ethernet issues on the C1 around 3 months ago with the board booting mainline. I'm sure the dev's would be happy to give you an update, try IRC channel #linux-amlogic on Freenode
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby gügü » Sun Jan 14, 2018 9:30 am

brad wrote:
gügü wrote:Can someone confirm my thoughts about Odroid C1 running mainline kernel?

I found this link and it shows that it pass all tests.

https://kernelci.org/boot/meson8b-odroidc1/

Thank you!


I recall the developers debugging some ethernet issues on the C1 around 3 months ago with the board booting mainline. I'm sure the dev's would be happy to give you an update, try IRC channel #linux-amlogic on Freenode


Thanx I'm just going to do that :D
gügü
 
Posts: 67
Joined: Sun Dec 20, 2015 6:35 am
languages_spoken: english
ODROIDs: C1 - C2

Re: Odroid C2 mainline kernel support

Unread postby mcloaked » Wed Jan 17, 2018 7:32 am

After my posts a few weeks ago my odroid c2 simply stopped booting. So whatever changes I had made trying to get the rtc working I guess caused a problem that I couldn't diagnose or rectify. So I had to pull out the eMMC card, and write a new clean system (following the arch linux method). The system is back up and running but with the original series 3 kernel and not mainline. So until a time when there is a more risk free method of upgrading the kernel to mainline that has no RTC issues I will stick with 3.14.79-28-ARCH
mcloaked
 
Posts: 8
Joined: Wed Jun 08, 2016 11:57 pm
languages_spoken: english
ODROIDs: odroid-c2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Wed Jan 17, 2018 12:36 pm

mcloaked wrote:until a time when there is a more risk free method of upgrading the kernel to mainline that has no RTC issues

I've got exactly this on my todo list, I'll post it here when it's done. It's possible, I assure you, I just don't remember exactly everything I did and need to redo it on a clean SD card.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby mad_ady » Wed Jan 17, 2018 4:15 pm

@campbell: once you document all the steps submit an article for Odroid Magazine also.
User avatar
mad_ady
 
Posts: 3083
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Thu Jan 18, 2018 2:31 am

I've just gone through the following procedure from a blank SD card, installing no other packages and making no other edits, and it works. This results in Arch Linux with kernel 4.14.13-1 and a working RTC. Some of the reboots here might not be necessary, but this worked. Note that after any package update that touches the dtbs (generally any time the kernel or uboot is updated) you will have to redo the steps to patch the dtb file, in order to re-enable the RTC.

- Follow the instructions at https://archlinuxarm.org/platforms/armv ... /odroid-c2 for deploying a vanilla Arch Linux installation with the Hardkernel 3.14.79 kernel

- Boot the board with the new SD/eMMC and log in as root

- Update the package manager and all packages with:
Code: Select all
pacman -Syu
reboot

- Log in as root, and run:
Code: Select all
pacman -R uboot-odroid-c2
pacman -S uboot-odroid-c2-mainline linux-aarch64
reboot

- Log in as root, and run:
Code: Select all
pacman -S dtc
cd /boot/dtbs/amlogic/
cp -p meson-gxbb-odroidc2{,_backup}.dtb
dtc -I dtb -O dts meson-gxbb-odroidc2.dtb > meson-gxbb-odroidc2.dts
nano meson-gxbb-odroidc2.dts

- Add the pcf8563@51 section within i2c@8500:
Code: Select all
pcf8563@51 {
   status = "okay";
   compatible = "nxp,pcf8563";
   reg = <0x51>;
   #clock-cells = <0x0>;
};

- Rebuild the dtb with:
Code: Select all
dtc -I dts -O dtb meson-gxbb-odroidc2.dts > meson-gxbb-odroidc2.dtb
reboot

- Log in as root, and test:
Code: Select all
hwclock -r
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby mad_ady » Thu Jan 18, 2018 3:29 am

You can automate the dtb edits further and place a script that does it in /etc/kernel/post-install.d/
User avatar
mad_ady
 
Posts: 3083
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Thu Jan 18, 2018 7:51 am

mad_ady wrote:You can automate the dtb edits further and place a script that does it in /etc/kernel/post-install.d/

There SHOULD be a way to make it happen with fdt commands inside the uboot script. I haven't figured it out yet and I keep rendering it non bootable while trying, so I gave up. That file (boot.txt/boot.scr) is generally NOT replaced when upgrading the kernel.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby mad_ady » Thu Jan 18, 2018 3:20 pm

By the looks of it you need to make bigger changes that require decompiling the dtb, making edits with tools like patch or sed and rebuilding it. You can do this with a more complicated post-install script (even if that script means rewriting the dtb file with a known good one (quick and dirty).
User avatar
mad_ady
 
Posts: 3083
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Odroid C2 mainline kernel support

Unread postby brad » Thu Jan 18, 2018 3:22 pm

campbell wrote:
mad_ady wrote:You can automate the dtb edits further and place a script that does it in /etc/kernel/post-install.d/

There SHOULD be a way to make it happen with fdt commands inside the uboot script. I haven't figured it out yet and I keep rendering it non bootable while trying, so I gave up. That file (boot.txt/boot.scr) is generally NOT replaced when upgrading the kernel.


Good work campbell this does raise some interesting questions on the best path forward for device tree customisation's. From my understanding we have a few possible options

1) as per mad_ady drop in the mod to /etc/kernel/post-install.d/ and reinstall kernel package (persistant change)
2) Manually edit the device tree with dtc tool (not persistant)
3) Edit the device tree by uboot device tree commands in boot.[scr|txt|ini] (Persistant)
4) Utilise device tree overlays in uboot to make the changes (persistent)
5) Utilise device tree overlays in uboot a modify boot.ini/ boot.src to be able to detect certain hardware automatically and apply the appropriate overlay file (persistant)

I can now think of a few common use cases where it would be beneficial
- MMC frequency mods to allow my old emmc to boot without errors
- Add support for I2S audio via detection of common codecs on the I2C bus (ie hifi shield)
- Add RTC's detected on I2C bus's
- Automatically re-enable frequency scaling for users with up to date firmware limited to 1.5GHz

I will look into feasibility in both hardkernel u boot and mainline uboot for the overlay option.

Edit: crap linux machine I use for serial console has died with a dead fan detected on boot. I've temporarily secondment my windows gaming machine to the task but this means the games are distracting me and no Linux for debug of boot. Wish me luck I never wanted linux so bad :lol: I hope I can spin up an linux VM and connect to the serial port on the C2
Last edited by brad on Thu Jan 18, 2018 5:25 pm, edited 1 time in total.
brad
 
Posts: 657
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby rooted » Thu Jan 18, 2018 3:24 pm

Overlay FTW
User avatar
rooted
 
Posts: 3735
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: Odroid C2 mainline kernel support

Unread postby Michi » Thu Jan 18, 2018 8:02 pm

I also have to update the Device Tree for my Odroid C2 after linux-aarch installation/upgrade. Therefore i created a small script with the needed changes and a pacman hook. The hook is running after the linux-aarch64 package installation.
The hook is placed in "/etc/pacman.d/hooks/" and the content is:

Code: Select all
[Trigger]
Operation = Upgrade
Operation = Install
Type = Package
Target = linux-aarch64

[Action]
Description = Modify Orodid C2 Device Tree for eMMC...
When = PostTransaction
Exec = /usr/local/bin/modify_odroid_c2_dtb.sh


This works perfectly for me.
Michi
 
Posts: 3
Joined: Wed Dec 27, 2017 8:20 pm
languages_spoken: english; german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Fri Jan 19, 2018 1:53 am

brad wrote:Edit: crap linux machine I use for serial console has died with a dead fan detected on boot. I've temporarily secondment my windows gaming machine to the task but this means the games are distracting me and no Linux for debug of boot. Wish me luck I never wanted linux so bad :lol: I hope I can spin up an linux VM and connect to the serial port on the C2

Off topic but I don't have a dedicated Windows machine - instead I have Windows installed on an mSATA drive mounted on a USB3 carrier card...plug it in and reboot my machine (a Mac in my case) and I'm in Windows, unplug it and it was never there :) Highly recommended if you only spend 5% of your time in Windows and/or don't want to mess with bootloaders or don't want to give up the hard drive space for a second OS
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby campbell » Fri Jan 19, 2018 1:56 am

mad_ady wrote:By the looks of it you need to make bigger changes that require decompiling the dtb, making edits with tools like patch or sed and rebuilding it. You can do this with a more complicated post-install script (even if that script means rewriting the dtb file with a known good one (quick and dirty).

I think you probably CAN do this with a script and a (maybe inline) patch file, but I think the better solution is one of the others, like modifying boot.txt. I already have other dtb mods in my boot.txt that are persistent across updates, but they're all only removals or status switches, not insertions of a branch.
campbell
 
Posts: 232
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Previous

Return to General Chat

Who is online

Users browsing this forum: No registered users and 5 guests