[syslinux] isohybrid.c: memcpy(mbr, &isohdpfx[hd0 + 3 * partok], MBRSIZE);
Geert Stappers
stappers at stappers.nl
Mon May 3 06:33:14 PDT 2010
Op 20100503 om 14:54 schreef Geert Stappers:
> Op 20100503 om 15:00 schreef P J P:
> > --- On Mon, 3/5/10, Geert Stappers <stappers at stappers.nl> wrote:
> > > Then please provide a bin2Carray.pl that writes elements
> > > to a multi-dimensional hexdata array. Get rid of ugly "repairs" like
> >
> > Please see: http://pjp.dgplug.org/tools/syslinux-3.86-isohybrid.patch.7
> >
> > Changes:
> >
> > - turns hexdata into hexdata[][MBRSIZE]
> > - removes some shell constructs from the Makefile.
> >
>
> Find attached a reworked version of that patch
>
> Changes:
> - renamed hexdata into isohdpfx
> - Makefile closer to Makefile in git HEAD
> - Makefile uses isohdpfx.{head,tail} to avoid further changes to
> isohdpfx.c being done in the Makefile
>
>
> To be continued ...
>
> diff --git a/utils/isohybrid.c b/utils/isohybrid.c
> new file mode 100644
> index 0000000..fbbfaeb
> --- /dev/null
> +++ b/utils/isohybrid.c
> @@ -0,0 +1,560 @@
> +/*
> + * isohybrid.c: Post process an ISO 9660 image generated with mkisofs or
> + * genisoimage to allow - hybrid booting - as a CD-ROM or as a hard
> + * disk.
> + *
> + * This is based on the original Perl script written by H. Peter Anvin. The
> + * rewrite in C is to avoid dependency on Perl on a system under installation.
> + *
<snip/>
> +int
> +initialise_mbr(uint8_t *mbr)
> +{
> + int i = 0;
> + uint32_t psize = 0, tmp = 0;
> + uint8_t ptype = 0, *rbm = mbr;
> + uint8_t bhead = 0, bsect = 0, bcyle = 0;
> + uint8_t ehead = 0, esect = 0, ecyle = 0;
> +
> + extern unsigned char isohdpfx[][MBRSIZE];
> +
> + memcpy(mbr, &isohdpfx[hd0 + 3 * partok], MBRSIZE);
That line, to which line does it match with in the original Perl script?
> + mbr += MBRSIZE; /* offset 432 */
> +
> + tmp = lendian_int(de_lba * 4);
> + memcpy(mbr, &tmp, sizeof(tmp));
> + mbr += sizeof(tmp); /* offset 436 */
> +
> + tmp = 0;
> + memcpy(mbr, &tmp, sizeof(tmp));
> + mbr += sizeof(tmp); /* offset 440 */
> +
> + tmp = lendian_int(id);
> + memcpy(mbr, &tmp, sizeof(tmp));
> + mbr += sizeof(tmp); /* offset 444 */
> +
> + mbr[0] = '\0';
> + mbr[1] = '\0';
> + mbr += 2; /* offset 446 */
Stappers
More information about the Syslinux
mailing list