Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2003 02:05:39 +0600
From:      Alex Mysik <mysik@r66.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/52249: [PATCH] Bootmanager shows NTFS partitions as "Unknown"
Message-ID:  <200305150109.18613.mysik@r66.ru>
Resent-Message-ID: <200305142010.h4EKACsc062722@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         52249
>Category:       i386
>Synopsis:       [PATCH] Bootmanager shows NTFS partitions as "Unknown"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 14 13:10:12 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Alex Mysik <mysik@r66.ru>
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD mysik.imp.uran.ru 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Thu Feb 
27 20:44:39 YEKT 2003 root@mysik.imp.uran.ru:/usr/src/sys/i386/compile/MYSIK 
i386
Dual boot x86 mashine with FreeBSD and Windows NT.

>Description:
At present FreeBSD bootmanager boot0 does not know NTFS partition (type of 
0x7).

>How-To-Repeat:

>Fix:
I added the support of NTFS partitions to boot0 in the case of the dual boot 
FreeBSD and Windows NT. However, because of a lack in MBR space it was 
necessary to remove a few bytes insignificant code, which makes a beep for any 
incorrect keystroke. I consider that the support of NTFS is more preferably 
today. The bootmanager shows NTFS partitions as "WinNT" now.

/usr/src/sys/boot/i386/boot0/boot0.s Revision 1.25

--- boot0.s.diff begins here ---
--- boot0.s	Tue Dec 19 05:17:36 2000
+++ boot0.s.new	Thu May 15 01:47:44 2003
@@ -25,7 +25,7 @@
 		.set PRT_OFF,0x1be		# Partition table
 
 		.set TBL0SZ,0x3 		# Table 0 size
-		.set TBL1SZ,0xc 		# Table 1 size
+		.set TBL1SZ,0xd 		# Table 1 size
 
 		.set MAGIC,0xaa55		# Magic: bootable
 		.set B0MAGIC,0xbb66		# Identification
@@ -192,7 +192,7 @@
 #
 main.8: 	movb $0x1,%ah			# BIOS: Check
 		int $0x16			#  for keypress
-		jnz main.11			# Have one
+		jnz main.10			# Have one
 		xorb %ah,%ah			# BIOS: Get
 		int $0x1a			#  system time
 		cmpw %di,%dx			# Timeout?
@@ -201,25 +201,18 @@
 # If timed out or defaulting, come here.
 #
 main.9: 	movb _OPT(%bp),%al		# Load default
-		jmp main.12			# Join common code
-#
-# User's last try was bad, beep in displeasure.
-# Since nothing was printed, just continue on as if the user
-# hadn't done anything. This gives the effect of the user getting a beep 
-# for all bad keystrokes but no action until either the timeout
-# occurs or the user hits a good key.
-#
-main.10:	movb $0x7,%al			# Signal
-		callw putchr			#  error
+		jmp main.11			# Join common code
+
 #
 # Get the keystroke.
 #
-main.11:	xorb %ah,%ah			# BIOS: Get
+main.10:	xorb %ah,%ah			# BIOS: Get
 		int $0x16			#  keypress
 		movb %ah,%al			# Scan code
 #
 # If it's CR act as if timed out.
 #
+
 		cmpb $KEY_ENTER,%al		# Enter pressed?
 		je main.9			# Yes
 #
@@ -229,13 +222,14 @@
 		subb $KEY_F1,%al		# Less F1 scan code
 		cmpb $0x4,%al			# F1..F5?
 		ja main.10			# No
+
 #
 # We have a selection.
 # but if it's a bad selection go back to complain.
 # The bits in MNUOPT were set when the options were printed.
 # Anything not printed is not an option.
 #
-main.12:	cbtw				# Option
+main.11:	cbtw				# Option
 		btw %ax,_MNUOPT(%bp)	 	#  enabled?
 		jnc main.10			# No
 #
@@ -248,7 +242,7 @@
 		movw %si,%bx			# Partition for read
 		cmpb $0x4,%al			# F5 pressed?
 		pushf				# Save
-		je main.13			# Yes
+		je main.12			# Yes
 		shlb $0x4,%al			# Point to
 		addw $partbl,%ax		#  selected
 		xchgw %bx,%ax	 		#  partition
@@ -256,19 +250,19 @@
 #
 # If not asked to do a write-back (flags 0x40) don't do one.
 #
-main.13:	pushw %bx			# Save
+main.12:	pushw %bx			# Save
 		testb $0x40,_FLAGS(%bp)		# No updates?
-		jnz main.14			# Yes
+		jnz main.13			# Yes
 		movw $start,%bx			# Data to write
 		movb $0x3,%ah			# Write sector
 		callw intx13			#  to disk
-main.14:	popw %si			# Restore
+main.13:	popw %si			# Restore
 		popf				# Restore
 #
 # If going to next drive, replace drive with selected one.
 # Remember to un-ascii it. Hey 0x80 is already set, cool!
 #
-		jne main.15			# If not F5
+		jne main.14			# If not F5
 		movb _NXTDRV(%bp),%dl		# Next drive
 		subb $'0',%dl			#  number
 # 
@@ -277,7 +271,7 @@
 # as a bad selection.
 # XXX what does %si carry?
 #
-main.15:	movw $LOAD,%bx			# Address for read
+main.14:	movw $LOAD,%bx			# Address for read
 		movb $0x2,%ah			# Read sector
 		callw intx13			#  from disk
 		jc main.10			# If error
@@ -364,7 +358,7 @@
 #
 # These values indicate bootable types we know the names of
 #
-		.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x63, 0x83
+		.byte 0x1, 0x4, 0x6, 0x7, 0xb, 0xc, 0xe, 0x63, 0x83
 		.byte 0x9f, 0xa5, 0xa6, 0xa9
 #
 # These are offsets that match the known names above and point to the strings
@@ -374,6 +368,7 @@
 		.byte os_dos-.			# DOS
 		.byte os_dos-.			# DOS
 		.byte os_dos-.			# DOS
+		.byte os_winnt-.		# Windows NT
 		.byte os_dos-.			# Windows
 		.byte os_dos-.			# Windows
 		.byte os_dos-.			# Windows
@@ -389,6 +384,7 @@
 #
 os_misc:	.ascii "?";    .byte '?'|0x80
 os_dos: 	.ascii "DO";   .byte 'S'|0x80
+os_winnt: 	.ascii "WinN"; .byte 'T'|0x80
 os_unix:	.ascii "UNI";  .byte 'X'|0x80
 os_linux:	.ascii "Linu"; .byte 'x'|0x80
 os_freebsd:	.ascii "Free"
--- boot0.s.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305150109.18613.mysik>