Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkfat/mkfat.c

    r09ab0a9a rdf1b4a8  
    11/*
    2  * Copyright (c) 2010 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6666        default_fat_count               = 2,
    6767        default_reserved_clusters       = 2,
    68         default_media_descriptor        = 0xF8 /**< fixed disk */
     68        default_media_descriptor        = 0xF8 /**< fixed disk */,
     69        fat32_root_cluster              = 2
    6970};
    7071
     
    198199        }
    199200
    200         rc = block_init(service_id, 2048);
     201        rc = block_init(service_id);
    201202        if (rc != EOK)  {
    202203                printf(NAME ": Error initializing libblock.\n");
     
    313314        cfg->reserved_sectors = 1 + cfg->addt_res_sectors;
    314315
    315         /* Only correct for FAT12/16 (FAT32 has root dir stored in clusters */
     316        /* Only correct for FAT12/16 (FAT32 has root dir stored in clusters) */
    316317        rd_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE,
    317318            cfg->sector_size);
     
    434435        }
    435436
     437        if (cfg->fat_type == FAT32) {
     438                /* Root dir is stored in cluster fat32_root_cluster */
     439                addr += fat32_root_cluster * cfg->sectors_per_cluster;
     440        }
     441
    436442        /* Root directory */
    437443        printf("Writing root directory.\n");
     
    529535                bs->fat32.ebs = 0x29;
    530536                bs->fat32.id = host2uint32_t_be(vsn);
    531                 bs->fat32.root_cluster = 2;
     537                bs->fat32.root_cluster = fat32_root_cluster;
    532538
    533539                (void) fat_label_encode(&bs->fat32.label, bs_label);
Note: See TracChangeset for help on using the changeset viewer.