[PATCH 2/8] Rename geninitrdsz.c to addrsize.c (#546422)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rename the geninitrdsz.c program to addrsize.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/addrsize.c       |   87 ++++++++++++++++++++++++++++++++++++++++++++++++
 utils/geninitrdsz.c    |   87 ------------------------------------------------
 5 files changed, 95 insertions(+), 92 deletions(-)
 create mode 100644 utils/addrsize.c
 delete mode 100644 utils/geninitrdsz.c

diff --git a/scripts/mk-images b/scripts/mk-images
index 2dd14ed..980264f 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
+ADDRSIZE=$IMGPATH/usr/lib/anaconda-runtime/addrsize
 MKS390CDBOOT=$IMGPATH/usr/lib/anaconda-runtime/mk-s390-cdboot
 GENMODINFO=$IMGPATH/usr/lib/anaconda-runtime/genmodinfo
 LIBEXECBINDIR=$IMGPATH/usr/lib/anaconda-runtime
diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390
index 2de6819..2ee2bde 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_ADDRESS=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
+	$ADDRSIZE $INITRD_ADDRESS $TOPDESTPATH/images/initrd.img $TOPDESTPATH/images/initrd.addrsize
 	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.addrsize = images/initrd.addrsize
 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..b893679 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      += addrsize mk-s390-cdboot
 endif
 
 modlist_CFLAGS      = -I$(top_srcdir)/loader $(GLIB_CFLAGS)
diff --git a/utils/addrsize.c b/utils/addrsize.c
new file mode 100644
index 0000000..701ebcd
--- /dev/null
+++ b/utils/addrsize.c
@@ -0,0 +1,87 @@
+/*
+ * 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.addrsize 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) {
+    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\n");
+        printf("Usage: %s [address] [initrd] [output file]\n", cmd);
+        printf("Example: %s 0x02000000 initrd.img initrd.addrsize\n", cmd);
+        return 1;
+    }
+
+    address = argv[1];
+    input = argv[2];
+    output = argv[3];
+
+    rc = stat(input, &initrd_stat);
+    if (rc) {
+        perror("Error getting initrd stats ");
+        return 2;
+    }
+
+    addr = htonl(strtoul(address, &tmp, 0));
+    size = htonl(initrd_stat.st_size);
+    fd = open(output, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+
+    if (write(fd, &zero, sizeof(int)) == -1) {
+        perror("writing initrd.addr (zero) ");
+        return 3;
+    }
+
+    if (write(fd, &addr, sizeof(int)) == -1) {
+        perror("writing initrd.addr (zero) ");
+        return 4;
+    }
+
+    if (write(fd, &zero, sizeof(int)) == -1) {
+        perror("writing initrd.addr (zero) ");
+        return 5;
+    }
+
+    if (write(fd, &addr, sizeof(int)) == -1) {
+        perror("writing initrd.addr (zero) ");
+        return 6;
+    }
+
+    close(fd);
+    return EXIT_SUCCESS;
+}
diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c
deleted file mode 100644
index 701ebcd..0000000
--- a/utils/geninitrdsz.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.addrsize 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) {
-    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\n");
-        printf("Usage: %s [address] [initrd] [output file]\n", cmd);
-        printf("Example: %s 0x02000000 initrd.img initrd.addrsize\n", cmd);
-        return 1;
-    }
-
-    address = argv[1];
-    input = argv[2];
-    output = argv[3];
-
-    rc = stat(input, &initrd_stat);
-    if (rc) {
-        perror("Error getting initrd stats ");
-        return 2;
-    }
-
-    addr = htonl(strtoul(address, &tmp, 0));
-    size = htonl(initrd_stat.st_size);
-    fd = open(output, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
-
-    if (write(fd, &zero, sizeof(int)) == -1) {
-        perror("writing initrd.addr (zero) ");
-        return 3;
-    }
-
-    if (write(fd, &addr, sizeof(int)) == -1) {
-        perror("writing initrd.addr (zero) ");
-        return 4;
-    }
-
-    if (write(fd, &zero, sizeof(int)) == -1) {
-        perror("writing initrd.addr (zero) ");
-        return 5;
-    }
-
-    if (write(fd, &addr, sizeof(int)) == -1) {
-        perror("writing initrd.addr (zero) ");
-        return 6;
-    }
-
-    close(fd);
-    return EXIT_SUCCESS;
-}
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux