Update of /cvsroot/leaf/src/bering-uclibc4/buildtool
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16573

Modified Files:
        buildimage.pl 
Log Message:
Updated with multiple kernel handling

Index: buildimage.pl
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc4/buildtool/buildimage.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** buildimage.pl       16 Oct 2010 11:12:49 -0000      1.2
--- buildimage.pl       11 Nov 2010 19:47:12 -0000      1.3
***************
*** 25,36 ****
  my $image;
  my $verbose;
  my $debug;
  my $Usage =
! qq{Usage: $0 --image=ImgDir --relver=VersionLabel [--verbose]
     image    Parent directory for buildimage.cfg, under buildtool/image
!             e.g. Bering-uClibc-isolinux-std
     relver   String to append to image name to show release version
              e.g. 4.0beta1
     verbose  [Optional] Report progress during execution
  };
  
--- 25,38 ----
  my $image;
  my $verbose;
+ my $keeptmp;
  my $debug;
  my $Usage =
! qq{Usage: $0 --image=ImgDir --relver=VersionLabel [--verbose] [--keeptmp]
     image    Parent directory for buildimage.cfg, under buildtool/image
!             e.g. Bering-uClibc_i486_isolinux_vga
     relver   String to append to image name to show release version
              e.g. 4.0beta1
     verbose  [Optional] Report progress during execution
+    keeptmp  [Optional] Do not delete temporary directory
  };
  
***************
*** 46,50 ****
  GetOptions( "verbose!" => \$verbose,
            "image=s"  => \$image,
!           "relver=s"  => \$label,
            "debug!"   => \$debug ) or die $Usage;
  
--- 48,53 ----
  GetOptions( "verbose!" => \$verbose,
            "image=s"  => \$image,
!           "relver=s" => \$label,
!           "keeptmp!" => \$keeptmp,
            "debug!"   => \$debug ) or die $Usage;
  
***************
*** 96,102 ****
  print "Build Date is:\t\t$configHash{ '{DATE}' }\n" if $verbose;
  
  # Extract kernel version from source tree
  my $kver;
! open( FH, "<".$sourceDir."/linux/linux/.config" );
  while ( <FH> )
  { if ( /version: (.*)/ ) { $kver = $1; last; } }
--- 99,123 ----
  print "Build Date is:\t\t$configHash{ '{DATE}' }\n" if $verbose;
  
+ # Create directory to hold image contents
+ my $tmpDir = createTempDir( );
+ 
+ # Extract name, type of image, kernel arch and suffix from config file
+ my $imageStruc = $imConfig->value( 'image' );
+ my $imgName = $imageStruc->{ 'imagename' };
+ die "ImageName is not specified in config file" unless defined $imgName;
+ print "Image name:\t\t$imgName\n" if $verbose;
+ my $kernelArch = $imageStruc->{ 'kernelarch' };
+ die "KernelArch is not specified in config file" unless defined $kernelArch;
+ print "Kernel Arch:\t\t$kernelArch\n" if $verbose;
+ my $imgType = $imageStruc->{ 'imagetype' };
+ die "ImageType is not specified in config file" unless defined $imgType;
+ print "Image type:\t\t$imgType\n" if $verbose;
+ my $imgSuffix = $imageStruc->{ 'imagesuffix' };
+ die "ImageSuffix is not specified in config file" unless defined $imgSuffix;
+ print "Image Suffix:\t\t$imgSuffix\n" if $verbose;
+ 
  # Extract kernel version from source tree
  my $kver;
! open( FH, "<".$sourceDir."/linux/linux-".$kernelArch."/.config" );
  while ( <FH> )
  { if ( /version: (.*)/ ) { $kver = $1; last; } }
***************
*** 104,113 ****
  print "Kernel Version is:\t$kver\n" if $verbose;
  
- # Create directory to hold image contents
- my $tmpDir = createTempDir( );
- 
  # Always create full modules.tgz
  print "Creating modules.tgz...\n" if $verbose;
