From e74b04a1e78ec4c811a5b02c251b4090da17ff5f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 24 Aug 2017 12:23:25 +0200 Subject: [PATCH] Issue iso_mbr_part_type info with -report_system_area "cmd" and "as_mkisofs" --- xorriso/iso_img.c | 19 ++++++++++++++++++- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index 548e7bf6..d74aed34 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -1647,9 +1647,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, int cared_for_sparc= 0, have_hfsplus= 0; int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0; int have_protective_msdos= 0, appended_partition= 0, part_like_isohybrid= 0; + int iso_mbr_part_type= -1; unsigned int prev_pltf= 0; unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks; - unsigned long int part_status, part_type, start_block; + unsigned long int part_status, part_type, start_block, partition_offset= 0; uint32_t high_block= 0; char name[24], *textpt, *contentpt, *buf= NULL; char **lines= NULL; @@ -1747,6 +1748,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, } else if(strcmp(name, "ISO image size/512 :") == 0) { img_blocks= num[0]; + } else if(strcmp(name, "Partition offset :") == 0 && + (num[0] == 0 || num[0] == 16)) { + partition_offset= num[0]; + } } @@ -1895,6 +1900,9 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, mbrpts[idx].block_count= num_blocks; if(num_blocks > 0 && start_block + num_blocks > mbr_parts_end) mbr_parts_end= start_block + num_blocks; + if(start_block == partition_offset * 4 && + (start_block + num_blocks) >= high_block * 4 && iso_mbr_part_type < 0) + iso_mbr_part_type = part_type; } else if(strcmp(name, "MBR partition path :") == 0) { idx= num[0] - 1; @@ -2413,6 +2421,15 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, Xorriso_record_cmd_linE did_sysarea= 1; } + if(iso_mbr_part_type >= 0) { + if(mkisofs) + sprintf(buf, "-iso_mbr_part_type 0x%2.2x", + (unsigned int) iso_mbr_part_type); + else + sprintf(buf, "-boot_image any iso_mbr_part_type=0x%2.2x", + (unsigned int) iso_mbr_part_type); + Xorriso_record_cmd_linE + } /* Issue commands related to El Torito */ if(elto_count <= 0) diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 8cca48ef..eb365081 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2017.08.07.134036" +#define Xorriso_timestamP "2017.08.24.102256"