Odin uses a .tar.md5 format which is actually a concatenated tar and .md5 file.

To convert boot.img to Odin flashable:

tar -H ustar -cvvf boot.tar boot.img

The -H option may be substituted with –format

This creates a file boot.tar in ustar format.

Now we append the md5 to the same file

md5sum boot.tar >> boot.tar

We now rename the file to .tar.md5

mv boot.tar boot.tar.md5

To extract and convert this back to a Recovery flashable format, we do

tar -xvvf boot.tar.md5

If you need to read the md5, you can use the following command:

tail -1 boot.tar.md5 | cut -d\  -f1

which reads the last byte of the file boot.tar.md5 which is the md5sum integer plus the filename seperated by a space, then “cuts” it by the delimitor of space, and shows the first characters before the delimitor.