binman: generate valid binaries for high memory
authorAlan Cox <alan@linux.intel.com>
Sat, 2 Jun 2018 21:58:44 +0000 (22:58 +0100)
committerAlan Cox <alan@linux.intel.com>
Sat, 2 Jun 2018 21:58:44 +0000 (22:58 +0100)
Library/tools/binman.c

index 14694d3..e1cf81a 100644 (file)
@@ -95,8 +95,15 @@ int main(int argc, char *argv[])
   }
   memcpy(buf + s__INITIALIZED, buf + s__INITIALIZER, l__INITIALIZER);
 
+  if (progload & 0xFF) {
+    fprintf(stderr, "%s: load address must be page aligned.\n", argv[0]);
+    exit(1);
+  }
 
-  bp = buf + progload + 10;
+  bp = buf + progload + 7;
+  *bp++ = progload >> 8;
+  *bp++ = 0;
+  *bp++ = 0;
   *bp++ = s__INITIALIZED - progload;
   *bp++ = (s__INITIALIZED - progload) >> 8;
   *bp++ = s__DATA - s__INITIALIZED;