mirror of
https://github.com/lingble/meta-tegra.git
synced 2025-10-29 19:42:41 +00:00
initrd-flash: fix auto mount trouble
Disable automount feature on OS is not longer required. Signed-off-by: Sebastian Suesens <sebastian.suesens@baslerweb.com>
This commit is contained in:
committed by
Matt Madison
parent
6bd895258b
commit
3b523a4cb0
@@ -220,6 +220,16 @@ run_rcm_boot() {
|
||||
|
||||
mount_partition() {
|
||||
local dev="$1"
|
||||
local mnt=$(cat /proc/mounts | grep "^$dev" | cut -d' ' -f2)
|
||||
local i=$(echo $mnt|awk -F' ' '{print NF}')
|
||||
while [ $i -ne 0 ]; do
|
||||
local mnt=$(echo ${mnt} | cut -d' ' -f$i)
|
||||
if ! umount "${mnt}" > /dev/null 2>&1; then
|
||||
echo "ERR: unmount ${mnt} on device $dev failed" >&2
|
||||
return 1
|
||||
fi
|
||||
i=$(expr $i - 1)
|
||||
done
|
||||
if udisksctl mount -b "$dev" > /dev/null; then
|
||||
cat /proc/mounts | grep "^$dev" | cut -d' ' -f2
|
||||
return 0
|
||||
|
||||
@@ -150,6 +150,18 @@ copy_to_device() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
unmount_device() {
|
||||
local dev="$1"
|
||||
local mnt=$(cat /proc/mounts | grep "^$dev" | cut -d' ' -f2)
|
||||
if [ -n "$mnt" ]; then
|
||||
if ! umount "${mnt}" > /dev/null 2>&1; then
|
||||
echo "ERR: unmount ${mnt} on device $dev failed" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
write_partitions_to_device() {
|
||||
local blksize partnumber partname partsize partfile partguid partfilltoend
|
||||
local i dest pline destsize filesize n_written
|
||||
@@ -177,6 +189,10 @@ write_partitions_to_device() {
|
||||
echo "ERR: cannot locate block device $dest" >&2
|
||||
return 1
|
||||
fi
|
||||
if ! unmount_device "$dest"; then
|
||||
echo "ERR: device unmount failed" >&2
|
||||
return 1
|
||||
fi
|
||||
destsize=$(blockdev --getsize64 "$dest" 2>/dev/null)
|
||||
if [ $n_written -eq 0 -a -z "$destsize" ]; then
|
||||
sleep 1
|
||||
@@ -201,6 +217,10 @@ write_partitions_to_device() {
|
||||
fi
|
||||
filesize=$(stat -c "%s" "$partfile")
|
||||
dest="/dev/$DEVNAME$PARTSEP$partnumber"
|
||||
if ! unmount_device "$dest"; then
|
||||
echo "ERR: device unmount failed" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ ! -b "$dest" ]; then
|
||||
echo "ERR: cannot locate block device $dest" >&2
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user