Kerminy HackSpace

Outils du site


ressources:odroid_c4

Ceci est une ancienne révision du document !


ODROID C4

C'est un Single Board Computer genre Raspberry en mieux

Notre usage est celui d'une machine de création sonore utilisant des capteurs, cela nécessite l'installation de puredata (purr,pd-l2ork,vanilla) et l'acces correcte aux GPIO, bouton Power (uart,i2c,…), ici c'est la C4 plutôt que la N2 parce qu'elle est plus petite et loge bien dans nos tuyaux.

de https://wiki.odroid.com/odroid-c4/getting_started/os_installation_guide#tab__odroid-c4hc4, récupérer l'image minimale ubuntu focal C4

apt install odroid-wiringpi odroid-wiringpi-python vim git
journalctl --vacuum-size=1M
echo "SystemMaxUse=5M" >> /etc/systemd/journald.conf
root@odroid:~# gpio readall
 +-----+-----+---------+------+---+--- C4 ---+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3V |      |   |  1 || 2  |   |      | 5V      |     |     |
 | 493 |   8 |   SDA.2 | ALT1 | 1 |  3 || 4  |   |      | 5V      |     |     |
 | 494 |   9 |   SCL.2 | ALT1 | 1 |  5 || 6  |   |      | 0V      |     |     |
 | 481 |   7 |  IO.481 |   IN | 1 |  7 || 8  | 1 | ALT1 | TxD1    | 15  | 488 |
 |     |     |      0V |      |   |  9 || 10 | 1 | ALT1 | RxD1    | 16  | 489 |
 | 479 |   0 |  IO.479 |   IN | 1 | 11 || 12 | 1 | IN   | IO.492  | 1   | 492 |
 | 480 |   2 |  IO.480 |   IN | 1 | 13 || 14 |   |      | 0V      |     |     |
 | 483 |   3 |  IO.483 |   IN | 1 | 15 || 16 | 1 | IN   | IO.476  | 4   | 476 |
 |     |     |    3.3V |      |   | 17 || 18 | 1 | IN   | IO.477  | 5   | 477 |
 | 484 |  12 |    MOSI | ALT4 | 1 | 19 || 20 |   |      | 0V      |     |     |
 | 485 |  13 |    MISO | ALT4 | 1 | 21 || 22 | 1 | IN   | IO.478  | 6   | 478 |
 | 487 |  14 |    SLCK | ALT4 | 1 | 23 || 24 | 1 | OUT  | SS      | 10  | 486 |
 |     |     |      0V |      |   | 25 || 26 | 0 | IN   | IO. 23  | 11  | 433 |
 | 474 |  30 |   SDA.3 | ALT2 | 1 | 27 || 28 | 1 | ALT2 | SCL.3   | 31  | 475 |
 | 490 |  21 |  IO.490 |   IN | 1 | 29 || 30 |   |      | 0V      |     |     |
 | 491 |  22 |  IO.491 |   IN | 1 | 31 || 32 | 0 | IN   | IO. 24  | 26  | 434 |
 | 482 |  23 |  IO.482 |   IN | 0 | 33 || 34 |   |      | 0V      |     |     |
 | 495 |  24 |  IO.495 |   IN | 0 | 35 || 36 | 1 | OUT  | IO. 22  | 27  | 432 |
 |     |  25 |   AIN.2 |      |   | 37 || 38 |   |      | 1V8     | 28  |     |
 |     |     |      0V |      |   | 39 || 40 |   |      | AIN.0   | 29  |     |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+--- C4 ---+---+------+---------+-----+-----+

Ajout bouton on/off

Connexion du bouton sur 9/11

ajouter dans /media/boot/boot.ini dans la section Boot Args juste apres la ligne bootargs en surcharge

### in case of GPIOX.3 (Pin 11) of 2x20 pins connector
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}

Ajout interface graphique

Un bureau fluxbox minimaliste , sous root pour minimiser les temps de latence (attention aux connexion…)

apt install xserver-xorg-core xserver-xorg-input-libinput xinit dbus-x11 xfonts-base x11-xserver-utils x11-utils libgl1-mesa-dri mesa-utils mesa-utils-extra
apt install vim fluxbox xterm  xfonts-base x11-xserver-utils
apt install pcmanfm xpad avahi-daemon # options
echo "startfluxbox" > /root/.xsession
echo "
# fluxbox startup-script:
#  ~/.fluxbox/startup
# Lines starting with a '#' are ignored.
# doit finir par exec fluxbox
#fbsetbg -l
fbsetroot -solid black

