wok-next rev 13974
syslinux/iso2exe: fix checksum
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Feb 06 12:05:22 2013 +0100 (2013-02-06) |
parents | 3dd8f0cfd04b |
children | 04f1f2b56a0f |
files | syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/win32.c |
line diff
1.1 --- a/syslinux/stuff/iso2exe/bootiso.S Wed Feb 06 02:13:32 2013 +0000 1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S Wed Feb 06 12:05:22 2013 +0100 1.3 @@ -171,7 +171,7 @@ 1.4 movw (%si), %cx 1.5 jcxz is386 1.6 #endif 1.7 - movw $0x7FE0/2, %cx 1.8 + movw $(EXESTR(0x8000))/2, %cx 1.9 chklp: 1.10 lodsw 1.11 addw %ax, %dx
2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Wed Feb 06 02:13:32 2013 +0000 2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Wed Feb 06 12:05:22 2013 +0100 2.3 @@ -44,8 +44,6 @@ 2.4 *5a4d) echo "The file $1 is already an EXE file." 1>&2 && exit 1;; 2.5 *0000) [ -x /usr/bin/isohybrid ] && isohybrid $1 2.6 esac 2.7 - [ ! -x /usr/sbin/mount.posixovl ] && 2.8 - echo "No file mount.posixovl. Aborting." 1>&2 && exit 1 2.9 2.10 echo "Moving syslinux hybrid boot record..." 2.11 ddq if=$1 bs=512 count=1 | ddq of=$1 bs=512 count=1 seek=1 conv=notrunc 2.12 @@ -56,10 +54,11 @@ 2.13 # keep the largest room for the tazlito info file 2.14 TMP=/tmp/iso2exe$$ 2.15 mkdir -p $TMP/bin $TMP/dev 2.16 - cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe 2.17 cp -a /dev/?d?* $TMP/dev 2.18 $0 --get init > $TMP/init.exe 2.19 - chmod +x $TMP/init.exe $TMP/bin/mount.posixov* 2.20 + grep -q mount.posixovl.iso2exe $TMP/init.exe && 2.21 + cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe 2.22 + find $TMP -type f | xargs chmod +x 2.23 ( cd $TMP ; find * | cpio -o -H newc ) | \ 2.24 lzma e $TMP/rootfs.gz -si 2> /dev/null 2.25 SIZE=$(wc -c < $TMP/rootfs.gz) 2.26 @@ -73,19 +72,21 @@ 2.27 printf "Adding DOS boot file at %04X...\n" $OFS 2.28 $0 --get boot.com | ddq of=$1 bs=1 seek=$OFS conv=notrunc 2.29 store 66 $(($OFS+0xC0)) $1 2.30 - SIZE=$($0 --get win32.exe | tee /tmp/exe$$ | wc -c) 2.31 - OFS=$(( 128 + ( ($OFS - $SIZE + 128) & 0xFE00 ) )) 2.32 - printf "Adding WIN32 file at %04X...\n" $OFS 2.33 - LOC=$((0xAC+$(get 0x94 /tmp/exe$$))) 2.34 - for i in $(seq 1 $(get 0x86 /tmp/exe$$)); do 2.35 - store $LOC $(($(get $LOC /tmp/exe$$)+$OFS-128)) /tmp/exe$$ 2.36 - LOC=$(($LOC+40)) 2.37 - done 2.38 - ddq if=/tmp/exe$$ of=$1 bs=1 skip=128 seek=$OFS conv=notrunc 2.39 + SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c) 2.40 + if [ $SIZE -ne 0 ]; then 2.41 + OFS=$(( 128 + ( ($OFS - $SIZE + 128) & 0xFE00 ) )) 2.42 + printf "Adding WIN32 file at %04X...\n" $OFS 2.43 + LOC=$((0xAC+$(get 0x94 /tmp/exe$$))) 2.44 + for i in $(seq 1 $(get 0x86 /tmp/exe$$)); do 2.45 + store $LOC $(($(get $LOC /tmp/exe$$)+$OFS-128)) /tmp/exe$$ 2.46 + LOC=$(($LOC+40)) 2.47 + done 2.48 + ddq if=/tmp/exe$$ of=$1 bs=1 skip=128 seek=$OFS conv=notrunc 2.49 + fi 2.50 rm -f /tmp/exe$$ 2.51 store 60 $OFS $1 2.52 store 26 ${RANDOM:-0} $1 2.53 - i=34 2.54 + i=66 2.55 n=0 2.56 echo -n "Adding checksum..." 2.57 while [ $i -lt 32768 ]; do
3.1 --- a/syslinux/stuff/iso2exe/win32.c Wed Feb 06 02:13:32 2013 +0000 3.2 +++ b/syslinux/stuff/iso2exe/win32.c Wed Feb 06 12:05:22 2013 +0100 3.3 @@ -1,6 +1,6 @@ 3.4 -#include <stdio.h> 3.5 +#include <windows.h> 3.6 3.7 int main() 3.8 { 3.9 - printf("No support for Windows yet.\n"); 3.10 + MessageBox(NULL,"No support for Windows yet.","Sorry",MB_OK); 3.11 }