partmap_test.in 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. #! @BUILD_SHEBANG@
  2. set -e
  3. # Copyright (C) 2010 Free Software Foundation, Inc.
  4. #
  5. # GRUB is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # GRUB is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. parted=parted
  18. grubshell=@builddir@/grub-shell
  19. PATH="$PATH:/sbin:/usr/sbin"
  20. . "@builddir@/grub-core/modinfo.sh"
  21. create_disk_image () {
  22. name="$1"
  23. size=$2
  24. rm -f "${name}"
  25. dd if=/dev/zero of="${name}" bs=512 count=1 seek=$((size * 2048 - 1)) status=noxfer > /dev/null
  26. }
  27. create_dfly_image () {
  28. name="$1"
  29. rm -f ${name}
  30. gunzip < "@srcdir@/tests/dfly-mbr-mbexample.mbr.img.gz" | dd of=${name} bs=1 seek=440 count=72 conv=notrunc > /dev/null
  31. gunzip < "@srcdir@/tests/dfly-mbr-mbexample.dfly.img.gz" | dd of=${name} bs=512 seek=33 count=1 conv=notrunc > /dev/null
  32. }
  33. check_output () {
  34. outfile=$1
  35. shift
  36. for dsk in $@; do
  37. if ! grep "($dsk)" "${outfile}" >/dev/null
  38. then
  39. echo "($dsk): disk/partiton not found in: $(cat "${outfile}")"
  40. exit 1
  41. fi
  42. done
  43. }
  44. list_parts () {
  45. mod=$1;
  46. shift;
  47. imgfile="$1"
  48. shift
  49. outfile="$1"
  50. shift
  51. echo ls | "${grubshell}" --disk="${imgfile}" \
  52. --modules=$mod > "${outfile}"
  53. cat "${outfile}" | tr -d "\n\r"
  54. echo
  55. }
  56. case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
  57. mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson)
  58. disk=ata0
  59. ;;
  60. powerpc-ieee1275)
  61. disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
  62. # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
  63. exit 77
  64. ;;
  65. sparc64-ieee1275)
  66. disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0
  67. # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
  68. exit 77
  69. ;;
  70. i386-ieee1275)
  71. disk=ieee1275/d
  72. # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
  73. exit 77
  74. ;;
  75. mips-arc)
  76. # FIXME: ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel.
  77. exit 77 ;;
  78. mipsel-arc)
  79. disk=arc/scsi0/disk0/rdisk0
  80. ;;
  81. arm*-efi)
  82. disk=hd2
  83. ;;
  84. *)
  85. disk=hd0
  86. ;;
  87. esac
  88. if ! which ${parted} >/dev/null 2>&1; then
  89. echo "${parted} not installed; cannot test partmap"
  90. exit 99
  91. fi
  92. imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
  93. outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
  94. #
  95. # MSDOS partition types
  96. #
  97. echo "Checking MSDOS partition types..."
  98. # 0 primary
  99. create_disk_image "${imgfile}" 64
  100. ${parted} -a none -s "${imgfile}" mklabel msdos
  101. list_parts part_msdos "${imgfile}" "${outfile}"
  102. check_output "${outfile}" $disk
  103. # 1 primary
  104. create_disk_image "${imgfile}" 64
  105. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M
  106. list_parts part_msdos "${imgfile}" "${outfile}"
  107. check_output "${outfile}" $disk $disk,msdos1
  108. # 2 primary
  109. create_disk_image "${imgfile}" 128
  110. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M
  111. list_parts part_msdos "${imgfile}" "${outfile}"
  112. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2
  113. # 3 primary
  114. create_disk_image "${imgfile}" 128
  115. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M
  116. list_parts part_msdos "${imgfile}" "${outfile}"
  117. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3
  118. # 4 primary
  119. create_disk_image "${imgfile}" 128
  120. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M
  121. list_parts part_msdos "${imgfile}" "${outfile}"
  122. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3 $disk,msdos4
  123. # 1 primary, 1 extended
  124. create_disk_image "${imgfile}" 128
  125. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100%
  126. list_parts part_msdos "${imgfile}" "${outfile}"
  127. check_output "${outfile}" $disk $disk,msdos1
  128. # 1 primary, 1 extended, 1 logical
  129. create_disk_image "${imgfile}" 128
  130. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M
  131. list_parts part_msdos "${imgfile}" "${outfile}"
  132. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5
  133. # 1 primary, 1 extended, 2 logical
  134. create_disk_image "${imgfile}" 128
  135. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M
  136. list_parts part_msdos "${imgfile}" "${outfile}"
  137. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6
  138. # 1 primary, 1 extended, 3 logical
  139. create_disk_image "${imgfile}" 128
  140. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M
  141. list_parts part_msdos "${imgfile}" "${outfile}"
  142. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7
  143. # 1 primary, 1 extended, 4 logical
  144. create_disk_image "${imgfile}" 128
  145. ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M mkpart logical 50M 60M
  146. list_parts part_msdos "${imgfile}" "${outfile}"
  147. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7 $disk,msdos8
  148. #
  149. # GPT partition types
  150. #
  151. echo "Checking GPT partition types..."
  152. # 0 parts
  153. create_disk_image "${imgfile}" 64
  154. ${parted} -a none -s "${imgfile}" mklabel gpt
  155. list_parts part_gpt "${imgfile}" "${outfile}"
  156. check_output "${outfile}" $disk
  157. # 1 parts
  158. create_disk_image "${imgfile}" 64
  159. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M
  160. list_parts part_gpt "${imgfile}" "${outfile}"
  161. check_output "${outfile}" $disk $disk,gpt1
  162. # 2 parts
  163. create_disk_image "${imgfile}" 128
  164. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M
  165. list_parts part_gpt "${imgfile}" "${outfile}"
  166. check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2
  167. # 3 parts
  168. create_disk_image "${imgfile}" 128
  169. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M
  170. list_parts part_gpt "${imgfile}" "${outfile}"
  171. check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3
  172. # 4 parts
  173. create_disk_image "${imgfile}" 128
  174. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 4 20M 30M mkpart 5 30M 40M
  175. list_parts part_gpt "${imgfile}" "${outfile}"
  176. check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4
  177. # 5 parts
  178. create_disk_image "${imgfile}" 128
  179. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M
  180. list_parts part_gpt "${imgfile}" "${outfile}"
  181. check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5
  182. # 6 parts
  183. create_disk_image "${imgfile}" 128
  184. ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M mkpart 6 50M 60M
  185. list_parts part_gpt "${imgfile}" "${outfile}"
  186. check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5 $disk,gpt6
  187. #
  188. # SUN partition types
  189. #
  190. # It seems partition #3 is reserved for whole disk by parted.
  191. #
  192. echo "Checking SUN partition types..."
  193. # 0 parts
  194. create_disk_image "${imgfile}" 64
  195. ${parted} -a none -s "${imgfile}" mklabel sun
  196. list_parts part_sun "${imgfile}" "${outfile}"
  197. check_output "${outfile}" $disk
  198. # 1 parts
  199. create_disk_image "${imgfile}" 64
  200. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M
  201. list_parts part_sun "${imgfile}" "${outfile}"
  202. check_output "${outfile}" $disk $disk,sun1
  203. # 2 parts
  204. create_disk_image "${imgfile}" 128
  205. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M
  206. list_parts part_sun "${imgfile}" "${outfile}"
  207. check_output "${outfile}" $disk $disk,sun1 $disk,sun2
  208. # 3 parts
  209. create_disk_image "${imgfile}" 128
  210. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M
  211. list_parts part_sun "${imgfile}" "${outfile}"
  212. check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4
  213. # 4 parts
  214. create_disk_image "${imgfile}" 128
  215. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M
  216. list_parts part_sun "${imgfile}" "${outfile}"
  217. check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5
  218. # 5 parts
  219. create_disk_image "${imgfile}" 128
  220. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M
  221. list_parts part_sun "${imgfile}" "${outfile}"
  222. check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6
  223. # 6 parts
  224. create_disk_image "${imgfile}" 128
  225. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M
  226. list_parts part_sun "${imgfile}" "${outfile}"
  227. check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6 $disk,sun7
  228. # 7 parts
  229. create_disk_image "${imgfile}" 128
  230. ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M mkpart 60M 70M
  231. list_parts part_sun "${imgfile}" "${outfile}"
  232. check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6 $disk,sun7 $disk,sun8
  233. #
  234. # Apple partition types
  235. #
  236. # Partition table itself is part of some partition, so there is always
  237. # a partition by default. Furthermore free space is also a partition,
  238. # so there is always at least 2 partitions
  239. #
  240. echo "Checking APPLE partition types..."
  241. # 0 parts
  242. create_disk_image "${imgfile}" 64
  243. ${parted} -a none -s "${imgfile}" mklabel mac
  244. list_parts part_apple "${imgfile}" "${outfile}"
  245. check_output "${outfile}" $disk $disk,apple1 $disk,apple2
  246. # 1 parts
  247. create_disk_image "${imgfile}" 64
  248. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M
  249. list_parts part_apple "${imgfile}" "${outfile}"
  250. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3
  251. # 2 parts
  252. create_disk_image "${imgfile}" 128
  253. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M
  254. list_parts part_apple "${imgfile}" "${outfile}"
  255. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3 $disk,apple4
  256. # 3 parts
  257. create_disk_image "${imgfile}" 128
  258. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M
  259. list_parts part_apple "${imgfile}" "${outfile}"
  260. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5
  261. # 4 parts
  262. create_disk_image "${imgfile}" 128
  263. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M
  264. list_parts part_apple "${imgfile}" "${outfile}"
  265. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6
  266. # 5 parts
  267. create_disk_image "${imgfile}" 128
  268. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M
  269. list_parts part_apple "${imgfile}" "${outfile}"
  270. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7
  271. # 6 parts
  272. create_disk_image "${imgfile}" 128
  273. ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M mkpart f 50M 60M
  274. list_parts part_apple "${imgfile}" "${outfile}"
  275. check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7 $disk,apple8
  276. #
  277. # DVH partition types
  278. #
  279. # Partition #11 is reserved for whole disk by parted.
  280. # Parted also aliases #9 as whole disk
  281. #
  282. echo "Checking DVH partition types..."
  283. # 0 parts
  284. create_disk_image "${imgfile}" 64
  285. ${parted} -a none -s "${imgfile}" mklabel dvh
  286. list_parts part_dvh "${imgfile}" "${outfile}"
  287. check_output "${outfile}" $disk
  288. # 1 parts
  289. create_disk_image "${imgfile}" 64
  290. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M
  291. list_parts part_dvh "${imgfile}" "${outfile}"
  292. check_output "${outfile}" $disk $disk,dvh1
  293. # 2 parts
  294. create_disk_image "${imgfile}" 128
  295. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M
  296. list_parts part_dvh "${imgfile}" "${outfile}"
  297. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2
  298. # 3 parts
  299. create_disk_image "${imgfile}" 128
  300. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M
  301. list_parts part_dvh "${imgfile}" "${outfile}"
  302. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3
  303. # 4 parts
  304. create_disk_image "${imgfile}" 128
  305. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M
  306. list_parts part_dvh "${imgfile}" "${outfile}"
  307. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4
  308. # 5 parts
  309. create_disk_image "${imgfile}" 128
  310. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M
  311. list_parts part_dvh "${imgfile}" "${outfile}"
  312. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5
  313. # 6 parts
  314. create_disk_image "${imgfile}" 128
  315. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M
  316. list_parts part_dvh "${imgfile}" "${outfile}"
  317. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6
  318. # 7 parts
  319. create_disk_image "${imgfile}" 128
  320. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M
  321. list_parts part_dvh "${imgfile}" "${outfile}"
  322. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7
  323. # 8 parts
  324. create_disk_image "${imgfile}" 128
  325. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M
  326. list_parts part_dvh "${imgfile}" "${outfile}"
  327. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8
  328. # 9 parts
  329. create_disk_image "${imgfile}" 128
  330. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M
  331. list_parts part_dvh "${imgfile}" "${outfile}"
  332. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10
  333. # 10 parts
  334. create_disk_image "${imgfile}" 128
  335. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M
  336. list_parts part_dvh "${imgfile}" "${outfile}"
  337. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12
  338. # 11 parts
  339. create_disk_image "${imgfile}" 128
  340. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M
  341. list_parts part_dvh "${imgfile}" "${outfile}"
  342. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13
  343. # 12 parts
  344. create_disk_image "${imgfile}" 128
  345. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M
  346. list_parts part_dvh "${imgfile}" "${outfile}"
  347. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14
  348. # 13 parts
  349. create_disk_image "${imgfile}" 135
  350. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M mkpart primary 120M 130M
  351. list_parts part_dvh "${imgfile}" "${outfile}"
  352. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14 $disk,dvh15
  353. # 14 parts
  354. create_disk_image "${imgfile}" 145
  355. ${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M mkpart primary 120M 130M mkpart primary 130M 140M
  356. list_parts part_dvh "${imgfile}" "${outfile}"
  357. check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14 $disk,dvh15 $disk,dvh16
  358. echo "Checking AMIGA partition types..."
  359. # 0 parts
  360. create_disk_image "${imgfile}" 64
  361. ${parted} -a none -s "${imgfile}" mklabel amiga
  362. list_parts part_amiga "${imgfile}" "${outfile}"
  363. check_output "${outfile}" $disk
  364. # 1 parts
  365. create_disk_image "${imgfile}" 64
  366. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M
  367. list_parts part_amiga "${imgfile}" "${outfile}"
  368. check_output "${outfile}" $disk $disk,amiga1
  369. # 2 parts
  370. create_disk_image "${imgfile}" 128
  371. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M
  372. list_parts part_amiga "${imgfile}" "${outfile}"
  373. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2
  374. # 3 parts
  375. create_disk_image "${imgfile}" 128
  376. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M
  377. list_parts part_amiga "${imgfile}" "${outfile}"
  378. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3
  379. # 4 parts
  380. create_disk_image "${imgfile}" 128
  381. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M
  382. list_parts part_amiga "${imgfile}" "${outfile}"
  383. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4
  384. # 5 parts
  385. create_disk_image "${imgfile}" 128
  386. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M
  387. list_parts part_amiga "${imgfile}" "${outfile}"
  388. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5
  389. # 6 parts
  390. create_disk_image "${imgfile}" 128
  391. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M mkpart x 50M 60M
  392. list_parts part_amiga "${imgfile}" "${outfile}"
  393. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5 $disk,amiga6
  394. # 7 parts
  395. create_disk_image "${imgfile}" 128
  396. ${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M mkpart x 50M 60M mkpart x 60M 70M
  397. list_parts part_amiga "${imgfile}" "${outfile}"
  398. check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5 $disk,amiga6 $disk,amiga7
  399. #
  400. # DragonFly BSD disklabel64
  401. #
  402. echo "Checking DragonFly BSD disklabel64..."
  403. create_dfly_image "${imgfile}"
  404. list_parts part_dfly "${imgfile}" "${outfile}"
  405. check_output "${outfile}" $disk $disk,msdos1 $disk,msdos1,dfly1 $disk,msdos1,dfly2 $disk,msdos1,dfly3