xterm -T 'Top' -e /usr/bin/top &
/root/.fluxbox/x11vnc.sh 2>&1 > /tmp/x11vnc.log &
exec fluxbox -log ~/.fluxbox/fluxbox.log
" > /root/.fluxbox/startup
chmod 755 /root/.fluxbox/startup

VNC

 
apt install x11vnc
x11vnc -storepasswd votre_mot_de_passe ~/.vnc_passwd
echo "
sleep 3
/usr/bin/x11vnc -rfbauth /root/.vnc_passwd -geometry 1024x780 \
	-reopen -bg -avahi -forever -display :0 
exit 0
" >/root/.fluxbox/x11vnc.sh

audio et Puredata

Une partie particulière pour nos installations audio

apt install qjackctl puredata- extra multimedia-puredata

liste des paquets puredata dans cette debian: list_paquet_puredata.txt


Archives

Le suivi du noyau est un peu chaotique, ceux téléchargés ne sont pas satisfaisant voir pas fonctionnels … je passe par la phase de fabrication d'Armbian : https://docs.armbian.com/Developer-Guide_Build-Preparation/

cd ~ #user odroid précédemment crée
sudo apt-get -y -qq install git  
git clone --depth=1 --branch=main https://github.com/armbian/build  
cd build
./compile.sh # ATTENTION il faut plus de 16Go sur exclusivement une ubuntu jammy !
  • image simple sans bureau

on obtient dans ./build/images/ le fichier Arm…img

Sinon
Il faut utiliser le noyau 4.9 legacy pour avoir un bon compromis avec le 'device tree' des GPIO… et ne pas encore passer sur un 5 ou 6 ! (ce qui est un véritable problème pour le suivi)

j'avais récupèré : https://wiki.odroid.com/odroid-c4/os_images/ubuntu/mate/20220713 pour avoir un bureau que je viderai, +VNC +…De fait en y repassant, les images desktop fournis par Armbian ou Dietpi (qui utilise le noyau armian) ne me sont pas fonctionnelles en version legacy :(

Je me connecte en serie par gtkterm. Dans le cas de l'image récupérée toute faite il faut faire du ménage de ce qui m'est inutile

 
apt remove --purge office* cups shotwell rhythmbox transmission-common transmission-gtk simple-scan poppler-utils apparmor modemmanager brltty mate-desktop pipewire lightdm
apt autoremove
journalctl --vacuum-size=1M
echo "SystemMaxUse=5M" >> /etc/systemd/journald.conf

GPIO

gpio readall
 +-----+-----+---------+------+---+--- C4 ---+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3V |      |   |  1 || 2  |   |      | 5V      |     |     |
 | 493 |   8 |   SDA.2 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 | 494 |   9 |   SCL.2 |   IN | 1 |  5 || 6  |   |      | 0V      |     |     |
 | 481 |   7 |  IO.481 |   IN | 1 |  7 || 8  | 1 | IN   | TxD1    | 15  | 488 |
 |     |     |      0V |      |   |  9 || 10 | 1 | IN   | RxD1    | 16  | 489 |
 | 479 |   0 |  IO.479 |   IN | 1 | 11 || 12 | 1 | IN   | IO.492  | 1   | 492 |
 | 480 |   2 |  IO.480 |   IN | 1 | 13 || 14 |   |      | 0V      |     |     |
 | 483 |   3 |  IO.483 |   IN | 1 | 15 || 16 | 1 | IN   | IO.476  | 4   | 476 |
 |     |     |    3.3V |      |   | 17 || 18 | 1 | IN   | IO.477  | 5   | 477 |
 | 484 |  12 |    MOSI |   IN | 1 | 19 || 20 |   |      | 0V      |     |     |
 | 485 |  13 |    MISO |   IN | 1 | 21 || 22 | 1 | IN   | IO.478  | 6   | 478 |
 | 487 |  14 |    SLCK |   IN | 1 | 23 || 24 | 1 | IN   | SS      | 10  | 486 |
 |     |     |      0V |      |   | 25 || 26 | 0 | IN   | IO. 23  | 11  | 433 |
 | 474 |  30 |   SDA.3 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.3   | 31  | 475 |
 | 490 |  21 |  IO.490 |   IN | 1 | 29 || 30 |   |      | 0V      |     |     |
 | 491 |  22 |  IO.491 |   IN | 1 | 31 || 32 | 0 | IN   | IO. 24  | 26  | 434 |
 | 482 |  23 |  IO.482 |   IN | 0 | 33 || 34 |   |      | 0V      |     |     |
 | 495 |  24 |  IO.495 |   IN | 0 | 35 || 36 | 0 | IN   | IO. 22  | 27  | 432 |
 |     |  25 |   AIN.2 |      |   | 37 || 38 |   |      | 1V8     | 28  |     |
 |     |     |      0V |      |   | 39 || 40 |   |      | AIN.0   | 29  |     |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+--- C4 ---+---+------+---------+-----+-----+
