wok rev 14264
syslinux/iso2exe: fix initrd offset
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 01 09:45:40 2013 +0200 (2013-04-01) |
parents | 692d9593f959 |
children | 381614055170 |
files | syslinux/receipt syslinux/stuff/iso2exe/Makefile syslinux/stuff/iso2exe/boot.c syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/win32.c syslinux/stuff/iso2exe/win32.rc |
line diff
1.1 --- a/syslinux/receipt Sun Mar 31 22:55:34 2013 +0100 1.2 +++ b/syslinux/receipt Mon Apr 01 09:45:40 2013 +0200 1.3 @@ -8,7 +8,7 @@ 1.4 TARBALL="$PACKAGE-$VERSION.tar.xz" 1.5 WEB_SITE="http://syslinux.zytor.com/" 1.6 WGET_URL="ftp://ftp.kernel.org/pub/linux/utils/boot/syslinux/$TARBALL" 1.7 -BUILD_DEPENDS="kbd-base perl nasm dev86 lzma mingw32-gcc upx" 1.8 +BUILD_DEPENDS="kbd-base perl nasm dev86 lzma mingw32-gcc upx posixovl" 1.9 DEPENDS="gpxe memtest" 1.10 CONFIG_FILES="/boot/isolinux" 1.11
2.1 --- a/syslinux/stuff/iso2exe/Makefile Sun Mar 31 22:55:34 2013 +0100 2.2 +++ b/syslinux/stuff/iso2exe/Makefile Mon Apr 01 09:45:40 2013 +0200 2.3 @@ -14,7 +14,7 @@ 2.4 ./iso2exe.sh --array ../mbr/isohdpfx.bin > $@ 2.5 2.6 iso2exe.com: iso2exe.c iso2exe.h 2.7 - $(BCC) $(BCCFLAGS) -o $@ iso2exe.c 2.8 + $(BCC) $(BCCFLAGS) -o $@ iso2exe.c && upx --ultra-brute $@ 2.9 2.10 iso2exe.exe: iso2exe.c iso2exe.h 2.11 i586-pc-mingw32-gcc -s -o $@ iso2exe.c -lws2_32
3.1 --- a/syslinux/stuff/iso2exe/boot.c Sun Mar 31 22:55:34 2013 +0100 3.2 +++ b/syslinux/stuff/iso2exe/boot.c Mon Apr 01 09:45:40 2013 +0200 3.3 @@ -46,7 +46,7 @@ 3.4 lseek(isofd, 24, SEEK_SET); 3.5 read(isofd, &magic, 4); 3.6 isofilesize = magic & 0xFFFF; 3.7 - isofileofs = 0x8000 - isofilesize; 3.8 + isofileofs = 0x7EE0 - isofilesize; 3.9 loadinitrd(); 3.10 close(isofd); 3.11 sprintf(cmdline,"rw root=/dev/null %s iso=%s magic=%lu mode=%s",
4.1 --- a/syslinux/stuff/iso2exe/bootlinux.c Sun Mar 31 22:55:34 2013 +0100 4.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c Mon Apr 01 09:45:40 2013 +0200 4.3 @@ -256,22 +256,15 @@ 4.4 mov cx, #3 4.5 xor ax, ax 4.6 nextdigit: 4.7 - shl edx, #4 4.8 - or dl, al 4.9 + shl al, #4 4.10 + shl ax, #4 4.11 next: 4.12 lodsb 4.13 - xor ah, #1 4.14 sub al, #0x30 4.15 cmp al, #9 4.16 jbe nextdigit 4.17 - shr ah, #1 4.18 - jc got2 4.19 - mov al, #0xF 4.20 - and al, dl 4.21 - and dl, #0xF0 4.22 - shl edx, #4 4.23 - or dl, al 4.24 -got2: 4.25 + shl eax, #16 4.26 + shld edx, eax, #8 4.27 loop next 4.28 pop ds 4.29 mov .loadkernel.version[bp], edx
5.1 --- a/syslinux/stuff/iso2exe/init Sun Mar 31 22:55:34 2013 +0100 5.2 +++ b/syslinux/stuff/iso2exe/init Mon Apr 01 09:45:40 2013 +0200 5.3 @@ -5,8 +5,7 @@ 5.4 get() 5.5 { 5.6 od -j $1 -N ${3:-2} -t u${3:-2} -An $2 2> /dev/null || 5.7 - dd if=$2 bs=1 skip=$1 count=${3:-2} 2> /dev/null | \ 5.8 - hexdump -e "\"\" 1/${3:-2} \"%d\"" 5.9 + hexdump -s $1 -n ${3:-2} -e "\"\" 1/${3:-2} \"%d\"" $2 5.10 } 5.11 5.12 getarg() 5.13 @@ -296,7 +295,7 @@ 5.14 5.15 fdbootstrap() 5.16 { 5.17 - sz=$(echo $(od -j 28 -N 1 -t u1 -An /mnt/$ISO)) 5.18 + sz=$(echo $(get 28 /mnt/$ISO 1)) 5.19 if [ 0$sz -eq 0 ]; then 5.20 $DIALOG --clear \ 5.21 --title " No floppy bootstrap available " \ 5.22 @@ -314,7 +313,7 @@ 5.23 " 10 70 5.24 [ $? -eq 0 ] || return 5.25 dd if=/mnt/$ISO of=/dev/fd0 bs=1 count=$(($sz * 512)) \ 5.26 - skip=$(( $(od -j 60 -N 4 -t u4 -An) - ($sz * 512) )) 5.27 + skip=$(( $(get 66 /mnt/$ISO) - ($sz * 512) )) 5.28 echo "$ISO" | dd of=/dev/fd0 bs=512 seek=1 5.29 fi 5.30 }
6.1 --- a/syslinux/stuff/iso2exe/iso2exe.c Sun Mar 31 22:55:34 2013 +0100 6.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 09:45:40 2013 +0200 6.3 @@ -4,7 +4,9 @@ 6.4 #include "iso2exe.h" 6.5 6.6 static int fd; 6.7 -static char buffer[2048]; 6.8 +static char tazlitoinfo[10*1024]; 6.9 +#define buffer tazlitoinfo 6.10 +#define BUFFERSZ 2048 6.11 6.12 static void quit(char *msg) 6.13 { 6.14 @@ -14,8 +16,8 @@ 6.15 6.16 static void readsector(unsigned long sector) 6.17 { 6.18 - if (lseek(fd, sector * sizeof(buffer), SEEK_SET) == -1 || 6.19 - read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) 6.20 + if (lseek(fd, sector * BUFFERSZ, SEEK_SET) == -1 || 6.21 + read(fd, buffer, BUFFERSZ) != BUFFERSZ) 6.22 quit("read sector failure"); 6.23 } 6.24 6.25 @@ -28,7 +30,6 @@ 6.26 unsigned long size, catalog, lba; 6.27 int cylinders, i, j, isohybrid; 6.28 unsigned n; 6.29 - char tazlitoinfo[10*1024]; 6.30 #ifndef WIN32 6.31 char *bootiso; 6.32 for (bootiso = (char *) main; 6.33 @@ -86,9 +87,9 @@ 6.34 // Compute the checksum 6.35 lseek(fd, 0UL, SEEK_SET); 6.36 for (i = 66, n = 0, j = 0; j < 16; j++, i = 0) { 6.37 - if (read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) 6.38 + if (read(fd, buffer, BUFFERSZ) != BUFFERSZ) 6.39 goto nochksum; 6.40 - for (; i < sizeof(buffer); i += 2) 6.41 + for (; i < BUFFERSZ; i += 2) 6.42 n += * (unsigned short *) (buffer + i); 6.43 } 6.44 * (unsigned short *) (bootiso + 64) = -n;
7.1 --- a/syslinux/stuff/iso2exe/win32.c Sun Mar 31 22:55:34 2013 +0100 7.2 +++ b/syslinux/stuff/iso2exe/win32.c Mon Apr 01 09:45:40 2013 +0200 7.3 @@ -14,6 +14,7 @@ 7.4 if (j <= 0) break; 7.5 } 7.6 return i; 7.7 +#define read fullread 7.8 } 7.9 7.10 static int fullwrite(int fd, char *p, int n) 7.11 @@ -24,6 +25,7 @@ 7.12 if (j <= 0) break; 7.13 } 7.14 return i; 7.15 +#define write fullwrite 7.16 } 7.17 7.18 static void exec16bits(char *isoFileName) 7.19 @@ -39,9 +41,9 @@ 7.20 fdiso = open(isoFileName, O_RDONLY|O_BINARY); 7.21 fdtmp = open(tmpFileName, O_WRONLY|O_BINARY|O_CREAT,0555); 7.22 for (i = 0; i < 0x8000; i += sizeof(buffer)) { 7.23 - fullread(fdiso, (char *) buffer, sizeof(buffer)); 7.24 + read(fdiso, (char *) buffer, sizeof(buffer)); 7.25 if (i == 0) buffer[15] = 0; // kill PE header 7.26 - fullwrite(fdtmp, (char *) buffer, sizeof(buffer)); 7.27 + write(fdtmp, (char *) buffer, sizeof(buffer)); 7.28 } 7.29 close(fdiso); 7.30 close(fdtmp); 7.31 @@ -64,17 +66,17 @@ 7.32 7.33 fdiso = open(isoFileName, O_RDONLY|O_BINARY); 7.34 if (lseek(fdiso, 17 * 2048L, SEEK_SET) != -1 && 7.35 - fullread(fdiso, buffer, 2048) == 2048 && 7.36 + read(fdiso, buffer, 2048) == 2048 && 7.37 strncmp(buffer+23,"EL TORITO SPECIFICATION",23) == 0) { 7.38 unsigned long lba = * (unsigned long *) (buffer + 71); 7.39 7.40 if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && 7.41 - fullread(fdiso, buffer, 2048) == 2048 && 7.42 + read(fdiso, buffer, 2048) == 2048 && 7.43 * (unsigned long *) (buffer + 0) == 1 && 7.44 * (unsigned long *) (buffer + 30) == 0x88AA55) { 7.45 lba = * (unsigned long *) (buffer + 40); 7.46 if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && 7.47 - fullread(fdiso, buffer, 2048) == 2048) 7.48 + read(fdiso, buffer, 2048) == 2048) 7.49 magic = * (unsigned long *) (buffer + 64); 7.50 } 7.51 } 7.52 @@ -126,7 +128,7 @@ 7.53 drive >>= 1; 7.54 fdiso = open(isoFileName, O_RDONLY|O_BINARY); 7.55 for (s = 0;;) { 7.56 - int s, n = fullread(fdiso, buffer, sizeof(buffer)); 7.57 + int s, n = read(fdiso, buffer, sizeof(buffer)); 7.58 if (n <= 0) break; 7.59 n = (n+511)/512; 7.60 if (s == 0) isohybrid = buffer[69]; 7.61 @@ -160,10 +162,10 @@ 7.62 read(fd, buffer, sizeof(buffer)); 7.63 n = buffer[BOOTSTRAP_SECTOR_COUNT_OFFSET]; 7.64 if (n != 0 && 7.65 - lseek(fd, * (unsigned long *) (buffer + 60) - (512 * n), 7.66 + lseek(fd, * (unsigned short *) (buffer + 66) - (512 * n), 7.67 SEEK_SET) != -1) { 7.68 for (i = 0; i < n; i++) { 7.69 - fullread(fd, buffer, 512); 7.70 + read(fd, buffer, 512); 7.71 if (i == 1) strncpy(buffer, isoFileName, 512); 7.72 rdwrsector(MODE_WRITE, 0, i, 1, buffer); 7.73 }
8.1 --- a/syslinux/stuff/iso2exe/win32.rc Sun Mar 31 22:55:34 2013 +0100 8.2 +++ b/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 09:45:40 2013 +0200 8.3 @@ -1,9 +1,11 @@ 8.4 /* http://msdn.microsoft.com/en-us/library/aa381058.aspx */ 8.5 8.6 id ICON "./win32.ico" /* BMP32x32 */ 8.7 -1 VERSIONINFO 8.8 -FILEVERSION 1,0,0,0 8.9 -PRODUCTVERSION 1,0,0,0 8.10 +VS_VERSION_INFO VERSIONINFO 8.11 +FILEVERSION 1,0,0,0 8.12 +PRODUCTVERSION 1,0,0,0 8.13 +/* FILEOS VOS__WINDOWS32 */ 8.14 +/* FILETYPE VFT_APP */ 8.15 BEGIN 8.16 BLOCK "StringFileInfo" 8.17 BEGIN