From 04933fc019b9ba0ad36dbfc43779b9bf8d38cec1 Mon Sep 17 00:00:00 2001 From: Yevhenii Onishchenko Date: Wed, 15 May 2024 11:53:56 +0300 Subject: [PATCH] Fix onion-dt-overlay postinst script to have error-free build Build fails if onion-dt-overlay-sw-spi package is included (*) in build and works fine if only package building is (M) enabled. Onion-dt-overlay package postinst script tries to create /sys/kernel/config/ directory which is not allowed during image building process. The fix introduces correct usage of IPKG_INSTROOT variable in bash, so the postinst script should be executed only on a target hardware. Resolves: #91 --- onion-dt-overlay/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/onion-dt-overlay/Makefile b/onion-dt-overlay/Makefile index cc5eebb..b7e75a5 100644 --- a/onion-dt-overlay/Makefile +++ b/onion-dt-overlay/Makefile @@ -68,7 +68,12 @@ define BuildDtbo define Package/onion-dt-overlay-$(1)/postinst #!/bin/sh - if [ -z "$${IPKG_INSTROOT}" ]; then + if [ -z "$$$${IPKG_INSTROOT}" ]; then + if ! cat /proc/mounts | grep -q config; then + echo "Mounting configfs..." + mount -t configfs none /sys/kernel/config + fi + mkdir -p /sys/kernel/config/device-tree/overlays/$(1) cat /lib/firmware/device-tree/overlays/$(1).dtbo > /sys/kernel/config/device-tree/overlays/$(1)/dtbo fi