2009-12-23 Felix Zielcke <fzielcke@z-51.de>
* commands/i386/pc/drivemap.c: Remove all trailing whitespace. * commands/lspci.c: Likewise. * commands/probe.c: Likewise. * commands/xnu_uuid.c: Likewise. * conf/i386-coreboot.rmk: Likewise. * conf/i386-efi.rmk: Likewise. * conf/i386-ieee1275.rmk: Likewise. * conf/i386-pc.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. * fs/i386/pc/pxe.c: Likewise. * gettext/gettext.c: Likewise. * include/grub/efi/graphics_output.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * kern/env.c: Likewise. * kern/i386/qemu/startup.S: Likewise. * lib/i386/pc/biosnum.c: Likewise. * lib/i386/relocator.c: Likewise. * lib/i386/relocator_asm.S: Likewise. * lib/relocator.c: Likewise. * loader/i386/bsd.c: Likewise. * loader/i386/multiboot.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/xnu.c: Likewise. * loader/xnu.c: Likewise. * normal/main.c: Likewise. * normal/menu_text.c: Likewise. * util/getroot.c: Likewise. * util/grub-mkconfig_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/mkisofs/eltorito.c: Likewise. * util/mkisofs/exclude.h: Likewise. * util/mkisofs/hash.c: Likewise. * util/mkisofs/iso9660.h: Likewise. * util/mkisofs/joliet.c: Likewise. * util/mkisofs/mkisofs.c: Likewise. * util/mkisofs/mkisofs.h: Likewise. * util/mkisofs/multi.c: Likewise. * util/mkisofs/name.c: Likewise. * util/mkisofs/rock.c: Likewise. * util/mkisofs/tree.c: Likewise. * util/mkisofs/write.c: Likewise. * video/efi_gop.c: Likewise.
This commit is contained in:
parent
009ec74317
commit
a2c1332b70
46 changed files with 803 additions and 755 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Program eltorito.c - Handle El Torito specific extensions to iso9660.
|
||||
*
|
||||
*
|
||||
|
||||
Written by Michael Fulbright <msf@redhat.com> (1996).
|
||||
|
||||
|
@ -53,7 +53,7 @@ static struct eltorito_boot_descriptor gboot_desc;
|
|||
static int tvd_write __PR((FILE * outfile));
|
||||
|
||||
/*
|
||||
* Check for presence of boot catalog. If it does not exist then make it
|
||||
* Check for presence of boot catalog. If it does not exist then make it
|
||||
*/
|
||||
void FDECL1(init_boot_catalog, const char *, path)
|
||||
{
|
||||
|
@ -61,37 +61,37 @@ void FDECL1(init_boot_catalog, const char *, path)
|
|||
char * bootpath; /* filename of boot catalog */
|
||||
char * buf;
|
||||
struct stat statbuf;
|
||||
|
||||
|
||||
bootpath = (char *) e_malloc(strlen(boot_catalog)+strlen(path)+2);
|
||||
strcpy(bootpath, path);
|
||||
if (bootpath[strlen(bootpath)-1] != '/')
|
||||
if (bootpath[strlen(bootpath)-1] != '/')
|
||||
{
|
||||
strcat(bootpath,"/");
|
||||
}
|
||||
|
||||
|
||||
strcat(bootpath, boot_catalog);
|
||||
|
||||
|
||||
/*
|
||||
* check for the file existing
|
||||
* check for the file existing
|
||||
*/
|
||||
#ifdef DEBUG_TORITO
|
||||
fprintf(stderr,"Looking for boot catalog file %s\n",bootpath);
|
||||
#endif
|
||||
|
||||
if (!stat_filter(bootpath, &statbuf))
|
||||
|
||||
if (!stat_filter(bootpath, &statbuf))
|
||||
{
|
||||
/*
|
||||
* make sure its big enough to hold what we want
|
||||
* make sure its big enough to hold what we want
|
||||
*/
|
||||
if (statbuf.st_size == 2048)
|
||||
if (statbuf.st_size == 2048)
|
||||
{
|
||||
/*
|
||||
* printf("Boot catalog exists, so we do nothing\n");
|
||||
* printf("Boot catalog exists, so we do nothing\n");
|
||||
*/
|
||||
free(bootpath);
|
||||
return;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("A boot catalog exists and appears corrupted.\n"));
|
||||
fprintf (stderr, _("Please check the following file: %s.\n"), bootpath);
|
||||
|
@ -100,15 +100,15 @@ void FDECL1(init_boot_catalog, const char *, path)
|
|||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* file does not exist, so we create it
|
||||
* file does not exist, so we create it
|
||||
* make it one CD sector long
|
||||
*/
|
||||
bcat = fopen (bootpath, "wb");
|
||||
if (bcat == NULL)
|
||||
error (1, errno, _("Error creating boot catalog (%s)"), bootpath);
|
||||
|
||||
|
||||
buf = (char *) e_malloc( 2048 );
|
||||
if (fwrite (buf, 1, 2048, bcat) != 2048)
|
||||
error (1, errno, _("Error writing to boot catalog (%s)"), bootpath);
|
||||
|
@ -127,65 +127,65 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
struct directory_entry * de2;
|
||||
unsigned int i;
|
||||
int nsectors;
|
||||
|
||||
|
||||
memset(boot_desc, 0, sizeof(*boot_desc));
|
||||
boot_desc->id[0] = 0;
|
||||
memcpy(boot_desc->id2, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
|
||||
boot_desc->version[0] = 1;
|
||||
|
||||
|
||||
memcpy(boot_desc->system_id, EL_TORITO_ID, sizeof(EL_TORITO_ID));
|
||||
|
||||
|
||||
/*
|
||||
* search from root of iso fs to find boot catalog
|
||||
* search from root of iso fs to find boot catalog
|
||||
*/
|
||||
de2 = search_tree_file(root, boot_catalog);
|
||||
if (!de2)
|
||||
if (!de2)
|
||||
{
|
||||
fprintf (stderr, _("Boot catalog cannot be found!\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
set_731(boot_desc->bootcat_ptr,
|
||||
(unsigned int) get_733(de2->isorec.extent));
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* now adjust boot catalog
|
||||
* lets find boot image first
|
||||
* lets find boot image first
|
||||
*/
|
||||
de=search_tree_file(root, boot_image);
|
||||
if (!de)
|
||||
if (!de)
|
||||
{
|
||||
fprintf (stderr, _("Boot image cannot be found!\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/*
|
||||
}
|
||||
|
||||
/*
|
||||
* we have the boot image, so write boot catalog information
|
||||
* Next we write out the primary descriptor for the disc
|
||||
* Next we write out the primary descriptor for the disc
|
||||
*/
|
||||
memset(&valid_desc, 0, sizeof(valid_desc));
|
||||
valid_desc.headerid[0] = 1;
|
||||
valid_desc.arch[0] = EL_TORITO_ARCH_x86;
|
||||
|
||||
|
||||
/*
|
||||
* we'll shove start of publisher id into id field, may get truncated
|
||||
* but who really reads this stuff!
|
||||
*/
|
||||
if (publisher)
|
||||
memcpy_max(valid_desc.id, publisher, MIN(23, strlen(publisher)));
|
||||
|
||||
|
||||
valid_desc.key1[0] = 0x55;
|
||||
valid_desc.key2[0] = 0xAA;
|
||||
|
||||
|
||||
/*
|
||||
* compute the checksum
|
||||
* compute the checksum
|
||||
*/
|
||||
checksum=0;
|
||||
checksum_ptr = (unsigned char *) &valid_desc;
|
||||
for (i=0; i<sizeof(valid_desc); i+=2)
|
||||
for (i=0; i<sizeof(valid_desc); i+=2)
|
||||
{
|
||||
/*
|
||||
* skip adding in ckecksum word, since we dont have it yet!
|
||||
* skip adding in ckecksum word, since we dont have it yet!
|
||||
*/
|
||||
if (i == 28)
|
||||
{
|
||||
|
@ -194,82 +194,82 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
checksum += (unsigned int)checksum_ptr[i];
|
||||
checksum += ((unsigned int)checksum_ptr[i+1])*256;
|
||||
}
|
||||
|
||||
/*
|
||||
* now find out the real checksum
|
||||
|
||||
/*
|
||||
* now find out the real checksum
|
||||
*/
|
||||
checksum = -checksum;
|
||||
set_721(valid_desc.cksum, (unsigned int) checksum);
|
||||
|
||||
|
||||
/*
|
||||
* now make the initial/default entry for boot catalog
|
||||
* now make the initial/default entry for boot catalog
|
||||
*/
|
||||
memset(&default_desc, 0, sizeof(default_desc));
|
||||
default_desc.boot_id[0] = EL_TORITO_BOOTABLE;
|
||||
|
||||
|
||||
/*
|
||||
* use default BIOS loadpnt
|
||||
*/
|
||||
*/
|
||||
set_721(default_desc.loadseg, 0);
|
||||
default_desc.arch[0] = EL_TORITO_ARCH_x86;
|
||||
|
||||
|
||||
/*
|
||||
* figure out size of boot image in sectors, for now hard code to
|
||||
* assume 512 bytes/sector on a bootable floppy
|
||||
*/
|
||||
nsectors = ((de->size + 511) & ~(511))/512;
|
||||
fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
|
||||
fprintf (stderr, " -> ");
|
||||
fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
|
||||
fprintf (stderr, " -> ");
|
||||
|
||||
if (! use_eltorito_emul_floppy)
|
||||
{
|
||||
default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
|
||||
fprintf (stderr, _("No emulation\n"));
|
||||
}
|
||||
else if (nsectors == 2880 )
|
||||
else if (nsectors == 2880 )
|
||||
/*
|
||||
* choose size of emulated floppy based on boot image size
|
||||
* choose size of emulated floppy based on boot image size
|
||||
*/
|
||||
{
|
||||
default_desc.boot_media[0] = EL_TORITO_MEDIA_144FLOP;
|
||||
fprintf (stderr, _("Emulating a 1.44 meg floppy\n"));
|
||||
}
|
||||
else if (nsectors == 5760 )
|
||||
else if (nsectors == 5760 )
|
||||
{
|
||||
default_desc.boot_media[0] = EL_TORITO_MEDIA_288FLOP;
|
||||
fprintf (stderr, _("Emulating a 2.88 meg floppy\n"));
|
||||
}
|
||||
else if (nsectors == 2400 )
|
||||
else if (nsectors == 2400 )
|
||||
{
|
||||
default_desc.boot_media[0] = EL_TORITO_MEDIA_12FLOP;
|
||||
fprintf (stderr, _("Emulating a 1.2 meg floppy\n"));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("\nError - boot image is not the an allowable size.\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
|
||||
|
||||
/*
|
||||
* FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
|
||||
*/
|
||||
nsectors = 1;
|
||||
set_721(default_desc.nsect, (unsigned int) nsectors );
|
||||
#ifdef DEBUG_TORITO
|
||||
fprintf(stderr,"Extent of boot images is %d\n",get_733(de->isorec.extent));
|
||||
#endif
|
||||
set_731(default_desc.bootoff,
|
||||
set_731(default_desc.bootoff,
|
||||
(unsigned int) get_733(de->isorec.extent));
|
||||
|
||||
|
||||
/*
|
||||
* now write it to disk
|
||||
* now write it to disk
|
||||
*/
|
||||
bootcat = fopen (de2->whole_name, "r+b");
|
||||
if (bootcat == NULL)
|
||||
if (bootcat == NULL)
|
||||
error (1, errno, _("Error opening boot catalog for update"));
|
||||
|
||||
/*
|
||||
* write out
|
||||
/*
|
||||
* write out
|
||||
*/
|
||||
if (fwrite (&valid_desc, 1, 32, bootcat) != 32)
|
||||
error (1, errno, _("Error writing to boot catalog"));
|
||||
|
@ -332,7 +332,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
static int FDECL1(tvd_write, FILE *, outfile)
|
||||
{
|
||||
/*
|
||||
* Next we write out the boot volume descriptor for the disc
|
||||
* Next we write out the boot volume descriptor for the disc
|
||||
*/
|
||||
get_torito_desc(&gboot_desc);
|
||||
xfwrite(&gboot_desc, 1, 2048, outfile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue