Compare commits
13 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
6927fd35e8 | |||
fb231ff186 | |||
b2fde289b1 | |||
dcc6ffd184 | |||
27e69c38ab | |||
f4b2bfc0d6 | |||
5482d5d7b4 | |||
b2997dcc46 | |||
48ae8acbd6 | |||
a488f8fb14 | |||
ea8da1f7d3 | |||
8ad92a08ea | |||
35c043a0f9 |
41
ChangeLog
41
ChangeLog
@ -1,11 +1,20 @@
|
||||
bzr branch lp:libisofs/for-libisoburn (to become libisofs-0.6.40.tar.gz)
|
||||
bzr branch lp:libisofs/for-libisoburn (to become libisofs-0.6.42.tar.gz)
|
||||
===============================================================================
|
||||
- no novelties yet -
|
||||
- no novelties yet
|
||||
|
||||
libisofs-0.6.40.tar.gz Fri Dec 10 2010
|
||||
===============================================================================
|
||||
* New API call iso_write_opts_set_disc_label(), new system area type
|
||||
3 = SUN Disk Label for booting SUN SPARC systems.
|
||||
* New API call iso_write_opts_set_will_cancel() avoids start of write thread
|
||||
and is to be used to inquire the future image size.
|
||||
* New error reply code ISO_DISPLACE_ROLLOVER for external data sources with
|
||||
address displacement.
|
||||
|
||||
libisofs-0.6.38.tar.gz Sat Oct 23 2010
|
||||
===============================================================================
|
||||
* New API calls iso_write_opts_attach_jte() and iso_write_opts_detach_jte()
|
||||
allow to use of libjte for jigdo production.
|
||||
allow to use libjte for jigdo production.
|
||||
* New API call iso_write_opts_set_tail_blocks() for tail padding inside
|
||||
ISO image.
|
||||
* New API call iso_image_generator_is_running() to learn when the write thread
|
||||
@ -198,29 +207,3 @@ Libisofs 0.6.2
|
||||
* Completely new API
|
||||
* Long term commitment to ABI libisofs.so.6
|
||||
|
||||
libisofs-0.2.8.tar.gz Tue Jul 31 2007
|
||||
===============================================================================
|
||||
* Support for hidden files
|
||||
* Eltorito support
|
||||
* Charset support
|
||||
* Support for inode caching
|
||||
* Ordering files on image
|
||||
* Unit tests
|
||||
* A lot of other features and bugfixes
|
||||
* Note: ABI has been broken.
|
||||
|
||||
libisofs-0.2.5.tar.gz Tue Jul 31 2007
|
||||
===============================================================================
|
||||
* Bugfix release. Fixed the ECMA-related problem with iso tree generation.
|
||||
There is newer release 0.2.8 with a lot of new features.
|
||||
|
||||
libisofs-0.2.4.tar.gz Jan 03 2007
|
||||
===============================================================================
|
||||
* Bugfix release. Fixes lots of problems people have encountered, including but
|
||||
not limited to broken docs generation.
|
||||
|
||||
libisofs-0.2.3.tar.gz Sat Dec 02 2006
|
||||
===============================================================================
|
||||
* Bugfix release, with some improvements for freebsd support.
|
||||
* Requires libburn to compile.
|
||||
|
||||
|
12
configure.ac
12
configure.ac
@ -1,4 +1,4 @@
|
||||
AC_INIT([libisofs], [0.6.38], [http://libburnia-project.org])
|
||||
AC_INIT([libisofs], [0.6.40], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -40,7 +40,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
||||
dnl
|
||||
LIBISOFS_MAJOR_VERSION=0
|
||||
LIBISOFS_MINOR_VERSION=6
|
||||
LIBISOFS_MICRO_VERSION=38
|
||||
LIBISOFS_MICRO_VERSION=40
|
||||
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
|
||||
|
||||
AC_SUBST(LIBISOFS_MAJOR_VERSION)
|
||||
@ -50,10 +50,10 @@ AC_SUBST(LIBISOFS_VERSION)
|
||||
|
||||
dnl Libtool versioning
|
||||
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
|
||||
# 2010.10.23 development jump has not yet happened
|
||||
# SONAME = 40 - 34 = 6 . Library name = libisofs.6.34.0
|
||||
LT_CURRENT=40
|
||||
LT_AGE=34
|
||||
# 2010.12.10 development jump has not yet happened
|
||||
# SONAME = 42 - 36 = 6 . Library name = libisofs.6.36.0
|
||||
LT_CURRENT=42
|
||||
LT_AGE=36
|
||||
LT_REVISION=0
|
||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
||||
|
@ -11,7 +11,7 @@ This information is collected from various sources. Some is backed by
|
||||
specifications, some is just rumor which happens to work (maybe not even that).
|
||||
|
||||
|
||||
Content
|
||||
Content
|
||||
|
||||
EL Torito CD booting, for PC-BIOS x86, PowerPC, (old) Mac, EFI.
|
||||
|
||||
@ -23,6 +23,8 @@ MIPS Volume Header, for MIPS Big Endian, e.g. SGI Indigo2.
|
||||
|
||||
DEC Boot Block, for MIPS Little Endian , e.g. DECstation.
|
||||
|
||||
SUN Disk Label and boot images, for SUN SPARC
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
@ -256,7 +258,7 @@ Sources:
|
||||
|
||||
The candidates for MBR booting will normally use El Torito rather than MBR
|
||||
if the ISO image is presented on CD, DVD, or BD media.
|
||||
The eventual MBR comes into effect it the image is on a media that is
|
||||
The eventual MBR comes into effect if the image is on a media that is
|
||||
interpreted by the BIOS as some kind of hard disk. Usually real hard disks,
|
||||
floppy disks, USB sticks, memory cards.
|
||||
|
||||
@ -524,46 +526,6 @@ Byte Range | Value | Meaning
|
||||
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
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
@ -648,6 +610,109 @@ Byte Range | Value | Meaning
|
||||
16 - 19 | p_filesz | /* Segment size in file */
|
||||
|-> seg_size | Needed for seg_size
|
||||
| |
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
SUN Disk Label and boot images
|
||||
for SUN SPARC
|
||||
|
||||
Sources:
|
||||
cdrtools-2.01.01a77/mkisofs/sunlabel.h
|
||||
cdrtools-2.01.01a77/mkisofs/mkisofs.8
|
||||
by Joerg Schilling
|
||||
|
||||
|
||||
The Disk Label is written to the first 512 bytes of the image. It can mark
|
||||
8 partitions (slices ) of which the first contains the ISO image. The other
|
||||
7 may contain boot images.
|
||||
Words are composed big-endian style.
|
||||
|
||||
Boot images are provided externally. mkisofs arranges them after the end of
|
||||
the ISO image so that each starts at a cylinder boundary (320 kB).
|
||||
|
||||
There is a mechanism in mkisofs which fills unused partitions by copies of
|
||||
their predecessor in the partition table:
|
||||
"If the special filename ... is used, the actual and all following
|
||||
boot partitions are mapped to the previous partition.
|
||||
If mkisofs is called with -G image -B ... all boot partitions are
|
||||
mapped to the partition that contains the ISO9660 filesystem."
|
||||
|
||||
|
||||
Disk Label components:
|
||||
|
||||
Byte Range | Value | Meaning
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
0 - 127 | label | ASCII Label
|
||||
| | "CD-ROM Disc with Sun sparc boot created by ..."
|
||||
| | mkisofs option -sparc-label
|
||||
| |
|
||||
128 - 263 | ========== | /* vtoc inclusions from AT&T SVr4 */
|
||||
| |
|
||||
128 - 131 | 1 | Layout version
|
||||
132 - 139 | 0 | /* volume name */
|
||||
140 - 141 | 8 | Number of partitions
|
||||
| |
|
||||
142 - 173 | ========== | 8 partition entries of 4 bytes
|
||||
| |
|
||||
142 - 145 | ========== | Entry for partition 1
|
||||
142 - 143 | 4 | ID tag of partition: 4 = User partition
|
||||
144 - 145 | 0x10 | Permissions: 0x10 = read-only
|
||||
| |
|
||||
146 - 149 | ========== | Entry for partition 2
|
||||
146 - 147 | id_tag2 | ID tag of partition:
|
||||
| | 0 = unused
|
||||
| | 2 = Root partition with boot image
|
||||
148 - 149 | perm2 | Permissions:
|
||||
| | 0 = unused
|
||||
| | 0x10 = read-only (if used)
|
||||
| |
|
||||
150 - 173 | ========== | Entries for partition 3 to 8.
|
||||
| | See above: Entry for partition 2
|
||||
| |
|
||||
174 - 175 | 0 | Padding
|
||||
| |
|
||||
176 - 187 | 0 | /* info for mboot */
|
||||
| |
|
||||
188 - 191 | 0x600ddeee | /* to verify vtoc sanity */
|
||||
| |
|
||||
192 - 231 | 0 | Reserved
|
||||
| |
|
||||
232 - 263 | 0 | 8 Timestamps of yet unknown format
|
||||
| |
|
||||
264 - 419 | 0 | Padding
|
||||
| |
|
||||
420 - 443 | ========== | Disk properties
|
||||
| |
|
||||
420 - 421 | 350 | Rotations per minute
|
||||
422 - 423 | 2048 | Number of physical cylinders (fixely 640 MB)
|
||||
424 - 425 | 0 | /* alternates per cylinder */
|
||||
426 - 429 | 0 | /* obsolete */
|
||||
430 - 431 | 1 | /* interleave factor */
|
||||
432 - 433 | 2048 | Number of data cylinders (fixely 640 MB)
|
||||
434 - 435 | 0 | /* # of alternate cylinders */
|
||||
436 - 437 | 1 | Number of heads per cylinder (i.e. 1 cyl = 320 kB)
|
||||
438 - 439 | 640 | Number of sectors per head (i.e. 1 head = 320 kB)
|
||||
440 - 443 | 0 | /* obsolete */
|
||||
| |
|
||||
444 - 507 | ========== | Partition table
|
||||
| |
|
||||
444 - 451 | ========== | Partition table entry #1
|
||||
| |
|
||||
444 - 447 | start_cyl | Start cylinder
|
||||
| |
|
||||
448 - 451 | num_blocks | Number of blocks in partition
|
||||
| |
|
||||
452 - 507 | ========== | Partition table entries #2 to #8
|
||||
| ... | See above Partition table entry #1
|
||||
| |
|
||||
508 - 509 | 0xdabe | Magic Number
|
||||
| |
|
||||
510 - 511 | checksum | The result of exoring 2-byte words 0 to 254
|
||||
| |
|
||||
---------- | ---------- | ----------------------------------------------------
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -107,7 +107,7 @@ void ecma119_image_free(Ecma119Image *t)
|
||||
free(t->writers);
|
||||
if (t->partition_root != NULL)
|
||||
ecma119_node_free(t->partition_root);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
|
||||
if (t->appended_partitions[i] != NULL)
|
||||
free(t->appended_partitions[i]);
|
||||
|
||||
@ -1299,13 +1299,20 @@ static int finish_libjte(Ecma119Image *target)
|
||||
|
||||
|
||||
static int write_mbr_partition_file(Ecma119Image *target, char *path,
|
||||
uint32_t blocks, int flag)
|
||||
uint32_t prepad, uint32_t blocks, int flag)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
uint32_t i;
|
||||
uint8_t buf[BLOCK_SIZE];
|
||||
int ret;
|
||||
|
||||
memset(buf, 0, BLOCK_SIZE);
|
||||
for (i = 0; i < prepad; i++) {
|
||||
ret = iso_write(target, buf, BLOCK_SIZE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return ISO_BAD_PARTITION_FILE;
|
||||
@ -1325,8 +1332,8 @@ static int write_mbr_partition_file(Ecma119Image *target, char *path,
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
if (fp != NULL)
|
||||
fclose(fp);
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1334,7 +1341,7 @@ static int write_mbr_partition_file(Ecma119Image *target, char *path,
|
||||
static
|
||||
void *write_function(void *arg)
|
||||
{
|
||||
int res;
|
||||
int res, first_partition = 1, last_partition = 0, sa_type;
|
||||
size_t i;
|
||||
IsoImageWriter *writer;
|
||||
|
||||
@ -1358,16 +1365,26 @@ void *write_function(void *arg)
|
||||
}
|
||||
|
||||
/* Append partition data */
|
||||
for (i = 0; i < 4; i++) {
|
||||
sa_type = (target->system_area_options >> 2) & 0x3f;
|
||||
if (sa_type == 0) { /* MBR */
|
||||
first_partition = 1;
|
||||
last_partition = 4;
|
||||
} else if (sa_type == 3) { /* SUN Disk Label */
|
||||
first_partition = 2;
|
||||
last_partition = 8;
|
||||
}
|
||||
for (i = first_partition - 1; i <= last_partition - 1; i++) {
|
||||
if (target->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
if (target->appended_partitions[i][0] == 0)
|
||||
continue;
|
||||
res = write_mbr_partition_file(target, target->appended_partitions[i],
|
||||
target->appended_part_prepad[i],
|
||||
target->appended_part_size[i], 0);
|
||||
if (res < 0)
|
||||
goto write_error;
|
||||
}
|
||||
|
||||
|
||||
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
||||
transplant_checksum_buffer(target, 0);
|
||||
|
||||
@ -1395,7 +1412,9 @@ void *write_function(void *arg)
|
||||
target->eff_partition_offset = 0;
|
||||
if (res == ISO_CANCELED) {
|
||||
/* canceled */
|
||||
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL);
|
||||
if (!target->will_cancel)
|
||||
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED,
|
||||
0, NULL);
|
||||
} else {
|
||||
/* image write error */
|
||||
iso_msg_submit(target->image->id, ISO_WRITE_ERROR, res,
|
||||
@ -1520,6 +1539,7 @@ static
|
||||
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
{
|
||||
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0, tag_pos;
|
||||
int sa_type;
|
||||
Ecma119Image *target;
|
||||
IsoImageWriter *writer;
|
||||
int el_torito_writer_index = -1, file_src_writer_index = -1;
|
||||
@ -1547,6 +1567,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
target->image = src;
|
||||
iso_image_ref(src);
|
||||
|
||||
target->will_cancel = opts->will_cancel;
|
||||
target->iso_level = opts->level;
|
||||
target->rockridge = opts->rockridge;
|
||||
target->joliet = opts->joliet;
|
||||
@ -1615,8 +1636,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
} else {
|
||||
system_area_options = opts->system_area_options & 0xfc;
|
||||
}
|
||||
if ((system_area_options & 0xfc) != 0)
|
||||
for (i = 0; i < 4; i++)
|
||||
sa_type = (system_area_options >> 2) & 0x3f;
|
||||
if (sa_type != 0 && sa_type != 3)
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
|
||||
if (opts->appended_partitions[i] != NULL)
|
||||
return ISO_NON_MBR_SYS_AREA;
|
||||
|
||||
@ -1708,7 +1730,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
target->mipsel_p_vaddr = 0;
|
||||
target->mipsel_p_filesz = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
target->empty_file_block = 0;
|
||||
|
||||
target->wthread_is_running = 0;
|
||||
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++) {
|
||||
target->appended_partitions[i] = NULL;
|
||||
if (opts->appended_partitions[i] != NULL) {
|
||||
target->appended_partitions[i] =
|
||||
strdup(opts->appended_partitions[i]);
|
||||
@ -1716,9 +1743,10 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
return ISO_OUT_OF_MEM;
|
||||
target->appended_part_types[i] = opts->appended_part_types[i];
|
||||
}
|
||||
target->appended_part_prepad[i] = 0;
|
||||
target->appended_part_start[i] = target->appended_part_size[i] = 0;
|
||||
}
|
||||
|
||||
strcpy(target->ascii_disc_label, opts->ascii_disc_label);
|
||||
|
||||
/*
|
||||
* 2. Based on those options, create needed writers: iso, joliet...
|
||||
@ -1809,6 +1837,11 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
/* Volume Descriptor Set Terminator */
|
||||
target->curblock++;
|
||||
|
||||
/* All empty files point to the Volume Descriptor Set Terminator
|
||||
* rather than to addresses of non-empty files.
|
||||
*/
|
||||
target->empty_file_block = target->curblock - 1;
|
||||
|
||||
/*
|
||||
* Create the writer for possible padding to ensure that in case of image
|
||||
* growing we can safely overwrite the first 64 KiB of image.
|
||||
@ -2018,6 +2051,20 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
/* This was possibly altered by above overwrite buffer production */
|
||||
target->vol_space_size = target->curblock - target->ms_block;
|
||||
|
||||
/*
|
||||
*/
|
||||
#define Libisofs_print_size_no_forK 1
|
||||
|
||||
#ifdef Libisofs_print_size_no_forK
|
||||
if (opts->will_cancel) {
|
||||
iso_msg_debug(target->image->id,
|
||||
"Will not start write thread because of iso_write_opts_set_will_cancel");
|
||||
*img = target;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* 4. Create and start writing thread */
|
||||
if (target->md5_session_checksum) {
|
||||
/* After any fake writes are done: Initialize image checksum context */
|
||||
@ -2059,6 +2106,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
ret = ISO_THREAD_ERROR;
|
||||
goto target_cleanup;
|
||||
}
|
||||
target->wthread_is_running= 1;
|
||||
|
||||
/*
|
||||
* Notice that once we reach this point, target belongs to the writer
|
||||
@ -2115,8 +2163,11 @@ static void bs_free_data(struct burn_source *bs)
|
||||
iso_ring_buffer_reader_close(target->buffer, 0);
|
||||
|
||||
/* wait until writer thread finishes */
|
||||
pthread_join(target->wthread, NULL);
|
||||
iso_msg_debug(target->image->id, "Writer thread joined");
|
||||
if (target->wthread_is_running) {
|
||||
pthread_join(target->wthread, NULL);
|
||||
target->wthread_is_running = 0;
|
||||
iso_msg_debug(target->image->id, "Writer thread joined");
|
||||
}
|
||||
}
|
||||
|
||||
iso_msg_debug(target->image->id,
|
||||
@ -2148,9 +2199,11 @@ int bs_cancel(struct burn_source *bs)
|
||||
}
|
||||
|
||||
/* wait until writer thread finishes */
|
||||
pthread_join(target->wthread, NULL);
|
||||
|
||||
iso_msg_debug(target->image->id, "Writer thread joined");
|
||||
if (target->wthread_is_running) {
|
||||
pthread_join(target->wthread, NULL);
|
||||
target->wthread_is_running = 0;
|
||||
iso_msg_debug(target->image->id, "Writer thread joined");
|
||||
}
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
@ -2306,8 +2359,10 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
|
||||
#endif /* Libisofs_with_libjtE */
|
||||
|
||||
wopts->tail_blocks = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
|
||||
wopts->appended_partitions[i] = NULL;
|
||||
wopts->ascii_disc_label[0] = 0;
|
||||
wopts->will_cancel = 0;
|
||||
|
||||
*opts = wopts;
|
||||
return ISO_SUCCESS;
|
||||
@ -2323,13 +2378,22 @@ void iso_write_opts_free(IsoWriteOpts *opts)
|
||||
free(opts->output_charset);
|
||||
if (opts->system_area_data != NULL)
|
||||
free(opts->system_area_data);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
|
||||
if (opts->appended_partitions[i] != NULL)
|
||||
free(opts->appended_partitions[i]);
|
||||
|
||||
free(opts);
|
||||
}
|
||||
|
||||
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
opts->will_cancel = !!will_cancel;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level)
|
||||
{
|
||||
if (opts == NULL) {
|
||||
@ -2806,7 +2870,7 @@ int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks)
|
||||
int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
|
||||
uint8_t partition_type, char *image_path, int flag)
|
||||
{
|
||||
if (partition_number < 1 || partition_number > 4)
|
||||
if (partition_number < 1 || partition_number > ISO_MAX_PARTITIONS)
|
||||
return ISO_BAD_PARTITION_NO;
|
||||
|
||||
if (opts->appended_partitions[partition_number - 1] != NULL)
|
||||
@ -2819,3 +2883,10 @@ int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
|
||||
{
|
||||
strncpy(opts->ascii_disc_label, label, ISO_DISC_LABEL_SIZE - 1);
|
||||
opts->ascii_disc_label[ISO_DISC_LABEL_SIZE - 1] = 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,33 @@
|
||||
*/
|
||||
#define ISO_EXTENT_SIZE 0xFFFFF800
|
||||
|
||||
/*
|
||||
* The maximum number of partition images that can be registered. Depending
|
||||
* on the system area type, the effectively usable number may be smaller or
|
||||
* even 0.
|
||||
*/
|
||||
#define ISO_MAX_PARTITIONS 8
|
||||
|
||||
/*
|
||||
* The cylindersize with SUN Disk Label
|
||||
* (512 bytes/sector, 640 sectors/head, 1 head/cyl = 320 KiB).
|
||||
* Expressed in ECMA-119 blocks of 2048 bytes/block.
|
||||
*/
|
||||
#define ISO_SUN_CYL_SIZE 160
|
||||
|
||||
/*
|
||||
* Maximum length of a disc label text plus 1.
|
||||
*/
|
||||
#define ISO_DISC_LABEL_SIZE 129
|
||||
|
||||
|
||||
/**
|
||||
* Holds the options for the image generation.
|
||||
*/
|
||||
struct iso_write_opts {
|
||||
|
||||
int will_cancel;
|
||||
|
||||
int level; /**< ISO level to write at. (ECMA-119, 10) */
|
||||
|
||||
/** Which extensions to support. */
|
||||
@ -337,8 +359,12 @@ struct iso_write_opts {
|
||||
/* Eventual disk file paths of prepared images which shall be appended
|
||||
after the ISO image and described by partiton table entries in a MBR
|
||||
*/
|
||||
char *appended_partitions[4];
|
||||
uint8_t appended_part_types[4];
|
||||
char *appended_partitions[ISO_MAX_PARTITIONS];
|
||||
uint8_t appended_part_types[ISO_MAX_PARTITIONS];
|
||||
|
||||
/* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
|
||||
*/
|
||||
char ascii_disc_label[ISO_DISC_LABEL_SIZE];
|
||||
};
|
||||
|
||||
typedef struct ecma119_image Ecma119Image;
|
||||
@ -355,6 +381,8 @@ struct ecma119_image
|
||||
IsoImage *image;
|
||||
Ecma119Node *root;
|
||||
|
||||
int will_cancel :1;
|
||||
|
||||
unsigned int iso_level :2;
|
||||
|
||||
/* extensions */
|
||||
@ -442,6 +470,11 @@ struct ecma119_image
|
||||
*/
|
||||
uint32_t curblock;
|
||||
|
||||
/*
|
||||
* The address to be used for the content pointer of empty data files.
|
||||
*/
|
||||
uint32_t empty_file_block;
|
||||
|
||||
/*
|
||||
* number of dirs in ECMA-119 tree, computed together with dir position,
|
||||
* and needed for path table computation in a efficient way
|
||||
@ -553,6 +586,7 @@ struct ecma119_image
|
||||
|
||||
/* writer thread descriptor */
|
||||
pthread_t wthread;
|
||||
int wthread_is_running;
|
||||
pthread_attr_t th_attr;
|
||||
|
||||
/* User settable PVD time stamps */
|
||||
@ -601,11 +635,14 @@ struct ecma119_image
|
||||
uint32_t mipsel_p_vaddr;
|
||||
uint32_t mipsel_p_filesz;
|
||||
|
||||
char *appended_partitions[4];
|
||||
uint8_t appended_part_types[4];
|
||||
char *appended_partitions[ISO_MAX_PARTITIONS];
|
||||
uint8_t appended_part_types[ISO_MAX_PARTITIONS];
|
||||
/* Counted in blocks of 2048 */
|
||||
uint32_t appended_part_start[4];
|
||||
uint32_t appended_part_size[4];
|
||||
uint32_t appended_part_prepad[ISO_MAX_PARTITIONS];
|
||||
uint32_t appended_part_start[ISO_MAX_PARTITIONS];
|
||||
uint32_t appended_part_size[ISO_MAX_PARTITIONS];
|
||||
|
||||
char ascii_disc_label[ISO_DISC_LABEL_SIZE];
|
||||
|
||||
};
|
||||
|
||||
|
@ -309,6 +309,7 @@ int create_image(IsoImage *image, const char *image_path,
|
||||
int boot_media_type = 0;
|
||||
int load_sectors = 0; /* number of sector to load */
|
||||
unsigned char partition_type = 0;
|
||||
off_t size;
|
||||
IsoNode *imgfile;
|
||||
IsoStream *stream;
|
||||
|
||||
@ -317,6 +318,9 @@ int create_image(IsoImage *image, const char *image_path,
|
||||
return ret;
|
||||
}
|
||||
if (ret == 0) {
|
||||
iso_msg_submit(image->id, ISO_NODE_DOESNT_EXIST, 0,
|
||||
"El Torito boot image file missing in ISO image: '%s'",
|
||||
image_path);
|
||||
return ISO_NODE_DOESNT_EXIST;
|
||||
}
|
||||
|
||||
@ -331,9 +335,16 @@ int create_image(IsoImage *image, const char *image_path,
|
||||
return ISO_BOOT_IMAGE_NOT_VALID;
|
||||
}
|
||||
|
||||
size = iso_stream_get_size(stream);
|
||||
if (size <= 0) {
|
||||
iso_msg_submit(image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
|
||||
"Boot image file is empty");
|
||||
return ISO_BOOT_IMAGE_NOT_VALID;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case ELTORITO_FLOPPY_EMUL:
|
||||
switch (iso_stream_get_size(stream)) {
|
||||
switch (size) {
|
||||
case 1200 * 1024:
|
||||
boot_media_type = 1; /* 1.2 meg diskette */
|
||||
break;
|
||||
@ -471,6 +482,9 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
||||
catname[0] = '\0';
|
||||
ret = iso_tree_path_to_node(image, catdir, &p);
|
||||
if (ret <= 0) {
|
||||
iso_msg_submit(image->id, ISO_NODE_DOESNT_EXIST, 0,
|
||||
"Cannot find directory for El Torito boot catalog in ISO image: '%s'",
|
||||
catdir);
|
||||
free(catdir);
|
||||
return ret < 0 ? ret : ISO_NODE_DOESNT_EXIST;
|
||||
}
|
||||
|
@ -266,7 +266,12 @@ int filesrc_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
/*
|
||||
* final section
|
||||
*/
|
||||
file->sections[extent].block = t->curblock + extent * (ISO_EXTENT_SIZE / BLOCK_SIZE);
|
||||
if (section_size <= 0) {
|
||||
file->sections[extent].block = t->empty_file_block;
|
||||
} else {
|
||||
file->sections[extent].block =
|
||||
t->curblock + extent * (ISO_EXTENT_SIZE / BLOCK_SIZE);
|
||||
}
|
||||
file->sections[extent].size = (uint32_t)section_size;
|
||||
|
||||
t->curblock += DIV_UP(iso_file_src_get_size(file), BLOCK_SIZE);
|
||||
|
@ -2796,8 +2796,17 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
break;
|
||||
if (idx < fsdata->num_bootimgs) {
|
||||
/* it is boot image node */
|
||||
|
||||
if (image->bootcat->bootimages[idx]->image != NULL) {
|
||||
/* idx is already occupied, try to find unoccupied one
|
||||
which has the same block address.
|
||||
*/
|
||||
for (; idx < fsdata->num_bootimgs; idx++)
|
||||
if (fsdata->eltorito && data->sections[0].block ==
|
||||
fsdata->bootblocks[idx] &&
|
||||
image->bootcat->bootimages[idx]->image == NULL)
|
||||
break;
|
||||
}
|
||||
if (idx >= fsdata->num_bootimgs) {
|
||||
ret = iso_msg_submit(image->id, ISO_EL_TORITO_WARN, 0,
|
||||
"More than one ISO node has been found for the same boot image.");
|
||||
if (ret < 0) {
|
||||
|
@ -248,7 +248,7 @@ int create_tree(Ecma119Image *t, IsoNode *iso, JolietNode **tree, int pathlen)
|
||||
char *ipath = iso_tree_get_node_path(iso);
|
||||
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
|
||||
"Can't add %s to Joliet tree. %s can only be added to a "
|
||||
"Rock Ridget tree.", ipath, (iso->type == LIBISO_SYMLINK ?
|
||||
"Rock Ridge tree.", ipath, (iso->type == LIBISO_SYMLINK ?
|
||||
"Symlinks" : "Special files"));
|
||||
free(ipath);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ struct iso_data_source
|
||||
* automatically called by iso_data_source_unref() when refcount reach
|
||||
* 0.
|
||||
*/
|
||||
void (*free_data)(IsoDataSource *);
|
||||
void (*free_data)(IsoDataSource *src);
|
||||
|
||||
/** Source specific data */
|
||||
void *data;
|
||||
@ -1122,7 +1122,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
|
||||
*/
|
||||
#define iso_lib_header_version_major 0
|
||||
#define iso_lib_header_version_minor 6
|
||||
#define iso_lib_header_version_micro 38
|
||||
#define iso_lib_header_version_micro 40
|
||||
|
||||
/**
|
||||
* Usage discussion:
|
||||
@ -1205,6 +1205,27 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile);
|
||||
*/
|
||||
void iso_write_opts_free(IsoWriteOpts *opts);
|
||||
|
||||
/**
|
||||
* Announce that only the image size is desired, that the struct burn_source
|
||||
* which is set to consume the image output stream will stay inactive,
|
||||
* and that the write thread will be cancelled anyway by the .cancel() method
|
||||
* of the struct burn_source.
|
||||
* This avoids to create a write thread which would begin production of the
|
||||
* image stream and would generate a MISHAP event when burn_source.cancel()
|
||||
* gets into effect.
|
||||
*
|
||||
* @param opts
|
||||
* The option set to be manipulated.
|
||||
* @param will_cancel
|
||||
* 0= normal image generation
|
||||
* 1= prepare for being canceled before image stream output is completed
|
||||
* @return
|
||||
* 1 success, < 0 error
|
||||
*
|
||||
* @since 0.6.40
|
||||
*/
|
||||
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel);
|
||||
|
||||
/**
|
||||
* Set the ISO-9960 level to write at.
|
||||
*
|
||||
@ -1751,6 +1772,9 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
||||
*
|
||||
* If system area data are given or options bit0 is set, then bit1 of
|
||||
* el_torito_set_isolinux_options() is automatically disabled.
|
||||
*
|
||||
* @param opts
|
||||
* The option set to be manipulated.
|
||||
* @param data
|
||||
* Either NULL or 32 kB of data. Do not submit less bytes !
|
||||
* @param options
|
||||
@ -1780,6 +1804,13 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
||||
* 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
|
||||
* 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.
|
||||
* @param flag
|
||||
* bit0 = invalidate any attached system area data. Same as data == NULL
|
||||
* (This re-activates eventually loaded image System Area data.
|
||||
@ -1787,12 +1818,28 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
||||
* bit1 = keep data unaltered
|
||||
* bit2 = keep options unaltered
|
||||
* @return
|
||||
* ISO_SUCCESS or error
|
||||
* ISO_SUCCESS or error
|
||||
* @since 0.6.30
|
||||
*/
|
||||
int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
|
||||
int options, int flag);
|
||||
|
||||
/**
|
||||
* Set a name for the system area. This setting is ignored unless system area
|
||||
* type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().
|
||||
* In this case it will replace the default text at the start of the image:
|
||||
* "CD-ROM Disc with Sun sparc boot created by libisofs"
|
||||
*
|
||||
* @param opts
|
||||
* The option set to be manipulated.
|
||||
* @param label
|
||||
* A text of up to 128 characters.
|
||||
* @return
|
||||
* ISO_SUCCESS or error
|
||||
* @since 0.6.40
|
||||
*/
|
||||
int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label);
|
||||
|
||||
/**
|
||||
* Explicitely set the four timestamps of the emerging Primary Volume
|
||||
* Descriptor. Default with all parameters is 0.
|
||||
@ -1936,24 +1983,33 @@ int iso_write_opts_detach_jte(IsoWriteOpts *opts, void **libjte_handle);
|
||||
*/
|
||||
int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks);
|
||||
|
||||
|
||||
/**
|
||||
* Cause an arbitrary data file to be appended to the ISO image and to be
|
||||
* described by a partition table entry in an MBR at the start of the
|
||||
* ISO image.
|
||||
* described by a partition table entry in an MBR or SUN Disk Label at the
|
||||
* start of the ISO image.
|
||||
* The partition entry will bear the size of the image file rounded up to
|
||||
* the next multiple of 2048 bytes.
|
||||
* MBR or SUN Disk Label are selected by iso_write_opts_set_system_area()
|
||||
* system area type: 0 selects MBR partition table. 3 selects a SUN partition
|
||||
* table with 320 kB start alignment.
|
||||
*
|
||||
* @param opts
|
||||
* The option set to be manipulated.
|
||||
* @param partition_number
|
||||
* Depicts the partition table entry which shall describe the
|
||||
* appended image. Range 1 to 4.
|
||||
* 1 will cause the whole ISO image to be unclaimable space before
|
||||
* partition 1.
|
||||
* appended image.
|
||||
* Range with MBR: 1 to 4. 1 will cause the whole ISO image to be
|
||||
* unclaimable space before partition 1.
|
||||
* Range with SUN Disk Label: 2 to 8.
|
||||
* @param image_path
|
||||
* File address in the local file system.
|
||||
* With SUN Disk Label: an empty name causes the partition to become
|
||||
* a copy of the next lower partition.
|
||||
* @param image_type
|
||||
* The partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
|
||||
* The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
|
||||
* Linux Native Partition = 0x83. See fdisk command L.
|
||||
* This parameter is ignored with SUN Disk Label.
|
||||
* @return
|
||||
* ISO_SUCCESS or error
|
||||
*
|
||||
@ -6363,6 +6419,10 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
||||
(FAILURE, HIGH, -371) */
|
||||
#define ISO_NON_MBR_SYS_AREA 0xE830FE8D
|
||||
|
||||
/** Displacement offset leads outside 32 bit range (FAILURE, HIGH, -372) */
|
||||
#define ISO_DISPLACE_ROLLOVER 0xE830FE8C
|
||||
|
||||
|
||||
|
||||
/* Internal developer note:
|
||||
Place new error codes directly above this comment.
|
||||
|
@ -266,6 +266,7 @@ iso_write_opts_set_default_gid;
|
||||
iso_write_opts_set_default_timestamp;
|
||||
iso_write_opts_set_default_uid;
|
||||
iso_write_opts_set_dir_rec_mtime;
|
||||
iso_write_opts_set_disc_label;
|
||||
iso_write_opts_set_fifo_size;
|
||||
iso_write_opts_set_hardlinks;
|
||||
iso_write_opts_set_iso1999;
|
||||
@ -292,6 +293,7 @@ iso_write_opts_set_scdbackup_tag;
|
||||
iso_write_opts_set_sort_files;
|
||||
iso_write_opts_set_system_area;
|
||||
iso_write_opts_set_tail_blocks;
|
||||
iso_write_opts_set_will_cancel;
|
||||
iso_zisofs_get_params;
|
||||
iso_zisofs_get_refcounts;
|
||||
iso_zisofs_set_params;
|
||||
|
@ -359,6 +359,8 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Cannot open data file for appended partition";
|
||||
case ISO_NON_MBR_SYS_AREA:
|
||||
return "May not combine appended partition with non-MBR system area";
|
||||
case ISO_DISPLACE_ROLLOVER:
|
||||
return "Displacement offset leads outside 32 bit range";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ int iso_msg_is_abort(int errcode);
|
||||
int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...);
|
||||
|
||||
|
||||
/* ts A80222 */
|
||||
/* To be called with events which report incidents with individual input
|
||||
files from the local filesystem. Not with image nodes, files containing an
|
||||
image or similar file-like objects.
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ecma119_tree.h"
|
||||
#include "image.h"
|
||||
#include "messages.h"
|
||||
#include "ecma119.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -79,13 +80,16 @@ void iso_compute_cyl_head_sec(uint32_t *img_blocks, int hpc, int sph,
|
||||
*/
|
||||
int iso_compute_append_partitions(Ecma119Image *t, int flag)
|
||||
{
|
||||
int ret, i;
|
||||
uint32_t pos, size;
|
||||
int ret, i, sa_type;
|
||||
uint32_t pos, size, add_pos = 0;
|
||||
struct stat stbuf;
|
||||
|
||||
sa_type = (t->system_area_options >> 2) & 0x3f;
|
||||
pos = (t->vol_space_size + t->ms_block);
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++) {
|
||||
if (t->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
if (t->appended_partitions[i][0] == 0)
|
||||
continue;
|
||||
ret = stat(t->appended_partitions[i], &stbuf);
|
||||
if (ret == -1)
|
||||
@ -93,10 +97,13 @@ int iso_compute_append_partitions(Ecma119Image *t, int flag)
|
||||
if (! S_ISREG(stbuf.st_mode))
|
||||
return ISO_BAD_PARTITION_FILE;
|
||||
size = ((stbuf.st_size + 2047) / 2048);
|
||||
t->appended_part_start[i] = pos;
|
||||
if (sa_type == 3 && (pos % ISO_SUN_CYL_SIZE))
|
||||
add_pos = ISO_SUN_CYL_SIZE - (pos % ISO_SUN_CYL_SIZE);
|
||||
t->appended_part_prepad[i] = add_pos;
|
||||
t->appended_part_start[i] = pos + add_pos;
|
||||
t->appended_part_size[i] = size;
|
||||
pos += size;
|
||||
t->total_size += size * 2048;
|
||||
pos += add_pos + size;
|
||||
t->total_size += (add_pos + size) * 2048;
|
||||
}
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
@ -565,9 +572,122 @@ static int make_mipsel_boot_block(Ecma119Image *t, uint8_t *buf, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* The following two functions were implemented according to
|
||||
doc/boot_sectors.txt section "SUN Disk Label and boot images" which
|
||||
was derived by Thomas Schmitt from
|
||||
cdrtools-2.01.01a77/mkisofs/sunlabel.h
|
||||
cdrtools-2.01.01a77/mkisofs/mkisofs.8
|
||||
by Joerg Schilling
|
||||
|
||||
Both functions are entirely under copyright (C) 2010 Thomas Schmitt.
|
||||
*/
|
||||
|
||||
/* @parm flag bit0= copy from next lower valid partition table entry
|
||||
*/
|
||||
static int write_sun_partition_entry(int partition_number,
|
||||
char *appended_partitions[],
|
||||
uint32_t partition_offset[], uint32_t partition_size[],
|
||||
uint32_t cyl_size, uint8_t *buf, int flag)
|
||||
{
|
||||
uint8_t *wpt;
|
||||
int read_idx, i;
|
||||
|
||||
if (partition_number < 1 || partition_number > 8)
|
||||
return ISO_ASSERT_FAILURE;
|
||||
|
||||
/* 142 - 173 | ========== | 8 partition entries of 4 bytes */
|
||||
wpt = buf + 142 + (partition_number - 1) * 4;
|
||||
if (partition_number == 1)
|
||||
iso_msb(wpt, 4, 2); /* 4 = User partition */
|
||||
else
|
||||
iso_msb(wpt, 2, 2); /* 2 = Root partition with boot image */
|
||||
iso_msb(wpt + 2, 0x10, 2); /* Permissions: 0x10 = read-only */
|
||||
|
||||
/* 444 - 507 | ========== | Partition table */
|
||||
wpt = buf + 444 + (partition_number - 1) * 8;
|
||||
read_idx = partition_number - 1;
|
||||
if (flag & 1) {
|
||||
/* Search next lower valid partition table entry. #1 is default */
|
||||
for (read_idx = partition_number - 2; read_idx > 0; read_idx--)
|
||||
if (appended_partitions[read_idx] != NULL)
|
||||
if (appended_partitions[read_idx][0] != 0)
|
||||
break;
|
||||
}
|
||||
iso_msb(wpt, partition_offset[read_idx] / (uint32_t) ISO_SUN_CYL_SIZE, 4);
|
||||
iso_msb(wpt + 4, partition_size[read_idx] * 4, 4);
|
||||
|
||||
/* 510 - 511 | checksum | The result of exoring 2-byte words 0 to 254 */
|
||||
buf[510] = buf[511] = 0;
|
||||
for (i = 0; i < 510; i += 2) {
|
||||
buf[510] ^= buf[i];
|
||||
buf[511] ^= buf[i + 1];
|
||||
}
|
||||
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write SUN Disk Label with ISO in partition 1 and unused 2 to 8
|
||||
*/
|
||||
static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Bytes 512 to 32767 may come from image or external file */
|
||||
memset(buf, 0, 512);
|
||||
|
||||
/* 0 - 127 | label | ASCII Label */
|
||||
if (t->ascii_disc_label[0])
|
||||
strncpy((char *) buf, t->ascii_disc_label, 128);
|
||||
else
|
||||
strcpy((char *) buf,
|
||||
"CD-ROM Disc with Sun sparc boot created by libisofs");
|
||||
|
||||
/* 128 - 131 | 1 | Layout version */
|
||||
iso_msb(buf + 128, 1, 4);
|
||||
|
||||
/* 140 - 141 | 8 | Number of partitions */
|
||||
iso_msb(buf + 140, 8, 2);
|
||||
|
||||
/* 188 - 191 | 0x600ddeee | vtoc sanity */
|
||||
iso_msb(buf + 188, 0x600ddeee, 4);
|
||||
|
||||
/* 420 - 421 | 350 | Rotations per minute */
|
||||
iso_msb(buf + 420, 350, 2);
|
||||
|
||||
/* 422 - 423 | 2048 | Number of physical cylinders (fixely 640 MB) */
|
||||
iso_msb(buf + 422, 2048, 2);
|
||||
|
||||
/* 430 - 431 | 1 | interleave factor */
|
||||
iso_msb(buf + 430, 1, 2);
|
||||
|
||||
/* 432 - 433 | 2048 | Number of data cylinders (fixely 640 MB) */
|
||||
iso_msb(buf + 432, 2048, 2);
|
||||
|
||||
/* 436 - 437 | 1 | Number of heads per cylinder (1 cyl = 320 kB)*/
|
||||
iso_msb(buf + 436, 1, 2);
|
||||
|
||||
/* 438 - 439 | 640 | Number of sectors per head (1 head = 320 kB) */
|
||||
iso_msb(buf + 438, 640, 2);
|
||||
|
||||
/* 508 - 509 | 0xdabe | Magic Number */
|
||||
iso_msb(buf + 508, 0xdabe, 2);
|
||||
|
||||
/* Set partition 1 to describe ISO image and compute checksum */
|
||||
t->appended_part_start[0] = 0;
|
||||
t->appended_part_size[0] = t->curblock;
|
||||
ret = write_sun_partition_entry(1, t->appended_partitions,
|
||||
t->appended_part_start, t->appended_part_size,
|
||||
ISO_SUN_CYL_SIZE, buf, 0);
|
||||
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
{
|
||||
int ret, int_img_blocks, sa_type, i, will_append = 0;
|
||||
int first_partition = 1, last_partition = 4;
|
||||
uint32_t img_blocks;
|
||||
|
||||
if ((t == NULL) || (buf == NULL)) {
|
||||
@ -578,7 +698,11 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
memset(buf, 0, 16 * BLOCK_SIZE);
|
||||
|
||||
sa_type = (t->system_area_options >> 2) & 0x3f;
|
||||
for (i = 0; i < 4; i++)
|
||||
if (sa_type == 3) {
|
||||
first_partition = 2;
|
||||
last_partition = 8;
|
||||
}
|
||||
for (i = first_partition - 1; i <= last_partition - 1; i++)
|
||||
if (t->appended_partitions[i] != NULL) {
|
||||
will_append = 1;
|
||||
break;
|
||||
@ -648,6 +772,10 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
} else if (sa_type == 3) {
|
||||
ret = make_sun_disk_label(t, buf, 0);
|
||||
if (ret != ISO_SUCCESS)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (t->partition_offset > 0 && sa_type == 0) {
|
||||
@ -661,13 +789,20 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
}
|
||||
|
||||
/* This eventually overwrites the partition table entries made so far */
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = first_partition - 1; i <= last_partition - 1; i++) {
|
||||
if (t->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
ret = write_mbr_partition_entry(i + 1, t->appended_part_types[i],
|
||||
if (sa_type == 3) {
|
||||
ret = write_sun_partition_entry(i + 1, t->appended_partitions,
|
||||
t->appended_part_start, t->appended_part_size,
|
||||
ISO_SUN_CYL_SIZE,
|
||||
buf, t->appended_partitions[i][0] == 0);
|
||||
} else {
|
||||
ret = write_mbr_partition_entry(i + 1, t->appended_part_types[i],
|
||||
t->appended_part_start[i], t->appended_part_size[i],
|
||||
t->partition_secs_per_head, t->partition_heads_per_cyl,
|
||||
buf, 0);
|
||||
}
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user