tools/kernel2minor: fix endian conversion issues, allow creating little-endian images