FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 11-07-2008, 07:55 PM
David Cantrell
 
Default 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.
---
utils/mk-s390-cdboot.c | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/utils/mk-s390-cdboot.c b/utils/mk-s390-cdboot.c
index 99d4fef..a9484cf 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...
");
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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of kernel
",
+ wc, rc);
+ }
}

printf("writing initrd...
");
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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of initrd
",
+ 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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 4) {
+ fprintf(stderr, "could only write %i of %i bytes of PSW address
",
+ wc, 4);
+ }

printf("writing initrd address and size...
");
printf("INITRD start: 0x%016llx
", 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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD start
",
+ wc, 8);
+ }

if (fseek(fd1, 0x10410, SEEK_SET) == -1) {
fprintf(stderr, "%s (%d): %s
", __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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD size
",
+ wc, 8);
+ }

printf("writing parmfile...
");
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
", __func__, __LINE__, strerror(errno));
abort();
}
+ if (wc != 1) {
+ fprintf(stderr, "could only write %i of %i bytes of parmfile
",
+ wc, 1);
+ }
}

if (fclose(fd1) == EOF) {
--
1.6.0.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 12-01-2008, 09:03 PM
David Cantrell
 
Default 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.
---
utils/mk-s390-cdboot.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/utils/mk-s390-cdboot.c b/utils/mk-s390-cdboot.c
index 99d4fef..4a58258 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...
");
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
", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of kernel
",
+ wc, rc);
+ }
}

printf("writing initrd...
");
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
", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != rc) {
+ fprintf(stderr, "could only write %i of %i bytes of initrd
",
+ 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
", __func__, __LINE__, strerror(errno));
abort();
}

+ if (wc != 4) {
+ fprintf(stderr, "could only write %i of %i bytes of PSW address
",
+ wc, 4);
+ }
+
printf("writing initrd address and size...
");
printf("INITRD start: 0x%016llx
", initrd_start);
printf("INITRD size : 0x%016llx
", 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
", __func__, __LINE__, strerror(errno));
abort();
}

+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD start
",
+ wc, 8);
+ }
+
if (fseek(fd1, 0x10410, SEEK_SET) == -1) {
fprintf(stderr, "%s (%d): %s
", __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
", __func__, __LINE__, strerror(errno));
abort();
}

+ if (wc != 8) {
+ fprintf(stderr, "could only write %i of %i bytes of INITRD size
",
+ wc, 8);
+ }
+
printf("writing parmfile...
");
if (fseek(fd1, 0x10480, SEEK_SET) == -1) {
fprintf(stderr, "%s (%d): %s
", __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
", __func__, __LINE__, strerror(errno));
abort();
}
+
+ if (wc != 1) {
+ fprintf(stderr, "could only write %i of %i bytes of parmfile
",
+ wc, 1);
+ }
}

if (fclose(fd1) == EOF) {
--
1.6.0.3

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

Thread Tools




All times are GMT. The time now is 08:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org