mkimg.rootfs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. #$1: rootfs dir
  3. #$2: output dir
  4. #$3: name
  5. #$4..: types
  6. rootfs_dir=$1
  7. rootfs_image_prepath=$2/$3
  8. while [ -n "$4" ]
  9. do
  10. case "$4" in
  11. "jffs2")
  12. echo "making filesystem image jffs2 ..."
  13. mkfs.jffs2 -e 0x20000 -d $rootfs_dir -o $rootfs_image_prepath.jffs2
  14. echo "making filesystem image jffs2 for nand ..."
  15. mkfs.jffs2 -e 0x20000 -n -d $rootfs_dir -o $rootfs_image_prepath.nand.jffs2
  16. ;;
  17. "cramfs")
  18. echo "making filesystem image cramfs ..."
  19. mkfs.cramfs $rootfs_dir $rootfs_image_prepath.cramfs
  20. ;;
  21. "yaffs2")
  22. echo "making filesystem image yaffs2 ..."
  23. mkfs.yaffs2 $rootfs_dir $rootfs_image_prepath.yaffs2 >/dev/null
  24. chmod a+r $rootfs_image_prepath.yaffs2
  25. ;;
  26. "cramfs-initrd")
  27. echo "making filesystem image cramfs-initrd ..."
  28. mkfs.cramfs $rootfs_dir $rootfs_image_prepath.temp
  29. mkimage -A arm -T ramdisk -C none -a 0 -e 0 -n "initrd in cramfs" -d $rootfs_image_prepath.temp $rootfs_image_prepath.cramfs.initrd
  30. rm $rootfs_dir $rootfs_image_prepath.temp -f
  31. ;;
  32. "cramfs-initrd-img")
  33. echo "making filesystem image cramfs-initrd ..."
  34. mkfs.cramfs $rootfs_dir $rootfs_image_prepath.temp
  35. mkimage -A arm -T ramdisk -C none -a 0x81100000 -e 0x81100000 -n "initrd in cramfs" -d $rootfs_image_prepath.temp $rootfs_image_prepath.cramfs.initrd.img
  36. rm $rootfs_dir $rootfs_image_prepath.temp -f
  37. esac
  38. shift
  39. done