ALT Linux Bugzilla
– Attachment 792 Details for
Bug 6389
mkdosfs: reading bootloader code from another disk image or device
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Копирование кода для загрузочного сектора из другого образа или с диска
dosfstools-2.11-alt-extbootcode.patch (text/plain), 3.90 KB, created by
evseev
on 2005-04-03 09:00:11 MSD
(
hide
)
Description:
Копирование кода для загрузочного сектора из другого образа или с диска
Filename:
MIME Type:
Creator:
evseev
Created:
2005-04-03 09:00:11 MSD
Size:
3.90 KB
patch
obsolete
>--- mkdosfs/mkdosfs.c.bootcode 2005-04-03 08:34:47 +0400 >+++ mkdosfs/mkdosfs.c 2005-04-03 08:35:12 +0400 >@@ -288,6 +288,7 @@ char dummy_boot_code[BOOTCODE_SIZE] = > static char *program_name = "mkdosfs"; /* Name of the program */ > static char *device_name = NULL; /* Name of the device on which to create the filesystem */ > static int atari_format = 0; /* Use Atari variation of MS-DOS FS format */ >+static const char *bootcode_srcimage = NULL; /* Source file/device from which read bootloader code */ > static int check = FALSE; /* Default to no readablity checking */ > static int verbose = 0; /* Default to verbose mode off */ > static long volume_id; /* Volume ID number */ >@@ -793,6 +794,24 @@ establish_params (int device_num,int siz > } > > >+static void >+apply_external_bootcode(void) >+{ >+ if ( !bootcode_srcimage ) >+ return; >+ char *bootcodeptr = ( size_fat == 32 ) ? >+ ( (char*) &bs.fat32.boot_code ) : ( (char*) &bs.oldfat.boot_code ); >+ int offset = ( int )( bootcodeptr - (char*)&bs ); >+ int nbytes = ( size_fat == 32 ) ? BOOTCODE_FAT32_SIZE : BOOTCODE_SIZE; >+ int srcfile = open( bootcode_srcimage, O_RDONLY ); >+ if ( srcfile < 0 ) >+ die("Cannot open device/file for reading source bootloader code"); >+ if ( lseek( srcfile, offset, SEEK_SET ) < 0) >+ die("Cannot seek to begin of source bootloader code"); >+ if ( read( srcfile, bootcodeptr, nbytes ) != nbytes ) >+ die("Cannot read source bootloader code"); >+} >+ > /* Create the filesystem data tables */ > > static void >@@ -851,6 +870,9 @@ setup_tables (void) > (char *)&bs.oldfat.boot_code) - > (char *)&bs) - 2; > >+ if (bootcode_srcimage) { >+ apply_external_bootcode(); >+ } else > if (size_fat == 32) { > int offset = (char *)&bs.fat32.boot_code - > (char *)&bs + MESSAGE_OFFSET + 0x7c00; >@@ -1379,7 +1401,7 @@ usage (void) > { > fatal_error("\ > Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file] [-b backup-boot-sector]\n\ >- [-m boot-msg-file] [-n volume-name] [-i volume-id]\n\ >+ [-m boot-msg-file] [-n volume-name] [-i volume-id] [-B bootcode-image ]\n\ > [-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]\n\ > [-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]\n\ > /dev/name [blocks]\n"); >@@ -1442,7 +1464,7 @@ main (int argc, char **argv) > printf ("%s " VERSION " (" VERSION_DATE ")\n", > program_name); > >- while ((c = getopt (argc, argv, "AbcCf:F:Ii:l:m:n:r:R:s:S:h:v")) != EOF) >+ while ((c = getopt (argc, argv, "AB:bcCf:F:Ii:l:m:n:r:R:s:S:h:v")) != EOF) > /* Scan the command line for options */ > switch (c) > { >@@ -1450,6 +1472,10 @@ main (int argc, char **argv) > atari_format = !atari_format; > break; > >+ case 'B': >+ bootcode_srcimage = optarg; >+ break; >+ > case 'b': /* b : location of backup boot sector */ > backup_boot = (int) strtol (optarg, &tmp, 0); > if (*tmp || backup_boot < 2 || backup_boot > 0xffff) >--- mkdosfs/mkdosfs.8.bootcode 2004-02-25 22:36:07 +0300 >+++ mkdosfs/mkdosfs.8 2005-04-03 08:34:48 +0400 >@@ -9,6 +9,10 @@ > .B \-A > ] > [ >+.B \-B >+.I source-bootcode-container >+] >+[ > .B \-b > .I sector-of-backup > ] >@@ -97,6 +101,15 @@ > option. Some PC-specific boot sector fields aren't written, and a boot > message (option \fB\-m\fP) is ignored. > .TP >+.BI \-B " source-bootcode-container " >+By default \fBmkdosfs\fP writes bootsector containing dummy code >+that does nothing except displays stupid message. If you want to create >+bootable DOS diskette and are ABSOULTELY sure that it has the same format >+as another already existing diskette (most important is difference >+between FAT and FAT32), you can extract boot loader from it. >+\fIsource-container\fP should be device file like /dev/fd0, >+as well as regular file like /mnt/windows/bootcode.dos >+.TP > .BI \-b " sector-of-backup " > Selects the location of the backup boot sector for FAT32. Default > depends on number of reserved sectors, but usually is sector 6. The
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 6389
: 792 |
793
|
794