summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-11-07 10:47:44 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-11-07 10:47:44 -1000
commit5ae46bdce0f4d6bde846b17cf7466ddefac57af0 (patch)
tree71af4a0a3e9530a509cfc67f01b8d707b7701a45
parent4a66d6ef1b2bb8e523285541fcd91ebdb3fbac38 (diff)
downloadanaconda-5ae46bdce0f4d6bde846b17cf7466ddefac57af0.tar.gz
anaconda-5ae46bdce0f4d6bde846b17cf7466ddefac57af0.tar.xz
anaconda-5ae46bdce0f4d6bde846b17cf7466ddefac57af0.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.
-rw-r--r--utils/mk-s390-cdboot.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/utils/mk-s390-cdboot.c b/utils/mk-s390-cdboot.c
index 99d4fef7c..a9484cfec 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,22 @@ 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 +158,15 @@ 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,11 +185,15 @@ 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);
@@ -190,22 +204,29 @@ 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) {
@@ -215,6 +236,7 @@ int main (int argc, char **argv) {
while (1) {
rc = fread(buffer, 1, 1, fd4);
+
if (rc == 0) {
break;
}
@@ -229,6 +251,10 @@ 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) {