From b16ad95d970dd8a85c37e93c26870514c47a089b Mon Sep 17 00:00:00 2001 From: klemek Date: Tue, 27 Oct 2026 23:25:14 +0100 Subject: [PATCH] fix: better cmdline/config txt setup/restore --- Makefile | 71 ++++++++++++++++++++++++++++------------------ system/cmdline.txt | 1 + system/config.ini | 3 ++ 3 files changed, 48 insertions(+), 27 deletions(-) create mode 100644 system/cmdline.txt diff --git a/Makefile b/Makefile index 2f5e967..3b7dcaf 100644 --- a/Makefile +++ b/Makefile @@ -12,22 +12,6 @@ LDLIBS ?= -lm -lGL -lglfw -lasound # FILES -test: - echo $(PROJECT_DIR) - -# forge-steel/src/main.c: -# $(MAKE) -s submodule-init -# -# forge-steel/hashmap.c/hashmap.c: -# $(MAKE) -s submodule-init -# -# forge-steel/log.c/src/log.c: -# $(MAKE) -s submodule-init -# -# forge-steel/include/linmath.h: -# $(MAKE) -s submodule-init - -# $(BUILD_DIR)/$(TARGET): forge-steel/src/main.c forge-steel/hashmap.c/hashmap.c forge-steel/log.c/src/log.c forge-steel/include/linmath.h $(BUILD_DIR)/$(TARGET): forge-steel/src/main.c forge-steel/hashmap.c/hashmap.c forge-steel/log.c/src/log.c forge-steel/include/linmath.h mkdir -p $(BUILD_DIR) $(CC) $(SOURCES) $(CFLAGS) $(LDLIBS) -o $(BUILD_DIR)/$(TARGET) @@ -47,14 +31,6 @@ apt-install: setup-weston: ln -fs $(PROJECT_DIR)/system/weston.ini $(HOME)/.config/weston.ini -.PHONY: setup-rasp-config -setup-rasp-config: - sudo $(PROJECT_DIR)/line_in_file.sh "include custom.txt" "/boot/firmware/config.txt" - sudo $(PROJECT_DIR)/append_to_file.sh " vc4.tv_norm=PAL" "/boot/firmware/cmdline.txt" "vc4.tv_norm=" - sudo $(PROJECT_DIR)/append_to_file.sh " video=Composite-1:720x576ie,tv_mode=PAL" "/boot/firmware/cmdline.txt" "video=" - sudo $(PROJECT_DIR)/append_to_file.sh " quiet loglevel=0 consoleblank=1" "/boot/firmware/cmdline.txt" "quiet" - sudo cp -f $(PROJECT_DIR)/system/config.ini /boot/firmware/custom.txt - .PHONY: remove-motd remove-motd: sudo rm -rf /etc/motd @@ -76,7 +52,7 @@ setup-bashrc: $(PROJECT_DIR)/line_in_file.sh "make -C $(PROJECT_DIR) --no-print-directory start-weston" "$(HOME)/.bashrc" .PHONY: install -install: remove-passwd apt-install setup-weston setup-rasp-config setup-services setup-bashrc remove-motd +install: remove-passwd apt-install setup-weston remove-motd disable-cloud-init setup-services setup-bashrc .PHONY: clean clean: @@ -98,9 +74,50 @@ start-weston: @echo "on" | sudo tee /sys/class/drm/card1-Composite-1/status || true @/usr/bin/weston --shell=kiosk-shell.so --xwayland --log=$(PROJECT_DIR)/weston.log -- kitty --hold make --no-print-directory -C $(PROJECT_DIR) run -.PHONY: host-install -host-install: +.PHONY: start +start: start-bg start-fg + +# HOST ONLY + +.PHONY: host-submodule-update +host-submodule-update: + git submodule update --init --recursive + +.PHONY: host-chmod-opt +host-chmod-opt: sudo chmod a+rwx /run/media/$(shell whoami)/rootfs/opt/ + +.PHONY: host-rsync +host-rsync: host-chmod-opt rsync -a $(PWD) /run/media/$(shell whoami)/rootfs/opt/ + +.PHONY: host-setup-custom +host-setup-custom: + cp $(PROJECT_DIR)/system/config.ini /run/media/$(shell whoami)/bootfs/custom.txt + +.PHONY: host-reset-config +host-reset-config: + sed -i '/include custom.txt/d' /run/media/$(shell whoami)/bootfs/config.txt + +.PHONY: host-setup-config +host-setup-config: host-setup-custom host-reset-config + echo "include custom.txt" >> /run/media/$(shell whoami)/bootfs/config.txt + +.PHONY: host-reset-cmdline +host-reset-cmdline: + sed -i '2,$$d' /run/media/$(shell whoami)/bootfs/cmdline.txt + +.PHONY: host-setup-cmdline +host-setup-cmdline: host-reset-cmdline + cat $(PROJECT_DIR)/system/cmdline.txt >> /run/media/$(shell whoami)/bootfs/cmdline.txt + +.PHONY: host-unmount +host-unmount: sudo umount -R /run/media/$(shell whoami)/rootfs sudo umount -R /run/media/$(shell whoami)/bootfs + +.PHONY: host-install +host-install: host-submodule-update host-rsync host-setup-config host-setup-cmdline host-unmount + +.PHONY: host-install-reset +host-install-reset: host-submodule-update host-rsync host-reset-config host-reset-cmdline host-unmount diff --git a/system/cmdline.txt b/system/cmdline.txt new file mode 100644 index 0000000..48f080e --- /dev/null +++ b/system/cmdline.txt @@ -0,0 +1 @@ +vc4.tv_norm=PAL video=Composite-1:720x576ie,tv_mode=PAL quiet loglevel=0 consoleblank=1 diff --git a/system/config.ini b/system/config.ini index 6e29671..c225e8b 100644 --- a/system/config.ini +++ b/system/config.ini @@ -19,3 +19,6 @@ gpu_mem=64 enable_tvout=1 sdtv_mode=2 sdtv_aspect=1 + +# --- I2C --- +dtparam=i2c_arm=on