mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[FATTEN]
* Change the number of FAT copies stored by the formatting code to 2. * Implement /BOOT command, to apply a boot sector to the image (FAT12/16 only, for now). * Make use of the command above to finally get the generated efisys.bin loading in 7zip as a floppy. svn path=/trunk/; revision=69135
This commit is contained in:
parent
30f6a61675
commit
d2e60268e5
3 changed files with 52 additions and 4 deletions
|
@ -16,8 +16,8 @@ else()
|
|||
endif()
|
||||
|
||||
add_custom_target(efisys
|
||||
COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.EFI
|
||||
DEPENDS native-fatten bootmgfw
|
||||
COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.EFI
|
||||
DEPENDS native-fatten bootmgfw fat
|
||||
VERBATIM)
|
||||
|
||||
##bootcd
|
||||
|
|
|
@ -4058,7 +4058,7 @@ FRESULT f_forward (
|
|||
/*-----------------------------------------------------------------------*/
|
||||
#define N_ROOTDIR12 224 /* Number of root directory entries for FAT12/16 */
|
||||
#define N_ROOTDIR16 512 /* Number of root directory entries for FAT12/16 */
|
||||
#define N_FATS 1 /* Number of FATs (1 or 2) */
|
||||
#define N_FATS 2 /* Number of FATs (1 or 2) */
|
||||
|
||||
|
||||
FRESULT f_mkfs (
|
||||
|
|
|
@ -193,10 +193,58 @@ int main(int oargc, char* oargv[])
|
|||
}
|
||||
else if (strcmp(parg, "boot") == 0)
|
||||
{
|
||||
FILE* fe;
|
||||
BYTE* temp = buff + 1024;
|
||||
|
||||
NEED_PARAMS(1, 1);
|
||||
|
||||
// Arg 1: boot file
|
||||
printf("Not Implemented.");
|
||||
|
||||
fe = fopen(argv[0], "rb");
|
||||
|
||||
if (!fe)
|
||||
{
|
||||
printf("Error: unable to open external file '%s' for reading.", argv[0]);
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(!fread(buff, 512, 1, fe))
|
||||
{
|
||||
printf("Error: unable to read boot sector from file '%s'.", argv[0]);
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
NEED_MOUNT();
|
||||
|
||||
if(disk_read(0, temp, 0, 1))
|
||||
{
|
||||
printf("Error: unable to read existing boot sector from image.");
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (g_Filesystem.fs_type == FS_FAT32)
|
||||
{
|
||||
printf("TODO: writing boot sectors for FAT32 images not yet supported.");
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Quick&dirty hardcoded length.
|
||||
memcpy(buff + 2, temp + 2, 0x3E - 0x02);
|
||||
}
|
||||
|
||||
if (disk_write(0, buff, 0, 1))
|
||||
{
|
||||
printf("Error: unable to write new boot sector to image.");
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
fclose(fe);
|
||||
}
|
||||
else if (strcmp(parg, "add") == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue