gen_realview_sdcard_img.sh 378 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. set -x
  3. [ $# -eq 3 ] || {
  4. echo "SYNTAX: $0 <file> <rootfs image> <rootfs size>"
  5. exit 1
  6. }
  7. OUTPUT="$1"
  8. ROOTFS="$2"
  9. ROOTFSSIZE="$3"
  10. head=4
  11. sect=63
  12. set `ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t 83 -p ${ROOTFSSIZE}M`
  13. ROOTFSOFFSET="$(($1 / 512))"
  14. ROOTFSSIZE="$(($2 / 512))"
  15. dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc