Rename the geninitrdsz.c program to gen-initrd-addr.c to more accurately reflect what it's generating. Update Makefile.am and its usage in the buildinstall scripts. The load address is provided as a shell variable in scripts/mk-images.s390. --- scripts/mk-images | 2 +- scripts/mk-images.s390 | 9 +++-- utils/Makefile.am | 2 +- utils/gen-initrd-addr.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++ utils/geninitrdsz.c | 81 ----------------------------------------------- 5 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 utils/gen-initrd-addr.c delete mode 100644 utils/geninitrdsz.c diff --git a/scripts/mk-images b/scripts/mk-images index bf76ce3..a7e047e 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -160,7 +160,7 @@ mkdir -p $INSTIMGPATH # Stuff that we need TRIMPCIIDS=$IMGPATH/usr/lib/anaconda-runtime/trimpciids GETKEYMAPS=$IMGPATH/usr/lib/anaconda-runtime/getkeymaps -GENINITRDSZ=$IMGPATH/usr/lib/anaconda-runtime/geninitrdsz +GENINITRDADDR=$IMGPATH/usr/lib/anaconda-runtime/gen-initrd-addr MKS390CDBOOT=$IMGPATH/usr/lib/anaconda-runtime/mk-s390-cdboot GENMODINFO=$IMGPATH/usr/lib/anaconda-runtime/genmodinfo KEYMAPS=$TMPDIR/keymaps-$BUILDARCH.$$ diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390 index 2de6819..b2c4c92 100644 --- a/scripts/mk-images.s390 +++ b/scripts/mk-images.s390 @@ -17,6 +17,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # +# initrd.img load address for generic.ins LPAR booting +# See https://bugzilla.redhat.com/show_bug.cgi?id=546422 for details. +INITRD_ADDR=0x2000000 + getAllS390ModuleNames() { s390dir="${KERNELROOT}/lib/modules/${version}/kernel/drivers/s390" if [ -d "${s390dir}" ]; then @@ -33,8 +37,7 @@ makeBootImages() { --initrdsize 20000 \ --loaderbin loader \ --modules "$INITRDMODS $(getAllS390ModuleNames)" - sz=$(ls -l $TOPDESTPATH/images/initrd.img | awk '{print $5}') - $GENINITRDSZ $sz $TOPDESTPATH/images/initrd.size + $GENINITRDADDR $INITRD_ADDR $TOPDESTPATH/images/initrd.addr cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img cp -v $BOOTDISKDIR/redhat.exec $TOPDESTPATH/images/redhat.exec @@ -51,7 +54,7 @@ makeBootImages() { [images-$KERNELARCH] kernel = images/kernel.img initrd = images/initrd.img -initrd.size = images/initrd.size +initrd.addr = images/initrd.addr generic.prm = images/generic.prm generic.ins = generic.ins cdboot.img = images/cdboot.img diff --git a/utils/Makefile.am b/utils/Makefile.am index bfc8fd4..a00e8c4 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -24,7 +24,7 @@ noinst_PROGRAMS = snarffont dist_noinst_SCRIPTS = filtermoddeps if IS_S390 -utils_PROGRAMS += geninitrdsz mk-s390-cdboot +utils_PROGRAMS += gen-initrd-addr mk-s390-cdboot endif modlist_CFLAGS = -I$(top_srcdir)/loader $(GLIB_CFLAGS) diff --git a/utils/gen-initrd-addr.c b/utils/gen-initrd-addr.c new file mode 100644 index 0000000..68b8083 --- /dev/null +++ b/utils/gen-initrd-addr.c @@ -0,0 +1,81 @@ +/* + * 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.addr file. + * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197773 + * https://bugzilla.redhat.com/show_bug.cgi?id=546422 + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <netinet/in.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> + +int main(int argc,char **argv) { + struct stat initrd_stat; + unsigned int addr = 0, size = 0, zero = 0; + int fd, rc; + char *tmp = NULL; + + if (argc != 3) { + 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.addr\n", basename(argv[0])); + return EXIT_SUCCESS; + } + + 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 output file (zero) "); + return errno; + } + + if (write(fd, &addr, sizeof(int)) == -1) { + perror("writing output file (addr) "); + return errno; + } + + if (write(fd, &zero, sizeof(int)) == -1) { + perror("writing output file (zero) "); + return errno; + } + + if (write(fd, &addr, sizeof(int)) == -1) { + perror("writing output file (addr) "); + return errno; + } + + close(fd); + return 0; +} diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c deleted file mode 100644 index b8c824a..0000000 --- a/utils/geninitrdsz.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.addr file. - * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197773 - * https://bugzilla.redhat.com/show_bug.cgi?id=546422 - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <netinet/in.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <string.h> - -int main(int argc,char **argv) { - struct stat initrd_stat; - unsigned int addr = 0, size = 0, zero = 0; - int fd, rc; - char *tmp = NULL; - - if (argc != 3) { - 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; - } - - 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.addr (zero) "); - return errno; - } - - if (write(fd, &addr, sizeof(int)) == -1) { - perror("writing initrd.addr (zero) "); - return errno; - } - - close(fd); - return 0; -} -- 1.6.6.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list