summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-11-07 11:13:16 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-12-02 08:28:09 -1000
commit801e763a66e13542a8d7b7afc55db918e57c83ba (patch)
treee39f46ca008317593fe5b4196c8f8490a693bc2e /utils
parent603f948666ca0cc0f9d889e3c60c76e15bf3cc0d (diff)
downloadanaconda-801e763a66e13542a8d7b7afc55db918e57c83ba.tar.gz
anaconda-801e763a66e13542a8d7b7afc55db918e57c83ba.tar.xz
anaconda-801e763a66e13542a8d7b7afc55db918e57c83ba.zip
Update mk-s390-cdboot.c to work with large kernel images (#184648)
IBM's update to mk-s390-cdboot.c to support large kernel images and large initrd images.
Diffstat (limited to 'utils')
-rw-r--r--utils/mk-s390-cdboot.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/utils/mk-s390-cdboot.c b/utils/mk-s390-cdboot.c
index 99d4fef7c..4a5825853 100644
--- a/utils/mk-s390-cdboot.c
+++ b/utils/mk-s390-cdboot.c
@@ -122,7 +122,8 @@ int main (int argc, char **argv) {
printf("writing kernel...\n");
while (1) {
- rc = fread(buffer, BUFFER_LEN, 1, fd2);
+ rc = fread(buffer, 1, 1, fd2);
+
if (rc == 0) {
break;
}
@@ -132,17 +133,23 @@ int main (int argc, char **argv) {
abort();
}
- wc = fwrite(buffer, BUFFER_LEN, 1, fd1);
+ wc = fwrite(buffer, 1, 1, fd1);
if (feof(fd1) || ferror(fd1)) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of kernel\n",
+ wc, rc);
+ }
}
printf("writing initrd...\n");
fseek(fd1, initrd_start, SEEK_SET);
while (1) {
- rc = fread(buffer, BUFFER_LEN, 1, fd3);
+ rc = fread(buffer, 1, 1, fd3);
+
if (rc == 0) {
break;
}
@@ -152,11 +159,16 @@ int main (int argc, char **argv) {
abort();
}
- wc = fwrite(buffer, BUFFER_LEN, 1, fd1);
+ wc = fwrite(buffer, 1, 1, fd1);
if (feof(fd1) || ferror(fd1)) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of initrd\n",
+ wc, rc);
+ }
}
if (fseek(fd3, 0, SEEK_END) == -1) {
@@ -175,12 +187,17 @@ int main (int argc, char **argv) {
abort();
}
- wc = fwrite(&start_psw_address, 4, 1, fd1);
+ wc = fwrite(&start_psw_address, 1, 4, fd1);
if (feof(fd1) || ferror(fd1)) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 4) {
+ fprintf(stderr, "could only write %i of %i bytes of PSW address\n",
+ wc, 4);
+ }
+
printf("writing initrd address and size...\n");
printf("INITRD start: 0x%016llx\n", initrd_start);
printf("INITRD size : 0x%016llx\n", initrd_size);
@@ -190,23 +207,33 @@ int main (int argc, char **argv) {
abort();
}
- wc = fwrite(&initrd_start, 8, 1, fd1);
+ wc = fwrite(&initrd_start, 1, 8, fd1);
if (feof(fd1) || ferror(fd1)) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD start\n",
+ wc, 8);
+ }
+
if (fseek(fd1, 0x10410, SEEK_SET) == -1) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
- wc = fwrite(&initrd_size, 8, 1, fd1);
+ wc = fwrite(&initrd_size, 1, 8, fd1);
if (feof(fd1) || ferror(fd1)) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD size\n",
+ wc, 8);
+ }
+
printf("writing parmfile...\n");
if (fseek(fd1, 0x10480, SEEK_SET) == -1) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
@@ -215,6 +242,7 @@ int main (int argc, char **argv) {
while (1) {
rc = fread(buffer, 1, 1, fd4);
+
if (rc == 0) {
break;
}
@@ -229,6 +257,11 @@ int main (int argc, char **argv) {
fprintf(stderr, "%s (%d): %s\n", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != 1) {
+ fprintf(stderr, "could only write %i of %i bytes of parmfile\n",
+ wc, 1);
+ }
}
if (fclose(fd1) == EOF) {