Ignore:
Timestamp:
Dec 5, 2013, 12:45:34 PM (11 years ago)
Author:
devigne
Message:

giet_fat32/fat32.c :
Added _fat_write function. At the moment it does not support the creation of a
new file (the writing must exist in the disk image) and does not support the
allocation of additional cluster from the original file.

create_dmg :
Bug fix for support Linux (The tree files were not consistent with the
pathnames in boot.c).

giet_libs/stdlib.c and stdlib.h :
Added stdlib file. At the moment they only contain the atoi function.

giet_libs/stdio.h :
Bug fix in SYSCALL DEFINE. SYSCALL_FAT_READ, WRITE, CLOSE, LSEEK had the same
value.

Makefile :
Added compilation line for stdlib.o

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/create_dmg

    r258 r259  
    88reserved_sectors=32
    99
     10# FAT32 SPEC: The first two clusters are not present in the data region but
     11# they are used in the computation of the FAT sectors
     12data_region_clusters=$clusters-2
    1013
    11 let "data_sectors = (clusters - 2) * sectors_per_cluster"
    12 let "fat_sectors = (clusters * 4) / 512"
    13 let "sectors=data_sectors + fat_sectors + reserved_sectors"
     14let "data_sectors = data_region_clusters * sectors_per_cluster"
     15let "fat_sectors  = (clusters * 4) / 512"
     16
     17# The disk image contains:
     18#   - MBR sector : this sector is removed by this script as it will be copied
     19#                  after)
     20#   - Reserved region sectors (usually 32)
     21#   - FAT region sectors
     22#   - DATA region sectors
     23let "sectors      = data_sectors + fat_sectors + reserved_sectors + 1"
    1424
    1525platform=`uname`
     
    4353                        # RAW DISK IMAGE READ-ONLY
    4454                        # The not used space is not considered (smaller disk image)
    45                         # format="UDRO"
     55                        format="UDRO"
    4656
    4757                        # RAW DISK IMAGE READ-WRITE
    4858                        # None compression is made
    49                         format="UDRW"
     59                        # format="UDRW"
    5060
    5161                        echo "Creating partition file $3 from $2 directory"
     
    5969                                -format $format \
    6070                                $3;
    61 #                               -verbose \
     71#                               -verbose \
    6272
    6373                        echo "Removing first sector of diskimage"
     
    106116
    107117elif [[ $platform == "Linux" ]]; then
    108         echo "Creating partion file: partition.dmg"
    109         mkfs.vfat -C -F32 -S $sector_size -s $sectors_per_cluster \
    110                 partition.dmg $sectors
     118        case $1 in
     119                create )
     120                        if [[ -z $2 ]]; then
     121                                echo "Create action need second argument: <srcdir_path>"
     122                                exit 1;
     123                        fi;
    111124
    112         echo "Copying files into the partition"
    113         mcopy -s -i partition.dmg build :://
    114         mcopy -i    partition.dmg map.bin :://
     125                        if [[ -z $3 ]]; then
     126                                echo "Create action need third argument: <disk_image>"
     127                                exit 1;
     128                        fi;
    115129
    116         echo "Copying MBR on the first sector"
    117         dd if=mbr.dmg of=disk.dmg count=1 bs=$sector_size
     130                        echo "Creating partition file: $3"
    118131
    119         echo "Copying partition file on the sector 200 of the disk"
    120         dd if=partition.dmg of=disk.dmg seek=200 bs=$sector_size
     132                        let "sectors = (sectors - 1) / 2"
     133                    mkfs.vfat \
     134                                -C \
     135                                -F32 \
     136                                -f 1 \
     137                                -R $reserved_sectors \
     138                                -S $sector_size \
     139                                -s $sectors_per_cluster \
     140                                -v \
     141                                $3.dmg $sectors
     142
     143                        if [[ -e $2 ]]; then
     144                                echo "Copying files from $2 into partition"
     145                                mcopy -s -i $3.dmg $2/* :://
     146                        fi;;
     147
     148                * )
     149                        echo "Pass the command as the first parameter: "
     150                        echo "  - create: create disk image"
     151                        echo "            First parameter after create action is the path"
     152                    echo "            of the directory to copy in the created "
     153                        echo "            partition"
     154                        echo ""
     155                        echo "EXAMPLES:"
     156                        echo " ./create_diskimage.sh create /path/to/source_dir disk_image"
     157        esac;
    121158
    122159else
Note: See TracChangeset for help on using the changeset viewer.