summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-09-05 11:26:58 -0500
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-05-20 19:50:20 +0300
commit7f6479988cca603dcd1a4384b07075996e0a2658 (patch)
tree4a33f306d9fa8c7bcebaf1bd6ffc0bbc490ad397 /recipes-core
parenta699d36a15e2aa575db5f0d0fdfa2f0995a7c93a (diff)
downloadmeta-mlinux-7f6479988cca603dcd1a4384b07075996e0a2658.tar.gz
meta-mlinux-7f6479988cca603dcd1a4384b07075996e0a2658.tar.bz2
meta-mlinux-7f6479988cca603dcd1a4384b07075996e0a2658.zip
Make /etc/init.d/config support eMMC, and eliminate MTD nand flash requirement
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/multitech/config/config.init36
1 files changed, 29 insertions, 7 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init
index d821f4c..27b067f 100644
--- a/recipes-core/multitech/config/config.init
+++ b/recipes-core/multitech/config/config.init
@@ -41,10 +41,21 @@ mount_config() {
mkdir -p ${CONFIG_DIR}
mount ${CONFIG_DIR}
- # Prepare flash for JFFS2 if mount fails
+ # Prepare flash for JFFS2 or EXT4 if mount fails
if [ $? -ne 0 ]; then
echo "Creating ${CONFIG_DIR}"
- flash_erase -j ${CONFIG_MTDC} 0 0
+ fs=$(mount -fvn ${CONFIG_DIR})
+ if [[ $fs =~ [[:space:]]*(/dev/(...)[^[:space:]]*) ]] ; then
+ if [[ ${BASH_REMATCH[2]} == mmc ]] ; then
+ # One more check for empty
+ mdev="${BASH_REMATCH[1]}"
+ if [[ $(dd if=$mdev count=4 2>/dev/null | tr -d '\0' | wc -c) == 0 ]] ; then
+ mkfs.ext4 -O 64bit ${mdev}
+ fi
+ else
+ flash_erase -j ${CONFIG_MTDC} 0 0
+ fi
+ fi
mount ${CONFIG_DIR}
fi
}
@@ -54,10 +65,21 @@ mount_oem() {
mkdir -p ${OEM_DIR}
mount ${OEM_DIR}
- # Prepare flash for JFFS2 if mount fails
+ # Prepare flash for JFFS2 or EXT4 if mount fails
+ # Prepare flash for JFFS2 or EXT4 if mount fails
if [ $? -ne 0 ]; then
echo "Creating ${OEM_DIR}"
- flash_erase -j ${OEM_MTDC} 0 0
+ fs=$(mount -fvn ${OEM_DIR})
+ if [[ $fs =~ [[:space:]]*(/dev/(...)[^[:space:]]*) ]] ; then
+ if [[ ${BASH_REMATCH[2]} == mmc ]] ; then
+ mdev="${BASH_REMATCH[1]}"
+ if [[ $(dd if=$mdev count=4 2>/dev/null | tr -d '\0' | wc -c) == 0 ]] ; then
+ mkfs.ext4 -O 64bit ${mdev}
+ fi
+ else
+ flash_erase -j ${OEM_MTDC} 0 0
+ fi
+ fi
mount ${OEM_DIR}
fi
}
@@ -65,15 +87,15 @@ mount_oem() {
case $1 in
start)
# mount config if not already mounted
- if ! grep -q "^${CONFIG_MTDB} " /proc/mounts; then
+ if ! grep -q " ${CONFIG_DIR} " /proc/mounts; then
mount_config
else
echo "$CONFIG_DIR already mounted"
fi
# mount oem if specified in /etc/fstab and it isn't already mounted
- if grep -qE "^${OEM_MTDB}\s+${OEM_DIR}\s+" /etc/fstab; then
- if ! grep -q "^${OEM_MTDB} " /proc/mounts; then
+ if mount -fvn "${OEM_DIR}" ; then
+ if ! grep -q " ${OEM_DIR} " /proc/mounts; then
mount_oem
else
echo "$OEM_DIR already mounted"