File s390-tools-sles11sp2-zipl-fix_scsi_dump.patch of Package s390-tools
Description: zipl: fix scsi dump.
Symptom: Scsi dump does not work on LPAR with "ERROR: Could not
enable dump device".
Problem: The machine loader needs to find a gap in memory to store
some internal information after the first bootmap entry.
The current implementation leaves no space between first
and second entry.
Solution: Put the stage 3 loader as first entry into the bootmap.
---
zipl/src/bootmap.c | 74 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 42 insertions(+), 32 deletions(-)
--- a/zipl/src/bootmap.c
+++ b/zipl/src/bootmap.c
@@ -464,6 +464,46 @@ add_ipl_program(int fd, struct job_ipl_d
/* Fill in component table header */
create_component_header(VOID_ADD(table, offset), type);
offset += sizeof(struct component_header);
+ /*
+ * Workaround for machine loader bug
+ * need to define the stage 3 loader at first position in the bootmap
+ * file
+ */
+ /* initiate values for ramdisk */
+ stats.st_size = 0;
+ if (ipl->ramdisk != NULL) {
+ /* Add ramdisk */
+ if (verbose) {
+ printf(" initial ramdisk...: %s\n", ipl->ramdisk);
+ }
+ /* Get ramdisk file size */
+ if (stat(ipl->ramdisk, &stats)) {
+ error_reason(strerror(errno));
+ error_text("Could not get information for file '%s'",
+ ipl->ramdisk);
+ free(table);
+ return -1;
+ }
+ }
+ /* Add stage 3 loader to bootmap */
+ rc = boot_get_stage3(&stage3, &stage3_size, ipl->parm_addr,
+ ipl->ramdisk_addr, (size_t) stats.st_size,
+ ipl->image_addr,
+ (info->type == disk_type_scsi) ? 0 : 1);
+ if (rc) {
+ free(table);
+ return rc;
+ }
+ rc = add_component_buffer(fd, stage3, stage3_size,
+ DEFAULT_STAGE3_ADDRESS,
+ VOID_ADD(table, offset), info, &comp_loc[3]);
+ free(stage3);
+ if (rc) {
+ error_text("Could not add stage 3 boot loader");
+ free(table);
+ return -1;
+ }
+ offset += sizeof(struct component_entry);
/* Add kernel image */
if (verbose) {
printf(" kernel image......: %s\n", ipl->image);
@@ -495,20 +535,9 @@ add_ipl_program(int fd, struct job_ipl_d
}
offset += sizeof(struct component_entry);
}
- stats.st_size = 0;
+
+ /* finally add ramdisk */
if (ipl->ramdisk != NULL) {
- /* Add ramdisk */
- if (verbose) {
- printf(" initial ramdisk...: %s\n", ipl->ramdisk);
- }
- /* Get ramdisk file size */
- if (stat(ipl->ramdisk, &stats)) {
- error_reason(strerror(errno));
- error_text("Could not get information for file '%s'",
- ipl->ramdisk);
- free(table);
- return -1;
- }
rc = add_component_file(fd, ipl->ramdisk,
ipl->ramdisk_addr, 0,
VOID_ADD(table, offset),
@@ -521,25 +550,6 @@ add_ipl_program(int fd, struct job_ipl_d
}
offset += sizeof(struct component_entry);
}
- /* Add stage 3 loader to bootmap */
- rc = boot_get_stage3(&stage3, &stage3_size, ipl->parm_addr,
- ipl->ramdisk_addr, (size_t) stats.st_size,
- ipl->image_addr,
- (info->type == disk_type_scsi) ? 0 : 1);
- if (rc) {
- free(table);
- return rc;
- }
- rc = add_component_buffer(fd, stage3, stage3_size,
- DEFAULT_STAGE3_ADDRESS,
- VOID_ADD(table, offset), info, &comp_loc[3]);
- free(stage3);
- if (rc) {
- error_text("Could not add stage 3 boot loader");
- free(table);
- return -1;
- }
- offset += sizeof(struct component_entry);
if (verbose)
print_components(comp_name, comp_loc, 4);
/* Terminate component table */