New API calls iso_image_add_mips_boot_file(), iso_image_get_mips_boot_files(),
iso_image_give_up_mips_boot(). The preliminary ban has been lifted to combine El Torito and MIPS Big Endian boot facilities. The current state of boot record documentation has been added to bzr.
This commit is contained in:
parent
2a087f6f39
commit
f33df0ef29
238
doc/boot_sectors.txt
Normal file
238
doc/boot_sectors.txt
Normal file
@ -0,0 +1,238 @@
|
||||
|
||||
|
||||
|
||||
Collection of Boot Sector Formats for ISO 9660 Images
|
||||
|
||||
|
||||
by Thomas Schmitt - mailto:scdbackup@gmx.net
|
||||
Libburnia project - mailto:libburn-hackers@pykix.org
|
||||
|
||||
This information is collected from various sources. Some is backed by
|
||||
specifications, some is just rumor which happens to work.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> EL Torito
|
||||
|
||||
El Torito, Bootable CD-ROM Format Specification, Version 1.0, January 25, 1995
|
||||
|
||||
>>> El Torito Volume Descriptor
|
||||
|
||||
>>> Boot Catalog
|
||||
|
||||
>>> Boot Images
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> MBR
|
||||
|
||||
http://en.wikipedia.org/wiki/Master_boot_record
|
||||
|
||||
|
||||
>>> iso_write_opts_set_part_offset()
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
SYSLINUX Isohybrid MBR
|
||||
|
||||
Sources:
|
||||
syslinux-3.72/utils/isohybrid , a perl script by H. Peter Anvin = hpa.
|
||||
Mailing list conversations with hpa.
|
||||
|
||||
An isohybrid MBR directs the booting BIOS to an Isolinux boot image which
|
||||
is also the target of an El Torito boot catalog entry.
|
||||
For that purpose one has to take an MBR template and has to set a few bytes
|
||||
to values which sufficiently describe the ISO image and the boot image file.
|
||||
|
||||
Words are composed little-endian style.
|
||||
|
||||
Byte Range | Value | Meaning
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
0 - 431 | = opaque = | Syslinux machine code provided by MBR template
|
||||
| |
|
||||
432 - 439 | hd_bootlba | Address of the ISOLINUX boot image file in the
|
||||
| | ISO image. Counted in 512 byte blocks.
|
||||
440 - 443 | mbr_id | Random number
|
||||
444 - 445 | 0 | Padding
|
||||
| |
|
||||
446 - 509 | ========== | Partition table
|
||||
| |
|
||||
446 - 461 | part_entry | Partition table entry 1 describing ISO image size
|
||||
| |
|
||||
462 - 509 | 0 | Unused partition entries 2 to 4
|
||||
| |
|
||||
510 - 511 | 0xaa55 | MBR signature
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
|
||||
|
||||
hpa about MBR templates and partition table filesystem types:
|
||||
-------------------------------------------------------------
|
||||
|
||||
[MBR templates] are available in the Syslinux build tree under the names:
|
||||
|
||||
mbr/isohdp[fp]x*.bin
|
||||
|
||||
The default probably should be mbr/isohdppx.bin, but it's ultimately up
|
||||
to the user.
|
||||
|
||||
Note: the filesystem type is largely arbitrary, in theory it can be any
|
||||
value other than 0x00, 0x05, 0x0f, 0x85, 0xee, or 0xef. 0x17 ("Windows
|
||||
IFS Hidden") seems safeish, some people believe 0x83 (Linux) is better.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> GRUB2 MBR
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
MIPS Volume Header
|
||||
for MIPS Big Endian, e.g. SGI Indigo2
|
||||
|
||||
Sources:
|
||||
cdrkit-1.1.10/genisoimage/boot-mips.c
|
||||
by Steve McIntyre <steve@einval.com>
|
||||
which refers to
|
||||
genisovh by Florian Lohoff <flo@rfc822.org>
|
||||
and Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
|
||||
who seem to have learned parameter settings from IRIX CD media
|
||||
There are traces in the web which relate this to specs by
|
||||
MIPS Computer Systems, Inc. , 1985
|
||||
Silicon Graphics Computer Systems, Inc. , 2000
|
||||
|
||||
|
||||
The first 512 bytes of the media constitute the Volume Header.
|
||||
Words are composed big-endian style.
|
||||
|
||||
Byte Range | Value | Meaning
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
0 - 3 | 0x0be5a941 | Magic number
|
||||
4 - 5 | 0 | Root partition number
|
||||
6 - 7 | 0 | Swap partition number
|
||||
8 - 23 | 0 | Name of file to boot (unclear what this means)
|
||||
| |
|
||||
24 - 71 | ========== | Device Parameters
|
||||
| |
|
||||
24 - 24 | 0 | Spiral addressing skew (unclear what this means)
|
||||
25 - 25 | 0 | Words of 0 before header
|
||||
26 - 26 | 0 | Words of 0 between hdr and data
|
||||
27 - 27 | 0 | Spare sectors per cylinder
|
||||
28 - 29 | num_cyl_l | Number of usable cylinder, lower two bytes
|
||||
| | ((iso_size + BYTES_PER_SECTOR - 1) /
|
||||
| | (SECTORS_PER_TRACK * BYTES_PER_SECTOR)) & 0xffff
|
||||
30 - 31 | 0 | Starting head of volume 0
|
||||
32 - 33 | 1 | Number of tracks per cylinder
|
||||
34 - 34 | 0 | Depth of CTQ queue (unclear what this means)
|
||||
35 - 35 | num_cyl_h | Number of usable cylinders, high byte
|
||||
| | ((iso_size + BYTES_PER_SECTOR - 1) /
|
||||
| | (SECTORS_PER_TRACK * BYTES_PER_SECTOR)) >> 16
|
||||
36 - 37 | 0 | unused
|
||||
38 - 39 | 32 | SECTORS_PER_TRACK
|
||||
40 - 41 | 512 | BYTES_PER_SECTOR
|
||||
42 - 43 | 0 | Sector interleave (unclear what this means)
|
||||
44 - 47 | 0x00000034 | Controller characteristics composed from
|
||||
| | DP_RESEEK 0x00000020 /* recalibrate as last resort */
|
||||
| | DP_IGNOREERRORS 0x00000010
|
||||
| | /* transfer data regardless of errors */
|
||||
| | DP_TRKFWD 0x00000004
|
||||
| | /* forward to replacement track */
|
||||
48 - 51 | 0 | Bytes/sec for kernel stats
|
||||
52 - 55 | 0 | Max num retries on data error
|
||||
56 - 59 | 0 | ms per word to xfer, for iostat
|
||||
60 - 71 | 0 | 6 parameter words for xylogics controllers
|
||||
| |
|
||||
72 - 311 | ========== | Volume Directory with 15 entries of 16 bytes each
|
||||
| |
|
||||
72 - 87 | ========== | Volume Directory Entry 1
|
||||
72 - 79 | boot_name | Boot file basename, eventually padded by 0 to lenght 8
|
||||
80 - 83 | boot_block | ISO 9660 LBA of boot file * 4, i.e. in blocks of 512
|
||||
84 - 87 | boot_bytes | File length in bytes
|
||||
| |
|
||||
88 - 311 | see above | Volume Directory Entries 2 to 15
|
||||
| |
|
||||
312 - 504 | ========== | Partition Table with 16 entries of 12 bytes each
|
||||
| |
|
||||
312 - 407 | 0 | Unused partition entries 1 to 8
|
||||
| |
|
||||
408 - 419 | ========== | Partition Table Entry 9 for Volume Header
|
||||
408 - 411 | part_blks | Number of 512 byte blocks in partition
|
||||
| |(iso_size + (BYTES_PER_SECTOR - 1)) / BYTES_PER_SECTOR
|
||||
412 - 415 | 0 | Start block of partition
|
||||
416 - 419 | 0 | PTYPE_VOLHDR = Partition is volume header
|
||||
| |
|
||||
420 - 431 | 0 | Unused partition entry 10
|
||||
| |
|
||||
432 - 443 | ========== | Partition Table Entry 11 for Volume
|
||||
432 - 435 | part_blks | Number of 512 byte blocks in partition
|
||||
| |(iso_size + (BYTES_PER_SECTOR - 1)) / BYTES_PER_SECTOR
|
||||
436 - 439 | 0 | Start block of partition
|
||||
440 - 443 | 6 | PTYPE_VOLUME = Partition is entire volume
|
||||
| |
|
||||
444 - 503 | 0 | Unused partition entries 12 to 16
|
||||
| |
|
||||
504 - 507 | head_chk | Volume header checksum
|
||||
| | The two's complement of bytes 0 to 503 read as big
|
||||
| | endian unsigned 32 bit: sum(words) + head_chk == 0
|
||||
| |
|
||||
508 - 511 | 0 | Volume header end padding
|
||||
| |
|
||||
up to 2048 | 0 | ISO 9660 Block end padding
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
|
||||
Test image produced by
|
||||
genisoimage -o /u/test/mips_boot.iso -mips-boot checksum.c jte
|
||||
which reports
|
||||
Found mips boot image checksum.c, using extent 636 (0x27C), #blocks 14336 (0x3800)
|
||||
|
||||
xorriso reports as 2048 byte LBA of the boot image dummy file
|
||||
File data lba: 0 , 159 , 7 , 14330 , '/CHECKSUM.C'
|
||||
|
||||
First 512 bytes in hex:
|
||||
0 : 0b e5 a9 41 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
16 : 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00
|
||||
32 : 00 01 00 00 00 00 00 20 02 00 00 00 00 00 00 34
|
||||
48 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
64 : 00 00 00 00 00 00 00 00 63 68 65 63 6b 73 75 6d
|
||||
80 : 00 00 02 7c 00 00 38 00 00 00 00 00 00 00 00 00
|
||||
... 0 ...
|
||||
400 : 00 00 00 00 00 00 00 00 00 00 0a 28 00 00 00 00
|
||||
416 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
432 : 00 00 0a 28 00 00 00 00 00 00 00 06 00 00 00 00
|
||||
... 0 ...
|
||||
496 : 00 00 00 00 00 00 00 00 22 ec 2c c9 00 00 00 00
|
||||
|
||||
The 32 bit two's complement of bytes 0 to 503 is 0x22ec2cc9.
|
||||
|
||||
In decimal:
|
||||
0 : 11 229 169 65 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
16 : 0 0 0 0 0 0 0 0 0 0 0 0 0 81 0 0
|
||||
32 : 0 1 0 0 0 0 0 32 2 0 0 0 0 0 0 52
|
||||
48 : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
64 : 0 0 0 0 0 0 0 0 99 104 101 99 107 115 117 109
|
||||
80 : 0 0 2 124 0 0 56 0 0 0 0 0 0 0 0 0
|
||||
... 0 ...
|
||||
400 : 0 0 0 0 0 0 0 0 0 0 10 40 0 0 0 0
|
||||
416 : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
432 : 0 0 10 40 0 0 0 0 0 0 0 6 0 0 0 0
|
||||
... 0 ...
|
||||
496 : 0 0 0 0 0 0 0 0 34 236 44 201 0 0 0 0
|
||||
|
||||
Cleartext part:
|
||||
64 : c h e c k s u m
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> MIPSEL Little Endian MIPS , e.g. DECstation
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> ??? HP-PA
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
>>> ??? DEC Alpha
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -1109,3 +1109,35 @@ int ecma119_tree_create(Ecma119Image *img)
|
||||
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the tree for a certain IsoNode and return its owning Ecma119Node
|
||||
* or NULL.
|
||||
*/
|
||||
static
|
||||
Ecma119Node *search_iso_node(Ecma119Node *root, IsoNode *node)
|
||||
{
|
||||
size_t i;
|
||||
Ecma119Node *res = NULL;
|
||||
|
||||
if (root->node == node)
|
||||
return root;
|
||||
for (i = 0; i < root->info.dir->nchildren && res == NULL; i++) {
|
||||
if (root->info.dir->children[i]->type == ECMA119_DIR)
|
||||
res = search_iso_node(root->info.dir->children[i], node);
|
||||
else if (root->info.dir->children[i]->node == node)
|
||||
res = root->info.dir->children[i];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Ecma119Node *ecma119_search_iso_node(Ecma119Image *img, IsoNode *node)
|
||||
{
|
||||
Ecma119Node *res = NULL;
|
||||
|
||||
if (img->root != NULL)
|
||||
res = search_iso_node(img->root, node);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -90,4 +90,11 @@ int ecma119_tree_create(Ecma119Image *img);
|
||||
*/
|
||||
void ecma119_node_free(Ecma119Node *node);
|
||||
|
||||
/**
|
||||
* Search the tree for a certain IsoNode and return its owning Ecma119Node
|
||||
* or NULL.
|
||||
*/
|
||||
Ecma119Node *ecma119_search_iso_node(Ecma119Image *img, IsoNode *node);
|
||||
|
||||
|
||||
#endif /*LIBISO_ECMA119_TREE_H_*/
|
||||
|
@ -1091,10 +1091,14 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
|
||||
t = writer->target;
|
||||
|
||||
#ifndef Libisofs_mips_boot_file_pathS
|
||||
|
||||
/* >>> Preliminary: No El Torito with system area type other than MBR */
|
||||
if (t->system_area_options & 0xfc)
|
||||
return ISO_SUCCESS;
|
||||
|
||||
#endif
|
||||
|
||||
/* Patch the boot image info tables if indicated */
|
||||
for (idx = 0; idx < t->catalog->num_bootimages; idx++) {
|
||||
if (!(t->catalog->bootimages[idx]->isolinux_options & 0x01))
|
||||
@ -1155,10 +1159,14 @@ int eltorito_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
t = writer->target;
|
||||
cat = t->catalog;
|
||||
|
||||
#ifndef Libisofs_mips_boot_file_pathS
|
||||
|
||||
/* >>> Preliminary: No El Torito with system area type other than MBR */
|
||||
if (t->system_area_options & 0xfc)
|
||||
return ISO_SUCCESS;
|
||||
|
||||
#endif
|
||||
|
||||
iso_msg_debug(t->image->id, "Write El-Torito boot record");
|
||||
|
||||
memset(&vol, 0, sizeof(struct ecma119_boot_rec_vol_desc));
|
||||
@ -1233,10 +1241,14 @@ int eltorito_writer_create(Ecma119Image *target)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef Libisofs_mips_boot_file_pathS
|
||||
|
||||
/* >>> Preliminary: No El Torito with system area type other than MBR */
|
||||
if (target->system_area_options & 0xfc)
|
||||
return ISO_SUCCESS;
|
||||
|
||||
#endif
|
||||
|
||||
/* we need the bootable volume descriptor */
|
||||
target->curblock++;
|
||||
return ISO_SUCCESS;
|
||||
|
@ -36,7 +36,7 @@
|
||||
*/
|
||||
int iso_image_new(const char *name, IsoImage **image)
|
||||
{
|
||||
int res;
|
||||
int res, i;
|
||||
IsoImage *img;
|
||||
|
||||
if (image == NULL) {
|
||||
@ -80,6 +80,9 @@ int iso_image_new(const char *name, IsoImage **image)
|
||||
}
|
||||
img->system_area_data = NULL;
|
||||
img->system_area_options = 0;
|
||||
img->num_mips_boot_files = 0;
|
||||
for (i = 0; i < 15; i++)
|
||||
img->mips_boot_file_paths[i] = NULL;
|
||||
img->builder_ignore_acl = 1;
|
||||
img->builder_ignore_ea = 1;
|
||||
img->inode_counter = 0;
|
||||
@ -103,7 +106,7 @@ void iso_image_ref(IsoImage *image)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the reference couting of the given image.
|
||||
* Decrements the reference counting of the given image.
|
||||
* If it reaches 0, the image is free, together with its tree nodes (whether
|
||||
* their refcount reach 0 too, of course).
|
||||
*/
|
||||
@ -127,6 +130,7 @@ void iso_image_unref(IsoImage *image)
|
||||
iso_node_builder_unref(image->builder);
|
||||
iso_filesystem_unref(image->fs);
|
||||
el_torito_boot_catalog_free(image->bootcat);
|
||||
iso_image_give_up_mips_boot(image, 0);
|
||||
free(image->volset_id);
|
||||
free(image->volume_id);
|
||||
free(image->publisher_id);
|
||||
@ -613,3 +617,41 @@ int iso_image_generator_is_running(IsoImage *image)
|
||||
return image->generator_is_running;
|
||||
}
|
||||
|
||||
|
||||
/* API */
|
||||
int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag)
|
||||
{
|
||||
if (image->num_mips_boot_files >= 15)
|
||||
return ISO_BOOT_TOO_MANY_MIPS;
|
||||
image->mips_boot_file_paths[image->num_mips_boot_files] = strdup(path);
|
||||
if (image->mips_boot_file_paths[image->num_mips_boot_files] == NULL)
|
||||
return ISO_OUT_OF_MEM;
|
||||
image->num_mips_boot_files++;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/* API */
|
||||
int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < image->num_mips_boot_files; i++)
|
||||
paths[i] = image->mips_boot_file_paths[image->num_mips_boot_files];
|
||||
for (; i < 15; i++)
|
||||
paths[i] = NULL;
|
||||
return image->num_mips_boot_files;
|
||||
}
|
||||
|
||||
/* API */
|
||||
int iso_image_give_up_mips_boot(IsoImage *image, int flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < image->num_mips_boot_files; i++)
|
||||
if (image->mips_boot_file_paths[i] != NULL) {
|
||||
free(image->mips_boot_file_paths[i]);
|
||||
image->mips_boot_file_paths[i] = NULL;
|
||||
}
|
||||
image->num_mips_boot_files = 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
@ -58,6 +58,14 @@ struct Iso_Image
|
||||
/* Prescribed/detected options, see iso_write_opts_set_system_area() */
|
||||
int system_area_options;
|
||||
|
||||
/*
|
||||
* Up to 15 boot files can be referred by a MIPS Big Endian Volume Header.
|
||||
The mips_boot_file_paths are ISO 9660 Rock Ridge paths.
|
||||
*/
|
||||
int num_mips_boot_files;
|
||||
char *mips_boot_file_paths[15]; /* ISO 9660 Rock Ridge Paths */
|
||||
|
||||
|
||||
/* image identifier, for message origin identifier */
|
||||
int id;
|
||||
|
||||
|
@ -1771,10 +1771,8 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
||||
* else: unspecified type
|
||||
* @since 0.6.38
|
||||
* 1= MIPS Big Endian Volume Header
|
||||
>>> EXPERIMENTAL:
|
||||
Submit MIPS boot image files as El Torito Boot image to
|
||||
iso_image_set_boot_image() , iso_image_add_boot_image().
|
||||
No El Torito info will be produced with system area type 1.
|
||||
* Submit up to 15 MIPS Big Endian boot files by
|
||||
* iso_image_add_mips_boot_file().
|
||||
* @param flag
|
||||
* bit0 = invalidate any attached system area data. Same as data == NULL
|
||||
* (This re-activates eventually loaded image System Area data.
|
||||
@ -2969,6 +2967,52 @@ void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
|
||||
int iso_image_get_system_area(IsoImage *img, char data[32768],
|
||||
int *options, int flag);
|
||||
|
||||
/**
|
||||
* Add a MIPS Big Endian boot file to the image. Up to 15 such files can be
|
||||
* written into a MIPS Big Endian Volume Header if this is enabled by
|
||||
* value 1 in iso_write_opts_set_system_area() option bits 2 to 7.
|
||||
* @param img
|
||||
* The image to be manipulated.
|
||||
* @param path
|
||||
* Absolute path of the boot file in the ISO 9660 Rock Ridge tree
|
||||
* @param flag
|
||||
* Bitfield for control purposes, unused yet, submit 0
|
||||
* @return
|
||||
* 1 on success, < 0 error
|
||||
* @since 0.6.38
|
||||
*/
|
||||
int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag);
|
||||
|
||||
/**
|
||||
* Obtain the number of added MIPS Big Endian boot files and pointers to
|
||||
* their paths in the ISO 9660 Rock Ridge tree.
|
||||
* @param img
|
||||
* The image to be inquired.
|
||||
* @param paths
|
||||
* An array of pointers to be set to the registered boot file paths.
|
||||
* This are just pointers to data inside IsoImage. Do not free() them.
|
||||
* Eventually make own copies of the data before manipulating the image.
|
||||
* @param flag
|
||||
* Bitfield for control purposes, unused yet, submit 0
|
||||
* @return
|
||||
* >= 0 is the number of valid path pointers , <0 means error
|
||||
* @since 0.6.38
|
||||
*/
|
||||
int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag);
|
||||
|
||||
/**
|
||||
* Clear the list of MIPS Big Endian boot file paths.
|
||||
* @param img
|
||||
* The image to be manipulated.
|
||||
* @param flag
|
||||
* Bitfield for control purposes, unused yet, submit 0
|
||||
* @return
|
||||
* 1 is success , <0 means error
|
||||
* @since 0.6.38
|
||||
*/
|
||||
int iso_image_give_up_mips_boot(IsoImage *image, int flag);
|
||||
|
||||
|
||||
/**
|
||||
* Increments the reference counting of the given node.
|
||||
*
|
||||
@ -6262,7 +6306,14 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
||||
|
||||
/** Failed to process file for Jigdo Template Extraction
|
||||
(MISHAP, HIGH, -366) */
|
||||
#define ISO_LIBJTE_FILE_FAILED 0xE430FE92
|
||||
#define ISO_LIBJTE_FILE_FAILED 0xE430FE92
|
||||
|
||||
/** Too many MIPS Big Endian boot files given (max. 15) (FAILURE, HIGH, -365)*/
|
||||
#define ISO_BOOT_TOO_MANY_MIPS 0xE830FE91
|
||||
|
||||
/** MIPS Big Endian boot file missing in image (MISHAP, HIGH, -364) */
|
||||
#define ISO_BOOT_MIPS_MISSING 0xE430FE90
|
||||
|
||||
|
||||
|
||||
/* Internal developer note:
|
||||
@ -6492,4 +6543,8 @@ struct burn_source {
|
||||
*/
|
||||
|
||||
|
||||
/* Try to address MIPS Big Endian boot files via their ISO/RR paths
|
||||
*/
|
||||
#define Libisofs_mips_boot_file_pathS yes
|
||||
|
||||
#endif /*LIBISO_LIBISOFS_H_*/
|
||||
|
@ -68,6 +68,7 @@ iso_get_local_charset;
|
||||
iso_get_messenger;
|
||||
iso_gzip_get_refcounts;
|
||||
iso_image_add_boot_image;
|
||||
iso_image_add_mips_boot_file;
|
||||
iso_image_attach_data;
|
||||
iso_image_create_burn_source;
|
||||
iso_image_filesystem_new;
|
||||
@ -89,6 +90,7 @@ iso_image_get_biblio_file_id;
|
||||
iso_image_get_boot_image;
|
||||
iso_image_get_copyright_file_id;
|
||||
iso_image_get_data_preparer_id;
|
||||
iso_image_get_mips_boot_files;
|
||||
iso_image_get_msg_id;
|
||||
iso_image_get_publisher_id;
|
||||
iso_image_get_root;
|
||||
@ -97,6 +99,7 @@ iso_image_get_system_area;
|
||||
iso_image_get_system_id;
|
||||
iso_image_get_volset_id;
|
||||
iso_image_get_volume_id;
|
||||
iso_image_give_up_mips_boot;
|
||||
iso_image_import;
|
||||
iso_image_new;
|
||||
iso_image_ref;
|
||||
|
@ -350,6 +350,10 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Failed to finish Jigdo Template Extraction";
|
||||
case ISO_LIBJTE_FILE_FAILED:
|
||||
return "Failed to process file for Jigdo Template Extraction";
|
||||
case ISO_BOOT_TOO_MANY_MIPS:
|
||||
return "Too many MIPS Big Endian boot files given (max. 15)";
|
||||
case ISO_BOOT_MIPS_MISSING:
|
||||
return "MIPS Big Endian boot file missing in image";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "system_area.h"
|
||||
#include "eltorito.h"
|
||||
#include "filesrc.h"
|
||||
#include "ecma119_tree.h"
|
||||
#include "image.h"
|
||||
#include "messages.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -209,8 +212,8 @@ int iso_offset_partition_start(uint32_t img_blocks, uint32_t partition_offset,
|
||||
}
|
||||
|
||||
|
||||
/* This function was implemented according to a byte map which was derived
|
||||
by Thomas Schmitt from
|
||||
/* This function was implemented according to doc/boot_sectors.txt section
|
||||
"MIPS Volume Header" which was derived by Thomas Schmitt from
|
||||
cdrkit-1.1.10/genisoimage/boot-mips.c by Steve McIntyre which is based
|
||||
on work of Florian Lohoff and Thiemo Seufer who possibly learned from
|
||||
documents of MIPS Computer Systems, Inc. and Silicon Graphics Computer
|
||||
@ -224,6 +227,15 @@ static int make_mips_volume_header(Ecma119Image *t, uint8_t *buf, int flag)
|
||||
off_t image_size;
|
||||
static uint32_t bps = 512, spt = 32;
|
||||
|
||||
#ifdef Libisofs_mips_boot_file_pathS
|
||||
Ecma119Node *ecma_node;
|
||||
IsoNode *node;
|
||||
IsoStream *stream;
|
||||
off_t file_size;
|
||||
uint32_t file_lba;
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
memset(buf, 0, 16 * BLOCK_SIZE);
|
||||
|
||||
image_size = t->curblock * 2048;
|
||||
@ -256,6 +268,58 @@ static int make_mips_volume_header(Ecma119Image *t, uint8_t *buf, int flag)
|
||||
/* 80 - 83 | boot_block | ISO 9660 LBA of boot file * 4 */
|
||||
/* 84 - 87 | boot_bytes | File length in bytes */
|
||||
/* 88 - 311 | 0 | Volume Directory Entries 2 to 15 */
|
||||
|
||||
#ifdef Libisofs_mips_boot_file_pathS
|
||||
|
||||
for (idx = 0; idx < t->image->num_mips_boot_files; idx++) {
|
||||
ret = iso_tree_path_to_node(t->image,
|
||||
t->image->mips_boot_file_paths[idx], &node);
|
||||
if (ret < 0) {
|
||||
iso_msg_submit(t->image->id, ISO_BOOT_MIPS_MISSING, 0,
|
||||
"Cannot find MIPS boot file '%s'",
|
||||
t->image->mips_boot_file_paths[idx]);
|
||||
return ISO_BOOT_MIPS_MISSING;
|
||||
}
|
||||
if (node->type != LIBISO_FILE) {
|
||||
iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
|
||||
"Designated MIPS boot file is not a data file: '%s'",
|
||||
t->image->mips_boot_file_paths[idx]);
|
||||
return ISO_BOOT_IMAGE_NOT_VALID;
|
||||
}
|
||||
|
||||
namept = (char *) iso_node_get_name(node);
|
||||
name_field = (char *) (buf + (72 + 16 * idx));
|
||||
strncpy(name_field, namept, 8);
|
||||
|
||||
ecma_node= ecma119_search_iso_node(t, node);
|
||||
if (ecma_node != NULL) {
|
||||
if (ecma_node->type != ECMA119_FILE) {
|
||||
iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
|
||||
"Program error: Ecma119Node of IsoFile is no ECMA119_FILE: '%s'",
|
||||
t->image->mips_boot_file_paths[idx]);
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
|
||||
"Program error: IsoFile has no Ecma119Node: '%s'",
|
||||
t->image->mips_boot_file_paths[idx]);
|
||||
return ISO_ASSERT_FAILURE;
|
||||
}
|
||||
file_lba = ecma_node->info.file->sections[0].block;
|
||||
|
||||
iso_msb(buf + (72 + 16 * idx) + 8, file_lba * 4, 4);
|
||||
|
||||
stream = iso_file_get_stream((IsoFile *) node);
|
||||
file_size = iso_stream_get_size(stream);
|
||||
|
||||
/* >>> shall i really round up to 2048 ? */
|
||||
iso_msb(buf + (72 + 16 * idx) + 12,
|
||||
((file_size + 2047) / 2048 ) * 2048, 4);
|
||||
|
||||
}
|
||||
|
||||
#else /* Libisofs_mips_boot_file_pathS */
|
||||
|
||||
for (idx = 0; idx < t->catalog->num_bootimages; idx++) {
|
||||
|
||||
/* >>> skip non-MIPS boot images */;
|
||||
@ -273,6 +337,8 @@ static int make_mips_volume_header(Ecma119Image *t, uint8_t *buf, int flag)
|
||||
4);
|
||||
}
|
||||
|
||||
#endif /* ! Libisofs_mips_boot_file_pathS */
|
||||
|
||||
/* 408 - 411 | part_blks | Number of 512 byte blocks in partition */
|
||||
blocks = (image_size + bps - 1) / bps;
|
||||
iso_msb(buf + 408, blocks, 4);
|
||||
@ -357,8 +423,8 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
return ret;
|
||||
} else if(sa_type == 1) {
|
||||
ret = make_mips_volume_header(t, buf, 0);
|
||||
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||
return ISO_ASSERT_FAILURE;
|
||||
if (ret != ISO_SUCCESS)
|
||||
return ret;
|
||||
} else if(t->partition_offset > 0) {
|
||||
/* Write a simple partition table. */
|
||||
ret = make_grub_msdos_label(img_blocks, buf, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user