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 <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
Jose Diaz de Grenu 2019-08-07 12:15:13 +02:00
parent dc8ec807cf
commit 797f9dc357
1 changed files with 9 additions and 1 deletions

View File

@ -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}"