From 54e8cf613dd0191fcc5e585d8c3db9c5a9ecada0 Mon Sep 17 00:00:00 2001 From: fake Date: Sun, 12 Sep 2004 13:22:40 +0000 Subject: [PATCH] fake: cdrtools: add an option to mkisofs that is used in the powerpc boot stuff, it makes creating chrp-bootcds possible. [2004090305052913497] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@4136 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- package/base/cdrtools/chrp-boot.patch | 225 ++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 package/base/cdrtools/chrp-boot.patch diff --git a/package/base/cdrtools/chrp-boot.patch b/package/base/cdrtools/chrp-boot.patch new file mode 100644 index 000000000..c85082031 --- /dev/null +++ b/package/base/cdrtools/chrp-boot.patch @@ -0,0 +1,225 @@ +diff -ur cdrtools-2.00.3/mkisofs/mac_label.c cdrtools-2.00.3-local/mkisofs/mac_label.c +--- cdrtools-2.00.3/mkisofs/mac_label.c 2002-05-20 11:58:11.000000000 +0100 ++++ cdrtools-2.00.3-local/mkisofs/mac_label.c 2003-07-30 21:23:28.000000000 +0100 +@@ -64,16 +64,46 @@ + struct directory_entry *de; + int i, + block, +- size; ++ size, ++ entry = 0; + MacLabel *mac_label = (MacLabel *) ml; + + if (verbose > 1) { + fprintf(stderr, "Creating %d PReP boot partition(s)\n", +- use_prep_boot); ++ use_prep_boot + use_chrp_boot); + } + mac_label->fdiskMagic[0] = fdiskMagic0; + mac_label->fdiskMagic[1] = fdiskMagic1; + ++ if (use_chrp_boot) { ++ fprintf(stderr, "CHRP boot partition 1\n"); ++ ++ mac_label->image[entry].boot = 0x80; ++ ++ mac_label->image[entry].CHSstart[0] = 0xff; ++ mac_label->image[entry].CHSstart[1] = 0xff; ++ mac_label->image[entry].CHSstart[2] = 0xff; ++ ++ mac_label->image[entry].type = chrpPartType; /* 0x96 */ ++ ++ mac_label->image[entry].CHSend[0] = 0xff; ++ mac_label->image[entry].CHSend[1] = 0xff; ++ mac_label->image[entry].CHSend[2] = 0xff; ++ ++ mac_label->image[entry].startSect[0] = 0; ++ mac_label->image[entry].startSect[1] = 0; ++ mac_label->image[entry].startSect[2] = 0; ++ mac_label->image[entry].startSect[3] = 0; ++ ++ size = (last_extent - session_start) * 2048 / 512; ++ mac_label->image[entry].size[0] = size & 0xff; ++ mac_label->image[entry].size[1] = (size >> 8) & 0xff; ++ mac_label->image[entry].size[2] = (size >> 16) & 0xff; ++ mac_label->image[entry].size[3] = (size >> 24) & 0xff; ++ ++ ++entry; ++ } ++ + for (i = 0; i < use_prep_boot; i++) { + de = search_tree_file(root, prep_boot_image[i]); + if (!de) { +@@ -88,18 +118,42 @@ + fprintf(stderr, "PReP boot partition %d is \"%s\"\n", + i + 1, prep_boot_image[i]); + ++ mac_label->image[entry].boot = 0x80; ++ ++ mac_label->image[entry].CHSstart[0] = 0xff; ++ mac_label->image[entry].CHSstart[1] = 0xff; ++ mac_label->image[entry].CHSstart[2] = 0xff; ++ ++ mac_label->image[entry].type = prepPartType; /* 0x41 */ ++ ++ mac_label->image[entry].CHSend[0] = 0xff; ++ mac_label->image[entry].CHSend[1] = 0xff; ++ mac_label->image[entry].CHSend[2] = 0xff; ++ + /* deal with endianess */ +- mac_label->image[i].type = prepPartType; /* 0x41 */ +- mac_label->image[i].startSect[0] = block & 0xff; +- mac_label->image[i].startSect[1] = (block >> 8) & 0xff; +- mac_label->image[i].startSect[2] = (block >> 16) & 0xff; +- mac_label->image[i].startSect[3] = (block >> 24) & 0xff; +- mac_label->image[i].size[0] = size & 0xff; +- mac_label->image[i].size[1] = (size >> 8) & 0xff; +- mac_label->image[i].size[2] = (size >> 16) & 0xff; +- mac_label->image[i].size[3] = (size >> 24) & 0xff; ++ mac_label->image[entry].startSect[0] = block & 0xff; ++ mac_label->image[entry].startSect[1] = (block >> 8) & 0xff; ++ mac_label->image[entry].startSect[2] = (block >> 16) & 0xff; ++ mac_label->image[entry].startSect[3] = (block >> 24) & 0xff; ++ ++ mac_label->image[entry].size[0] = size & 0xff; ++ mac_label->image[entry].size[1] = (size >> 8) & 0xff; ++ mac_label->image[entry].size[2] = (size >> 16) & 0xff; ++ mac_label->image[entry].size[3] = (size >> 24) & 0xff; ++ ++ ++entry; + } ++ while (entry < 4) { ++ mac_label->image[entry].CHSstart[0] = 0xff; ++ mac_label->image[entry].CHSstart[1] = 0xff; ++ mac_label->image[entry].CHSstart[2] = 0xff; ++ ++ mac_label->image[entry].CHSend[0] = 0xff; ++ mac_label->image[entry].CHSend[1] = 0xff; ++ mac_label->image[entry].CHSend[2] = 0xff; + ++ ++entry; ++ } + } + + #endif /* PREP_BOOT */ +diff -ur cdrtools-2.00.3/mkisofs/mac_label.h cdrtools-2.00.3-local/mkisofs/mac_label.h +--- cdrtools-2.00.3/mkisofs/mac_label.h 2000-03-18 18:23:55.000000000 +0000 ++++ cdrtools-2.00.3-local/mkisofs/mac_label.h 2003-07-23 12:49:59.000000000 +0100 +@@ -37,6 +37,7 @@ + #ifdef PREP_BOOT + struct fdiskPartition { + #define prepPartType 0x41 ++#define chrpPartType 0x96 + unsigned char boot; /* bootable flag; not used */ + unsigned char CHSstart[3]; /* start CHS; not used */ + unsigned char type; /* Partition type, = 0x41 (PReP bootable) */ +diff -ur cdrtools-2.00.3/mkisofs/mkisofs.c cdrtools-2.00.3-local/mkisofs/mkisofs.c +--- cdrtools-2.00.3/mkisofs/mkisofs.c 2003-05-15 15:12:44.000000000 +0100 ++++ cdrtools-2.00.3-local/mkisofs/mkisofs.c 2003-07-30 21:24:16.000000000 +0100 +@@ -197,7 +197,7 @@ + #ifdef PREP_BOOT + char *prep_boot_image[4]; + int use_prep_boot = 0; +- ++int use_chrp_boot = 0; + #endif /* PREP_BOOT */ + #endif /* APPLE_HYB */ + +@@ -401,6 +401,8 @@ + #define OPTION_HFS_BLESS 2040 + #define OPTION_HFS_PARMS 2041 + ++#define OPTION_CHRP_BOOT 2042 ++ + #endif /* APPLE_HYB */ + + static int save_pname = 0; +@@ -661,6 +663,8 @@ + #ifdef PREP_BOOT + {{"prep-boot", required_argument, NULL, OPTION_PREP_BOOT}, + '\0', "FILE", "PReP boot image file -- up to 4 are allowed", ONE_DASH}, ++ {{"chrp-boot", no_argument, NULL, OPTION_CHRP_BOOT}, ++ '\0', NULL, "Add CHRP boot header", ONE_DASH}, + #endif /* PREP_BOOT */ + {{"cap", no_argument, NULL, OPTION_CAP}, + '\0', NULL, "Look for AUFS CAP Macintosh files", TWO_DASHES}, +@@ -2073,13 +2077,13 @@ + #ifdef PREP_BOOT + case OPTION_PREP_BOOT: + use_prep_boot++; +- if (use_prep_boot > 4) { ++ if (use_prep_boot > 4 - use_chrp_boot) { + #ifdef USE_LIBSCHILY + comerrno(EX_BAD, +- "Maximum of 4 PReP boot images are allowed\n"); ++ "Maximum of 4 partition entries are allowed\n"); + #else + fprintf(stderr, +- "Maximum of 4 PReP boot images are allowed\n"); ++ "Maximum of 4 partition entries are allowed\n"); + #endif + exit(1); + } +@@ -2096,6 +2100,21 @@ + exit(1); + } + break; ++ case OPTION_CHRP_BOOT: ++ if (use_chrp_boot) ++ break; /* silently allow duplicates */ ++ use_chrp_boot = 1; ++ if (use_prep_boot > 3) { ++#ifdef USE_LIBSCHILY ++ comerrno(EX_BAD, ++ "Maximum of 4 partition entries are allowed\n"); ++#else ++ fprintf(stderr, ++ "Maximum of 4 partition entries are allowed\n"); ++#endif ++ exit(1); ++ } ++ break; + #endif /* PREP_BOOT */ + #endif /* APPLE_HYB */ + default: +@@ -2957,7 +2976,7 @@ + */ + #ifdef APPLE_HYB + #ifdef PREP_BOOT +- if (apple_hyb || use_prep_boot) ++ if (apple_hyb || use_prep_boot || use_chrp_boot) + #else /* PREP_BOOT */ + if (apple_hyb) + #endif /* PREP_BOOT */ +diff -ur cdrtools-2.00.3/mkisofs/mkisofs.h cdrtools-2.00.3-local/mkisofs/mkisofs.h +--- cdrtools-2.00.3/mkisofs/mkisofs.h 2002-12-07 19:59:42.000000000 +0000 ++++ cdrtools-2.00.3-local/mkisofs/mkisofs.h 2003-07-23 12:54:29.000000000 +0100 +@@ -393,6 +393,7 @@ + #ifdef PREP_BOOT + extern char *prep_boot_image[4]; + extern int use_prep_boot; ++extern int use_chrp_boot; + + #endif /* PREP_BOOT */ + #endif /* APPLE_HYB */ +diff -ur cdrtools-2.00.3/mkisofs/write.c cdrtools-2.00.3-local/mkisofs/write.c +--- cdrtools-2.00.3/mkisofs/write.c 2002-12-23 14:16:45.000000000 +0000 ++++ cdrtools-2.00.3-local/mkisofs/write.c 2003-07-30 21:17:53.000000000 +0100 +@@ -2131,7 +2131,7 @@ + if (apple_hyb) + hfs_file_gen(start_extent); + #ifdef PREP_BOOT +- else if (use_prep_boot) ++ else if (use_prep_boot || use_chrp_boot) + gen_prepboot(); + #endif /* PREP_BOOT */ + #endif /* APPLE_HYB */ +@@ -2290,7 +2290,7 @@ + /* reserve space for the label partition - if it is needed */ + #ifdef PREP_BOOT + /* a PReP bootable partition needs the map.. */ +- if (gen_pt || use_prep_boot) ++ if (gen_pt || use_prep_boot || use_chrp_boot) + #else + if (gen_pt) + #endif /* PREP_BOOT */