info-mtools
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mtools] mformat boot sector bug with mtools 3.9.10


From: Phillip Susi
Subject: [mtools] mformat boot sector bug with mtools 3.9.10
Date: Sun, 03 Apr 2005 18:28:18 -0400
User-agent: Mozilla Thunderbird 1.0+ (Windows/20050309)

I downloaded the source code for mtools 3.9.10 from http://mtools.linux.lu/mtools-3.9.10.tar.bz2, unpacked it and compiled it with a cygwin environment. I configured it and have been using it to try and set up a hard disk image to boot ReactOS in the qemu emulator, and I believe I have found a bug with the way mformat creates a boot sector using one you supply as a template.
I used the following command to format the partition:

mformat -t 58 -h 64 -s 32 -B fat.bin c:

I found that when I tried to boot the image the MBR reported there was no operating system installed because mformat seems to have hosed up the boot sector. minfo shows this:

Boot sector hexdump:
000  eb 3c 90 46 72 4c 64 72 31 2e 30 00 02 02 01 00 .<.FrLdr1.0.....
010  02 00 02 00 00 f8 e7 00 20 00 40 00 20 00 00 00 ........ address@hidden ...
020  e0 cf 01 00 00 00 29 5d 62 bb 7b 4e 4f 20 4e 41 ......)]b.{NO NA
030  4d 45 20 20 20 20 46 41 54 31 36 20 20 20 31 c0 ME    FAT16   1.
040  8e d0 bd 00 7c bc f2 7b 8e d8 8e c0 80 7e 24 ff ....|..{.....~$.
050  75 03 88 56 24 b4 08 8a 56 24 cd 13 73 05 b9 ff u..V$...V$..s...
060  ff 88 ce 88 eb 88 cf c0 ef 06 80 e1 3f 66 0f b6 ............?f..
070  c6 66 0f b7 db 66 0f b6 c9 66 40 66 43 66 f7 e1 address@hidden
080  66 f7 e3 66 89 46 f8 31 c0 31 c9 8a 46 10 f7 66 f..f.F.1.1..F..f
090  16 03 46 1c 13 56 1e 03 46 0e 11 ca 89 46 fc 89 ..F..V..F....F..
0a0  56 fe 8b 76 11 60 31 d2 b8 20 00 f7 e6 8b 5e 0b V..v.`1.. ....^.
0b0  01 d8 48 f7 f3 01 46 fc 11 4e fe 61 bb e0 07 8e ..H...F..N.a....
0c0  c3 31 db 31 c9 41 31 ff 06 b8 15 00 a2 cf 7d 80 .1.1.A1.......}.
0d0  06 cf 7d 30 88 26 d0 7d 80 06 d0 7d 30 be cf 7d ..}0.&.}...}0..}
0e0  e8 53 00 e8 73 00 07 26 38 2d 74 38 60 b1 0b be .S..s..&8-t8`...
0f0  e7 7d f3 a6 61 74 0e 4e 74 2a 83 c7 20 81 ff 00 .}..at.Nt*.. ...
100  02 72 e4 eb b7 26 8b 45 1a 50 68 00 08 07 e8 37 .r...&.E.Ph....7
110  00 58 c7 46 f6 59 7d c7 46 f4 48 7d c7 46 f2 36 .X.F.Y}.F.H}.F.6
120  7d e9 df 02 be cf 7d e8 0c 00 be cf 7d e8 06 00 }.....}.....}...
130  31 c0 cd 16 cd 19 ac 08 c0 74 09 b4 0e bb 07 00 1........t......
140  cd 10 eb f2 eb fe eb e2 48 48 30 ed 8a 4e 0d f7 ........HH0..N..
150  e1 03 46 fc 13 56 fe 31 db 60 49 01 c8 83 d2 00 ..F..V.1.`I.....
160  3b 56 fa 77 07 72 31 3b 46 f8 76 2c 61 60 66 6a ;V.w.r1;F.v,a`fj
170  00 52 50 06 53 6a 01 6a 10 89 e6 8a 56 24 b4 42 .RP.Sj.j....V$.B
180  cd 13 72 c2 83 c4 10 61 40 83 d2 00 53 8c c3 83 address@hidden
190  c3 20 8e c3 5b e2 d6 c3 61 60 91 92 31 d2 f7 76 . ..[...a`..1..v
1a0  18 91 f7 76 18 42 87 ca f7 76 1a 88 d6 8a 56 24 ...v.B...v....V$
1b0  88 c5 c0 cc 02 08 e1 b8 01 02 cd 13 72 88 61 40 ............r.a@
1c0  75 01 42 53 8c c3 83 c3 20 8e c3 5b e2 cb c3 66 u.BS.... ..[...f
1d0  72 65 65 6c 64 72 2e 73 79 73 20 6e 6f 74 20 66 reeldr.sys not f
1e0  6f 75 6e 64 0a 00 46 52 45 45 4c 44 52 20 53 59 ound..FREELDR SY
1f0  53 ff ff ff ff ff ff ff ff ff ff ff 00 55 aa aa S............U..

As you can see the signature bytes at the end are wrong. It should end in 55 aa, but instead ends in 55 aa aa. This is not consistent with the fat.bin I asked mformat to use as a template, which has the following hex dump:

000000 eb 3c 90 46 72 4c 64 72 31 2e 30 00 02 01 01 00
000010 02 e0 00 40 0b f0 09 00 12 00 02 00 00 00 00 00
000020 00 00 00 00 00 00 29 00 00 00 00 4e 4f 20 4e 41
000030 4d 45 20 20 20 20 46 41 54 31 32 20 20 20 31 c0
000040 8e d0 bd 00 7c bc f2 7b 8e d8 8e c0 80 7e 24 ff
000050 75 03 88 56 24 b4 08 8a 56 24 cd 13 73 05 b9 ff
000060 ff 88 ce 88 eb 88 cf c0 ef 06 80 e1 3f 66 0f b6
000070 c6 66 0f b7 db 66 0f b6 c9 66 40 66 43 66 f7 e1
000080 66 f7 e3 66 89 46 f8 31 c0 31 c9 8a 46 10 f7 66
000090 16 03 46 1c 13 56 1e 03 46 0e 11 ca 89 46 fc 89
0000a0 56 fe 8b 76 11 60 31 d2 b8 20 00 f7 e6 8b 5e 0b
0000b0 01 d8 48 f7 f3 01 46 fc 11 4e fe 61 bb e0 07 8e
0000c0 c3 31 db 31 c9 41 31 ff 06 b8 15 00 a2 cf 7d 80
0000d0 06 cf 7d 30 88 26 d0 7d 80 06 d0 7d 30 be cf 7d
0000e0 e8 53 00 e8 73 00 07 26 38 2d 74 38 60 b1 0b be
0000f0 e7 7d f3 a6 61 74 0e 4e 74 2a 83 c7 20 81 ff 00
000100 02 72 e4 eb b7 26 8b 45 1a 50 68 00 08 07 e8 37
000110 00 58 c7 46 f6 59 7d c7 46 f4 48 7d c7 46 f2 36
000120 7d e9 df 02 be cf 7d e8 0c 00 be cf 7d e8 06 00
000130 31 c0 cd 16 cd 19 ac 08 c0 74 09 b4 0e bb 07 00
000140 cd 10 eb f2 eb fe eb e2 48 48 30 ed 8a 4e 0d f7
000150 e1 03 46 fc 13 56 fe 31 db 60 49 01 c8 83 d2 00
000160 3b 56 fa 77 07 72 31 3b 46 f8 76 2c 61 60 66 6a
000170 00 52 50 06 53 6a 01 6a 10 89 e6 8a 56 24 b4 42
000180 cd 13 72 c2 83 c4 10 61 40 83 d2 00 53 8c c3 83
000190 c3 20 8e c3 5b e2 d6 c3 61 60 91 92 31 d2 f7 76
0001a0 18 91 f7 76 18 42 87 ca f7 76 1a 88 d6 8a 56 24
0001b0 88 c5 c0 cc 02 08 e1 b8 01 02 cd 13 72 88 61 40
0001c0 75 01 42 53 8c c3 83 c3 20 8e c3 5b e2 cb c3 66
0001d0 72 65 65 6c 64 72 2e 73 79 73 20 6e 6f 74 20 66
0001e0 6f 75 6e 64 0d 0a 00 46 52 45 45 4c 44 52 20 53
0001f0 59 53 ff ff ff ff ff ff ff ff ff ff ff 00 55 aa


As you can see the fat.bin I gave mformat ends correctly in 55 aa, but when mformat uses it as a template to create the boot sector used for the virtual partition, it clobbers it somehow. If I omit the -B fat.bin flags to mformat, it correctly creates the boot sector with the right signature from its own internal boot code template. Also I did not see this bug until I started modifying the boot sector template to try and debug some problems it was having, so mformat appears to be able to correctly install boot sectors you supply, but there is something about this specific one it does not like.


I thought I would report this in the hopes that someone working on the mtools source might fix the bug, or show me what I'm doing wrong. If you need help duplicating the problem, just ask.

_______________________________________________
mtools mailing list
address@hidden
http://www.tux.org/mailman/listinfo/mtools


reply via email to

[Prev in Thread] Current Thread [Next in Thread]