xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

eltorito.c File Reference
#include "libisofs.h"
#include "eltorito.h"
#include "fsource.h"
#include "filesrc.h"
#include "image.h"
#include "messages.h"
#include "writer.h"
#include "ecma119.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for eltorito.c:

Go to the source code of this file.

Data Structures

struct  boot_info_table
 
struct  partition_desc
 
struct  hard_disc_mbr
 
struct  catalog_stream
 

Functions

int el_torito_set_boot_platform_id (ElToritoBootImage *bootimg, uint8_t id)
 
int el_torito_get_boot_platform_id (ElToritoBootImage *bootimg)
 
void el_torito_set_load_seg (ElToritoBootImage *bootimg, short segment)
 
int el_torito_get_load_seg (ElToritoBootImage *bootimg)
 
void el_torito_set_load_size (ElToritoBootImage *bootimg, short sectors)
 
int el_torito_get_load_size (ElToritoBootImage *bootimg)
 
void el_torito_set_full_load (ElToritoBootImage *bootimg, int mode)
 
int el_torito_get_full_load (ElToritoBootImage *bootimg)
 
void el_torito_set_no_bootable (ElToritoBootImage *bootimg)
 
int el_torito_get_bootable (ElToritoBootImage *bootimg)
 
int el_torito_set_id_string (ElToritoBootImage *bootimg, uint8_t id_string[28])
 
int el_torito_get_id_string (ElToritoBootImage *bootimg, uint8_t id_string[28])
 
int el_torito_set_selection_crit (ElToritoBootImage *bootimg, uint8_t crit[20])
 
int el_torito_get_selection_crit (ElToritoBootImage *bootimg, uint8_t crit[20])
 
int el_torito_seems_boot_info_table (ElToritoBootImage *bootimg, int flag)
 
void el_torito_patch_isolinux_image (ElToritoBootImage *bootimg)
 
int el_torito_set_isolinux_options (ElToritoBootImage *bootimg, int options, int flag)
 
int el_torito_get_isolinux_options (ElToritoBootImage *bootimg, int flag)
 
int el_torito_get_boot_media_type (ElToritoBootImage *bootimg, enum eltorito_boot_media_type *media_type)
 
static int iso_tree_add_boot_node (IsoDir *parent, const char *name, IsoBoot **boot)
 
static void iso_parse_start_size (char *text, unsigned long *part_start, unsigned long *part_size)
 
static int create_image (IsoImage *image, const char *image_path, enum eltorito_boot_media_type type, struct el_torito_boot_image **bootimg, IsoFile **bootnode)
 
int iso_image_set_boot_image (IsoImage *image, const char *image_path, enum eltorito_boot_media_type type, const char *catalog_path, ElToritoBootImage **boot)
 
int iso_image_get_boot_image (IsoImage *image, ElToritoBootImage **boot, IsoFile **imgnode, IsoBoot **catnode)
 
int iso_image_get_bootcat (IsoImage *image, IsoBoot **catnode, uint32_t *lba, char **content, off_t *size)
 
int iso_image_get_all_boot_imgs (IsoImage *image, int *num_boots, ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag)
 
void iso_image_remove_boot_image (IsoImage *image)
 
int iso_image_add_boot_image (IsoImage *image, const char *image_path, enum eltorito_boot_media_type type, int flag, ElToritoBootImage **boot)
 
int iso_image_set_boot_catalog_weight (IsoImage *image, int sort_weight)
 
int iso_image_set_boot_catalog_hidden (IsoImage *image, int hide_attrs)
 
void el_torito_boot_catalog_free (struct el_torito_boot_catalog *cat)
 
static void write_validation_entry (uint8_t *buf, uint8_t platform_id, uint8_t id_string[24])
 
static void write_section_header (uint8_t *buf, Ecma119Image *t, int idx, int num_entries)
 
static int write_section_load_size (struct el_torito_boot_image *img, struct el_torito_section_entry *se, uint16_t load_size, off_t full_byte_size, int flag)
 
static int write_section_entry (uint8_t *buf, Ecma119Image *t, int idx)
 
static int catalog_open (IsoStream *stream)
 
static int catalog_close (IsoStream *stream)
 
