The geninitrdsz.c program was originally provided by IBM. An old bug number is referenced in the source. Apparently this program is not generating a useful file any more, so IBM has reworked it and it now generates a load address patch file that can be used when booting an LPAR directly. --- utils/geninitrdsz.c | 51 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 35 insertions(+), 16 deletions(-) diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c index 6dfd976..b8c824a 100644 --- a/utils/geninitrdsz.c +++ b/utils/geninitrdsz.c @@ -1,11 +1,12 @@ /* - * geninitrdsz.c - * Generate initrd.size file for zSeries platforms. + * gen-initrd-addr.c + * Generate initrd.addr 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.addr 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,27 +34,45 @@ #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; + struct stat initrd_stat; + unsigned int addr = 0, size = 0, zero = 0; + int fd, rc; + char *tmp = NULL; if (argc != 3) { - printf("Usage: %s [integer size] [output file]\n", basename(argv[0])); - printf("Example: %s 12288475 initrd.size\n", basename(argv[0])); - return 0; + printf("Generate initrd.addr file used by the .ins LPAR load mechanism\n"); + printf("Usage: %s [address] [output file]\n", basename(argv[0])); + printf("Example: %s 0x2000000 initrd.size\n", basename(argv[0])); + return EXIT_SUCCESS; } - size = htonl(atoi(argv[1])); - fd = open(argv[2], O_CREAT | O_RDWR, mode); + rc = stat(argv[2], &initrd_stat); + if (rc) { + perror("Error getting initrd stats "); + return rc; + } + + addr = htonl(strtoul(argv[1], &tmp, 0)); + size = initrd_stat.st_size; + fd = open(argv[2], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); + + if (write(fd, &zero, sizeof(int)) == -1) { + perror("writing initrd.addr (zero) "); + return errno; + } + + if (write(fd, &addr, sizeof(int)) == -1) { + perror("writing initrd.addr (zero) "); + return errno; + } if (write(fd, &zero, sizeof(int)) == -1) { - perror("writing initrd.size (zero)"); + perror("writing initrd.addr (zero) "); return errno; } - if (write(fd, &size, sizeof(int)) == -1) { - perror("writing initrd.size (size)"); + if (write(fd, &addr, sizeof(int)) == -1) { + perror("writing initrd.addr (zero) "); return errno; } -- 1.6.6.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list