暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

flash.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. if [ "$#" -ne 1 ] ; then
  3. echo "Usage: $0 /dev/disk" >&2
  4. exit 1
  5. fi
  6. # Unmount mounted partitions
  7. for fs in `grep $1 /proc/mounts|cut -d ' ' -f 1` ; do
  8. echo Unmounting $fs
  9. sudo umount $fs
  10. done
  11. echo Overwriting old partition table
  12. sudo dd if=/dev/zero of=$1 bs=1024 count=1024
  13. echo Recreating new partition table
  14. sudo fdisk $1 << EOF
  15. n
  16. p
  17. 1
  18. +16MB
  19. t
  20. 53
  21. n
  22. p
  23. 2
  24. w
  25. EOF
  26. if [ -e output/images/imx23_olinuxino_dev_linux.sb ] ; then
  27. echo Writing mxs-bootlet bootstream
  28. sudo dd if=output/images/imx23_olinuxino_dev_linux.sb bs=512 of="$1"1 seek=4
  29. elif [ -e output/images/u-boot.sd ] ; then
  30. echo Writing U-Boot bootstream
  31. sudo dd if=output/images/u-boot.sd of="$1"1
  32. else
  33. echo Could not find a suitable bootstream!
  34. fi
  35. if [ -e output/images/rootfs.tar ] ; then
  36. echo Creating root filesystem
  37. sudo mkfs.ext4 "$1"2 -L rootfs
  38. echo Mounting root filesystem
  39. sudo mkdir -p /media/rootfs
  40. sudo mount "$1"2 /media/rootfs
  41. echo Copying root filesystem
  42. sudo tar xfp output/images/rootfs.tar -C /media/rootfs
  43. echo Synchronising changes to disk
  44. sudo sync
  45. echo Unmounting root filesystem
  46. sudo umount /media/rootfs
  47. sudo rm -rf /media/rootfs
  48. else
  49. echo Writing root filesystem
  50. sudo dd if=output/images/rootfs.ext2 of="$1"2 bs=512
  51. echo Synchronising changes to disk
  52. sudo sync
  53. fi