Device Tree Overlay (Odroid C4) inactive?

Hi,
After checking HardKernel’s Ubuntu Mate, I’ve decided I needed a smaller distro (using 16GB eMMC), enter DietPi.

I probably missed something during installation after flashing DietPi_OdroidC4-ARMv8-Buster to eMMC. I need to enable lineout overlay (second soundcard J4-header on Odroid C4) but config.ini is nowhere to be found, should be in the same dir as boot.ini. Overlay dir with *.dtb and *.dts files is present.

I added deb http://deb.odroid.in/c4/ focal main in /etc/apt/source.list and a missing KEY (NO_PUBKEY error, fixed with sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2DD567ECD986B59D) followed by apt update && apt full-upgrade and a reboot but still no config.ini file :frowning:

Previously doing this on Ubuntu Mate did fix the issue https://forum.odroid.com/viewtopic.php?p=308807#p308807
I’d appreciate any input regarding this matter.

Hi,

did you try to add the overlay stuff into /boot/config.txt.

Thanks for the replay.
As stated above config.ini is missing, creating this file and adding only Device Tree Overlay did not work (I’ve already tried it when overlay wasn’t working on Ubuntu). Copying /boot/config.ini from a working Ubuntu-minimal backup image also does nothing, aplay -l returns only card 0: ODROIDHDMI.

config.ini file content:

[generic]
; *************************************************
; Copy of a working Ubuntu minimal /boot/config.ini
; *************************************************

; Auto Detection of Monitor settings based on your Screen information
display_autodetect=true

; HDMI Mode
; Resolution Configuration
;    Symbol             | Resolution
; ----------------------+-------------
;    "480x272p60hz"     | 480x272 Progressive 60Hz
;    "480x320p60hz"     | 480x320 Progressive 60Hz
;    "480p60hz"         | 720x480 Progressive 60Hz
;    "576p50hz"         | 720x576 Progressive 50Hz
;    "720p60hz"         | 1280x720 Progressive 60Hz
;    "720p50hz"         | 1280x720 Progressive 50Hz
;    "1080p60hz"        | 1920x1080 Progressive 60Hz
;    "1080p50hz"        | 1920x1080 Progressive 50Hz
;    "1080p30hz"        | 1920x1080 Progressive 30Hz
;    "1080p24hz"        | 1920x1080 Progressive 24Hz
;    "1080i60hz"        | 1920x1080 Interlaced 60Hz
;    "1080i50hz"        | 1920x1080 Interlaced 50Hz
;    "2160p60hz"        | 3840x2160 Progressive 60Hz
;    "2160p50hz"        | 3840x2160 Progressive 50Hz
;    "2160p30hz"        | 3840x2160 Progressive 30Hz
;    "2160p25hz"        | 3840x2160 Progressive 25Hz
;    "2160p24hz"        | 3840x2160 Progressive 24Hz
;    "smpte24hz"        | 3840x2160 Progressive 24Hz SMPTE
;    "2160p60hz420"     | 3840x2160 Progressive 60Hz YCbCr 4:2:0
;    "2160p50hz420"     | 3840x2160 Progressive 50Hz YCbCr 4:2:0
;    "640x480p60hz"     | 640x480 Progressive 60Hz
;    "800x480p60hz"     | 800x480 Progressive 60Hz
;    "800x600p60hz"     | 800x600 Progressive 60Hz
;    "1024x600p60hz"    | 1024x600 Progressive 60Hz
;    "1024x768p60hz"    | 1024x768 Progressive 60Hz
;    "1280x800p60hz"    | 1280x800 Progressive 60Hz
;    "1280x1024p60hz"   | 1280x1024 Progressive 60Hz
;    "1360x768p60hz"    | 1360x768 Progressive 60Hz
;    "1440x900p60hz"    | 1440x900 Progressive 60Hz
;    "1600x900p60hz"    | 1600x900 Progressive 60Hz
;    "1600x1200p60hz"   | 1600x1200 Progressive 60Hz
;    "1680x1050p60hz"   | 1680x1050 Progressive 60Hz
;    "1920x1200p60hz"   | 1920x1200 Progressive 60Hz
;    "2560x1080p60hz"   | 2560x1080 Progressive 60Hz
;    "2560x1440p60hz"   | 2560x1440 Progressive 60Hz
;    "2560x1600p60hz"   | 2560x1600 Progressive 60Hz
;    "3440x1440p60hz"   | 3440x1440 Progressive 60Hz
hdmimode=1080p60hz

; Monitor output
; Controls if HDMI PHY should output anything to the monitor
monitor_onoff=false

; Overscan percentage
; This value scales down the actual screen size by the percentage below
; valid range is 80 to 100
overscan=100

; SDR/HDR Configuration
; This forces SDR or HDR modes
; valid options are: sdr hdr auto
sdrmode=auto

; voutmode : hdmi or dvi
; hdmi / dvi
voutmode=hdmi

; HPD enable/disable option
; false / true
disablehpd=false

; Enable/Disable CEC
cec=true

; Hardkernel ODROID-VU7 support
; By default VU7 support is disabled
disable_vu7=true

; Maximum CPU frequency
; 100/250/500/667/1000/1200/1404/1500/1608/1704/1800/1908 (stock)/2016/2100
; max_freq_a55=1800


; Maximum number of CPU cores
maxcpus=4

; Wake-On-Lan support (0=disable, 1=enable)
; enable_wol=1

; Device Tree Overlay
overlay_resize=16384
overlay_profile=lineout
overlays="spi0 i2c0 i2c1 uart0"

[overlay_custom]
overlays="i2c0 i2c1"

[overlay_hktft32]
overlays="hktft32"

[overlay_hktft35]
overlays="hktft35"

[overlay_lineout]
overlays="lineout"

For now I2C also is not working but this should be resolved when overlay works (ls /dev/i2c* → No such file or directory).
I probably could force something like I2C to work with:

root@odroid:~# fdtput -t s /boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000 status okay

But this defeats the purpose of overlays plus I have no idea what to fdtput to enable lineout.

DietPi is based on Debian and not Ubuntu

Sure but does this affect DTO? I mean is it even possible to use lineout on Odroid C4 in DietPi?

you can have a look to dietpi-config > Audio Options

I just found that indeed the default boot.ini on Odroid C4 (same as N2) does not yet incorporate the dtoverlays nicely. Will be done for next DietPi release. Good that you already found the command to do that manually for now, we’ll implement it a way that you can add overlays via simple dtoverlay= (or similar) setting in boot.ini and add some of them via dietpi-config, e.g. toggle for I2C and SPI and probably a few others where applicable.

There is only HDMI output (hw:0,0) and usb-dac (detects as none which is correct).

Thanks, I would appreciate also including the lineout as it is a dedicated header (J4) for analog audio not populated by default.

Makes sense, the overlay for is is there, right?

Yes, lineout.dtb and lineout.dts are in overlay directory.

Hi,

I just started experimenting with DietPi on an Odroid N2 (recent image + updates). Currently I’m trying to activate i2c-0.

While searching for some hints I found this thread and was wondering if the dtoverlays are supported in the meantime?

The dtb files seem to be there, but I couldn’t find the right place to define the overlays to be used. Do you have any advise?

Thanks in advance!

Just did some reverse engineering on the original hardkernel ubuntu image and copied the following lines (from boot.ini and config.ini) to /boot/boot.ini (this color + adapted the path to the overlay files (this color):

# Set load addresses
setenv dtb_loadaddr "0x1000000"
setenv k_addr "0x1100000"
setenv loadaddr "0x1B00000"
setenv initrd_loadaddr "0x3700000"

setenv dtbo_addr_r "0x11000000"

# Device Tree Overlay
overlay_resize=16384
overlay_profile=
overlays="spi0 i2c0 i2c1 uart0"

# Load kernel, dtb and initrd
fatload mmc ${devno}:1 ${k_addr} Image.gz
fatload mmc ${devno}:1 ${dtb_loadaddr} meson64_odroidn2.dtb
fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd
fdt addr ${dtb_loadaddr}

if test "x{overlays}" != "x"; then
fdt resize ${overlay_resize}
for overlay in ${overlays}; do
load mmc ${devno}:1 ${dtbo_addr_r} overlays/odroidn2/${overlay}.dtbo \
&& fdt apply ${dtbo_addr_r}
done
fi

# unzip the kernel
unzip ${k_addr} ${loadaddr}

# boot
booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr}
\
\

