From mysik@r66.ru  Wed May 14 13:05:48 2003
Return-Path: <mysik@r66.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AFCCB37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 14 May 2003 13:05:47 -0700 (PDT)
Received: from relay.mplik.ru (relay.mplik.ru [212.23.64.165])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A9D9D43FB1
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 14 May 2003 13:05:45 -0700 (PDT)
	(envelope-from mysik@r66.ru)
Received: by relay.mplik.ru (Postfix, from userid 100)
	id 30E6940A1F; Thu, 15 May 2003 02:05:43 +0600 (YEKST)
Received: from 84-ats73-as2.dialup.mplik.ru (84-ats73-as2.dialup.mplik.ru [213.140.126.84])
	by relay.mplik.ru (Postfix) with ESMTP id 4149240AA8
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 May 2003 02:05:41 +0600 (YEKST)
Message-Id: <200305150109.18613.mysik@r66.ru>
Date: Thu, 15 May 2003 02:05:39 +0600
From: Alex Mysik <mysik@r66.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] Bootmanager shows NTFS partitions as "Unknown"

>Number:         52249
>Category:       i386
>Synopsis:       [PATCH] Bootmanager shows NTFS partitions as "Unknown"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 14 13:10:12 PDT 2003
>Closed-Date:    Wed Jun 08 17:45:03 GMT 2005
>Last-Modified:  Wed Jun 08 17:45:03 GMT 2005
>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:

From: Matteo Riondato <rionda@gufi.org>
To: bug-followup@FreeBSD.org, mysik@r66.ru
Cc:  
Subject: Re: i386/52249: [PATCH] Bootmanager shows NTFS partitions as "Unknown"
Date: Wed, 8 Jun 2005 13:06:34 +0200

 A different fix for this was committed on Tue Feb 8 20:43:04 2005 UTC
 (3 months, 4 weeks ago) by des in revision  1.14 of
 sys/boot/i386/boot0/boot0.S and was MFCed in April.
 
 This PR can be closed.
 Best Regards
 -- 
 Rionda aka Matteo Riondato
 G.U.F.I. Staff Member (http://www.gufi.org)
 FreeSBIE Developer (http://www.freesbie.org)
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Wed Jun 8 17:44:41 GMT 2005 
State-Changed-Why:  
A different fix has been committed (see Audit Trail). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52249 
>Unformatted:
