# HG changeset patch # User Pascal Bellard # Date 1364802340 -7200 # Node ID bf8be127c60ba91461745bdb3627d4616188c15f # Parent 692d9593f9597ed79323aa52fa342699ce61a2d4 syslinux/iso2exe: fix initrd offset diff -r 692d9593f959 -r bf8be127c60b syslinux/receipt --- a/syslinux/receipt Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/receipt Mon Apr 01 09:45:40 2013 +0200 @@ -8,7 +8,7 @@ TARBALL="$PACKAGE-$VERSION.tar.xz" WEB_SITE="http://syslinux.zytor.com/" WGET_URL="ftp://ftp.kernel.org/pub/linux/utils/boot/syslinux/$TARBALL" -BUILD_DEPENDS="kbd-base perl nasm dev86 lzma mingw32-gcc upx" +BUILD_DEPENDS="kbd-base perl nasm dev86 lzma mingw32-gcc upx posixovl" DEPENDS="gpxe memtest" CONFIG_FILES="/boot/isolinux" diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/Makefile --- a/syslinux/stuff/iso2exe/Makefile Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/Makefile Mon Apr 01 09:45:40 2013 +0200 @@ -14,7 +14,7 @@ ./iso2exe.sh --array ../mbr/isohdpfx.bin > $@ iso2exe.com: iso2exe.c iso2exe.h - $(BCC) $(BCCFLAGS) -o $@ iso2exe.c + $(BCC) $(BCCFLAGS) -o $@ iso2exe.c && upx --ultra-brute $@ iso2exe.exe: iso2exe.c iso2exe.h i586-pc-mingw32-gcc -s -o $@ iso2exe.c -lws2_32 diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/boot.c --- a/syslinux/stuff/iso2exe/boot.c Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/boot.c Mon Apr 01 09:45:40 2013 +0200 @@ -46,7 +46,7 @@ lseek(isofd, 24, SEEK_SET); read(isofd, &magic, 4); isofilesize = magic & 0xFFFF; - isofileofs = 0x8000 - isofilesize; + isofileofs = 0x7EE0 - isofilesize; loadinitrd(); close(isofd); sprintf(cmdline,"rw root=/dev/null %s iso=%s magic=%lu mode=%s", diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/bootlinux.c --- a/syslinux/stuff/iso2exe/bootlinux.c Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/bootlinux.c Mon Apr 01 09:45:40 2013 +0200 @@ -256,22 +256,15 @@ mov cx, #3 xor ax, ax nextdigit: - shl edx, #4 - or dl, al + shl al, #4 + shl ax, #4 next: lodsb - xor ah, #1 sub al, #0x30 cmp al, #9 jbe nextdigit - shr ah, #1 - jc got2 - mov al, #0xF - and al, dl - and dl, #0xF0 - shl edx, #4 - or dl, al -got2: + shl eax, #16 + shld edx, eax, #8 loop next pop ds mov .loadkernel.version[bp], edx diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/init --- a/syslinux/stuff/iso2exe/init Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/init Mon Apr 01 09:45:40 2013 +0200 @@ -5,8 +5,7 @@ get() { od -j $1 -N ${3:-2} -t u${3:-2} -An $2 2> /dev/null || - dd if=$2 bs=1 skip=$1 count=${3:-2} 2> /dev/null | \ - hexdump -e "\"\" 1/${3:-2} \"%d\"" + hexdump -s $1 -n ${3:-2} -e "\"\" 1/${3:-2} \"%d\"" $2 } getarg() @@ -296,7 +295,7 @@ fdbootstrap() { - sz=$(echo $(od -j 28 -N 1 -t u1 -An /mnt/$ISO)) + sz=$(echo $(get 28 /mnt/$ISO 1)) if [ 0$sz -eq 0 ]; then $DIALOG --clear \ --title " No floppy bootstrap available " \ @@ -314,7 +313,7 @@ " 10 70 [ $? -eq 0 ] || return dd if=/mnt/$ISO of=/dev/fd0 bs=1 count=$(($sz * 512)) \ - skip=$(( $(od -j 60 -N 4 -t u4 -An) - ($sz * 512) )) + skip=$(( $(get 66 /mnt/$ISO) - ($sz * 512) )) echo "$ISO" | dd of=/dev/fd0 bs=512 seek=1 fi } diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/iso2exe.c --- a/syslinux/stuff/iso2exe/iso2exe.c Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/iso2exe.c Mon Apr 01 09:45:40 2013 +0200 @@ -4,7 +4,9 @@ #include "iso2exe.h" static int fd; -static char buffer[2048]; +static char tazlitoinfo[10*1024]; +#define buffer tazlitoinfo +#define BUFFERSZ 2048 static void quit(char *msg) { @@ -14,8 +16,8 @@ static void readsector(unsigned long sector) { - if (lseek(fd, sector * sizeof(buffer), SEEK_SET) == -1 || - read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) + if (lseek(fd, sector * BUFFERSZ, SEEK_SET) == -1 || + read(fd, buffer, BUFFERSZ) != BUFFERSZ) quit("read sector failure"); } @@ -28,7 +30,6 @@ unsigned long size, catalog, lba; int cylinders, i, j, isohybrid; unsigned n; - char tazlitoinfo[10*1024]; #ifndef WIN32 char *bootiso; for (bootiso = (char *) main; @@ -86,9 +87,9 @@ // Compute the checksum lseek(fd, 0UL, SEEK_SET); for (i = 66, n = 0, j = 0; j < 16; j++, i = 0) { - if (read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) + if (read(fd, buffer, BUFFERSZ) != BUFFERSZ) goto nochksum; - for (; i < sizeof(buffer); i += 2) + for (; i < BUFFERSZ; i += 2) n += * (unsigned short *) (buffer + i); } * (unsigned short *) (bootiso + 64) = -n; diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/win32.c --- a/syslinux/stuff/iso2exe/win32.c Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/win32.c Mon Apr 01 09:45:40 2013 +0200 @@ -14,6 +14,7 @@ if (j <= 0) break; } return i; +#define read fullread } static int fullwrite(int fd, char *p, int n) @@ -24,6 +25,7 @@ if (j <= 0) break; } return i; +#define write fullwrite } static void exec16bits(char *isoFileName) @@ -39,9 +41,9 @@ fdiso = open(isoFileName, O_RDONLY|O_BINARY); fdtmp = open(tmpFileName, O_WRONLY|O_BINARY|O_CREAT,0555); for (i = 0; i < 0x8000; i += sizeof(buffer)) { - fullread(fdiso, (char *) buffer, sizeof(buffer)); + read(fdiso, (char *) buffer, sizeof(buffer)); if (i == 0) buffer[15] = 0; // kill PE header - fullwrite(fdtmp, (char *) buffer, sizeof(buffer)); + write(fdtmp, (char *) buffer, sizeof(buffer)); } close(fdiso); close(fdtmp); @@ -64,17 +66,17 @@ fdiso = open(isoFileName, O_RDONLY|O_BINARY); if (lseek(fdiso, 17 * 2048L, SEEK_SET) != -1 && - fullread(fdiso, buffer, 2048) == 2048 && + read(fdiso, buffer, 2048) == 2048 && strncmp(buffer+23,"EL TORITO SPECIFICATION",23) == 0) { unsigned long lba = * (unsigned long *) (buffer + 71); if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && - fullread(fdiso, buffer, 2048) == 2048 && + read(fdiso, buffer, 2048) == 2048 && * (unsigned long *) (buffer + 0) == 1 && * (unsigned long *) (buffer + 30) == 0x88AA55) { lba = * (unsigned long *) (buffer + 40); if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && - fullread(fdiso, buffer, 2048) == 2048) + read(fdiso, buffer, 2048) == 2048) magic = * (unsigned long *) (buffer + 64); } } @@ -126,7 +128,7 @@ drive >>= 1; fdiso = open(isoFileName, O_RDONLY|O_BINARY); for (s = 0;;) { - int s, n = fullread(fdiso, buffer, sizeof(buffer)); + int s, n = read(fdiso, buffer, sizeof(buffer)); if (n <= 0) break; n = (n+511)/512; if (s == 0) isohybrid = buffer[69]; @@ -160,10 +162,10 @@ read(fd, buffer, sizeof(buffer)); n = buffer[BOOTSTRAP_SECTOR_COUNT_OFFSET]; if (n != 0 && - lseek(fd, * (unsigned long *) (buffer + 60) - (512 * n), + lseek(fd, * (unsigned short *) (buffer + 66) - (512 * n), SEEK_SET) != -1) { for (i = 0; i < n; i++) { - fullread(fd, buffer, 512); + read(fd, buffer, 512); if (i == 1) strncpy(buffer, isoFileName, 512); rdwrsector(MODE_WRITE, 0, i, 1, buffer); } diff -r 692d9593f959 -r bf8be127c60b syslinux/stuff/iso2exe/win32.rc --- a/syslinux/stuff/iso2exe/win32.rc Sun Mar 31 22:55:34 2013 +0100 +++ b/syslinux/stuff/iso2exe/win32.rc Mon Apr 01 09:45:40 2013 +0200 @@ -1,9 +1,11 @@ /* http://msdn.microsoft.com/en-us/library/aa381058.aspx */ id ICON "./win32.ico" /* BMP32x32 */ -1 VERSIONINFO -FILEVERSION 1,0,0,0 -PRODUCTVERSION 1,0,0,0 +VS_VERSION_INFO VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +/* FILEOS VOS__WINDOWS32 */ +/* FILETYPE VFT_APP */ BEGIN BLOCK "StringFileInfo" BEGIN