===== truc autour du device tree =====
  * https://forums.raspberrypi.com/viewtopic.php?t=339588
  * https://stackoverflow.com/questions/21670967/how-to-compile-dts-linux-device-tree-source-files-to-dtb

/boot/dtb/amlogic# dtc -I dtb -O dts meson-sm1-odroid-c4.dtb -o meson-sm1-odroid-c4.dts

:-( ... trop de taf de ce coté du device tree ... je laisse tombé et reviens sur les images Hardkernel Odroid!

===== install truc fluxbox =====
<code c>
#si image toute faite 
apt install software-properties-common
add-apt-repository ppa:hardkernel/ppa
apt update
apt install odroid-wiringpi sudo
usermod -G sudo odroid #user odroid deja fait
# dans tous les cas
apt install vim fluxbox xterm  xfonts-base x11-xserver-utils
apt install pcmanfm xpad # options

Ajout bouton on/off

Connexion du bouton sur 9/11

ajouter dans /media/boot/boot.ini pour Ubuntu-Odroid ou boot.cmd pour Armbian juste avant # Load kernel, dtb and initrd

### in case of GPIOX.3 (Pin 11) of 2x20 pins connector
setenv gpiopower "479"
setenv bootargs ${bootargs} gpiopower=${gpiopower}
 
#recompile
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

autologin

apt remove lightdm apt install nodm modifier /etc/default nodm pour loger l'utilisateur odroid et pas root

# nodm configuration
# Set NODM_ENABLED to something different than 'false' to enable nodm
NODM_ENABLED=true
# User to autologin for
NODM_USER=odroid
# First vt to try when looking for free VTs
NODM_FIRST_VT='7'
# X session
NODM_XSESSION=/usr/bin/startfluxbox
# Options for nodm itself
NODM_OPTIONS=
# Options for the X server.
# Format: [/usr/bin/<Xserver>] [:<disp>] <Xserver-options>
# The Xserver executable and the display name can be omitted, but should
# be placed in front, if nodm's defaults shall be overridden.
NODM_X_OPTIONS='-nolisten tcp'
# If an X session will run for less than this time in seconds, nodm will wait an
# increasing bit of time before restarting the session.
NODM_MIN_SESSION_TIME=60
# Timeout (in seconds) to wait for X to be ready to accept connections. If X is
# not ready before this timeout, it is killed and restarted.
NODM_X_TIMEOUT=300

..j'ai cherché longtemps le truc de remplacer Xsession par startfluxbox … pour avoir une compatibilité maximale et surtout le lancement automatique par le fichier .fluxbox/startup !

# fluxbox startup-script:
#  ~/.fluxbox/startup
# Lines starting with a '#' are ignored.
# doit finir par exec fluxbox
#fbsetbg -l
xterm -T "Top" -e /usr/bin/top &
/usr/bin/x11vnc -rfbauth ~/.vnc/passwd -forever -display :0 &
exec fluxbox -log ~/.fluxbox/fluxbox.log

VNC

 
apt install x11vnc
x11vnc -storepasswd votre_mot_de_passe ~/.vnc_passwd

poser x11vnc -many -rfbauth ~/.vnc_passwd dans un startmenu … cf https://doc.ubuntu-fr.org/x11vnc

ressources/odroid_c4.1680705739.txt.gz · Dernière modification : 2024/02/08 17:20 (modification externe)