Lines 288-293
char dummy_boot_code[BOOTCODE_SIZE] =
Link Here
|
288 |
static char *program_name = "mkdosfs"; /* Name of the program */ |
288 |
static char *program_name = "mkdosfs"; /* Name of the program */ |
289 |
static char *device_name = NULL; /* Name of the device on which to create the filesystem */ |
289 |
static char *device_name = NULL; /* Name of the device on which to create the filesystem */ |
290 |
static int atari_format = 0; /* Use Atari variation of MS-DOS FS format */ |
290 |
static int atari_format = 0; /* Use Atari variation of MS-DOS FS format */ |
|
|
291 |
static const char *bootcode_srcimage = NULL; /* Source file/device from which read bootloader code */ |
291 |
static int check = FALSE; /* Default to no readablity checking */ |
292 |
static int check = FALSE; /* Default to no readablity checking */ |
292 |
static int verbose = 0; /* Default to verbose mode off */ |
293 |
static int verbose = 0; /* Default to verbose mode off */ |
293 |
static long volume_id; /* Volume ID number */ |
294 |
static long volume_id; /* Volume ID number */ |
Lines 793-798
establish_params (int device_num,int siz
Link Here
|
793 |
} |
794 |
} |
794 |
|
795 |
|
795 |
|
796 |
|
|
|
797 |
static void |
798 |
apply_external_bootcode(void) |
799 |
{ |
800 |
if ( !bootcode_srcimage ) |
801 |
return; |
802 |
char *bootcodeptr = ( size_fat == 32 ) ? |
803 |
( (char*) &bs.fat32.boot_code ) : ( (char*) &bs.oldfat.boot_code ); |
804 |
int offset = ( int )( bootcodeptr - (char*)&bs ); |
805 |
int nbytes = ( size_fat == 32 ) ? BOOTCODE_FAT32_SIZE : BOOTCODE_SIZE; |
806 |
int srcfile = open( bootcode_srcimage, O_RDONLY ); |
807 |
if ( srcfile < 0 ) |
808 |
die("Cannot open device/file for reading source bootloader code"); |
809 |
if ( lseek( srcfile, offset, SEEK_SET ) < 0) |
810 |
die("Cannot seek to begin of source bootloader code"); |
811 |
if ( read( srcfile, bootcodeptr, nbytes ) != nbytes ) |
812 |
die("Cannot read source bootloader code"); |
813 |
} |
814 |
|
796 |
/* Create the filesystem data tables */ |
815 |
/* Create the filesystem data tables */ |
797 |
|
816 |
|
798 |
static void |
817 |
static void |
Lines 851-856
setup_tables (void)
Link Here
|
851 |
(char *)&bs.oldfat.boot_code) - |
870 |
(char *)&bs.oldfat.boot_code) - |
852 |
(char *)&bs) - 2; |
871 |
(char *)&bs) - 2; |
853 |
|
872 |
|
|
|
873 |
if (bootcode_srcimage) { |
874 |
apply_external_bootcode(); |
875 |
} else |
854 |
if (size_fat == 32) { |
876 |
if (size_fat == 32) { |
855 |
int offset = (char *)&bs.fat32.boot_code - |
877 |
int offset = (char *)&bs.fat32.boot_code - |
856 |
(char *)&bs + MESSAGE_OFFSET + 0x7c00; |
878 |
(char *)&bs + MESSAGE_OFFSET + 0x7c00; |
Lines 1379-1385
usage (void)
Link Here
|
1379 |
{ |
1401 |
{ |
1380 |
fatal_error("\ |
1402 |
fatal_error("\ |
1381 |
Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file] [-b backup-boot-sector]\n\ |
1403 |
Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file] [-b backup-boot-sector]\n\ |
1382 |
[-m boot-msg-file] [-n volume-name] [-i volume-id]\n\ |
1404 |
[-m boot-msg-file] [-n volume-name] [-i volume-id] [-B bootcode-image ]\n\ |
1383 |
[-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]\n\ |
1405 |
[-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]\n\ |
1384 |
[-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]\n\ |
1406 |
[-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]\n\ |
1385 |
/dev/name [blocks]\n"); |
1407 |
/dev/name [blocks]\n"); |
Lines 1442-1448
main (int argc, char **argv)
Link Here
|
1442 |
printf ("%s " VERSION " (" VERSION_DATE ")\n", |
1464 |
printf ("%s " VERSION " (" VERSION_DATE ")\n", |
1443 |
program_name); |
1465 |
program_name); |
1444 |
|
1466 |
|
1445 |
while ((c = getopt (argc, argv, "AbcCf:F:Ii:l:m:n:r:R:s:S:h:v")) != EOF) |
1467 |
while ((c = getopt (argc, argv, "AB:bcCf:F:Ii:l:m:n:r:R:s:S:h:v")) != EOF) |
1446 |
/* Scan the command line for options */ |
1468 |
/* Scan the command line for options */ |
1447 |
switch (c) |
1469 |
switch (c) |
1448 |
{ |
1470 |
{ |
Lines 1450-1455
main (int argc, char **argv)
Link Here
|
1450 |
atari_format = !atari_format; |
1472 |
atari_format = !atari_format; |
1451 |
break; |
1473 |
break; |
1452 |
|
1474 |
|
|
|
1475 |
case 'B': |
1476 |
bootcode_srcimage = optarg; |
1477 |
break; |
1478 |
|
1453 |
case 'b': /* b : location of backup boot sector */ |
1479 |
case 'b': /* b : location of backup boot sector */ |
1454 |
backup_boot = (int) strtol (optarg, &tmp, 0); |
1480 |
backup_boot = (int) strtol (optarg, &tmp, 0); |
1455 |
if (*tmp || backup_boot < 2 || backup_boot > 0xffff) |
1481 |
if (*tmp || backup_boot < 2 || backup_boot > 0xffff) |