New option bits 8 and 9 with iso_write_opts_set_system_area().

This commit is contained in:
Thomas Schmitt 2011-03-03 19:14:40 +01:00
parent e035146e01
commit 43eae7502b
4 changed files with 26 additions and 9 deletions

View File

@ -1698,7 +1698,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
system_area = src->system_area_data; system_area = src->system_area_data;
system_area_options = src->system_area_options; system_area_options = src->system_area_options;
} else { } else {
system_area_options = opts->system_area_options & 0xfc; system_area_options = opts->system_area_options & 0xfffffffc;
} }
sa_type = (system_area_options >> 2) & 0x3f; sa_type = (system_area_options >> 2) & 0x3f;
if (sa_type != 0 && sa_type != 3) if (sa_type != 0 && sa_type != 3)
@ -2910,7 +2910,7 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
memcpy(opts->system_area_data, data, 32768); memcpy(opts->system_area_data, data, 32768);
} }
if (!(flag & 4)) if (!(flag & 4))
opts->system_area_options = options & 0xff; opts->system_area_options = options & 0x3ff;
return ISO_SUCCESS; return ISO_SUCCESS;
} }

View File

@ -575,19 +575,27 @@ struct ecma119_image
*/ */
char *system_area_data; char *system_area_data;
/* /*
* bit0= Only with PC-BIOS DOS MBR * bit0= Only with DOS MBR
* Make bytes 446 - 512 of the system area a partition * Make bytes 446 - 512 of the system area a partition
* table which reserves partition 1 from byte 63*512 to the * table which reserves partition 1 from byte 63*512 to the
* end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl. * end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl.
* (GRUB protective msdos label.) * (GRUB protective msdos label.)
* This works with and without system_area_data. * This works with and without system_area_data.
* bit1= Only with PC-BIOS DOS MBR * bit1= Only with DOS MBR
* Apply isohybrid MBR patching to the system area. * Apply isohybrid MBR patching to the system area.
* This works only with system_area_data plus ISOLINUX boot image * This works only with system_area_data plus ISOLINUX boot image
* and only if not bit0 is set. * and only if not bit0 is set.
* bit2-7= System area type * bit2-7= System area type
* 0= DOS MBR * 0= DOS MBR
* 1= MIPS Big Endian Volume Header * 1= MIPS Big Endian Volume Header
* 2= DEC Boot Block for MIPS Little Endian
* 3= SUN Disk Label for SUN SPARC
* bit8-9= Only with DOS MBR
* Cylinder alignment mode eventually pads the image to make it
* end at a cylinder boundary.
* 0 = auto (align if bit1)
* 1 = always align to cylinder boundary
* 2 = never align to cylinder boundary
*/ */
int system_area_options; int system_area_options;

View File

@ -1959,7 +1959,13 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
* iso_write_opts_set_partition_img() for partition numbers 2 * iso_write_opts_set_partition_img() for partition numbers 2
* to 8. * to 8.
* This will overwrite the first 512 bytes of the submitted * This will overwrite the first 512 bytes of the submitted
* data. * bit8-9= Only with System area type 0 = MBR
* @since 1.0.4
* Cylinder alignment mode eventually pads the image to make it
* end at a cylinder boundary.
* 0 = auto (align if bit1)
* 1 = always align to cylinder boundary
* 2 = never align to cylinder boundary
* @param flag * @param flag
* bit0 = invalidate any attached system area data. Same as data == NULL * bit0 = invalidate any attached system area data. Same as data == NULL
* (This re-activates eventually loaded image System Area data. * (This re-activates eventually loaded image System Area data.

View File

@ -841,17 +841,20 @@ int try_sph(off_t imgsize, int secs_per_head, int *heads_per_cyl, int flag)
int iso_align_isohybrid(Ecma119Image *t, int flag) int iso_align_isohybrid(Ecma119Image *t, int flag)
{ {
int sa_type, ret; int sa_type, ret, always_align;
uint32_t img_blocks; uint32_t img_blocks;
off_t imgsize, cylsize = 0, frac; off_t imgsize, cylsize = 0, frac;
sa_type = (t->system_area_options >> 2) & 0x3f; sa_type = (t->system_area_options >> 2) & 0x3f;
if (sa_type != 0) if (sa_type != 0)
return ISO_SUCCESS; return ISO_SUCCESS;
always_align = (t->system_area_options >> 8) & 3;
if (always_align >= 2)
return ISO_SUCCESS;
img_blocks = t->curblock; img_blocks = t->curblock;
imgsize = ((off_t) img_blocks) * (off_t) 2048; imgsize = ((off_t) img_blocks) * (off_t) 2048;
if ((t->system_area_options & 3) if (((t->system_area_options & 3) || always_align)
&& (off_t) (t->partition_heads_per_cyl * t->partition_secs_per_head && (off_t) (t->partition_heads_per_cyl * t->partition_secs_per_head
* 1024) * (off_t) 512 < imgsize) { * 1024) * (off_t) 512 < imgsize) {
/* Choose small values which can represent the image size */ /* Choose small values which can represent the image size */
@ -875,7 +878,7 @@ int iso_align_isohybrid(Ecma119Image *t, int flag)
} }
cylsize = 0; cylsize = 0;
if (sa_type == 0 && t->catalog != NULL && if (t->catalog != NULL &&
(t->catalog->bootimages[0]->isolinux_options & 0x0a) == 0x02) { (t->catalog->bootimages[0]->isolinux_options & 0x0a) == 0x02) {
/* Check for isolinux image with magic number of 3.72 and produce /* Check for isolinux image with magic number of 3.72 and produce
an MBR from our built-in template. (Deprecated since 31 Mar 2010) an MBR from our built-in template. (Deprecated since 31 Mar 2010)
@ -883,7 +886,7 @@ int iso_align_isohybrid(Ecma119Image *t, int flag)
if (img_blocks >= 0x40000000) if (img_blocks >= 0x40000000)
return ISO_SUCCESS; return ISO_SUCCESS;
cylsize = 64 * 32 * 512; cylsize = 64 * 32 * 512;
} else if (sa_type == 0 && (t->system_area_options & 2)) { } else if ((t->system_area_options & 2) || always_align) {
/* Patch externally provided system area as isohybrid MBR */ /* Patch externally provided system area as isohybrid MBR */
if (t->catalog == NULL || t->system_area_data == NULL) { if (t->catalog == NULL || t->system_area_data == NULL) {
/* isohybrid makes only sense together with ISOLINUX boot image /* isohybrid makes only sense together with ISOLINUX boot image