From patchwork Tue Feb 26 09:24:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/7] e2fsprogs: add the original mkdebugfs.sh Date: Tue, 26 Feb 2013 09:24:36 -0000 From: Robert Yang X-Patchwork-Id: 45105 Message-Id: To: Cc: dvhart@linux.intel.com 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 --- .../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