wok-current rev 14266
syslinux/iso2exe: add partition table
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 01 17:47:04 2013 +0200 (2013-04-01) |
parents | 381614055170 |
children | ada914860f33 |
files | syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/win32.c syslinux/stuff/iso2exe/win32.rc |
line diff
1.1 --- a/syslinux/stuff/iso2exe/init Mon Apr 01 11:37:10 2013 +0200 1.2 +++ b/syslinux/stuff/iso2exe/init Mon Apr 01 17:47:04 2013 +0200 1.3 @@ -352,13 +352,6 @@ 1.4 [ $? -eq 0 ] || return 1.5 usbdev || return 1.6 dd if=/mnt/$ISO of=$device 1.7 - if [ $(get 0 /mnt/$ISO) -eq 23117 ]; then # iso2exe ? 1.8 - LOC=$(get 69 /mnt/$ISO 1) 1.9 - # move isohybrid boot sector (partitionable) 1.10 - dd if=/mnt/$ISO bs=512 count=1 skip=$LOC of=$device conv=notrunc 1.11 - # move tazlito data (backward compatibility) 1.12 - dd if=/mnt/$ISO bs=512 count=20 skip=$(($LOC+1)) of=$device seek=2 conv=notrunc 1.13 - fi 1.14 } 1.15 1.16 usbkey()
2.1 --- a/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 11:37:10 2013 +0200 2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 17:47:04 2013 +0200 2.3 @@ -69,6 +69,9 @@ 2.4 * (unsigned long *) &bootiso[isohybrid + partition + 8] = 0; 2.5 * (unsigned long *) &bootiso[isohybrid + partition + 12] = cylinders * sectors * heads; 2.6 2.7 + // Copy the partition table 2.8 + memcpy(bootiso + 0x1B8, bootiso + isohybrid + 0x1B8, 0x48); 2.9 + 2.10 // Install iso2exe boot sector 2.11 * (unsigned short *) (bootiso + 26) = rand(); 2.12
3.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Mon Apr 01 11:37:10 2013 +0200 3.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Mon Apr 01 17:47:04 2013 +0200 3.3 @@ -25,8 +25,8 @@ 3.4 cp -a /dev/?d?* $TMP/dev 3.5 $0 --get init > $TMP/init.exe 3.6 grep -q mount.posixovl.iso2exe $TMP/init.exe && 3.7 - cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe && 3.8 - echo "Store mount.posixovl..." 3.9 + cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe \ 3.10 + 2> /dev/null && echo "Store mount.posixovl..." 3.11 find $TMP -type f | xargs chmod +x 3.12 ( cd $TMP ; find * | cpio -o -H newc ) | \ 3.13 lzma e $TMP/rootfs.gz -si 2> /dev/null 3.14 @@ -64,6 +64,11 @@ 3.15 printf "Adding bootiso head at %04X...\n" 0 3.16 $0 --get bootiso.bin 2> /dev/null > /tmp/exe$$ 3.17 ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc 3.18 + store $((0x94)) $((0xE0 - 12*8)) $1 3.19 + store $((0xF4)) $((16 - 12)) $1 3.20 + ddq if=$1 of=/tmp/exe$$ bs=1 skip=$((0x178)) count=$((0x88)) 3.21 + ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 seek=$((0x178 - 12*8)) 3.22 + ddq if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 conv=notrunc 3.23 store 69 $(($SIZE/512)) $1 8 3.24 store 510 $((0xAA55)) $1 3.25 rm -f /tmp/exe$$
4.1 --- a/syslinux/stuff/iso2exe/win32.c Mon Apr 01 11:37:10 2013 +0200 4.2 +++ b/syslinux/stuff/iso2exe/win32.c Mon Apr 01 17:47:04 2013 +0200 4.3 @@ -67,7 +67,7 @@ 4.4 fdiso = open(isoFileName, O_RDONLY|O_BINARY); 4.5 if (lseek(fdiso, 17 * 2048L, SEEK_SET) != -1 && 4.6 read(fdiso, buffer, 2048) == 2048 && 4.7 - strncmp(buffer+23,"EL TORITO SPECIFICATION",23) == 0) { 4.8 + strncmp(buffer+7,"EL TORITO SPECIFICATION",23) == 0) { 4.9 unsigned long lba = * (unsigned long *) (buffer + 71); 4.10 4.11 if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && 4.12 @@ -118,9 +118,9 @@ 4.13 return result; 4.14 } 4.15 4.16 -static void rawrite(unsigned long drive, char *isoFileName) 4.17 +static int rawrite(unsigned long drive, char *isoFileName) 4.18 { 4.19 - int fdiso, s, dev, isohybrid = -1; 4.20 + int fdiso, s, dev; 4.21 char buffer[2048]; 4.22 4.23 if (drive == 0) return; 4.24 @@ -131,13 +131,11 @@ 4.25 int s, n = read(fdiso, buffer, sizeof(buffer)); 4.26 if (n <= 0) break; 4.27 n = (n+511)/512; 4.28 - if (s == 0) isohybrid = buffer[69]; 4.29 rdwrsector(MODE_WRITE, dev, s, n, buffer); 4.30 - if (s == isohybrid) 4.31 - rdwrsector(MODE_WRITE, dev, 0, 1, buffer); 4.32 s += n; 4.33 } 4.34 close(fdiso); 4.35 + return dev; 4.36 } 4.37 4.38 static unsigned long drives(void) 4.39 @@ -242,11 +240,14 @@ 4.40 if (new == base) { 4.41 MessageBox(NULL,"No USB stick found.","Sorry", 4.42 MB_OK|MB_ICONERROR); 4.43 - exit(1); 4.44 } 4.45 - rawrite(base ^ new, isoFileName); 4.46 + else { 4.47 + char *msg = "(hd0) is up to date."; 4.48 + msg[3] += rawrite(base ^ new, isoFileName) - 128; 4.49 + MessageBox(NULL,msg,"Finished",MB_OK); 4.50 + } 4.51 } 4.52 - if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && 4.53 + else if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && 4.54 MessageBox(NULL,"Do you want to create a bootstrap floppy ?", 4.55 "Create a bootstrap floppy ?", 4.56 MB_YESNO|MB_ICONQUESTION) == IDYES && 4.57 @@ -257,5 +258,7 @@ 4.58 // Create a 9k bootstrap with vfat, ext2 & ntfs drivers 4.59 // to boot the ISO image on hard disk 4.60 writefloppy(isoFileName); 4.61 + MessageBox(NULL,"The bootstrap floppy is up to date.", 4.62 + "Finished",MB_OK); 4.63 } 4.64 }
5.1 --- a/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 11:37:10 2013 +0200 5.2 +++ b/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 17:47:04 2013 +0200 5.3 @@ -1,6 +1,6 @@ 5.4 /* http://msdn.microsoft.com/en-us/library/aa381058.aspx */ 5.5 5.6 -id ICON "./win32.ico" /* BMP32x32 */ 5.7 +/* id ICON "./win32.ico" */ /* BMP32x32 */ 5.8 VS_VERSION_INFO VERSIONINFO 5.9 FILEVERSION 1,0,0,0 5.10 PRODUCTVERSION 1,0,0,0