Rewritten unpackbootimg.c