zipl/src: Reuse data of file components in bootmap

If the option '--add-files' is specified, don't duplicate data of
components added via add_component_file() and friends to bootmap
file for each mirror. Instead, reuse the data that were added when
preparing a program table for the first mirror to create metadata
(block lists, program tables, etc) specific for other mirrors.


Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2025-08-27 14:16:42 +02:00
committed by Steffen Eiden
parent 731f00202c
commit 431e4542ca
2 changed files with 30 additions and 5 deletions

View File

@@ -80,6 +80,7 @@ struct install_set {
int nr_menu_entries;
struct misc_fd mfd;
struct install_set_mirror mirrors[MAX_TARGETS];
struct file_range comp_reg[NR_PROGRAM_COMPONENTS];
char *filename;
unsigned int skip_prepare_device:1;
unsigned int tmp_filename_created:1;

View File

@@ -376,15 +376,26 @@ static int add_component_file_range(struct install_set *bis,
}
size -= trailer;
/* Write buffer */
*count = disk_write_block_buffer(&bis->mfd, 0, buffer,
size, list,
bis->info->fs_block_size,
info);
*count = disk_write_block_buffer_align(&bis->mfd,
0 /* not a base disk */,
buffer, size, list,
bis->info->fs_block_size,
info,
info->phy_block_size,
/*
* save component offset
*/
&bis->comp_reg
[comp_id].offset);
free(buffer);
if (*count == 0) {
error_text("Could not write to bootmap file");
return -1;
}
/* zero offset is occupied by bootmap header */
assert(bis->comp_reg[comp_id].offset > 0);
/* save component size */
bis->comp_reg[comp_id].len = size;
} else {
if (!file_is_on_device(filename, bis->info)) {
error_reason("File is not on target device");
@@ -423,7 +434,20 @@ static int add_component_file(struct install_set *bis, const char *filename,
void *component, int add_files, int comp_id,
int menu_idx, int mirror_id, int program_table_id)
{
return add_component_file_range(bis, filename, NULL, load_address,
struct file_range *reg = NULL;
if (add_files &&
bis->comp_reg[comp_id].offset > 0) {
/*
* The file has been already written to the bootmap.
* Use the respective region in the bootmap file to
* add the component
*/
filename = bis->filename;
reg = &bis->comp_reg[comp_id];
add_files = 0;
}
return add_component_file_range(bis, filename, reg, load_address,
trailer, component, add_files,
comp_id, menu_idx, mirror_id,
program_table_id);