-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swupdate-scripts: add a script to report the mmc / storage size
This script reports the size of the flash chip. Since it will report a valid value for any block device it is booted from and to make clear it is not a partition size, it is named storage-size. The script will fail when the root partition is not a block device, e.g. on the devices using ubi.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
meta-venus/recipes-support/swupdate-scripts/files/storage-size.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# only block devices are supported at the moment | ||
rootpart="$(mount | grep ' on / ' | awk '{print $1}')" | ||
parentdev=$(echo $rootpart | sed -n -r 's,^/dev/([a-zA-Z0-9]+)p[0-9]$,\1,p') | ||
if [ "$parentdev" = "" ]; then | ||
echo "$rootdev doesn't seem to be a block device" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
sysdir="/sys/block/$parentdev" | ||
if [ ! -d $sysdir ]; then | ||
echo "$sysdir doesn't exist" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
awk '{print $1*512}' "$sysdir/size" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters