New API calls iso_image_set_sparc_core() and iso_image_get_sparc_core().

This commit is contained in:
Thomas Schmitt 2013-04-13 22:17:26 +02:00
parent 439a14da1d
commit 83cb07b23c
9 changed files with 109 additions and 5 deletions

View File

@ -2,6 +2,11 @@ bzr branch lp:libisofs/for-libisoburn (to become libisofs-1.3.0.tar.gz)
===============================================================================
* Bug fix: Unspecified Expiration Time and Effective Time of ISO volume was
represented by 0-bytes rather than ASCII '0' digits.
* Bug fix: Reserved and unused fields of APM entries were not zeroed.
* New option bits with el_torito_set_isolinux_options() and
iso_write_opts_set_system_area() to control GRUB2 patching of
boot image and MBR.
* New API calls iso_image_set_sparc_core() and iso_image_get_sparc_core().
libisofs-1.2.8.tar.gz Mon Mar 18 2013

View File

@ -990,6 +990,14 @@ int ecma119_writer_create(Ecma119Image *target)
return ret;
}
if (target->image->sparc_core_node != NULL) {
/* Obtain a duplicate of the IsoFile's Ecma119Node->file */
ret = iso_file_src_create(target, target->image->sparc_core_node,
&target->sparc_core_src);
if (ret < 0)
return ret;
}
if(target->partition_offset > 0) {
/* Create second tree */
target->eff_partition_offset = target->partition_offset;
@ -1882,6 +1890,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->mipsel_p_vaddr = 0;
target->mipsel_p_filesz = 0;
target->sparc_core_src = NULL;
target->empty_file_block = 0;
target->tree_end_block = 0;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2012 Thomas Schmitt
* Copyright (c) 2009 - 2013 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -825,6 +825,11 @@ struct ecma119_image
uint32_t mipsel_p_vaddr;
uint32_t mipsel_p_filesz;
/* A data file of which the position and size shall be written after
a SUN Disk Label.
*/
IsoFileSrc *sparc_core_src;
char *appended_partitions[ISO_MAX_PARTITIONS];
uint8_t appended_part_types[ISO_MAX_PARTITIONS];
/* Counted in blocks of 2048 */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2012 Thomas Schmitt
* Copyright (c) 2009 - 2013 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -83,6 +83,7 @@ int iso_image_new(const char *name, IsoImage **image)
img->num_mips_boot_files = 0;
for (i = 0; i < 15; i++)
img->mips_boot_file_paths[i] = NULL;
img->sparc_core_node = NULL;
img->builder_ignore_acl = 1;
img->builder_ignore_ea = 1;
img->inode_counter = 0;
@ -136,6 +137,8 @@ void iso_image_unref(IsoImage *image)
iso_filesystem_unref(image->fs);
el_torito_boot_catalog_free(image->bootcat);
iso_image_give_up_mips_boot(image, 0);
if (image->sparc_core_node != NULL)
iso_node_unref((IsoNode *) image->sparc_core_node);
free(image->volset_id);
free(image->volume_id);
free(image->publisher_id);
@ -767,3 +770,24 @@ int iso_image_hfsplus_get_blessed(IsoImage *img, IsoNode ***blessed_nodes,
return 1;
}
/* API */
int iso_image_set_sparc_core(IsoImage *img, IsoFile *sparc_core, int flag)
{
if (img->sparc_core_node != NULL)
iso_node_unref((IsoNode *) img->sparc_core_node);
img->sparc_core_node = sparc_core;
if (sparc_core != NULL)
iso_node_ref((IsoNode *) sparc_core);
return 1;
}
/* API */
int iso_image_get_sparc_core(IsoImage *img, IsoFile **sparc_core, int flag)
{
*sparc_core = img->sparc_core_node;
return 1;
}

View File

@ -69,6 +69,10 @@ struct Iso_Image
int num_mips_boot_files;
char *mips_boot_file_paths[15]; /* ISO 9660 Rock Ridge Paths */
/* A data file of which the position and size shall be written after
a SUN Disk Label.
*/
IsoFile *sparc_core_node;
/* image identifier, for message origin identifier */
int id;

View File

@ -2156,23 +2156,25 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
* bit2-7= System area type
* 0= with bit0 or bit1: MBR
* else: unspecified type which will be used unaltered.
* @since 0.6.38
* 1= MIPS Big Endian Volume Header
* @since 0.6.38
* Submit up to 15 MIPS Big Endian boot files by
* iso_image_add_mips_boot_file().
* This will overwrite the first 512 bytes of the submitted
* data.
* 2= DEC Boot Block for MIPS Little Endian
* @since 0.6.38
* The first boot file submitted by
* iso_image_add_mips_boot_file() will be activated.
* This will overwrite the first 512 bytes of the submitted
* data.
* @since 0.6.40
* 3= SUN Disk Label for SUN SPARC
* @since 0.6.40
* Submit up to 7 SPARC boot images by
* iso_write_opts_set_partition_img() for partition numbers 2
* to 8.
* 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
@ -3656,6 +3658,41 @@ int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag);
*/
int iso_image_give_up_mips_boot(IsoImage *image, int flag);
/**
* Designate a data file in the ISO image of which the position and size
* shall be written after the SUN Disk Label. The position is written as
* 64-bit big-endian number to byte position 0x228. The size is written
* as 32-bit big-endian to 0x230.
* This setting has an effect only if system area type is set to 3
* with iso_write_opts_set_system_area().
*
* @param img
* The image to be manipulated.
* @param sparc_core
* The IsoFile which shall be mentioned after the SUN Disk label.
* NULL is a permissible value. It disables this feature.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 is success , <0 means error
* @since 1.3.0
*/
int iso_image_set_sparc_core(IsoImage *img, IsoFile *sparc_core, int flag);
/**
* Obtain the current setting of iso_image_set_sparc_core().
*
* @param img
* The image to be inquired.
* @param sparc_core
* Will return a pointer to the IsoFile (or NULL, which is not an error)
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 is success , <0 means error
* @since 1.3.0
*/
int iso_image_get_sparc_core(IsoImage *img, IsoFile **sparc_core, int flag);
/**
* Increments the reference counting of the given node.

View File

@ -101,6 +101,7 @@ iso_image_get_publisher_id;
iso_image_get_pvd_times;
iso_image_get_root;
iso_image_get_session_md5;
iso_image_get_sparc_core;
iso_image_get_system_area;
iso_image_get_system_id;
iso_image_get_volset_id;
@ -122,6 +123,7 @@ iso_image_set_copyright_file_id;
iso_image_set_data_preparer_id;
iso_image_set_ignore_aclea;
iso_image_set_publisher_id;
iso_image_set_sparc_core;
iso_image_set_system_id;
iso_image_set_volset_id;
iso_image_set_volume_id;

View File

@ -691,7 +691,8 @@ static int write_sun_partition_entry(int partition_number,
*/
static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag)
{
int ret;
int ret, i;
uint64_t blk;
/* Bytes 512 to 32767 may come from image or external file */
memset(buf, 0, 512);
@ -733,6 +734,16 @@ static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag)
/* 508 - 509 | 0xdabe | Magic Number */
iso_msb(buf + 508, 0xdabe, 2);
if (t->sparc_core_src != NULL) {
/* May be used for grub-sparc. */
blk= ((uint64_t) t->sparc_core_src->sections[0].block) *
(uint64_t) 2048;
for (i = 0; i < 8; i++)
buf[Libisofs_grub2_sparc_patch_lba_poS + i] = blk >> ((7 - i) * 8);
iso_msb(buf + Libisofs_grub2_sparc_patch_size_poS,
t->sparc_core_src->sections[0].size, 4);
}
/* Set partition 1 to describe ISO image and compute checksum */
t->appended_part_start[0] = 0;
t->appended_part_size[0] = t->curblock;

View File

@ -273,4 +273,10 @@ void iso_ascii_utf_16le(uint8_t gap_name[72]);
#define Libisofs_grub2_mbr_patch_poS 0x1b0
#define Libisofs_grub2_mbr_patch_offsT 4
/* Parameters of SUN Disk Label patching for GRUB2
See API iso_image_set_sparc_core().
*/
#define Libisofs_grub2_sparc_patch_lba_poS 0x228
#define Libisofs_grub2_sparc_patch_size_poS 0x230
#endif /* SYSTEM_AREA_H_ */