From fa47322bb0268224d189f2745d8cde47e15f0a49 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Wed, 31 Jul 2024 15:30:48 +0200 Subject: [PATCH] bundles/raspberrypi: fix config.txt for lcd display --- bundles/raspberrypi/files/config.txt | 23 +++++++++++++++-------- bundles/raspberrypi/metadata.py | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/bundles/raspberrypi/files/config.txt b/bundles/raspberrypi/files/config.txt index 445fc63..bf6751e 100644 --- a/bundles/raspberrypi/files/config.txt +++ b/bundles/raspberrypi/files/config.txt @@ -1,23 +1,30 @@ disable_overscan=1 -hdmi_force_hotplug=1 -dtparam=spi=on dtparam=audio=on -dtoverlay=vc4-fkms-v3d +dtoverlay=vc4-kms-v3d max_framebuffers=2 -hdmi_drive=2 force_turbo=1 -gpu_mem=${node.metadata['raspberrypi'].get('gpu_mem', 128)} +gpu_mem=${node.metadata.get('raspberrypi/gpu_mem', 128)} + +% if node.metadata.get('raspberrypi/enable_display'): +display_auto_detect=1 +% else: +dtparam=i2c_arm=on +dtparam=i2s=on +dtparam=spi=on +hdmi_drive=2 +hdmi_force_hotplug=1 +% endif % if node.os == 'debian': arm_64bit=1 % endif arm_boost=1 -% for item in sorted(node.metadata['raspberrypi'].get('config.txt', set())): +% for item in sorted(node.metadata.get('raspberrypi/config.txt', set())): ${item} % endfor -% if node.metadata['raspberrypi'].get('camera', False): -start_x=1 +% if node.metadata.get('raspberrypi/enable_camera', False): +camera_auto_detect=1 % endif diff --git a/bundles/raspberrypi/metadata.py b/bundles/raspberrypi/metadata.py index 5c8f42a..80eac1a 100644 --- a/bundles/raspberrypi/metadata.py +++ b/bundles/raspberrypi/metadata.py @@ -25,7 +25,6 @@ defaults = { }, }, 'raspberrypi': { - 'default-target': 'multi-user.target', 'cmdline': { 'console=tty1', 'root=/dev/mmcblk0p2', @@ -37,6 +36,8 @@ defaults = { 'plymouth.ignore-serial-consoles', 'net.ifnames=0', }, + 'default-target': 'multi-user.target', + 'enable_display': False, }, 'systemd': { 'journal': { @@ -46,3 +47,19 @@ defaults = { }, }, } + + +@metadata_reactor.provides( + 'raspberrypi/cmdline', +) +def display(metadata): + if not metadata.get('raspberrypi/enable_display'): + return {} + + return { + 'raspberrypi': { + 'cmdline': { + 'video=DSI-1:800x480@60,rotate=180', + }, + }, + }