Subversion Repositories DevTools

Rev

Rev 1105 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1105 Rev 1107
Line 78... Line 78...
78
# Inputs          : $outdir             - Target directory
78
# Inputs          : $outdir             - Target directory
79
#                   $image_name         - Root name of the output image
79
#                   $image_name         - Root name of the output image
80
#                   $WORK               - Root of file system image
80
#                   $WORK               - Root of file system image
81
#                   $BUILD              - Scratch Work Area
81
#                   $BUILD              - Scratch Work Area
82
#                   $disk_blocks        - Size of target disk
82
#                   $disk_blocks        - Size of target disk
-
 
83
#                   $fullfs             - Size of test full fs
83
#
84
#
84
# Returns         : 
85
# Returns         : 
85
#
86
#
86
sub CreateSdImage
87
sub CreateSdImage
87
{
88
{
88
    my ($outdir,$image_name,$WORK, $BUILD, $disk_blocks) = @_;
89
    my ($outdir,$image_name,$WORK, $BUILD, $disk_blocks, $fullfs) = @_;
-
 
90
    my $install_grub = ( -f "$WORK/boot/grub/grub" );
-
 
91
 
-
 
92
    #
-
 
93
    #   Ensure that the required utility programs can be found and that they
-
 
94
    #   are being consumed from packages and not from the users path
-
 
95
    #
-
 
96
    Error ( "Required utility program not found in package: e2fsimage" )
-
 
97
        unless ( LocateProgInPath ('e2fsimage' ) );
-
 
98
 
-
 
99
    Error ( "Required utility program not found in package: grub" )
-
 
100
        unless ( ! $install_grub || LocateProgInPath ('grub' ) );
-
 
101
 
-
 
102
    #
-
 
103
    #   Insert size of the FullFS
-
 
104
    #   May be zero
-
 
105
    #
-
 
106
    $partitions{0}{size} = $fullfs;
89
 
107
 
90
    #
108
    #
91
    #
109
    #
92
    #   Magic: The size of the SD card
110
    #   Magic: The size of the SD card
93
    #          This was determined by 'dd' ing an SD card and using the number of
111
    #          This was determined by 'dd' ing an SD card and using the number of
Line 227... Line 245...
227
    #   Install grub into the MBR of the file system [ optional]
245
    #   Install grub into the MBR of the file system [ optional]
228
    #   This is only required for an x86 target and will detected by the
246
    #   This is only required for an x86 target and will detected by the
229
    #   presence of a key grub file
247
    #   presence of a key grub file
230
    #   The grub files will have been copied into the filesystem image earlier
248
    #   The grub files will have been copied into the filesystem image earlier
231
    #
249
    #
232
    if ( -f "$WORK/boot/grub/grub" )
250
    if ( $install_grub )
233
    {
251
    {
234
        Message ("Installing Grub into the MBR");
252
        Message ("Installing Grub into the MBR");
-
 
253
 
235
        #
254
        #
236
        #   Need to run a copy of grab (built for the build machine) on the image
255
        #   Need to run a copy of grab (built for the build machine) on the image
237
        #
256
        #
238
        #   Need a command file to feed into grub
257
        #   Need a command file to feed into grub
239
        #   Prevent grub from scanning bios
258
        #   Prevent grub from scanning bios
Line 340... Line 359...
340
    my $pdata = $partitions{$FS_PART} || Error ("Unknown partition number: $FS_PART");
359
    my $pdata = $partitions{$FS_PART} || Error ("Unknown partition number: $FS_PART");
341
    my $FS_IMAGE = $pdata->{name};
360
    my $FS_IMAGE = $pdata->{name};
342
    my $FS_BASE =  $pdata->{root};
361
    my $FS_BASE =  $pdata->{root};
343
    my $FS_SIZE = $pdata->{size} / 2;
362
    my $FS_SIZE = $pdata->{size} / 2;
344
 
363
 
-
 
364
    #
-
 
365
    #   The 'full' image may not be required
-
 
366
    #   It will have a zero size
-
 
367
    #
-
 
368
    return unless ( $FS_SIZE );
-
 
369
 
345
    Message "Creating EXT3 file system: ${FS_IMAGE}, Partition: ${FS_PART}, Size: ${FS_SIZE} blocks";
370
    Message "Creating EXT3 file system: ${FS_IMAGE}, Partition: ${FS_PART}, Size: ${FS_SIZE} blocks";
346
 
371
 
347
    $FS_IMAGE = "${BUILD}/${FS_IMAGE}.ext3";
372
    $FS_IMAGE = "${BUILD}/${FS_IMAGE}.ext3";
348
    $pdata->{fsname} = $FS_IMAGE;
373
    $pdata->{fsname} = $FS_IMAGE;
349
    unlink ${FS_IMAGE};
374
    unlink ${FS_IMAGE};