[OE-core] [PATCH 3/7] e2fsprogs: add the original mkdebugfs.sh

Robert Yang liezhi.yang at windriver.com
Tue Feb 26 09:24:36 UTC 2013


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 at windriver.com>
---
 .../e2fsprogs/e2fsprogs/mkdebugfs.sh               | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh

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
-- 
1.7.11.2





More information about the Openembedded-core mailing list