partmap_test.in 20 KB

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