]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BeagleBoardPkg/Tools/generate_image.c
Update the copyright notice format
[mirror_edk2.git] / BeagleBoardPkg / Tools / generate_image.c
index 9bcd67a1878799a0d51b8a40b120d5a591cd2d80..6ac92680a04a12589737fb0f6b4340557760ed9a 100644 (file)
@@ -1,8 +1,15 @@
 /** @file
-
-  Copyright (c) 2008-2009, Apple Inc. All rights reserved.
+ The data structures in this code come from:
+ OMAP35x Applications Processor Technical Reference Manual chapter 25
+ OMAP34xx Multimedia Device Technical Reference Manual chapter 26.4.8.
+ You should use the OMAP35x manual when possible. Some things, like SectionKey, 
+ are not defined in the OMAP35x manual and you have to use the OMAP34xx manual
+ to find the data. 
+
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
   
-  All rights reserved. This program and the accompanying materials
+  This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
+
+
 
 //TOC structure as defined by OMAP35XX TRM.
 typedef struct {
@@ -255,7 +262,7 @@ PrepareConfigurationHeader (
   // Open data file
   DataFile = fopen(gDataFile, "rb");
   if (DataFile == NULL) {
-    fprintf(stderr, "Can't open data file %s.\n", gOutputImageFile);
+    fprintf(stderr, "Can't open data file %s.\n", gDataFile);
     exit(1);
   }
   
@@ -353,53 +360,51 @@ ConstructImage (
   fclose(OutputFile);
 }
 
+
 int 
 main (
   int    argc, 
   char** argv
   )
 {
-  char Ch;
+  char          Ch;
   unsigned char *ptr;
+  int           i;
+  int           TwoArg;  
 
   if (argc == 1) {
     PrintUsage ();
     exit(1);
   }
 
-  while ((Ch = getopt(argc, argv, "D:E:I:O:")) != -1) {
-    switch (Ch) {
-      case 'E': /* Image execution address */
-        gImageExecutionAddress = strtoul (optarg, (char **)&ptr, 16);
-        break;
-      
-      case 'I': /* Input image file */
-        gInputImageFile = optarg;
-        break;
-
-      case 'O': /* Output image file */
-        gOutputImageFile = optarg;
-        break;
-      
-      case 'D': /* Data file */
-        gDataFile = optarg;
-        break;
-
-      case '?':
-        if ((optopt == 'E') || (optopt == 'I') || (optopt == 'O')) {
-          fprintf (stderr, "Option -%c requires an argument.\n", optopt);
-        } else if (isprint (optopt)) {
-          fprintf (stderr, "Unknown option `-%c'.\n", optopt);
-        } else {
-          fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
-        }
-        return 1;
-
-      default:
-        abort ();
+  for (i=1; i < argc; i++) {
+    if (argv[i][0] == '-') {
+      // TwoArg TRUE -E 0x123, FALSE -E0x1234
+      TwoArg = (argv[i][2] != ' ');
+      switch (argv[i][1]) {
+        case 'E': /* Image execution address */
+          gImageExecutionAddress = strtoul (TwoArg ? argv[i+1] : &argv[i][2], (char **)&ptr, 16);
+          break;
+        
+        case 'I': /* Input image file */
+          gInputImageFile = TwoArg ? argv[i+1] : &argv[i][2];
+          break;
+
+        case 'O': /* Output image file */
+          gOutputImageFile = TwoArg ? argv[i+1] : &argv[i][2];
+          break;
+        
+        case 'D': /* Data file */
+          gDataFile = TwoArg ? argv[i+1] : &argv[i][2];
+          break;
+
+        default:
+          abort ();
+      }
     }
   }
 
   //Prepare configuration header
   PrepareConfigurationHeader ();