Patchwork [3/7] e2fsprogs: add the original mkdebugfs.sh

login
register
mail settings
Submitter Robert Yang
Date Feb. 26, 2013, 9:24 a.m.
Message ID <f16ee0ba2991c2c533010996e4eb6cabd24f4798.1361862860.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/45105/
State New
Headers show

Comments

Robert Yang - Feb. 26, 2013, 9:24 a.m.
This script is from Darren Hart, it will be used for creating the extX
filesystem from a given directory, which will replace the genext2fs in
image_types.bbclass.

It isn't shipp in e2fsprogs package at the moment, just add it intact,
and will do more work on it in the following commits.

[YOCTO #3848]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 .../e2fsprogs/e2fsprogs/mkdebugfs.sh               | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh

Patch

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh
new file mode 100644
index 0000000..5dfa380
--- /dev/null
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh
@@ -0,0 +1,49 @@ 
+#!/bin/sh
+SRCDIR=$1
+DEVICE=$2
+DEBUGFS="debugfs/debugfs"
+
+yes | mkfs.ext4 test.img
+
+{
+	CWD="/"
+	find $SRCDIR | while read FILE; do
+		#TGT=${FILE#$SRCDIR}
+		TGT=$(basename "${FILE#$SRCDIR}")
+		DIR=$(dirname "${FILE#$SRCDIR}")
+
+		# Skip the root dir
+		if [ -z "$TGT" ]; then
+			continue
+		fi
+
+		if [ "$DIR" != "$CWD" ]; then
+			echo "cd $DIR"
+			CWD="$DIR"
+		fi
+
+		case $(stat -c "%F" $FILE) in
+		"directory")
+			echo "mkdir $TGT"
+			;;
+		"regular file")
+			echo "write $FILE $TGT"
+			;;
+		"symbolic link")
+			LINK_TGT=$(ls -l $FILE | sed -e 's/.*-> //')
+			echo "symlink $TGT $LINK_TGT"
+			;;
+		"block special file")
+			DEVNO=$(stat -c "%t %T" $FILE)
+			echo "mknod $TGT b $DEVNO"
+			;;
+		"character special file")
+			DEVNO=$(stat -c "%t %T" $FILE)
+			echo "mknod $TGT c $DEVNO"
+			;;
+		*)
+			echo "Unknown file $FILE" 1>&2
+			;;
+		esac
+	done
+} | $DEBUGFS -w -f /dev/stdin $DEVICE