1 --- cdrtools-2.01/mkisofs/Makefile.orig Sat Mar 1 23:44:58 2003
2 +++ cdrtools-2.01/mkisofs/Makefile Mon Mar 10 20:59:39 2003
9 apple.c volume.c desktop.c mac_label.c stream.c \
10 ifo_read.c dvd_file.c dvd_reader.c
11 HFILES= apple.h bootinfo.h config.h defaults.h diskmbr.h exclude.h \
12 --- cdrtools-1.10/mkisofs/defaults.h
13 +++ cdrtools-1.10/mkisofs/defaults.h
15 #define VOLUME_ID_DEFAULT "CDROM"
16 #define BOOT_CATALOG_DEFAULT "boot.catalog"
17 #define BOOT_IMAGE_DEFAULT NULL
18 +#define SILO_BOOT_IMAGE_DEFAULT "boot/second.b"
19 +#define SILO_BOOTBLOCK_DEFAULT "boot/cd.b"
20 +#define SILO_CONF_FILE_DEFAULT "/etc/silo.conf"
23 #define APPLE_TYPE_DEFAULT "TEXT"
24 #define APPLE_CREATOR_DEFAULT "unix"
25 --- cdrtools-1.10/mkisofs/mkisofs.8
26 +++ cdrtools-1.10/mkisofs/mkisofs.8
27 @@ -1272,6 +1280,25 @@
30 If specified in both places, the command line version is used.
32 +.BI \-s " silo_conf_file
33 +Specifies the path and filename of the SILO configuration file to be
34 +used when making a "SILO" bootable CD. The pathname must be relative to the
35 +source path specified to
37 +and start with a slash.
40 +See SILO documentation for the syntax of this file.
42 +.BI \-S " silo_bootblock
43 +Specifies the path and filename of the SILO first stage boot image to be
44 +used when making a "SILO" bootable CD. The pathname must be relative to the
45 +source path specified to
49 +The boot image must come from SILO 0.8.7 and higher.
52 Generate a file TRANS.TBL in each directory on the CDROM, which can be used
53 --- cdrtools-2.01/mkisofs/mkisofs.c.orig Sun Mar 2 17:28:33 2003
54 +++ cdrtools-2.01/mkisofs/mkisofs.c Mon Mar 10 21:21:18 2003
60 int all_files = 1; /* New default is to include all files */
64 char *boot_catalog = BOOT_CATALOG_DEFAULT;
65 char *boot_image = BOOT_IMAGE_DEFAULT;
66 char *genboot_image = BOOT_IMAGE_DEFAULT;
67 +char *silo_boot_image = SILO_BOOT_IMAGE_DEFAULT;
68 +char *silo_bootblock = SILO_BOOTBLOCK_DEFAULT;
69 +char *silo_conf_file = SILO_CONF_FILE_DEFAULT;
71 int ucs_level = 3; /* We now have Unicode tables so use level 3 */
72 int volume_set_size = 1;
73 int volume_sequence_number = 1;
76 #endif /* APPLE_HYB */
78 +#define OPTION_SILO_BOOT 2200
80 static int save_pname = 0;
82 static const struct ld_option ld_options[] =
84 '\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},
85 {{"sparc-boot", required_argument, NULL, 'B'},
86 'B', "FILES", "Set sparc boot image names", ONE_DASH},
87 + {{"silo-boot", required_argument, NULL, OPTION_SILO_BOOT},
88 + '\0', "FILE", "Set SILO second stage boot image name" , ONE_DASH },
89 {{"generic-boot", required_argument, NULL, 'G'},
90 'G', "FILE", "Set generic boot image name", ONE_DASH},
91 {{"sparc-label", required_argument, NULL, OPTION_SPARCLABEL},
93 { {"sort", required_argument, NULL, OPTION_SORT},
94 '\0', "FILE", "Sort file content locations according to rules in FILE" , ONE_DASH },
97 + { {"silo-conf-file", required_argument, NULL, 's'},
98 + 's', "FILE", "Set name of SILO configuration file on the CD", ONE_DASH },
99 + { {"silo-bootblock", required_argument, NULL, 'S'},
100 + 'S', "FILE", "Set SILO first stage bootblock image name", ONE_DASH },
101 {{"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
102 '\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH},
103 {{"stream-file-name", required_argument, NULL, OPTION_STREAM_FILE_NAME},
104 @@ -1362,6 +1374,34 @@
108 + case OPTION_SILO_BOOT:
110 + silo_boot_image = optarg; /* pathname of the boot image on cd */
111 + if (silo_boot_image == NULL) {
112 + fprintf(stderr,"Required boot image pathname missing\n");
118 + silo_bootblock = optarg; /* pathname of the boot image on cd */
119 + if (silo_bootblock == NULL) {
120 + fprintf(stderr,"Required bootblock pathname missing\n");
126 + silo_conf_file = optarg; /* pathname of the boot image on cd */
127 + if (silo_conf_file == NULL) {
128 + fprintf(stderr,"Required SILO config file pathname missing\n");
131 + if (*silo_conf_file != '/') {
132 + fprintf(stderr,"SILO config file pathname must start with /\n");
136 case OPTION_ABSTRACT:
138 if (strlen(abstract) > 37) {
139 @@ -3004,7 +3044,10 @@
140 outputlist_insert(&sunlabel_desc);
142 outputlist_insert(&genboot_desc);
143 - outputlist_insert(&startpad_desc);
145 + outputlist_insert(&silo_desc);
147 + outputlist_insert(&padblock_desc);
150 outputlist_insert(&voldesc_desc);
151 --- cdrtools-2.01/mkisofs/mkisofs.h.orig Fri Feb 28 01:30:36 2003
152 +++ cdrtools-2.01/mkisofs/mkisofs.h Mon Mar 10 21:22:48 2003
154 extern struct output_fragment *out_tail;
156 extern struct output_fragment startpad_desc;
157 +extern struct output_fragment silo_desc;
158 extern struct output_fragment voldesc_desc;
159 extern struct output_fragment xvoldesc_desc;
160 extern struct output_fragment joliet_desc;
162 struct directory_entry *s_entry;
166 + int (*filter)(char *, int, int);
172 +extern struct deferred_write * dw_head, * dw_tail;
174 struct eltorito_boot_entry_info {
175 struct eltorito_boot_entry_info *next;
178 extern char *boot_catalog;
179 extern char *boot_image;
180 extern char *genboot_image;
181 +extern char *silo_boot_image;
182 +extern char *silo_bootblock;
183 +extern char *silo_conf_file;
184 extern int ucs_level;
185 extern int volume_set_size;
186 extern int volume_sequence_number;
187 --- cdrtools-1.10/mkisofs/silo.c
188 +++ cdrtools-1.10/mkisofs/silo.c
191 + * Program silo.c - Handle SILO bootable iso9660 CD-ROMs.
194 + Copyright (C) 1999 Jakub Jelinek <jakub@redhat.com>.
196 + This program is free software; you can redistribute it and/or modify
197 + it under the terms of the GNU General Public License as published by
198 + the Free Software Foundation; either version 2, or (at your option)
201 + This program is distributed in the hope that it will be useful,
202 + but WITHOUT ANY WARRANTY; without even the implied warranty of
203 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
204 + GNU General Public License for more details.
206 + You should have received a copy of the GNU General Public License
207 + along with this program; if not, write to the Free Software
208 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
211 +static char rcsid[] ="$Id$";
213 +#include <mconfig.h>
215 +#include <sys/types.h>
216 +#include <sys/stat.h>
221 +#include "mkisofs.h"
222 +#include "iso9660.h"
225 +/* used by Win32 for opening binary file - not used by Unix */
228 +#endif /* O_BINARY */
230 +struct sun_disklabel {
231 + char info[128]; /* Informative text string */
239 + char spare1[246]; /* Boot information etc. */
240 + char rspeed[2]; /* 722 - Disk rotational speed */
241 + char pcylcount[2]; /* 722 - Physical cylinder count */
242 + char sparecyl[2]; /* 722 - extra sects per cylinder */
243 + char spare2[4]; /* More magic... */
244 + char ilfact[2]; /* 722 - Interleave factor */
245 + char ncyl[2]; /* 722 - Data cylinder count */
246 + char nacyl[2]; /* 722 - Alt. cylinder count */
247 + char ntrks[2]; /* 722 - Tracks per cylinder */
248 + char nsect[2]; /* 722 - Sectors per track */
249 + char spare3[4]; /* Even more magic... */
250 + struct sun_partition {
251 + char start_cylinder[4]; /* 732 */
252 + char num_sectors[4]; /* 732 */
254 + char magic[2]; /* 722 - Magic number */
255 + char csum[2]; /* 722 - Label xor'd checksum */
256 + struct bootblock_header {
257 + char magic[4]; /* 732 */
261 + char extent[4]; /* 732 */
262 + char size[4]; /* 732 */
263 + char text[2048-512-56];
272 + char conf_file[256];
275 +static int silo_size(int starting_extent)
281 +static int silo_filter(char * buffer, int size, int offset)
283 + if (offset < 0x808 + sizeof(silo_info)
284 + && offset + size > 0x808)
287 + if (offset < 0x808)
289 + offset = 0x808 - offset;
296 + i = sizeof(silo_info) - offset;
297 + if (i > size) i = size;
298 + memcpy (buffer, ((char *)&silo_info) + offset, i);
303 +static int silo_write(FILE * outfile)
305 + struct directory_entry * de;
306 + struct directory_entry * de2;
307 + struct deferred_write * dwpnt;
308 + int bootblock, i, should_write;
309 + struct sun_disklabel silo_bb;
311 + memset (&silo_bb, 0, sizeof (silo_bb));
313 + if (*silo_bootblock == '/') silo_bootblock++;
314 + if (*silo_boot_image == '/') silo_boot_image++;
317 + * search from root of iso fs to find boot catalog
319 + de2 = search_tree_file(root, silo_bootblock);
322 + fprintf(stderr,"Uh oh, I cant find the SILO bootblock!\n");
327 + * now read it from disk
329 + bootblock = open(de2->whole_name, O_RDWR | O_BINARY);
330 + if (bootblock == -1)
332 + fprintf(stderr,"Error opening SILO bootblock for reading.\n");
337 + if (read (bootblock, (char *)&silo_bb.bootblock, 1024) != 1024)
339 + fprintf(stderr,"Error reading SILO bootblock.\n");
346 + if (get_732 (silo_bb.bootblock.magic) != 0x01030107
347 + || strncmp (silo_bb.bootblock.siloid, "SILO", 4)
348 + || silo_bb.bootblock.siloid[5] != '.'
349 + || silo_bb.bootblock.siloid[4] < '0'
350 + || silo_bb.bootblock.siloid[4] > '9'
351 + || silo_bb.bootblock.siloid[6] < '0'
352 + || silo_bb.bootblock.siloid[6] > '9'
353 + || silo_bb.bootblock.siloid[7] < '0'
354 + || silo_bb.bootblock.siloid[7] > '9')
356 + fprintf(stderr,"Error: the file %s is not a valid SILO bootblock.\n", silo_bootblock);
361 + /* Check version number. Only SILO 0.87 and up is valid. */
362 + if (silo_bb.bootblock.siloid[4] == '0'
363 + && (silo_bb.bootblock.siloid[6] < '8'
364 + || (silo_bb.bootblock.siloid[6] == '8'
365 + && silo_bb.bootblock.siloid[7] <= '6')))
367 + fprintf(stderr,"Error: SILO bootblock is too old. Must be at least 0.8.7.\n");
373 + * search from root of iso fs to find boot catalog
375 + de = search_tree_file(root, silo_boot_image);
378 + fprintf(stderr,"Uh oh, I cant find the SILO boot image!\n");
383 + * need to filter second.b, so that we can seed
384 + * silo.conf location and other stuff.
385 + * We could write it into the de->whole_name file,
386 + * but I prefer filtering it like this because
387 + * then the tree can be e.g. read only NFS mounted.
389 + for (dwpnt = dw_head; dwpnt; dwpnt = dwpnt->next)
391 + if (!dwpnt->name) continue;
392 + if (!strcmp (dwpnt->name, de->whole_name))
393 + dwpnt->filter = silo_filter;
396 + set_732 (silo_bb.bootblock.extent, de->starting_block);
397 + set_732 (silo_bb.bootblock.size, de->size);
399 + strcpy (silo_bb.info, "SPARC bootable CD-ROM: ");
400 + strcat (silo_bb.info, volume_id);
402 + should_write = (last_extent - session_start) << 2;
404 + /* Now some magic */
405 + silo_bb.spare0[3] = 1;
406 + silo_bb.spare0[13] = 8;
407 + for (i = 0; i < 8; i++) {
408 + silo_bb.infos[i].id = 0x83;
409 + silo_bb.infos[i].flags = 0x18;
411 + set_732 (silo_bb.spare1 + 14, 0x600ddeee);
412 + set_722 (silo_bb.rspeed, 0x15e);
413 + set_722 (silo_bb.pcylcount, (should_write + 639) / 640);
414 + set_722 (silo_bb.ilfact, 1);
415 + set_722 (silo_bb.ncyl, (should_write + 639) / 640);
416 + set_722 (silo_bb.ntrks, 1);
417 + set_722 (silo_bb.nsect, 640);
418 + set_732 (silo_bb.partitions[0].num_sectors, should_write);
419 + set_722 (silo_bb.magic, 0xdabe);
420 + for (i = 0; i < 510; i+=2) {
421 + silo_bb.csum[0] ^= silo_bb.info[i];
422 + silo_bb.csum[1] ^= silo_bb.info[i+1];
425 + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile);
426 + memset (&silo_bb, 0, sizeof(silo_bb));
428 + for(i=1; i<16; i++)
430 + xfwrite(&silo_bb, 1, sizeof(silo_bb), outfile);
433 + memset (&silo_info, 0, sizeof(silo_info));
434 + silo_info.id = 'L';
435 + silo_info.conf_part = 1;
436 + strncpy (silo_info.conf_file, silo_conf_file, 256);
437 + silo_info.conf_file[259] = '\0';
439 + last_extent_written += 16;
444 +struct output_fragment silo_desc = {NULL, silo_size, NULL, silo_write};
445 --- cdrtools-1.10/mkisofs/vms.c
446 +++ cdrtools-1.10/mkisofs/vms.c
448 extern unsigned int last_extent_written;
451 -vms_write_one_file(char *filename, int size, FILE * outfile)
452 +vms_write_one_file(struct deferred_write * dwpnt, FILE * outfile)
456 @@ -296,10 +296,12 @@
462 - open_file(filename);
465 + open_file(dwpnt->name);
467 + remain = dwpnt->size;
470 use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT * SECTOR_SIZE : remain);
471 @@ -308,11 +310,14 @@
472 rab->rab$l_ubf = buffer;
473 rab->rab$w_usz = sizeof(buffer);
474 status = sys$read(rab);
476 + (* dwpnt->filter)(buffer, use, offset);
477 fwrite(buffer, 1, use, outfile);
478 last_extent_written += use / SECTOR_SIZE;
479 if ((last_extent_written % 1000) < use / SECTOR_SIZE)
480 fprintf(stderr, "%d..", last_extent_written);
486 --- cdrtools-2.01/mkisofs/write.c.orig Fri Feb 28 01:32:13 2003
487 +++ cdrtools-2.01/mkisofs/write.c Mon Mar 10 21:27:06 2003
490 static int assign_directory_addresses __PR((struct directory *node));
492 -static void write_one_file __PR((char *filename, unsigned int size,
493 +static void write_one_file __PR((struct deferred_write *dwpnt,
494 FILE *outfile, off_t off));
496 -static void write_one_file __PR((char *filename, unsigned int size,
497 +static void write_one_file __PR((struct deferred_write *dwpnt,
500 static void write_files __PR((FILE *outfile));
502 static struct deferred_write mac_boot;
504 #endif /* APPLE_HYB */
505 -static struct deferred_write *dw_head = NULL,
506 +struct deferred_write *dw_head = NULL,
509 unsigned int last_extent_written = 0;
510 @@ -354,16 +354,14 @@
514 -write_one_file(filename, size, outfile, off)
517 +write_one_file(dwpnt, outfile, off)
518 + struct deferred_write *dwpnt;
523 -write_one_file(filename, size, outfile)
526 +write_one_file(dwpnt, outfile)
527 + struct deferred_write *dwpnt;
529 #endif /* APPLE_HYB */
531 @@ -379,18 +377,18 @@
538 - if ((infile = fopen(filename, "rb")) == NULL) {
539 + if ((infile = fopen(dwpnt->name, "rb")) == NULL) {
541 - comerr("cannot open '%s'\n", filename);
542 + comerr("cannot open '%s'\n", dwpnt->name);
544 #ifndef HAVE_STRERROR
545 fprintf(stderr, "cannot open '%s': (%d)\n",
547 + dwpnt->name, errno);
549 fprintf(stderr, "cannot open '%s': %s\n",
550 - filename, strerror(errno));
551 + dwpnt->name, strerror(errno));
557 fseek(infile, off, SEEK_SET);
558 #endif /* APPLE_HYB */
561 + remain = dwpnt->size;
564 use = (remain > SECTOR_SIZE * NSECT - 1 ?
565 NSECT * SECTOR_SIZE : remain);
566 @@ -408,13 +406,16 @@
567 memset(buffer, 0, use);
568 if (fread(buffer, 1, use, infile) == 0) {
570 - comerr("cannot read from '%s'\n", filename);
571 + comerr("cannot read from '%s'\n", dwpnt->name);
573 - fprintf(stderr, "cannot read from '%s'\n", filename);
574 + fprintf(stderr, "cannot read from '%s'\n", dwpnt->name);
579 + (* dwpnt->filter)(buffer, use, offset);
580 xfwrite(buffer, 1, use, outfile);
582 last_extent_written += use / SECTOR_SIZE;
584 if ((last_extent_written % 1000) < use / SECTOR_SIZE) {
585 @@ -474,13 +475,12 @@
589 - vms_write_one_file(dwpnt->name, dwpnt->size, outfile);
590 + vms_write_one_file(dwpnt, outfile);
593 - write_one_file(dwpnt->name, dwpnt->size, outfile,
595 + write_one_file(dwpnt, outfile,dwpnt->off);
597 - write_one_file(dwpnt->name, dwpnt->size, outfile);
598 + write_one_file(dwpnt, outfile);
599 #endif /* APPLE_HYB */
602 @@ -1145,6 +1145,7 @@
604 dwpnt->size = s_entry->size;
605 dwpnt->extent = last_extent;
606 + dwpnt->filter = NULL;
607 set_733((char *) s_entry->isorec.extent,
609 s_entry->starting_block = last_extent;
610 @@ -1716,8 +1717,7 @@
612 /* write out HFS boot block */
614 - write_one_file(mac_boot.name, mac_boot.size, outfile,
616 + write_one_file(&mac_boot, outfile, mac_boot.off);
618 #endif /* APPLE_HYB */