How to debug preinit script under lib?

add set -x to them then flash the firmware?
because sometime it cant boot i have to reset

ps. it is a custom board.