Originally Posted by smallpond
Would it not be better to figure out why it is crashing?
Originally Posted by priyadarshan
Yes it would be... but we are looking for temporary makeshift solution...
I cannot imagine a rationale in which that could apply, so I won't try...
But if it saves you some time, your line
cat /dev/ttyS0 > file.txt
...does not do anything useful. It tells the the system to wait for input from /dev/ttyS0 (hang, as you say) and send whatever is typed to file.txt.
But any such action within the init sequence would be pretty pointless and the result dependent on where it was in that sequence - before or after filesystems were mounted, whether mounted readonly, the total context of the as-yet-not-fully-inited system.