• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *		NTFS bootsector, adapted from the vfat one.
3  */
4 
5 /* mkfs.fat.c - utility to create FAT/MS-DOS filesystems
6  * Copyright (C) 1991 Linus Torvalds <torvalds@klaava.helsinki.fi>
7  * Copyright (C) 1992-1993 Remy Card <card@masi.ibp.fr>
8  * Copyright (C) 1993-1994 David Hudson <dave@humbug.demon.co.uk>
9  * Copyright (C) 1998 H. Peter Anvin <hpa@zytor.com>
10  * Copyright (C) 1998-2005 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
11  * Copyright (C) 2008-2014 Daniel Baumann <mail@daniel-baumann.ch>
12  * Copyright (C) 2015 Andreas Bombe <aeb@debian.org>
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  * The complete text of the GNU General Public License
26  * can be found in /usr/share/common-licenses/GPL-3 file.
27  */
28 
29 #include "boot.h"
30 
31 #define BOOTCODE_SIZE 4136
32 
33 /* The "boot code" we put into the filesystem... it writes a message and
34  * tells the user to try again */
35 
36 #define MSG_OFFSET_OFFSET 3
37 
38 const unsigned char boot_array[BOOTCODE_SIZE] =
39 
40 	"\xeb\x52\x90"   /* jump to code at 0x54 (0x7c54) */
41 	"NTFS    \0"     /* NTFS signature */
42 
43 	"\0\0\0\0\0\0\0\0\0\0\0\0"     /* 72 bytes for device parameters */
44 	"\0\0\0\0\0\0\0\0\0\0\0\0"
45 	"\0\0\0\0\0\0\0\0\0\0\0\0"
46 	"\0\0\0\0\0\0\0\0\0\0\0\0"
47 	"\0\0\0\0\0\0\0\0\0\0\0\0"
48 	"\0\0\0\0\0\0\0\0\0\0\0\0"
49 	                               /* Boot code run at location 0x7c54 */
50 	"\x0e"		/* push cs */
51 	"\x1f"		/* pop ds */
52 	"\xbe\x71\x7c"	/* mov si, offset message_txt (at location 0x7c71) */
53 							/* write_msg: */
54 	"\xac"		/* lodsb */
55 	"\x22\xc0"	/* and al, al */
56 	"\x74\x0b"	/* jz key_press */
57 	"\x56"		/* push si */
58 	"\xb4\x0e"	/* mov ah, 0eh */
59 	"\xbb\x07\x00"	/* mov bx, 0007h */
60 	"\xcd\x10"	/* int 10h */
61 	"\x5e"		/* pop si */
62 	"\xeb\xf0"	/* jmp write_msg */
63 							/* key_press: */
64 	"\x32\xe4"	/* xor ah, ah */
65 	"\xcd\x16"	/* int 16h */
66 	"\xcd\x19"	/* int 19h */
67 	"\xeb\xfe"	/* foo: jmp foo */
68 	/* message_txt: */
69 	"This is not a bootable disk. Please insert a bootable floppy and\r\n"
70 	"press any key to try again ... \r\n"
71 				/* At location 0xd4, 298 bytes to reach 0x1fe */
72 				/* 298 = 4 blocks of 72 then 10 */
73 	"\0\0\0\0\0\0\0\0\0\0\0\0"
74 	"\0\0\0\0\0\0\0\0\0\0\0\0"
75 	"\0\0\0\0\0\0\0\0\0\0\0\0"
76 	"\0\0\0\0\0\0\0\0\0\0\0\0"
77 	"\0\0\0\0\0\0\0\0\0\0\0\0"
78 	"\0\0\0\0\0\0\0\0\0\0\0\0"
79 
80 	"\0\0\0\0\0\0\0\0\0\0\0\0"
81 	"\0\0\0\0\0\0\0\0\0\0\0\0"
82 	"\0\0\0\0\0\0\0\0\0\0\0\0"
83 	"\0\0\0\0\0\0\0\0\0\0\0\0"
84 	"\0\0\0\0\0\0\0\0\0\0\0\0"
85 	"\0\0\0\0\0\0\0\0\0\0\0\0"
86 
87 	"\0\0\0\0\0\0\0\0\0\0\0\0"
88 	"\0\0\0\0\0\0\0\0\0\0\0\0"
89 	"\0\0\0\0\0\0\0\0\0\0\0\0"
90 	"\0\0\0\0\0\0\0\0\0\0\0\0"
91 	"\0\0\0\0\0\0\0\0\0\0\0\0"
92 	"\0\0\0\0\0\0\0\0\0\0\0\0"
93 
94 	"\0\0\0\0\0\0\0\0\0\0\0\0"
95 	"\0\0\0\0\0\0\0\0\0\0\0\0"
96 	"\0\0\0\0\0\0\0\0\0\0\0\0"
97 	"\0\0\0\0\0\0\0\0\0\0\0\0"
98 	"\0\0\0\0\0\0\0\0\0\0\0\0"
99 	"\0\0\0\0\0\0\0\0\0\0\0\0"
100 
101 	"\0\0\0\0\0\0\0\0\0\0"
102 					/* Boot signature at 0x1fe */
103 	"\x55\xaa";
104