This patch seems to work fine. But I think, there needs to be a little more for a proper implementation “in the DietPi way”

That looks actually pretty fine. I’m just not sure if this memory address is common, it looks too large, actually :thinking:.

But otherwise, resizing the device tree, looping through the device-specific overlay dir and loading what has been added to the config file looks fine. I like the check if there is any overlay defined, before resizing the device tree. E.g. Armbian resizes it regardless if the variable is empty or not. I’m not sure if this causes additional RAM usage, but at least it is an unnecessary step in that case.

Ah lol, did you check our current image? It seems Meveric was busy and added overlay loading already:

# Device Tree Overlay
# Overlay profiles
# default = "spi0 i2c0 i2c1 uart0"
# hktft32 = "hktft32" // 3.2" TFT from HardKernel
# hktft32 = "hktft32" // 3.5" TFT from HardKernel
# custom // load your own set of overlays -> use overlay_custom to specify
setenv overlay_resize "16384"
setenv overlay_profile "default"
setenv overlay_custom "i2c0 i2c1"
...
# Set load addresses
setenv dtb_loadaddr "0x1000000"
setenv dtbo_addr_r "0x11000000"
setenv k_addr "0x1100000"
setenv loadaddr "0x1B00000"
setenv initrd_loadaddr "0x3700000"

# Load kernel, dtb and initrd
fatload mmc ${devno}:1 ${k_addr} Image.gz
if test "x${variant}" != "x"; then
	fatload mmc ${devno}:1 ${dtb_loadaddr} meson64_odroid${variant}.dtb
else
	fatload mmc ${devno}:1 ${dtb_loadaddr} meson64_odroidc4.dtb
fi
fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd
fdt addr ${dtb_loadaddr}

if test "x{overlays}" != "x"; then
	fdt resize ${overlay_resize}
	for overlay in ${overlays}; do
		fatload mmc ${devno}:1 ${dtbo_addr_r} overlays/${board}/${overlay}.dtbo && fdt apply ${dtbo_addr_r}
	done
fi

Apart from the implemented overlay profiles, it is pretty much a copy of what you did, means a copy of the Hardkernel config :wink:.

Actually I thought, I was using the latest. But looking at the image I downloaded from here: DietPi - Lightweight justice for your SBC! → N2 (https://dietpi.com/downloads/images/DietPi_OdroidN2-ARMv8-Buster.7z), it seems not to be the latest (it’s timestamped with ‘Mon 9 Mar 14:43:47 CET 2020’). Is there any other location where the images can be downloaded (kind of an archive)?

I did the update and my installation is at version 6.34.3, but the files at the boot partition don’t seem to got updated. At least I couldn’t find the code you’ve mentioned (it’s expected to be in boot.ini, right?) and the latest entry in /boot/dietpi-CHANGELOG.txt is for version 6.28.

Is there anything else I might have missed to proceed besides running dietpi-update in order to get the files of the boot partition updated as well?

Ah sorry, I mixed it up with the threads name that it was Odroid C4. Indeed the N2 doesn’t have it yet. But good about it is that your method is then very close to what the N2 will get from Meverics pre-images side. We’ll probably create very own boot.ini/boot.cmd configs. I think those overlay_profile stuff is actually not required if one can add the exact required overlays to a custom list instead, so I like your slimmer implementation more.

@MichaIng: Allright, thanks! But you didn’t answer my question: Is there any other location where the images can be downloaded (kind of an archive)?

If it’s mentioned somewehre else already, plz just point me there (I didn’t find it yet… still new to DietPi and learning…). Thanks!

there is no real archive. All images are stored at one place at https://dietpi.com/downloads/images/

OK, thanks! So it looks like you only keep the lates version of the images, right?

yes because even if you would flash an old image, you will be updated to latest version on first boot.