tool: fixed error on touch_ramfs.sh

touch_ramfs.sh has a critical error on it.
ramfs_factory directory is affected in real ramdisk image.

This patch will fix this problem by checking the directory of given file name.
tool: automatically generate target directory

It occurs an error while unpacking boot image, if
there is no target directory.

This patch will generate target directory automatically
by checking its existance.