static off_t catalog_get_size (IsoStream *stream)
 
static int catalog_read (IsoStream *stream, void *buf, size_t count)
 
static int catalog_is_repeatable (IsoStream *stream)
 
static void catalog_get_id (IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)
 
static void catalog_free (IsoStream *stream)
 
static int catalog_stream_new (Ecma119Image *target, IsoStream **stream)
 
int el_torito_catalog_file_src_create (Ecma119Image *target, IsoFileSrc **src)
 
int make_boot_info_table (uint8_t *buf, uint32_t pvd_lba, uint32_t boot_lba, uint32_t imgsize)
 
static int patch_boot_info_table (uint8_t *buf, Ecma119Image *t, size_t imgsize, int idx)
 
static int patch_grub2_boot_image (uint8_t *buf, Ecma119Image *t, size_t imgsize, int idx, size_t pos, int offst)
 
int iso_patch_eltoritos (Ecma119Image *t)
 
static int eltorito_writer_compute_data_blocks (IsoImageWriter *writer)
 
static int eltorito_writer_write_vol_desc (IsoImageWriter *writer)
 
static int eltorito_writer_write_data (IsoImageWriter *writer)
 
static int eltorito_writer_free_data (IsoImageWriter *writer)
 
int eltorito_writer_create (Ecma119Image *target)
 

Variables

IsoStreamIface catalog_stream_class
 

Function Documentation

◆ catalog_close()

static int catalog_close ( IsoStream stream)
static

◆ catalog_free()

static void catalog_free ( IsoStream stream)
static

Definition at line 1143 of file eltorito.c.

References iso_stream::data.

◆ catalog_get_id()

static void catalog_get_id ( IsoStream stream,
unsigned int *  fs_id,
dev_t *  dev_id,
ino_t *  ino_id 
)
static

fs_id will be the id reserved for El-Torito dev_id will be 0 for catalog, 1 for boot image (if needed) ino_id 0 is supposed to be unique. At write time it will get assigned an automatic file serial number in the ISO, if needed.

Definition at line 1134 of file eltorito.c.

References ISO_ELTORITO_FS_ID.

◆ catalog_get_size()

static off_t catalog_get_size ( IsoStream stream)
static

Definition at line 1094 of file eltorito.c.

References BLOCK_SIZE.

◆ catalog_is_repeatable()

static int catalog_is_repeatable ( IsoStream stream)
static

Definition at line 1122 of file eltorito.c.

◆ catalog_open()

◆ catalog_read()

static int catalog_read ( IsoStream stream,
void *  buf,
size_t  count 
)
static

◆ catalog_stream_new()

static int catalog_stream_new ( Ecma119Image target,
IsoStream **  stream 
)
static

◆ create_image()

◆ el_torito_boot_catalog_free()

◆ el_torito_catalog_file_src_create()

int el_torito_catalog_file_src_create ( Ecma119Image target,
IsoFileSrc **  src 
)

Create a IsoFileSrc for writing the el-torito catalog for the given target, and add it to target. If the target already has a src for the catalog, it just returns.

Definition at line 1199 of file eltorito.c.

References ecma119_image::cat, ecma119_image::catalog, catalog_stream_new(), Iso_File_Src::checksum_index, iso_file_src_add(), ISO_OUT_OF_MEM, iso_stream_unref(), ISO_SUCCESS, Iso_File_Src::no_write, Iso_File_Src::nsections, Iso_File_Src::sections, el_torito_boot_catalog::sort_weight, Iso_File_Src::sort_weight, Iso_File_Src::stream, and catalog_stream::target.

Referenced by create_boot_cat(), create_node(), create_tree(), and eltorito_writer_create().

◆ el_torito_get_boot_media_type()

int el_torito_get_boot_media_type ( ElToritoBootImage bootimg,
enum eltorito_boot_media_type media_type 
)

Get the boot media type as of parameter "type" of iso_image_set_boot_image() or iso_image_add_boot_image().

Parameters
bootimgThe image to inquire
media_typeReturns the media type
Returns
1 = ok , < 0 = error
Since
0.6.32

Definition at line 237 of file eltorito.c.

References ELTORITO_FLOPPY_EMUL, ELTORITO_HARD_DISC_EMUL, ELTORITO_NO_EMUL, ISO_ASSERT_FAILURE, ISO_WRONG_ARG_VALUE, and el_torito_boot_image::type.

Referenced by Xorriso_boot_image_status().

◆ el_torito_get_boot_platform_id()

int el_torito_get_boot_platform_id ( ElToritoBootImage bootimg)

Get the platform ID value. See el_torito_set_boot_platform_id().

Parameters
bootimgThe image to inquire
Returns
0 - 255 : The platform ID < 0 : error
Since
0.6.32

Definition at line 73 of file eltorito.c.

References el_torito_boot_image::platform_id.

Referenced by Xorriso__append_boot_params(), Xorriso_boot_image_status(), and Xorriso_set_isolinux_options().

◆ el_torito_get_bootable()

int el_torito_get_bootable ( ElToritoBootImage bootimg)

Get the bootability flag. See el_torito_set_no_bootable().

Parameters
bootimgThe image to inquire
Returns
0 = not bootable, 1 = bootable , <0 = error
Since
0.6.32

Definition at line 143 of file eltorito.c.

References el_torito_boot_image::bootable.

◆ el_torito_get_full_load()

int el_torito_get_full_load ( ElToritoBootImage bootimg)

Inquire the setting of el_torito_set_full_load().

Parameters
bootimgThe image to inquire
Returns
The mode set with el_torito_set_full_load().

Definition at line 128 of file eltorito.c.

References el_torito_boot_image::load_size_full.

◆ el_torito_get_id_string()

int el_torito_get_id_string ( ElToritoBootImage bootimg,
uint8_t  id_string[28] 
)

Get the id_string as of el_torito_set_id_string().

Parameters
bootimgThe image to inquire
id_stringReturns 28 bytes of id string
Returns
1 = ok , <0 = error
Since
0.6.32

Definition at line 156 of file eltorito.c.

References el_torito_boot_image::id_string.

Referenced by Xorriso_boot_image_status().

◆ el_torito_get_isolinux_options()

int el_torito_get_isolinux_options ( ElToritoBootImage bootimg,
int  flag 
)

Get the options as of el_torito_set_isolinux_options().

Parameters
bootimgThe image to inquire
flagReserved for future usage, set to 0.
Returns
>= 0 returned option bits , <0 = error
Since
0.6.32

Definition at line 231 of file eltorito.c.

References el_torito_boot_image::isolinux_options.

Referenced by Xorriso_boot_image_status().

◆ el_torito_get_load_seg()

int el_torito_get_load_seg ( ElToritoBootImage bootimg)

Get the load segment value. See el_torito_set_load_seg().

Parameters
bootimgThe image to inquire
Returns
0 - 65535 : The load segment value < 0 : error
Since
0.6.32

Definition at line 93 of file eltorito.c.

References el_torito_boot_image::load_seg.

◆ el_torito_get_load_size()

int el_torito_get_load_size ( ElToritoBootImage bootimg)

Get the load size. See el_torito_set_load_size().

Parameters
bootimgThe image to inquire
Returns
0 - 65535 : The load size value < 0 : error
Since
0.6.32

Definition at line 114 of file eltorito.c.

References el_torito_boot_image::load_size.

Referenced by Xorriso_boot_image_status().

◆ el_torito_get_selection_crit()

int el_torito_get_selection_crit ( ElToritoBootImage bootimg,
uint8_t  crit[20] 
)

Get the Selection Criteria bytes as of el_torito_set_selection_crit().

Parameters
bootimgThe image to inquire
critReturns 20 bytes of type and data
Returns
1 = ok , <0 = error
Since
0.6.32

Definition at line 171 of file eltorito.c.

References el_torito_boot_image::selection_crit.

Referenced by Xorriso_boot_image_status().

◆ el_torito_patch_isolinux_image()

void el_torito_patch_isolinux_image ( ElToritoBootImage bootimg)

Specifies that this image needs to be patched. This involves the writing of a 56 bytes boot information table at offset 8 of the boot image file. The original boot image file won't be modified. This is needed for isolinux boot images.

Definition at line 196 of file eltorito.c.

References el_torito_boot_image::isolinux_options.

◆ el_torito_seems_boot_info_table()

int el_torito_seems_boot_info_table ( ElToritoBootImage bootimg,
int  flag 
)

Makes a guess whether the boot image was patched by a boot information table. It is advisable to patch such boot images if their content gets copied to a new location. See el_torito_set_isolinux_options(). Note: The reply can be positive only if the boot image was imported from an existing ISO image.

Parameters
bootimgThe image to inquire
flagBitfield for control purposes: bit0 - bit3= mode 0 = inquire for classic boot info table as described in man mkisofs
Since
0.6.32 1 = inquire for GRUB2 boot info as of bit9 of options of el_torito_set_isolinux_options()
1.3.0
Returns
1 = seems to contain the inquired boot info, 0 = quite surely not
Since
0.6.32

Definition at line 179 of file eltorito.c.

References el_torito_boot_image::seems_boot_info_table, and el_torito_boot_image::seems_grub2_boot_info.

Referenced by Xorriso__append_boot_params(), and Xorriso_set_isolinux_options().

◆ el_torito_set_boot_platform_id()

int el_torito_set_boot_platform_id ( ElToritoBootImage bootimg,
uint8_t  id 
)

Sets the platform ID of the boot image.

The Platform ID gets written into the boot catalog at byte 1 of the Validation Entry, or at byte 1 of a Section Header Entry. If Platform ID and ID String of two consecutive bootimages are the same

Parameters
bootimgThe image to manipulate.
idA Platform ID as of El Torito 1.0 : 0x00= 80x86, 0x01= PowerPC, 0x02= Mac Others : 0xef= EFI
Returns
1 ok , <=0 error
Since
0.6.32

Definition at line 66 of file eltorito.c.

References el_torito_boot_image::platform_id.

Referenced by Xorriso_attach_boot_image().

◆ el_torito_set_full_load()

void el_torito_set_full_load ( ElToritoBootImage bootimg,
int  mode 
)

State that the load size shall be the size of the boot image automatically. This overrides el_torito_set_load_size().

Parameters
bootimgThe image to to manipulate
mode0= use value of el_torito_set_load_size() 1= determine value from boot image

Definition at line 120 of file eltorito.c.

References el_torito_boot_image::load_size_full, and el_torito_boot_image::type.

Referenced by Xorriso_attach_boot_image().

◆ el_torito_set_id_string()

int el_torito_set_id_string ( ElToritoBootImage bootimg,
uint8_t  id_string[28] 
)

Set the id_string of the Validation Entry or Sector Header Entry which will govern the boot image Section Entry in the El Torito Catalog.

Parameters
bootimgThe image to manipulate.
id_stringThe first boot image puts 24 bytes of ID string into the Validation Entry, where they shall "identify the manufacturer/developer of the CD-ROM". Further boot images put 28 bytes into their Section Header. El Torito 1.0 states that "If the BIOS understands the ID string, it may choose to boot the system using one of these entries in place of the INITIAL/DEFAULT entry." (The INITIAL/DEFAULT entry points to the first boot image.)
Returns
1 = ok , <0 = error
Since
0.6.32

Definition at line 149 of file eltorito.c.

References el_torito_boot_image::id_string.

Referenced by Xorriso_attach_boot_image().

◆ el_torito_set_isolinux_options()

int el_torito_set_isolinux_options ( ElToritoBootImage bootimg,
int  options,
int  flag 
)

Specifies options for IsoLinux boot images. This should only be used with isolinux boot images.

Parameters
optionsbitmask style flag. The following values are defined:

bit 0 -> 1 to path the image, 0 to not Patching the image involves the writing of a 56 bytes boot information table at offset 8 of the boot image file. The original boot image file won't be modified. This is needed to allow isolinux images to be bootable. bit 1 -> 1 to generate an hybrid image, 0 to not An hybrid image is a boot image that boots from either CD/DVD media or from USB sticks. For that, you should use an isolinux image that supports hybrid mode. Recent images support this.

Returns
1 if success, < 0 on error
Since
0.6.12

Definition at line 222 of file eltorito.c.

References ISO_SUCCESS, el_torito_boot_image::isolinux_options, el_torito_boot_image::seems_boot_info_table, and el_torito_boot_image::seems_grub2_boot_info.

Referenced by Xorriso_set_isolinux_options().

◆ el_torito_set_load_seg()

void el_torito_set_load_seg ( ElToritoBootImage bootimg,
short  segment 
)

Sets the load segment for the initial boot image. This is only for no emulation boot images, and is a NOP for other image types.

Definition at line 82 of file eltorito.c.

References el_torito_boot_image::load_seg, and el_torito_boot_image::type.

◆ el_torito_set_load_size()

void el_torito_set_load_size ( ElToritoBootImage bootimg,
short  sectors 
)

Sets the number of sectors (512b) to be load at load segment during the initial boot procedure. This is only for no emulation boot images, and is a NOP for other image types.

Definition at line 103 of file eltorito.c.

References el_torito_boot_image::load_size, and el_torito_boot_image::type.

Referenced by Xorriso_attach_boot_image().

◆ el_torito_set_no_bootable()

void el_torito_set_no_bootable ( ElToritoBootImage bootimg)

Marks the specified boot image as not bootable

Definition at line 137 of file eltorito.c.

References el_torito_boot_image::bootable.

◆ el_torito_set_selection_crit()

int el_torito_set_selection_crit ( ElToritoBootImage bootimg,
uint8_t  crit[20] 
)

Set the Selection Criteria of a boot image.

Parameters
bootimgThe image to manipulate.
critThe first boot image has no selection criteria. They will be ignored. Further boot images put 1 byte of Selection Criteria Type and 19 bytes of data into their Section Entry. El Torito 1.0 states that "The format of the selection criteria is a function of the BIOS vendor. In the case of a foreign language BIOS three bytes would be used to identify the language". Type byte == 0 means "no criteria", type byte == 1 means "Language and Version Information (IBM)".
Returns
1 = ok , <0 = error
Since
0.6.32

Definition at line 164 of file eltorito.c.

References el_torito_boot_image::selection_crit.

Referenced by Xorriso_attach_boot_image().

◆ eltorito_writer_compute_data_blocks()

static int eltorito_writer_compute_data_blocks ( IsoImageWriter writer)
static

Definition at line 1412 of file eltorito.c.

References ISO_SUCCESS.

Referenced by eltorito_writer_create().

◆ eltorito_writer_create()

◆ eltorito_writer_free_data()

static int eltorito_writer_free_data ( IsoImageWriter writer)
static

Definition at line 1455 of file eltorito.c.

References ISO_SUCCESS.

Referenced by eltorito_writer_create().

◆ eltorito_writer_write_data()

static int eltorito_writer_write_data ( IsoImageWriter writer)
static

Definition at line 1448 of file eltorito.c.

References ISO_SUCCESS.

Referenced by eltorito_writer_create().

◆ eltorito_writer_write_vol_desc()

◆ iso_image_add_boot_image()

int iso_image_add_boot_image ( IsoImage image,
const char *  image_path,
enum eltorito_boot_media_type  type,
int  flag,
ElToritoBootImage **  boot 
)

Add a further boot image to the set of El-Torito bootable images. This set has already to be created by iso_image_set_boot_image(). Up to 31 further boot images may be added.

Parameters
imageThe image to which the boot image shall be added. returns an error and the image remains unmodified.
image_pathThe absolute path of a IsoFile to be used as boot image or –interval:appended_partition_$number[start$start_size_$size]:... if type is ELTORITO_NO_EMUL. See iso_image_set_boot_image.
typeThe boot media type. See iso_image_set_boot_image.
flagBitfield for control purposes. Unused yet. Submit 0.
bootLocation where a pointer to the added boot image will be stored. See iso_image_set_boot_image
Returns
1 on success, < 0 on error ISO_BOOT_NO_CATALOG means iso_image_set_boot_image() was not called first.
Since
0.6.32

Definition at line 786 of file eltorito.c.

References Iso_Image::bootcat, el_torito_boot_catalog::bootimages, create_image(), Iso_File::explicit_weight, Iso_File::from_old_session, ISO_BOOT_IMAGE_OVERFLOW, ISO_BOOT_NO_CATALOG, Libisofs_max_boot_imageS, el_torito_boot_catalog::num_bootimages, and Iso_File::sort_weight.

