diff options
Diffstat (limited to 'meta-extras/packages/dosfstools/files/mkdosfs-bootcode.patch')
-rw-r--r-- | meta-extras/packages/dosfstools/files/mkdosfs-bootcode.patch | 240 |
1 files changed, 0 insertions, 240 deletions
diff --git a/meta-extras/packages/dosfstools/files/mkdosfs-bootcode.patch b/meta-extras/packages/dosfstools/files/mkdosfs-bootcode.patch deleted file mode 100644 index 52be86284b..0000000000 --- a/meta-extras/packages/dosfstools/files/mkdosfs-bootcode.patch +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | diff -urN dosfstools-2.10.orig/mkdosfs/ChangeLog dosfstools-2.10/mkdosfs/ChangeLog | ||
2 | --- dosfstools-2.10.orig/mkdosfs/ChangeLog 1997-06-18 03:09:38.000000000 -0700 | ||
3 | +++ dosfstools-2.10/mkdosfs/ChangeLog 2004-08-02 20:57:57.734939816 -0700 | ||
4 | @@ -1,3 +1,14 @@ | ||
5 | +19th June 2003 Sam Bingner (sam@bingner.com) | ||
6 | + | ||
7 | + Added option to read in bootcode from a file so that if you have | ||
8 | + for example Windows 2000 boot code, you can have it write that | ||
9 | + as the bootcode. This is a dump of the behinning of a partition | ||
10 | + generally 512 bytes, but can be up to reserved sectors*512 bytes. | ||
11 | + Also writes 0x80 as the BIOS drive number if we are formatting a | ||
12 | + hard drive, and sets the number of hidden sectors to be the | ||
13 | + number of sectors in one track. These were required so that DOS | ||
14 | + could boot using the bootcode. | ||
15 | + | ||
16 | 28th January 1995 H. Peter Anvin (hpa@yggdrasil.com) | ||
17 | |||
18 | Better algorithm to select cluster sizes on large filesystems. | ||
19 | diff -urN dosfstools-2.10.orig/mkdosfs/mkdosfs.8 dosfstools-2.10/mkdosfs/mkdosfs.8 | ||
20 | --- dosfstools-2.10.orig/mkdosfs/mkdosfs.8 2003-05-15 11:28:28.000000000 -0700 | ||
21 | +++ dosfstools-2.10/mkdosfs/mkdosfs.8 2004-08-02 20:57:57.735939664 -0700 | ||
22 | @@ -40,6 +40,10 @@ | ||
23 | .I message-file | ||
24 | ] | ||
25 | [ | ||
26 | +.B \-B | ||
27 | +.I bootcode-file | ||
28 | +] | ||
29 | +[ | ||
30 | .B \-n | ||
31 | .I volume-name | ||
32 | ] | ||
33 | @@ -155,6 +159,18 @@ | ||
34 | carriage return-line feed combinations, and tabs have been expanded. | ||
35 | If the filename is a hyphen (-), the text is taken from standard input. | ||
36 | .TP | ||
37 | +.BI \-B " bootcode-file" | ||
38 | +Uses boot machine code from file "file". On any thing other than FAT32, | ||
39 | +this only writes the first 3 bytes, and 480 bytes from offset 3Eh. On | ||
40 | +FAT32, this writes the first 3 bytes, 420 bytes from offset 5Ah to both | ||
41 | +primary and backup boot sectors. Also writes all other reserved sectors | ||
42 | +excluding the sectors following boot sectors (usually sector 2 and 7). | ||
43 | +Does not require that the input file be as large as reserved_sectors*512. | ||
44 | +To make a FAT32 partition bootable, you will need at least the first | ||
45 | +13 sectors (6656 bytes). You can also specify a partition as the argument | ||
46 | +to clone the boot code from that partition. | ||
47 | +i.e mkdosfs -B /dev/sda1 /dev/sda1 | ||
48 | +.TP | ||
49 | .BI \-n " volume-name" | ||
50 | Sets the volume name (label) of the filesystem. The volume name can | ||
51 | be up to 11 characters long. The default is no label. | ||
52 | @@ -188,8 +204,9 @@ | ||
53 | simply will not support it ;) | ||
54 | .SH AUTHOR | ||
55 | Dave Hudson - <dave@humbug.demon.co.uk>; modified by Peter Anvin | ||
56 | -<hpa@yggdrasil.com>. Fixes and additions by Roman Hodek | ||
57 | -<Roman.Hodek@informatik.uni-erlangen.de> for Debian/GNU Linux. | ||
58 | +<hpa@yggdrasil.com> and Sam Bingner <sam@bingner.com>. Fixes and | ||
59 | +additions by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> | ||
60 | +for Debian/GNU Linux. | ||
61 | .SH ACKNOWLEDGEMENTS | ||
62 | .B mkdosfs | ||
63 | is based on code from | ||
64 | diff -urN dosfstools-2.10.orig/mkdosfs/mkdosfs.c dosfstools-2.10/mkdosfs/mkdosfs.c | ||
65 | --- dosfstools-2.10.orig/mkdosfs/mkdosfs.c 2003-06-14 13:07:08.000000000 -0700 | ||
66 | +++ dosfstools-2.10/mkdosfs/mkdosfs.c 2004-08-02 20:57:57.736939512 -0700 | ||
67 | @@ -24,6 +24,12 @@ | ||
68 | - New options -A, -S, -C | ||
69 | - Support for filesystems > 2GB | ||
70 | - FAT32 support | ||
71 | + | ||
72 | + Fixes/additions June 2003 by Sam Bingner | ||
73 | + <sam@bingner.com>: | ||
74 | + - Add -B option to read in bootcode from a file | ||
75 | + - Write BIOS drive number so that FS can properly boot | ||
76 | + - Set number of hidden sectors before boot code to be one track | ||
77 | |||
78 | Copying: Copyright 1993, 1994 David Hudson (dave@humbug.demon.co.uk) | ||
79 | |||
80 | @@ -167,6 +173,8 @@ | ||
81 | #define FAT_BAD 0x0ffffff7 | ||
82 | |||
83 | #define MSDOS_EXT_SIGN 0x29 /* extended boot sector signature */ | ||
84 | +#define HD_DRIVE_NUMBER 0x80 /* Boot off first hard drive */ | ||
85 | +#define FD_DRIVE_NUMBER 0x00 /* Boot off first floppy drive */ | ||
86 | #define MSDOS_FAT12_SIGN "FAT12 " /* FAT12 filesystem signature */ | ||
87 | #define MSDOS_FAT16_SIGN "FAT16 " /* FAT16 filesystem signature */ | ||
88 | #define MSDOS_FAT32_SIGN "FAT32 " /* FAT32 filesystem signature */ | ||
89 | @@ -188,6 +196,8 @@ | ||
90 | #define BOOTCODE_SIZE 448 | ||
91 | #define BOOTCODE_FAT32_SIZE 420 | ||
92 | |||
93 | +#define MAX_RESERVED 0xFFFF | ||
94 | + | ||
95 | /* __attribute__ ((packed)) is used on all structures to make gcc ignore any | ||
96 | * alignments */ | ||
97 | |||
98 | @@ -215,7 +225,7 @@ | ||
99 | __u16 fat_length; /* sectors/FAT */ | ||
100 | __u16 secs_track; /* sectors per track */ | ||
101 | __u16 heads; /* number of heads */ | ||
102 | - __u32 hidden; /* hidden sectors (unused) */ | ||
103 | + __u32 hidden; /* hidden sectors (one track) */ | ||
104 | __u32 total_sect; /* number of sectors (if sectors == 0) */ | ||
105 | union { | ||
106 | struct { | ||
107 | @@ -298,6 +308,8 @@ | ||
108 | |||
109 | /* Global variables - the root of all evil :-) - see these and weep! */ | ||
110 | |||
111 | +static char *template_boot_code; /* Variable to store a full template boot sector in */ | ||
112 | +static int use_template = 0; | ||
113 | static char *program_name = "mkdosfs"; /* Name of the program */ | ||
114 | static char *device_name = NULL; /* Name of the device on which to create the filesystem */ | ||
115 | static int atari_format = 0; /* Use Atari variation of MS-DOS FS format */ | ||
116 | @@ -842,6 +854,12 @@ | ||
117 | vi->volume_id[2] = (unsigned char) ((volume_id & 0x00ff0000) >> 16); | ||
118 | vi->volume_id[3] = (unsigned char) (volume_id >> 24); | ||
119 | } | ||
120 | + if (bs.media == 0xf8) { | ||
121 | + vi->drive_number = HD_DRIVE_NUMBER; /* Set bios drive number to 80h */ | ||
122 | + } | ||
123 | + else { | ||
124 | + vi->drive_number = FD_DRIVE_NUMBER; /* Set bios drive number to 00h */ | ||
125 | + } | ||
126 | |||
127 | if (!atari_format) { | ||
128 | memcpy(vi->volume_label, volume_name, 11); | ||
129 | @@ -886,7 +904,7 @@ | ||
130 | printf( "Using %d reserved sectors\n", reserved_sectors ); | ||
131 | bs.fats = (char) nr_fats; | ||
132 | if (!atari_format || size_fat == 32) | ||
133 | - bs.hidden = CT_LE_L(0); | ||
134 | + bs.hidden = bs.secs_track; | ||
135 | else | ||
136 | /* In Atari format, hidden is a 16 bit field */ | ||
137 | memset( &bs.hidden, 0, 2 ); | ||
138 | @@ -1358,6 +1376,32 @@ | ||
139 | * dir area on FAT12/16, and the first cluster on FAT32. */ | ||
140 | writebuf( (char *) root_dir, size_root_dir, "root directory" ); | ||
141 | |||
142 | + if (use_template == 1) { | ||
143 | + /* dupe template into reserved sectors */ | ||
144 | + seekto( 0, "Start of partition" ); | ||
145 | + if (size_fat == 32) { | ||
146 | + writebuf( template_boot_code, 3, "backup jmpBoot" ); | ||
147 | + seekto( 0x5a, "sector 1 boot area" ); | ||
148 | + writebuf( template_boot_code+0x5a, 420, "sector 1 boot area" ); | ||
149 | + seekto( 512*2, "third sector" ); | ||
150 | + if (backup_boot != 0) { | ||
151 | + writebuf( template_boot_code+512*2, backup_boot*sector_size - 512*2, "data to backup boot" ); | ||
152 | + seekto( backup_boot*sector_size, "backup boot sector" ); | ||
153 | + writebuf( template_boot_code, 3, "backup jmpBoot" ); | ||
154 | + seekto( backup_boot*sector_size+0x5a, "backup boot sector boot area" ); | ||
155 | + writebuf( template_boot_code+0x5a, 420, "backup boot sector boot area" ); | ||
156 | + seekto( (backup_boot+2)*sector_size, "sector following backup code" ); | ||
157 | + writebuf( template_boot_code+(backup_boot+2)*sector_size, (reserved_sectors-backup_boot-2)*512, "remaining data" ); | ||
158 | + } else { | ||
159 | + writebuf( template_boot_code+512*2, (reserved_sectors-2)*512, "remaining data" ); | ||
160 | + } | ||
161 | + } else { | ||
162 | + writebuf( template_boot_code, 3, "jmpBoot" ); | ||
163 | + seekto( 0x3e, "sector 1 boot area" ); | ||
164 | + writebuf( template_boot_code+0x3e, 448, "boot code" ); | ||
165 | + } | ||
166 | + } | ||
167 | + | ||
168 | if (info_sector) free( info_sector ); | ||
169 | free (root_dir); /* Free up the root directory space from setup_tables */ | ||
170 | free (fat); /* Free up the fat table space reserved during setup_tables */ | ||
171 | @@ -1371,7 +1415,7 @@ | ||
172 | { | ||
173 | fatal_error("\ | ||
174 | Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file] [-b backup-boot-sector]\n\ | ||
175 | - [-m boot-msg-file] [-n volume-name] [-i volume-id]\n\ | ||
176 | + [-m boot-msg-file] [-n volume-name] [-i volume-id] [-B bootcode]\n\ | ||
177 | [-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]\n\ | ||
178 | [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]\n\ | ||
179 | /dev/name [blocks]\n"); | ||
180 | @@ -1433,7 +1477,7 @@ | ||
181 | printf ("%s " VERSION " (" VERSION_DATE ")\n", | ||
182 | program_name); | ||
183 | |||
184 | - while ((c = getopt (argc, argv, "AcCf:F:Ii:l:m:n:r:R:s:S:v")) != EOF) | ||
185 | + while ((c = getopt (argc, argv, "AcCf:F:Ii:l:m:n:r:R:s:S:v:B:b")) != EOF) | ||
186 | /* Scan the command line for options */ | ||
187 | switch (c) | ||
188 | { | ||
189 | @@ -1494,6 +1538,51 @@ | ||
190 | listfile = optarg; | ||
191 | break; | ||
192 | |||
193 | + case 'B': /* B : read in bootcode */ | ||
194 | + if ( strcmp(optarg, "-") ) | ||
195 | + { | ||
196 | + msgfile = fopen(optarg, "r"); | ||
197 | + if ( !msgfile ) | ||
198 | + perror(optarg); | ||
199 | + } | ||
200 | + else | ||
201 | + msgfile = stdin; | ||
202 | + | ||
203 | + if ( msgfile ) | ||
204 | + { | ||
205 | + if (!(template_boot_code = malloc( MAX_RESERVED ))) | ||
206 | + die( "Out of memory" ); | ||
207 | + /* The template boot sector including reserved must not be > 65535 */ | ||
208 | + use_template = 1; | ||
209 | + i = 0; | ||
210 | + do | ||
211 | + { | ||
212 | + ch = getc(msgfile); | ||
213 | + switch (ch) | ||
214 | + { | ||
215 | + case EOF: | ||
216 | + break; | ||
217 | + | ||
218 | + default: | ||
219 | + template_boot_code[i++] = ch; /* Store character */ | ||
220 | + break; | ||
221 | + } | ||
222 | + } | ||
223 | + while ( ch != EOF && i < MAX_RESERVED ); | ||
224 | + ch = getc(msgfile); /* find out if we're at EOF */ | ||
225 | + | ||
226 | + /* Fill up with zeros */ | ||
227 | + while( i < MAX_RESERVED ) | ||
228 | + template_boot_code[i++] = '\0'; | ||
229 | + | ||
230 | + if ( ch != EOF ) | ||
231 | + printf ("Warning: template too long; truncated after %d bytes\n", i); | ||
232 | + | ||
233 | + if ( msgfile != stdin ) | ||
234 | + fclose(msgfile); | ||
235 | + } | ||
236 | + break; | ||
237 | + | ||
238 | case 'm': /* m : Set boot message */ | ||
239 | if ( strcmp(optarg, "-") ) | ||
240 | { | ||