# HG changeset patch # User Pascal Bellard # Date 1364831224 -7200 # Node ID ff85ea851c53bec33cf78b7017f9080726819005 # Parent 38161405517059d24d085cdf6c68fa922233a6ff syslinux/iso2exe: add partition table diff -r 381614055170 -r ff85ea851c53 syslinux/stuff/iso2exe/init --- a/syslinux/stuff/iso2exe/init Mon Apr 01 11:37:10 2013 +0200 +++ b/syslinux/stuff/iso2exe/init Mon Apr 01 17:47:04 2013 +0200 @@ -352,13 +352,6 @@ [ $? -eq 0 ] || return usbdev || return dd if=/mnt/$ISO of=$device - if [ $(get 0 /mnt/$ISO) -eq 23117 ]; then # iso2exe ? - LOC=$(get 69 /mnt/$ISO 1) - # move isohybrid boot sector (partitionable) - dd if=/mnt/$ISO bs=512 count=1 skip=$LOC of=$device conv=notrunc - # move tazlito data (backward compatibility) - dd if=/mnt/$ISO bs=512 count=20 skip=$(($LOC+1)) of=$device seek=2 conv=notrunc - fi } usbkey() diff -r 381614055170 -r ff85ea851c53 syslinux/stuff/iso2exe/iso2exe.c --- a/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 11:37:10 2013 +0200 +++ b/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 17:47:04 2013 +0200 @@ -69,6 +69,9 @@ * (unsigned long *) &bootiso[isohybrid + partition + 8] = 0; * (unsigned long *) &bootiso[isohybrid + partition + 12] = cylinders * sectors * heads; + // Copy the partition table + memcpy(bootiso + 0x1B8, bootiso + isohybrid + 0x1B8, 0x48); + // Install iso2exe boot sector * (unsigned short *) (bootiso + 26) = rand(); diff -r 381614055170 -r ff85ea851c53 syslinux/stuff/iso2exe/iso2exe.sh --- a/syslinux/stuff/iso2exe/iso2exe.sh Mon Apr 01 11:37:10 2013 +0200 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Mon Apr 01 17:47:04 2013 +0200 @@ -25,8 +25,8 @@ cp -a /dev/?d?* $TMP/dev $0 --get init > $TMP/init.exe grep -q mount.posixovl.iso2exe $TMP/init.exe && - cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe && - echo "Store mount.posixovl..." + cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe \ + 2> /dev/null && echo "Store mount.posixovl..." find $TMP -type f | xargs chmod +x ( cd $TMP ; find * | cpio -o -H newc ) | \ lzma e $TMP/rootfs.gz -si 2> /dev/null @@ -64,6 +64,11 @@ printf "Adding bootiso head at %04X...\n" 0 $0 --get bootiso.bin 2> /dev/null > /tmp/exe$$ ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc + store $((0x94)) $((0xE0 - 12*8)) $1 + store $((0xF4)) $((16 - 12)) $1 + ddq if=$1 of=/tmp/exe$$ bs=1 skip=$((0x178)) count=$((0x88)) + ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 seek=$((0x178 - 12*8)) + ddq if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 conv=notrunc store 69 $(($SIZE/512)) $1 8 store 510 $((0xAA55)) $1 rm -f /tmp/exe$$ diff -r 381614055170 -r ff85ea851c53 syslinux/stuff/iso2exe/win32.c --- a/syslinux/stuff/iso2exe/win32.c Mon Apr 01 11:37:10 2013 +0200 +++ b/syslinux/stuff/iso2exe/win32.c Mon Apr 01 17:47:04 2013 +0200 @@ -67,7 +67,7 @@ fdiso = open(isoFileName, O_RDONLY|O_BINARY); if (lseek(fdiso, 17 * 2048L, SEEK_SET) != -1 && read(fdiso, buffer, 2048) == 2048 && - strncmp(buffer+23,"EL TORITO SPECIFICATION",23) == 0) { + strncmp(buffer+7,"EL TORITO SPECIFICATION",23) == 0) { unsigned long lba = * (unsigned long *) (buffer + 71); if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && @@ -118,9 +118,9 @@ return result; } -static void rawrite(unsigned long drive, char *isoFileName) +static int rawrite(unsigned long drive, char *isoFileName) { - int fdiso, s, dev, isohybrid = -1; + int fdiso, s, dev; char buffer[2048]; if (drive == 0) return; @@ -131,13 +131,11 @@ int s, n = read(fdiso, buffer, sizeof(buffer)); if (n <= 0) break; n = (n+511)/512; - if (s == 0) isohybrid = buffer[69]; rdwrsector(MODE_WRITE, dev, s, n, buffer); - if (s == isohybrid) - rdwrsector(MODE_WRITE, dev, 0, 1, buffer); s += n; } close(fdiso); + return dev; } static unsigned long drives(void) @@ -242,11 +240,14 @@ if (new == base) { MessageBox(NULL,"No USB stick found.","Sorry", MB_OK|MB_ICONERROR); - exit(1); } - rawrite(base ^ new, isoFileName); + else { + char *msg = "(hd0) is up to date."; + msg[3] += rawrite(base ^ new, isoFileName) - 128; + MessageBox(NULL,msg,"Finished",MB_OK); + } } - if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && + else if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && MessageBox(NULL,"Do you want to create a bootstrap floppy ?", "Create a bootstrap floppy ?", MB_YESNO|MB_ICONQUESTION) == IDYES && @@ -257,5 +258,7 @@ // Create a 9k bootstrap with vfat, ext2 & ntfs drivers // to boot the ISO image on hard disk writefloppy(isoFileName); + MessageBox(NULL,"The bootstrap floppy is up to date.", + "Finished",MB_OK); } } diff -r 381614055170 -r ff85ea851c53 syslinux/stuff/iso2exe/win32.rc --- a/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 11:37:10 2013 +0200 +++ b/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 17:47:04 2013 +0200 @@ -1,6 +1,6 @@ /* http://msdn.microsoft.com/en-us/library/aa381058.aspx */ -id ICON "./win32.ico" /* BMP32x32 */ +/* id ICON "./win32.ico" */ /* BMP32x32 */ VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0