Referenced by Xorriso_attach_boot_image().

◆ iso_image_get_all_boot_imgs()

int iso_image_get_all_boot_imgs ( IsoImage image,
int *  num_boots,
ElToritoBootImage ***  boots,
IsoFile ***  bootnodes,
int  flag 
)

Get all El-Torito boot images of an ISO image.

The first of these boot images is the same as returned by iso_image_get_boot_image(). The others are alternative boot images.

Parameters
imageThe image from which to get the boot images.
num_bootsThe number of available array elements in boots and bootnodes.
bootsReturns NULL or an allocated array of pointers to boot images. Apply system call free(boots) to dispose it.
bootnodesReturns NULL or an allocated array of pointers to the IsoFile nodes which bear the content of the boot images in boots. An array entry is NULL if the boot image source is no IsoFile.

Need getter for partition index

Parameters
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
1 on success, 0 no El-Torito catalog and boot image attached, < 0 error.
Since
0.6.32

Definition at line 724 of file eltorito.c.

References Iso_Image::bootcat, el_torito_boot_catalog::bootimages, el_torito_boot_image::image, ISO_NULL_POINTER, ISO_OUT_OF_MEM, and el_torito_boot_catalog::num_bootimages.

Referenced by Xorriso_boot_image_status(), Xorriso_set_isolinux_options(), and Xorriso_show_boot_info().

◆ iso_image_get_boot_image()

int iso_image_get_boot_image ( IsoImage image,
ElToritoBootImage **  boot,
IsoFile **  imgnode,
IsoBoot **  catnode 
)

Get the boot catalog and the El-Torito default boot image of an ISO image.

This can be useful, for example, to check if a volume read from a previous session or an existing image is bootable. It can also be useful to get the image and catalog tree nodes. An application would want those, for example, to prevent the user removing it.

