1#!/bin/sh - 2# bin2asm (binary to asm) shell script version by ukai 3# 4# $NetBSD: bin2asm.sh,v 1.1 1996/08/25 23:39:21 jtk Exp $ 5# 6if [ $# -lt 1 ]; then 7 echo 'usage: $0 [in]' 8 exit 1 9fi 10in=$1 11size=`ls -l ${in} | awk '{print $5}'` 12# Oops, must 8 byte align 13len=`expr \( $size + 8 \) / 8 \* 8` 14 15echo "/* \$NetBSD\$ */" 16echo "/* This file is automatically generated by bin2asm.sh */" 17echo "/* Original file is '${in}' */" 18echo 19dd if=${in} bs=${len} conv=sync |\ 20 hexdump -v -e '" .byte " 7/1 "0x%02x, " 1/1 " 0x%02x" "\n"' 21echo 22echo "/* Total size = $size -> $len */" 23echo "/* End of File */" 24