Package: genisoimage Version: 9:1.1.0-1 Severity: wishlist Tags: patch Attached is a patch that allows alpha and hppa boot blocks to coexist on a single ISO image, muhahaha. Please consider applying it, after it's been verified to work on hppa (already tested on alpha).
If there are any concerns about the way in which this is implemented, please let me know. Cheers, -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. [EMAIL PROTECTED] http://www.debian.org/
only in patch2: unchanged: --- cdrkit-1.1.0.orig/genisoimage/boot-alpha.c +++ cdrkit-1.1.0/genisoimage/boot-alpha.c @@ -47,8 +47,12 @@ int add_boot_alpha_filename(char *filename); static int boot_alpha_write(FILE *outfile); +static int boot_alpha_hppa_write(FILE *outfile); static char *boot_file_name = NULL; +unsigned long long alpha_hppa_boot_sector[256]; /* One (ISO) sector */ +int boot_sector_initialized = 0; + #define BOOT_STRING "Linux/Alpha aboot for ISO filesystem." /* Simple function: store the filename to be used later when we need @@ -61,17 +65,17 @@ static int boot_alpha_write(FILE *outfile) { - unsigned long long boot_sector[256]; /* One (ISO) sector */ - unsigned long long sum = 0; - struct directory_entry *boot_file; /* Boot file we need to search for */ + struct directory_entry *boot_file; /* Boot file we need to search for */ unsigned long length = 0; unsigned long extent = 0; - int i = 0; - memset(boot_sector, 0, sizeof(boot_sector)); + if (!boot_sector_initialized) { + memset(alpha_hppa_boot_sector, 0, sizeof(alpha_hppa_boot_sector)); + boot_sector_initialized = 1; + } /* Write the text header into the boot sector */ - strcpy((char *)boot_sector, BOOT_STRING); + strcpy((char *)alpha_hppa_boot_sector, BOOT_STRING); /* Find the dir entry for the boot file by walking our file list */ boot_file = search_tree_file(root, boot_file_name); @@ -103,22 +107,31 @@ /* Now write those values into the appropriate area of the boot sector in LITTLE ENDIAN format. */ - write_le64(length, (unsigned char *)(unsigned long long *)&boot_sector[60]); - write_le64(extent, (unsigned char *)&boot_sector[61]); + write_le64(length, (unsigned char *)&alpha_hppa_boot_sector[60]); + write_le64(extent, (unsigned char *)&alpha_hppa_boot_sector[61]); + + return 0; +} + +static int boot_alpha_hppa_write(FILE *outfile) +{ + unsigned long long sum = 0; + int i = 0; /* Now generate a checksum of the first 504 bytes of the boot - sector and place it in boot_sector[63]. Isomarkboot currently + sector and place it in alpha_hppa_boot_sector[63]. Isomarkboot currently gets this wrong and will not work on big-endian systems! */ for (i = 0; i < 63; i++) - sum += read_le64((unsigned char *)&boot_sector[i]); + sum += read_le64((unsigned char *)&alpha_hppa_boot_sector[i]); - write_le64(sum, (unsigned char *)&boot_sector[63]); + write_le64(sum, (unsigned char *)&alpha_hppa_boot_sector[63]); - jtwrite(boot_sector, sizeof(boot_sector), 1, 0, FALSE); - xfwrite(boot_sector, sizeof(boot_sector), 1, outfile, 0, FALSE); + jtwrite(alpha_hppa_boot_sector, sizeof(alpha_hppa_boot_sector), 1, 0, FALSE); + xfwrite(alpha_hppa_boot_sector, sizeof(alpha_hppa_boot_sector), 1, outfile, 0, FALSE); last_extent_written++; return 0; } -struct output_fragment alphaboot_desc = {NULL, oneblock_size, NULL, boot_alpha_write, "alpha boot block"}; +struct output_fragment alphaboot_desc = {NULL, NULL, NULL, boot_alpha_write, "alpha boot block"}; +struct output_fragment alpha_hppa_boot_desc = {NULL, oneblock_size, NULL, boot_alpha_hppa_write, "alpha/hppa boot block"}; only in patch2: unchanged: --- cdrkit-1.1.0.orig/genisoimage/boot-hppa.c +++ cdrkit-1.1.0/genisoimage/boot-hppa.c @@ -53,6 +53,9 @@ #include <schily.h> #include "endianconv.h" +extern long long alpha_hppa_boot_sector[256]; +extern int boot_sector_initialized; + int add_boot_hppa_cmdline(char *cmdline); int add_boot_hppa_kernel_32(char *filename); int add_boot_hppa_kernel_64(char *filename); @@ -129,13 +132,18 @@ static int boot_hppa_write(FILE *outfile) { - unsigned char boot_sector[2048]; /* One (ISO) sector */ - struct directory_entry *boot_file; /* Boot file we need to search for */ + struct directory_entry *boot_file; /* Boot file we need to search for */ unsigned long length = 0; unsigned long extent = 0; + unsigned char *boot_sector = (unsigned char *) alpha_hppa_boot_sector; int i = 0; - memset(boot_sector, 0, sizeof(boot_sector)); + if (!boot_sector_initialized) { + memset(alpha_hppa_boot_sector, 0, sizeof(alpha_hppa_boot_sector)); + boot_sector_initialized = 1; + } + + printf("Address is: %p\n",alpha_hppa_boot_sector); boot_sector[0] = 0x80; /* magic */ boot_sector[1] = 0x00; /* magic */ @@ -193,11 +201,7 @@ write_be32(extent, &boot_sector[240]); write_be32(length, &boot_sector[244]); - jtwrite(boot_sector, sizeof(boot_sector), 1, 0, FALSE); - xfwrite(boot_sector, sizeof(boot_sector), 1, outfile, 0, FALSE); - last_extent_written++; - return 0; } -struct output_fragment hppaboot_desc = {NULL, oneblock_size, NULL, boot_hppa_write, "hppa boot block"}; +struct output_fragment hppaboot_desc = {NULL, NULL, NULL, boot_hppa_write, "hppa boot block"}; only in patch2: unchanged: --- cdrkit-1.1.0.orig/genisoimage/genisoimage.c +++ cdrkit-1.1.0/genisoimage/genisoimage.c @@ -3448,6 +3448,8 @@ outputlist_insert(&alphaboot_desc); if (use_hppaboot) outputlist_insert(&hppaboot_desc); + if (use_alphaboot || use_hppaboot) + outputlist_insert(&alpha_hppa_boot_desc); if (use_mipsboot) outputlist_insert(&mipsboot_desc); if (use_mipselboot) only in patch2: unchanged: --- cdrkit-1.1.0.orig/genisoimage/genisoimage.h +++ cdrkit-1.1.0/genisoimage/genisoimage.h @@ -210,6 +210,7 @@ extern struct output_fragment strpath_desc; extern struct output_fragment alphaboot_desc; extern struct output_fragment hppaboot_desc; +extern struct output_fragment alpha_hppa_boot_desc; extern struct output_fragment mipsboot_desc; extern struct output_fragment mipselboot_desc;