Both nodes are owned by libisofs and should not be freed. You can get your own ref with iso_node_ref(). You can can also check if the node is already on the tree by getting its parent (note that when reading El-Torito info from a previous image, the nodes might not be on the tree even if you haven't removed them). Remember that you'll need to get a new ref (with iso_node_ref()) before inserting them again to the tree, and probably you will also need to set the name or permissions.

Parameters
imageThe image from which to get the boot image.
bootIf not NULL, it will be filled with a pointer to the boot image, if any. That object is owned by the IsoImage and should not be freed by the user, nor dereferenced once the last reference to the IsoImage was disposed via iso_image_unref().
imgnodeWhen not NULL, it will be filled with the image tree node. No extra ref is added, you can use iso_node_ref() to get one if you need it.
catnodeWhen not NULL, it will be filled with the catnode tree node. No extra ref is added, you can use iso_node_ref() to get one if you need it.
Returns
1 on success, 0 is the image is not bootable (i.e., it has no El-Torito image), < 0 error.

Definition at line 676 of file eltorito.c.

References Iso_Image::bootcat, el_torito_boot_catalog::bootimages, el_torito_boot_image::image, ISO_NULL_POINTER, ISO_SUCCESS, and el_torito_boot_catalog::node.

Referenced by Xorriso_attach_boot_image(), Xorriso_make_iso_write_opts(), Xorriso_record_boot_info(), Xorriso_set_isolinux_options(), Xorriso_set_system_area(), Xorriso_show_boot_info(), and Xorriso_write_session().

◆ iso_image_get_bootcat()

int iso_image_get_bootcat ( IsoImage image,
IsoBoot **  catnode,
uint32_t *  lba,
char **  content,
off_t *  size 
)

Get detailed information about the boot catalog that was loaded from an ISO image. The boot catalog links the El Torito boot record at LBA 17 with the boot images which are IsoFile objects in the image. The boot catalog itself is not a regular file and thus will not deliver an IsoStream. Its content is usually quite short and can be obtained by this call.

Parameters
imageThe image to inquire.
catnodeWill return the boot catalog tree node. No extra ref is taken.
lbaWill return the block address of the boot catalog in the image.
contentWill return either NULL or an allocated memory buffer with the content bytes of the boot catalog. Dispose it by free() when no longer needed.
sizeWill return the number of bytes in content.
Returns
1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error.
Since
1.1.2

Definition at line 699 of file eltorito.c.

References Iso_Image::bootcat, Iso_Boot::content, ISO_OUT_OF_MEM, Iso_Boot::lba, el_torito_boot_catalog::node, and Iso_Boot::size.

Referenced by Xorriso_fake_stbuf(), and Xorriso_tree_restore_node().

◆ iso_image_remove_boot_image()

void iso_image_remove_boot_image ( IsoImage image)

Removes the El-Torito bootable image.

The IsoBoot node that acts as placeholder for the catalog is also removed for the image tree, if there. If the image is not bootable (don't have el-torito boot image) this function just returns.

Definition at line 766 of file eltorito.c.

References Iso_Image::bootcat, el_torito_boot_catalog_free(), iso_node_get_parent(), iso_node_take(), iso_node_unref(), and el_torito_boot_catalog::node.

Referenced by Xorriso_attach_boot_image(), and Xorriso_write_session().

◆ iso_image_set_boot_catalog_hidden()

int iso_image_set_boot_catalog_hidden ( IsoImage image,
int  hide_attrs 
)

Hides the boot catalog file from directory trees.

For the meaning of hiding files see iso_node_set_hidden().

Parameters
imageThe image to manipulate.
hide_attrsOr-combination of values from enum IsoHideNodeFlag to set the trees in which the record.
Returns
0= no boot catalog attached , 1= ok , <0 = error
Since
0.6.34

Definition at line 822 of file eltorito.c.

References Iso_Image::bootcat, iso_node_set_hidden(), and el_torito_boot_catalog::node.

Referenced by Xorriso_write_session().

◆ iso_image_set_boot_catalog_weight()

int iso_image_set_boot_catalog_weight ( IsoImage image,
int  sort_weight 
)

Sets the sort weight of the boot catalog that is attached to an IsoImage.

For the meaning of sort weights see iso_node_set_sort_weight(). That function cannot be applied to the emerging boot catalog because it is not represented by an IsoFile.

Parameters
imageThe image to manipulate.
sort_weightThe larger this value, the lower will be the block address of the boot catalog record.
Returns
0= no boot catalog attached , 1= ok , <0 = error
Since
0.6.32

Definition at line 813 of file eltorito.c.

References Iso_Image::bootcat, and el_torito_boot_catalog::sort_weight.

Referenced by Xorriso_attach_boot_image(), and Xorriso_write_session().

◆ iso_image_set_boot_image()

int iso_image_set_boot_image ( IsoImage image,
const char *  image_path,
enum eltorito_boot_media_type  type,
const char *  catalog_path,
ElToritoBootImage **  boot 
)

Create a new set of El-Torito bootable images by adding a boot catalog and the default boot image. Further boot images may then be added by iso_image_add_boot_image().

Parameters
imageThe image to make bootable. If it was already bootable this function returns an error and the image remains unmodified.
image_pathThe absolute path of a IsoFile to be used as default boot image or –interval:appended_partition_$number[start$start_size_$size]:... if type is ELTORITO_NO_EMUL. $number gives the partition number. If start$start_size_$size is present, then it overrides the 2 KiB start block of the partition and the partition size counted in blocks of 512 bytes.
typeThe boot media type. This can be one of 3 types:
  • ELTORITO_FLOPPY_EMUL. Floppy emulation: Boot image file must be exactly 1200 KiB, 1440 KiB or 2880 KiB.
  • ELTORITO_HARD_DISC_EMUL. Hard disc emulation: The image must begin with a master boot record with a single image.
  • ELTORITO_NO_EMUL. No emulation. You should specify load segment and load size of image.
catalog_pathThe absolute path in the image tree where the catalog will be stored. The directory component of this path must be a directory existent on the image tree, and the filename component must be unique among all children of that directory on image. Otherwise a correspodent error code will be returned. This function will add an IsoBoot node that acts as a placeholder for the real catalog, that will be generated at image creation time.
bootLocation where a pointer to the added boot image will be stored. That object is owned by the IsoImage and must not be freed by the user, nor dereferenced once the last reference to the IsoImage was disposed via iso_image_unref(). A NULL value is allowed if you don't need a reference to the boot image.
Returns
1 on success, < 0 on error
Since
0.6.2

Definition at line 540 of file eltorito.c.

References Iso_Image::bootcat, el_torito_boot_catalog::bootimages, create_image(), Iso_File::explicit_weight, Iso_File::from_old_session, Iso_Image::id, el_torito_boot_image::image, ISO_IMAGE_ALREADY_BOOTABLE, iso_msg_submit(), ISO_NODE_DOESNT_EXIST, iso_node_ref(), iso_node_take(), iso_node_unref(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, iso_tree_add_boot_node(), iso_tree_path_to_node(), ISO_WRONG_ARG_VALUE, LIBISO_DIR, Libisofs_max_boot_imageS, el_torito_boot_catalog::node, el_torito_boot_catalog::num_bootimages, Iso_Image::root, el_torito_boot_catalog::sort_weight, Iso_File::sort_weight, and Iso_Node::type.

Referenced by Xorriso_attach_boot_image().

◆ iso_parse_start_size()

static void iso_parse_start_size ( char *  text,
unsigned long *  part_start,
unsigned long *  part_size 
)
static

Definition at line 333 of file eltorito.c.

References partition_desc::size, and partition_desc::start.

Referenced by create_image().

◆ iso_patch_eltoritos()

◆ iso_tree_add_boot_node()

◆ make_boot_info_table()

int make_boot_info_table ( uint8_t *  buf,
uint32_t  pvd_lba,
uint32_t  boot_lba,
uint32_t  imgsize 
)

Insert boot info table content into buf.

Returns
1 on success, 0 error (but continue), < 0 error

Definition at line 1252 of file eltorito.c.

References boot_info_table::bi_csum, boot_info_table::bi_file, boot_info_table::bi_length, boot_info_table::bi_pvd, ISO_ISOLINUX_CANT_PATCH, iso_lsb(), iso_read_lsb(), and ISO_SUCCESS.

Referenced by iso_image_eval_boot_info_table(), and patch_boot_info_table().

◆ patch_boot_info_table()

static int patch_boot_info_table ( uint8_t *  buf,
Ecma119Image t,
size_t  imgsize,
int  idx 
)
static

Patch an El Torito boot image by a boot info table.

Returns
1 on success, 0 error (but continue), < 0 error

Definition at line 1297 of file eltorito.c.

References iso_file_section::block, ecma119_image::bootsrc, Iso_Image::id, ecma119_image::image, ISO_ISOLINUX_CANT_PATCH, iso_msg_submit(), make_boot_info_table(), iso_write_opts::ms_block, ecma119_image::opts, and Iso_File_Src::sections.

Referenced by iso_patch_eltoritos().

◆ patch_grub2_boot_image()

static int patch_grub2_boot_image ( uint8_t *  buf,
Ecma119Image t,
size_t  imgsize,
int  idx,
size_t  pos,
int  offst 
)
static

◆ write_section_entry()

◆ write_section_header()

◆ write_section_load_size()

static int write_section_load_size ( struct el_torito_boot_image img,
struct el_torito_section_entry se,
uint16_t  load_size,
off_t  full_byte_size,
int  flag 
)
static

◆ write_validation_entry()

static void write_validation_entry ( uint8_t *  buf,
uint8_t  platform_id,
uint8_t  id_string[24] 
)
static

Variable Documentation

◆ catalog_stream_class

IsoStreamIface catalog_stream_class
Initial value:
= {
0,
"boot",
NULL,
NULL,
NULL,
NULL
}
static int catalog_is_repeatable(IsoStream *stream)
Definition: eltorito.c:1122
static off_t catalog_get_size(IsoStream *stream)
Definition: eltorito.c:1094
static int catalog_read(IsoStream *stream, void *buf, size_t count)
Definition: eltorito.c:1100
static void catalog_free(IsoStream *stream)
Definition: eltorito.c:1143
static void catalog_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)
Definition: eltorito.c:1134
static int catalog_open(IsoStream *stream)
Definition: eltorito.c:1017
static int catalog_close(IsoStream *stream)
Definition: eltorito.c:1078

Definition at line 1148 of file eltorito.c.

Referenced by catalog_stream_new().