Skip to content

Instantly share code, notes, and snippets.

@kylemanna
Created November 18, 2011 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kylemanna/1376913 to your computer and use it in GitHub Desktop.
Save kylemanna/1376913 to your computer and use it in GitHub Desktop.
Reverse endianess on a binary file
#!/bin/sh
# Following command will reorder 32 bit words from little endian to big endian
#
# This is needed on TI81xx platforms to convert a standard LE bootloader/SPL/MLO
# to a byte ordering the works via SPI flash
arm-none-linux-gnueabi-objcopy -Ibinary --reverse-bytes=4 MLO MLO.spi
# Output:
# $ hexdump -C MLO | head -n2
# 00000000 40 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 |@...............|
# 00000010 00 00 00 00 43 48 53 45 54 54 49 4e 47 53 00 00 |....CHSETTINGS..|
# $ hexdump -C MLO.spi | head -n2
# 00000000 00 00 00 40 00 00 00 0c 00 00 00 00 00 00 00 00 |...@............|
# 00000010 00 00 00 00 45 53 48 43 4e 49 54 54 00 00 53 47 |....ESHCNITT..SG|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment