Generate initrd.addrsize file correctly for LPAR booting (#546422)
Modify geninitrdsz.c to generate a patch file containing the load
address and size of the initrd.img image. Used for booting on an LPAR
using the generic.ins file.
---
utils/geninitrdsz.c | 67 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c
index 6dfd976..701ebcd 100644
--- a/utils/geninitrdsz.c
+++ b/utils/geninitrdsz.c
@@ -1,11 +1,12 @@
/*
- * geninitrdsz.c
- * Generate initrd.size file for zSeries platforms.
+ * addrsize.c
+ * Generate initrd.addrsize file for s390x platforms.
* Takes an integer argument and writes out the binary representation of
- * that value to the initrd.size file.
+ * that value to the initrd.addrsize file.
* https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197773
+ * https://bugzilla.redhat.com/show_bug.cgi?id=546422
*
- * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,30 +34,54 @@
#include <string.h>
int main(int argc,char **argv) {
- unsigned int zero = 0;
- int fd;
- unsigned int size;
- mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH;
-
- if (argc != 3) {
- printf("Usage: %s [integer size] [output file]
", basename(argv[0]));
- printf("Example: %s 12288475 initrd.size
", basename(argv[0]));
- return 0;
+ char *cmd = basename(argv[0]);
+ char *address = NULL, *input = NULL, *output = NULL;
+ struct stat initrd_stat;
+ unsigned int addr = 0, size = 0, zero = 0;
+ int fd, rc;
+ char *tmp = NULL;
+
+ if (argc != 4) {
+ printf("Generate initrd address and size file used by the .ins LPAR load mechanism
");
+ printf("Usage: %s [address] [initrd] [output file]
", cmd);
+ printf("Example: %s 0x02000000 initrd.img initrd.addrsize
", cmd);
+ return 1;
}