From 8d7df2b2ff865372141e21214aa79ed1cbf67296 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 6 Apr 2010 12:51:15 +0000 Subject: [PATCH] New API call isoburn_igopt_set_system_area() --- libisoburn/isoburn.c | 42 +++++++++++++++++++++++++++++++++++++ libisoburn/isoburn.h | 14 +++++++++++++ libisoburn/libisoburn.h | 23 ++++++++++++++++++++ xorriso/xorriso_timestamp.h | 2 +- 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index 6416e685..48a10a43 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -449,6 +449,14 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d, iso_write_opts_set_default_gid(wopts, opts->gid); iso_write_opts_set_output_charset(wopts, opts->output_charset); iso_write_opts_set_fifo_size(wopts, fifo_chunks); + ret = iso_write_opts_set_system_area(wopts, opts->system_area_data, + opts->system_area_options, 0); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot set content of System Area", + 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa); opts->effective_lba= nwa; @@ -850,6 +858,8 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag) o->fifo_size= 4*1024*1024; o->effective_lba= -1; o->data_start_lba= -1; + o->system_area_data= NULL; + o->system_area_options= 0; return(1); } @@ -1061,3 +1071,35 @@ int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, return(1); } + +int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *opts, + char data[32768], int options) +{ + if (data == NULL) { /* Disable */ + if (opts->system_area_data != NULL) + free(opts->system_area_data); + opts->system_area_data = NULL; + } else { + if (opts->system_area_data == NULL) { + opts->system_area_data = calloc(32768, 1); + if (opts->system_area_data == NULL) + return(-1); + } + memcpy(opts->system_area_data, data, 32768); + } + opts->system_area_options = options & 1; + return(1); +} + + +int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *opts, + char data[32768], int *options) +{ + *options= opts->system_area_options; + if(opts->system_area_data == NULL) + return(0); + memcpy(data, opts->system_area_data, 32768); + return(1); +} + + diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index 9673a78e..c6236123 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -488,6 +488,20 @@ struct isoburn_imgen_opts { char scdbackup_tag_time[19]; char *scdbackup_tag_written; + + /* Content of an embedded boot image. Valid if not NULL. + * In that case it must point to a memory buffer at least 32 kB. + */ + char *system_area_data; + /* + * bit0= make bytes 446 - 512 of the system area a partition + * table which reserves partition 1 from byte 63*512 to the + * end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl. + * (GRUB protective msdos label.) + * This works with and without system_area_data. + */ + int system_area_options; + }; diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 019ce00e..40754b58 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -1167,6 +1167,29 @@ int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, char **tag_written); +/** Attach 32 kB of binary data which shall get written to the first 32 kB + of the ISO image, the System Area. + options can cause manipulations of these data before writing happens. + If system area data are giveni or options bit0 is set, then bit1 of + el_torito_set_isolinux_options() is automatically disabled. + @since 0.5.4 + @param o The option set to work on + @param data Either NULL or 32 kB of data. Do not submit less bytes ! + @param options Can cause manipulations of submitted data before they + get written: + bit0= apply a --protective-msdos-label as of grub-mkisofs. + This means to patch bytes 446 to 512 of the system + area so that one partition is defined which begins + at the second 512-byte block of the image and ends + where the image ends. + @return 1 success, 0 no data to get, <0 failure +*/ +int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o, + char data[32768], int options); +int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o, + char data[32768], int *options); + + /* ----------------------------------------------------------------------- */ /* End of Options for image generation */ /* ----------------------------------------------------------------------- */ diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index b02c58db..74043242 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.04.05.192817" +#define Xorriso_timestamP "2010.04.06.125013"