! system_exec( "cd $stagingDir/lib/modules/$kver ; tar -czf $tmpDir/modules.tgz 
* --exclude=build --exclude=source", "Error building modules.tgz" );
  
  # Always create full firmware.tgz
--- 125,131 ----
  print "Kernel Version is:\t$kver\n" if $verbose;
  
  # Always create full modules.tgz
  print "Creating modules.tgz...\n" if $verbose;
! system_exec( "cd $stagingDir/lib/modules/$kver-$kernelArch ; tar -czf 
$tmpDir/modules.tgz * --exclude=build --exclude=source", "Error building 
modules.tgz" );
  
  # Always create full firmware.tgz
***************
*** 115,127 ****
  system_exec( "cd $stagingDir/lib/firmware ; tar -czf $tmpDir/firmware.tgz *", 
"Error building firmware.tgz" );
  
- # Extract name and type of image to build from config file
- my $imageStruc = $imConfig->value( 'image' );
- my $imgName = $imageStruc->{ 'imagename' };
- die "ImageName is not specified in config file" unless defined $imgName;
- print "Image name:\t\t$imgName\n" if $verbose;
- my $imgType = $imageStruc->{ 'imagetype' };
- die "ImageType is not specified in config file" unless defined $imgType;
- print "Image type:\t\t$imgType\n" if $verbose;
- 
  # Extract configuration variables from config file
  # Populate global configHash with Search-And-Replace Key:Value
--- 133,136 ----
***************
*** 185,207 ****
  
  # Complete the processing depending on the image type specified
! if ( $imgType eq "syslinux" )
  {
!     print "Performing SYSLINUX processing...\n" if $verbose;
!     my $fileName = File::Spec->catfile(
!       $baseDir,
!         $btConfig->value( 'image_dir' ),
!       $image,
!       $imgName."_".$label.".tar.gz" );
      system_exec( "cd $tmpDir ; tar -czf $fileName .", "Error creating image 
tarfile: $!" );
  }
  elsif ( $imgType eq "isolinux" )
  {
!     print "Performing ISOLINUX processing...\n" if $verbose;
!     my $fileName = File::Spec->catfile(
!       $baseDir,
!         $btConfig->value( 'image_dir' ),
!       $image,
!       $imgName."_".$label.".iso" );
! 
      # Summary of mkisofs arguments:
      #  -o             Name of generated image file
--- 194,212 ----
  
  # Complete the processing depending on the image type specified
! print "Performing ".$imgType." processing...\n" if $verbose;
! my $fileBase = File::Spec->catfile(
!     $baseDir,
!     $btConfig->value( 'image_dir' ),
!     $image,
!     $imgName."_".$label."_".$kernelArch."_".$imgType."_".$imgSuffix );
! 
! if ( $imgType eq "syslinux" || $imgType eq "pxelinux" )
  {
!     my $fileName = $fileBase.".tar.gz";
      system_exec( "cd $tmpDir ; tar -czf $fileName .", "Error creating image 
tarfile: $!" );
  }
  elsif ( $imgType eq "isolinux" )
  {
!     my $fileName = $fileBase.".iso";
      # Summary of mkisofs arguments:
      #  -o             Name of generated image file
***************
*** 225,229 ****
  
  # Tidyup
! cleanTempDir( );
  
  # End of main
--- 230,234 ----
  
  # Tidyup
! cleanTempDir( ) unless $keeptmp;
  
  # End of main
***************
*** 357,361 ****
  =head1 SYNOPSIS
  
! B<buildimage.pl> --image=ImgDir --relver=VersionLabel [--verbose]
  
     image    Parent directory for buildimage.cfg, under buildtool/image
--- 362,366 ----
  =head1 SYNOPSIS
  
! B<buildimage.pl> --image=ImgDir --relver=VersionLabel [--verbose] [--keeptmp]
  
     image    Parent directory for buildimage.cfg, under buildtool/image
***************
*** 364,367 ****
--- 369,373 ----
              e.g. 4.0beta1
     verbose  [Optional] Report progress during execution
+    keeptmp  [Optional] Do not delete temporary directory
  
  =head1 DESCRIPTION
***************
*** 369,384 ****
  B<buildimage.pl> creates a Bering-uClibc disk image based on parameter
  settings defined in a configuration file (buildimage.cfg) located within a
! sub-directory of buildtool/image. The name of this sub-directory is specified
  with the "--image" command-line argument.
  
! The disk image can be for SYSLINUX (suitable for writing to a flash drive)
! or can use ISOLINUX. The choice between these is specified in buildimage.cfg.
  
! For SYSLINUX, the "image" is a .tar.gz file which needs to be extracted
! onto suitably prepared media.
! For ISOLINUX the "image" is a .iso file which can be burned to a CD-R.
  
! Note that the name of the image file is based on the ImageName field in the
! configuration file which may be different from the --image argument.
  
  =head1 SEE ALSO
--- 375,407 ----
  B<buildimage.pl> creates a Bering-uClibc disk image based on parameter
  settings defined in a configuration file (buildimage.cfg) located within a
! sub-directory of buildtool/image/. The name of this sub-directory is specified
  with the "--image" command-line argument.
  
! The disk image can be for SYSLINUX (suitable for writing to a flash drive),
! PXELINUX (suitable for network booting) or can use ISOLINUX.
! The choice between these is specified in buildimage.cfg.
  
! For SYSLINUX and PXELINUX, the "image" is a .tar.gz file which needs to be
! extracted onto suitably prepared media or installed on a PXELINUX server.
! For ISOLINUX the "image" is a .iso file which can be burned to a CD-R disk.
  
! Note that the name of the generated image file is derived from entries in the
! configuration file rather than from the --image command-line argument.
! 
! The generated image name is formed from:
!    - The value of the ImageName entry in the configuration file
!        Typically "Bering-uClibc"
!    - The value of the --relver command-line argument
!        Something like "4.0-beta1"
!    - The value of the KernelArch entry in the configuration file
!        Something like "i686"
!    - The value of the ImageType entry in the configuration file
!        Something like "syslinux"
!    - The value of the ImageSuffix entry in the configuration file
!        A free-format string like "vga" or "ser"
! 
! Each of these is separated by an underscore character (_).
! In addition, a file extension based on ImageType is appended (e.g. ".iso"
! for ISOLINUX).
  
  =head1 SEE ALSO


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
leaf-cvs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to