diff options
author | David Cantrell <dcantrell@redhat.com> | 2006-09-11 17:36:32 +0000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2006-09-11 17:36:32 +0000 |
commit | 0da38dfef15ae4417ccd0f29d27641a421d4a0bd (patch) | |
tree | 08758b7f47b1ca6169211b61819a74524184884a /utils | |
parent | df90e2d0817ff87209fc667ce4c4450a9e65141d (diff) | |
download | anaconda-0da38dfef15ae4417ccd0f29d27641a421d4a0bd.tar.gz anaconda-0da38dfef15ae4417ccd0f29d27641a421d4a0bd.tar.xz anaconda-0da38dfef15ae4417ccd0f29d27641a421d4a0bd.zip |
* utils/geninitrdsz.c: Added util to generate the initrd.size file
needed on zSeries (#197773).
* utils/Makefile: Compile geninitrdsz, install to anaconda-runtime.
* scripts/mk-images: Define GENINITRDSZ command.
* scripts/mk-images.s390: Generate initrd.size for each s390 tree
build.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Makefile | 8 | ||||
-rw-r--r-- | utils/geninitrdsz.c | 46 |
2 files changed, 52 insertions, 2 deletions
diff --git a/utils/Makefile b/utils/Makefile index 313f89723..ee5bc9994 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -19,7 +19,7 @@ endif everything: $(TARGET) -all: modlist moddeps snarffont mapshdr readmap +all: modlist moddeps snarffont mapshdr readmap geninitrdsz modlist: modlist.o moduleinfo.o $(CC) $(LDFLAGS) -o modlist modlist.o moduleinfo.o $(LOADLIBES) @@ -42,6 +42,9 @@ md5.o: md5.c md5.h hash.o : hash.c $(CC) $(RPMCFLAGS) -c -o $@ $< +geninitrdsz: geninitrdsz.c + $(CC) $(CFLAGS) -o $@ $< + depends: install: all @@ -54,9 +57,10 @@ install: all install -m755 modlist $(DESTDIR)/$(RUNTIMEDIR) install -m755 readmap $(DESTDIR)/$(RUNTIMEDIR) install -m755 mapshdr $(DESTDIR)/$(RUNTIMEDIR) + install -m755 geninitrdsz $(DESTDIR)/$(RUNTIMEDIR) clean: - rm -f modlist moddeps snarffont mapshdr readmap \ + rm -f modlist moddeps snarffont mapshdr readmap geninitrdsz \ moduledeps.c moduleinfo.c .depend *.o depend: diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c new file mode 100644 index 000000000..5b8b8048e --- /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; + + 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, S_IRUSR | S_IWUSR); + + 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; +} |