diff options
author | Peter Jones <pjones@redhat.com> | 2008-06-24 12:06:16 -0400 |
---|---|---|
committer | Peter Jones <pjones@vroomfondel.internal.datastacks.com> | 2008-06-24 12:06:16 -0400 |
commit | fc3f43857518eff686b7d0ecb3c749a6876b3b64 (patch) | |
tree | 667778977500cd90d1c52e13492ad4eee0409a97 | |
parent | 17a2bb2e42c03cab5034f758a6ebaaa7a2e0271a (diff) | |
download | anaconda-fc3f43857518eff686b7d0ecb3c749a6876b3b64.tar.gz anaconda-fc3f43857518eff686b7d0ecb3c749a6876b3b64.tar.xz anaconda-fc3f43857518eff686b7d0ecb3c749a6876b3b64.zip |
Add geninitrdsz and use it in mk-images.s390 (#449617)
-rwxr-xr-x | scripts/mk-images | 1 | ||||
-rw-r--r-- | scripts/mk-images.s390 | 2 | ||||
-rw-r--r-- | utils/Makefile | 18 | ||||
-rw-r--r-- | utils/geninitrdsz.c | 46 |
4 files changed, 65 insertions, 2 deletions
diff --git a/scripts/mk-images b/scripts/mk-images index 740747a3b..89eb239ee 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -97,6 +97,7 @@ TOPDIR=$(cd $TOPDIR; pwd) TRIMPCIIDS=$IMGPATH/usr/lib/anaconda-runtime/trimpciids TRIMUSBMAP=$IMGPATH/usr/lib/anaconda-runtime/trimusbmap GETKEYMAPS=$IMGPATH/usr/lib/anaconda-runtime/getkeymaps + GENINITRDSZ=$IMGPATH/usr/lib/anaconda-runtime/geninitrdsz KEYMAPS=/tmp/keymaps-$BUILDARCH.$$ SCREENFONT=$IMGPATH/usr/lib/anaconda-runtime/screenfont-${BASEARCH}.gz GETMODDEPS=$IMGPATH/usr/lib/anaconda-runtime/moddeps diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390 index 783a26f69..a94b8462d 100644 --- a/scripts/mk-images.s390 +++ b/scripts/mk-images.s390 @@ -24,6 +24,8 @@ makeBootImages() { --initrdsize 20000 \ --loaderbin loader \ --modules "$NETWORKMODULES" + sz=$(ls -l $TOPDESTPATH/images/initrd.img | awk '{print $5}') + $GENINITRDSZ $sz $TOPDESTPATH/images/initrd.size cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img cp -v $BOOTDISKDIR/generic.prm $TOPDESTPATH/images/generic.prm diff --git a/utils/Makefile b/utils/Makefile index d8dba43ab..792c5fe0b 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -11,6 +11,14 @@ CFLAGS = -Wall -g -I.. -I$(LOADERDIR) -Werror RPMCFLAGS = $(CFLAGS) -I/usr/include/rpm LDFLAGS = -g +UTILS = modlist moddeps snarffont mapshdr readmap genhdlist +ifeq (s390, $(ARCH)) +UTILS += geninitrdsz +endif +ifeq (s390x, $(ARCH)) +UTILS += geninitrdsz +endif + ifeq (.depend,$(wildcard .depend)) TARGET=all else @@ -19,7 +27,7 @@ endif everything: $(TARGET) -all: modlist moddeps snarffont mapshdr readmap genhdlist +all: $(UTILS) modlist: modlist.o moduleinfo.o $(CC) $(LDFLAGS) -o modlist modlist.o moduleinfo.o $(LOADLIBES) @@ -39,6 +47,9 @@ moddeps: moddeps.o moduledeps.o md5.o: md5.c md5.h gcc -c -O -g md5.c +geninitrdsz: geninitrdsz.c + $(CC) $(CFLAGS) -o $@ $< + genhdlist: genhdlist.c hash.c $(CC) $(LDFLAGS) $(RPMCFLAGS) -o genhdlist genhdlist.c hash.c \ -lrpm -lrpmdb -lrpmio -lbz2 -lz -lpopt -lelf -lpthread -lbeecrypt @@ -59,10 +70,13 @@ install: all install -m755 checkcards.py $(DESTDIR)/$(RUNTIMEDIR) install -m755 readmap $(DESTDIR)/$(RUNTIMEDIR) install -m755 mapshdr $(DESTDIR)/$(RUNTIMEDIR) + if [ -x geninitrdsz ]; then \ + install -m755 geninitrdsz $(DESTDIR)/$(RUNTIMEDIR) ; \ + fi clean: rm -f modlist moddeps snarffont genhdlist mapshdr readmap \ - moduledeps.c moduleinfo.c .depend *.o + geninitrdsz moduledeps.c moduleinfo.c .depend *.o depend: $(CPP) -M $(RPMCFLAGS) *.c > .depend diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c new file mode 100644 index 000000000..01d1cf135 --- /dev/null +++ b/utils/geninitrdsz.c @@ -0,0 +1,46 @@ +/* + * Generate initrd.size file for zSeries platforms. + * Takes an integer argument and writes out the binary representation of + * that value to the initrd.size file. + * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197773 + */ + +#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) { + 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]\n", basename(argv[0])); + printf("Example: %s 12288475 initrd.size\n", basename(argv[0])); + return 0; + } + + size = htonl(atoi(argv[1])); + fd = open(argv[2], O_CREAT | O_RDWR, mode); + + if (write(fd, &zero, sizeof(int)) == -1) { + perror("writing initrd.size (zero)"); + return errno; + } + + if (write(fd, &size, sizeof(int)) == -1) { + perror("writing initrd.size (size)"); + return errno; + } + + close(fd); + return 0; +} |