Coordinated appending of partition images with situations other than
isohybrid MBR production or partition offset.
This commit is contained in:
parent
b58d1e28ef
commit
1f486fd78b
@ -1615,6 +1615,11 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
} else {
|
} else {
|
||||||
system_area_options = opts->system_area_options & 0xfc;
|
system_area_options = opts->system_area_options & 0xfc;
|
||||||
}
|
}
|
||||||
|
if ((system_area_options & 0xfc) != 0)
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if (opts->appended_partitions[i] != NULL)
|
||||||
|
return ISO_NON_MBR_SYS_AREA;
|
||||||
|
|
||||||
target->system_area_data = NULL;
|
target->system_area_data = NULL;
|
||||||
if (system_area != NULL) {
|
if (system_area != NULL) {
|
||||||
target->system_area_data = calloc(32768, 1);
|
target->system_area_data = calloc(32768, 1);
|
||||||
|
@ -6357,7 +6357,11 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
|||||||
#define ISO_BAD_PARTITION_NO 0xE830FE8F
|
#define ISO_BAD_PARTITION_NO 0xE830FE8F
|
||||||
|
|
||||||
/** Cannot open data file for appended partition (FAILURE, HIGH, -370) */
|
/** Cannot open data file for appended partition (FAILURE, HIGH, -370) */
|
||||||
#define ISO_BAD_PARTITION_FILE 0xE830FE8E
|
#define ISO_BAD_PARTITION_FILE 0xE830FE8E
|
||||||
|
|
||||||
|
/** May not combine appended partition with non-MBR system area
|
||||||
|
(FAILURE, HIGH, -371) */
|
||||||
|
#define ISO_NON_MBR_SYS_AREA 0xE830FE8D
|
||||||
|
|
||||||
|
|
||||||
/* Internal developer note:
|
/* Internal developer note:
|
||||||
|
@ -357,6 +357,8 @@ const char *iso_error_to_msg(int errcode)
|
|||||||
return "Partition number out of range";
|
return "Partition number out of range";
|
||||||
case ISO_BAD_PARTITION_FILE:
|
case ISO_BAD_PARTITION_FILE:
|
||||||
return "Cannot open data file for appended partition";
|
return "Cannot open data file for appended partition";
|
||||||
|
case ISO_NON_MBR_SYS_AREA:
|
||||||
|
return "May not combine appended partition with non-MBR system area";
|
||||||
default:
|
default:
|
||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
}
|
}
|
||||||
|
@ -436,8 +436,9 @@ static int make_mips_volume_header(Ecma119Image *t, uint8_t *buf, int flag)
|
|||||||
doc/boot_sectors.txt section "MIPS Little Endian" which was derived
|
doc/boot_sectors.txt section "MIPS Little Endian" which was derived
|
||||||
by Thomas Schmitt from
|
by Thomas Schmitt from
|
||||||
cdrkit-1.1.10/genisoimage/boot-mipsel.c by Steve McIntyre which is based
|
cdrkit-1.1.10/genisoimage/boot-mipsel.c by Steve McIntyre which is based
|
||||||
on work of Florian Lohoff and Thiemo Seufer, and from <elf.h> by Free
|
on work of Florian Lohoff and Thiemo Seufer,
|
||||||
Software Foundation, Inc.
|
and from <elf.h> by Free Software Foundation, Inc.
|
||||||
|
|
||||||
Both functions are entirely under copyright (C) 2010 Thomas Schmitt.
|
Both functions are entirely under copyright (C) 2010 Thomas Schmitt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -566,7 +567,7 @@ static int make_mipsel_boot_block(Ecma119Image *t, uint8_t *buf, int flag)
|
|||||||
|
|
||||||
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||||
{
|
{
|
||||||
int ret, int_img_blocks, sa_type, i;
|
int ret, int_img_blocks, sa_type, i, will_append = 0;
|
||||||
uint32_t img_blocks;
|
uint32_t img_blocks;
|
||||||
|
|
||||||
if ((t == NULL) || (buf == NULL)) {
|
if ((t == NULL) || (buf == NULL)) {
|
||||||
@ -577,6 +578,12 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
memset(buf, 0, 16 * BLOCK_SIZE);
|
memset(buf, 0, 16 * BLOCK_SIZE);
|
||||||
|
|
||||||
sa_type = (t->system_area_options >> 2) & 0x3f;
|
sa_type = (t->system_area_options >> 2) & 0x3f;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if (t->appended_partitions[i] != NULL) {
|
||||||
|
will_append = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
img_blocks = t->curblock;
|
img_blocks = t->curblock;
|
||||||
if (t->system_area_data != NULL) {
|
if (t->system_area_data != NULL) {
|
||||||
/* Write more or less opaque boot image */
|
/* Write more or less opaque boot image */
|
||||||
@ -619,20 +626,28 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
t->partition_secs_per_head, 0, 1, 0x17, buf, 1);
|
t->partition_secs_per_head, 0, 1, 0x17, buf, 1);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
return ret;
|
return ret;
|
||||||
} else if(sa_type == 1) {
|
} else if (sa_type == 1) {
|
||||||
ret = make_mips_volume_header(t, buf, 0);
|
ret = make_mips_volume_header(t, buf, 0);
|
||||||
if (ret != ISO_SUCCESS)
|
if (ret != ISO_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
} else if(sa_type == 2) {
|
} else if (sa_type == 2) {
|
||||||
ret = make_mipsel_boot_block(t, buf, 0);
|
ret = make_mipsel_boot_block(t, buf, 0);
|
||||||
if (ret != ISO_SUCCESS)
|
if (ret != ISO_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
} else if(t->partition_offset > 0 && sa_type == 0) {
|
} else if ((t->partition_offset > 0 || will_append) && sa_type == 0) {
|
||||||
/* Write a simple partition table. */
|
/* Write a simple partition table. */
|
||||||
ret = make_grub_msdos_label(img_blocks, t->partition_secs_per_head,
|
ret = make_grub_msdos_label(img_blocks, t->partition_secs_per_head,
|
||||||
t->partition_heads_per_cyl, buf, 2);
|
t->partition_heads_per_cyl, buf, 2);
|
||||||
if (ret != ISO_SUCCESS) /* error should never happen */
|
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
|
if (t->partition_offset == 0) {
|
||||||
|
/* Re-write partion entry 1 : start at 0, type Linux */
|
||||||
|
ret = write_mbr_partition_entry(1, 0x83, 0, img_blocks,
|
||||||
|
t->partition_secs_per_head, t->partition_heads_per_cyl,
|
||||||
|
buf, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t->partition_offset > 0 && sa_type == 0) {
|
if (t->partition_offset > 0 && sa_type == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user