From 797f9dc357942fd3b6919f8e316be2e4d3422fc7 Mon Sep 17 00:00:00 2001 From: Jose Diaz de Grenu Date: Wed, 7 Aug 2019 12:15:13 +0200 Subject: [PATCH] qualcomm.sh: remount as writteable if '/' is ro On some scenarios, like when booting from NFS, the root filesystem is not writteable. When this happens the qualcomm.sh is not able to write the MAC file which so the wireless driver fails to load. The arguments that U-Boot uses when booting from NFS using dboot result in the root filesystem being mounted as read-only, but at some point it is remounted as read/write. This happens after trying to load the wireless driver, though. Currently this is the only scenario in which we can reproduce the problem, and there are several other processes in DEY that require a writeable root filesystem (wireless SSID editing, Dropbear SSH key-gen and u-boot-fw-utils) so remount the rootfs as writteable as a workaround. While on it improve the script a bit to notify on error trying to create this file, just in case this happens in other scenarios. https://jira.digi.com/browse/DEL-5854 Signed-off-by: Jose Diaz de Grenu --- .../kernel-module-qualcomm/qualcomm.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh index 69ba0d912..34566f3e8 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh @@ -47,7 +47,15 @@ done # Override the MAC firmware file only if the MAC file has changed. if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then - cp ${TMP_MACFILE} ${MACFILE} + if [ ! -w ${MACFILE} ]; then + mount_point="$(df $(dirname "${MACFILE}") | awk '!/^Filesystem/{ print $6 }')" + log "6" "[INFO] ${MACFILE} is not writable, remounting '${mount_point}' as rw" + mount -o remount,rw ${mount_point} + fi + + if cp ${TMP_MACFILE} ${MACFILE}; then + log "3" "[ERROR] Could not create ${MACFILE}" + fi fi rm -f "${TMP_MACFILE}"