# HG changeset patch # User Pascal Bellard # Date 1592581581 0 # Node ID c04335df099f513b74e5080d0a7ebf98aab853b7 # Parent f17d3e9b8ddcb498d07744f52501d002de4817a2 syslinux/isoboot.s: accept user args diff -r f17d3e9b8ddc -r c04335df099f linld/stuff/src/!COMPILE.BAT --- a/linld/stuff/src/!COMPILE.BAT Fri Jun 19 11:08:54 2020 -0400 +++ b/linld/stuff/src/!COMPILE.BAT Fri Jun 19 15:46:21 2020 +0000 @@ -3,16 +3,12 @@ tasm /h > helptasm.log bcc > helpbcc.log tlink > helptlink.log -bcc @bccopt.opt -S -mt -DISOHOOK -DMOVE_SETUP -DUSE_ARGSTR -DLARGE_IMAGES *.cpp > cpp.log +bcc @bccopt.opt -S -mt -DMOVE_SETUP -DUSE_ARGSTR -DLARGE_IMAGES *.cpp > cpp.log ren LINLD.ASM LINLD.ASO ren LOAD.ASM LOAD.ASO ren HIMEM.ASM HIMEM.ASO -ren ISO9660.ASM ISO9660.ASO mawk -f pipehole.awk LINLD.ASO > LINLD.ASM mawk -f pipehole.awk LOAD.ASO > LOAD.ASM mawk -f pipehole.awk HIMEM.ASO > HIMEM.ASM -mawk -f pipehole.awk ISO9660.ASO > ISO9660.ASM -tasm /la /m /dISOHOOK /dMOVE_SETUP /dUSE_ARGSTR /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log +tasm /la /m /dMOVE_SETUP /dUSE_ARGSTR /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log tlink /m /s /t @link.cmd > lnk.log -tlink /m /s /t @link2.cmd > lnk2.log -tlink /m /s /t @header.cmd > header.log diff -r f17d3e9b8ddc -r c04335df099f linld/stuff/src/ISO9660.CPP --- a/linld/stuff/src/ISO9660.CPP Fri Jun 19 11:08:54 2020 -0400 +++ b/linld/stuff/src/ISO9660.CPP Fri Jun 19 15:46:21 2020 +0000 @@ -11,17 +11,26 @@ #define cpydirofs(to,from) ((to) = (from)) #endif +#ifdef ISOHOOK +void isoroot(void) +#else int isoroot(void) +#endif { static const unsigned long root = 16UL * 2048; - struct isostate *x=&isostate; - if (isoreadsector(&root) == -1 || strhead(x->buffer+1,"CD001") == -1) { - //close(x->fd); +#ifdef ISOHOOK + isoreadsector(&root); + setdirofs(isostate.dirofs, (* (unsigned long *) (isostate.buffer + 0x9E))); + isostate.dirsize = filesize2dirsize(* (unsigned long *) (isostate.buffer + 0xA6)); +#else + if (isoreadsector(&root) == -1 || strhead(isostate.buffer+1,"CD001") == -1) { + //close(isostate.fd); return -1; } - setdirofs(x->dirofs, (* (unsigned long *) (isostate.buffer + 0x9E))); - x->dirsize = filesize2dirsize(* (unsigned long *) (isostate.buffer + 0xA6)); + setdirofs(isostate.dirofs, (* (unsigned long *) (isostate.buffer + 0x9E))); + isostate.dirsize = filesize2dirsize(* (unsigned long *) (isostate.buffer + 0xA6)); return 0; +#endif } int isoreaddir(void) @@ -121,6 +130,15 @@ _64bits = cpuhaslm(); #endif do { +#ifdef ISOHOOK + s = (char *) x->filename2open; + if (*s == '/') { + s++; + isoroot(); + } + name = s; + while (*++s); +#else for (s = (char *) x->filename2open; *s == '/' ; s++) { isoroot(); } @@ -128,6 +146,7 @@ name = s; do s++; while (*s && *s != '/'); c = *s; *s = 0; +#endif for (x->curdirsize = 0xFFFF; isoreaddir() != -1;) { const char *n = name; #define i (x->tmp) @@ -138,11 +157,15 @@ i += s - name; // strlen(name); } if (strcmp(i, n)) continue; +#ifndef ISOHOOK *s++ = c; +#endif if (IS_DIR(x->filemod)) { cpydirofs(x->dirofs, x->fileofs); x->dirsize = filesize2dirsize(x->filesize); +#ifndef ISOHOOK if (c) goto next; +#endif } isolseek(&x->fileofs); return 0; diff -r f17d3e9b8ddc -r c04335df099f linld/stuff/src/ISOCRTL.ASM --- a/linld/stuff/src/ISOCRTL.ASM Fri Jun 19 11:08:54 2020 -0400 +++ b/linld/stuff/src/ISOCRTL.ASM Fri Jun 19 15:46:21 2020 +0000 @@ -23,7 +23,7 @@ public _isostate _isostate isostate - org $-7 +; org $-7 ends _BSS @@ -31,9 +31,14 @@ global fold:near fold: - org 0F000h + org 0EF00h global unfold:near unfold: + jmp iso_open + extrn @isoreaddir$qv + dw @isoreaddir$qv + jmp @readmenu$qv + push dx call readfd push ds @@ -65,11 +70,8 @@ iso_open: mov [_isostate.filename2open],ax call @_isoopen$qv - inc ax - jnz open_ok - dec ax - stc -open_ok: + cmp ax,1 + cmc push bx iso_close_hack: pop bx @@ -91,74 +93,12 @@ pop cx endm -iso_read_hack: - ifdef NO386 - push dx - curseek - mov bx,[word _isostate.filesize] - sub bx,ax - mov ax,[(word _isostate.filesize)+2] - sbb ax,dx - ja @@cxok - je @@rem - xor cx,cx -@@rem: - cmp bx,cx - ja @@cxok - mov cx,bx -@@cxok: - pop dx - else - p386 - push edx - curseek - mov edx,[_isostate.filesize] - sub edx,eax - jnb @@rem - xor cx,cx -@@rem: - movzx eax,cx - cmp edx,eax - ja @@cxok - mov cx,dx -@@cxok: - pop edx - endif - or cx,cx - pop bx - jmp readfd +;*************************************************************** +;_fastcall void readmenu(void); +;*************************************************************** + global @readmenu$qv:near + proc @readmenu$qv near -iso_lseek_hack: - xchg ax,bx - pop bx - ifdef SEEK_CUR - cmp al,1 ; current - jne @@nocurrent - call dosfd ; lseek(,0L,SEEK_CUR) - jmp @doseek2 -@nocurrent: - endif - add dx,[word _isostate.fileofs] - adc cx,[(word _isostate.fileofs)+2] - cmp al,0 ; start - je @@doseek - add dx,[word _isostate.filesize] - adc cx,[(word _isostate.filesize)+2] -@@doseek: - call lseekset ; lseek(,0L,SEEK_SET) -@doseek2: - sub ax,[word _isostate.fileofs] - sbb dx,[(word _isostate.fileofs)+2] - ret - -iso_cleanup_hack: - mov ah,3Eh ; close file - jmp dosfd - - - - global @readmenu$qv:near -@readmenu$qv: mov dx,18 xor cx,cx call lseekset @@ -167,13 +107,16 @@ call readfd ; // read x->filemod + x->fileofs & x->filesize mov bx,offset _isostate.fileofs ; x->fileofs = 0x7FF0 - (x->filesize &= 0xFFFF); - and [word bx+6],0 mov ax,7FF0h + cwd + mov [word bx+6],dx sub ax,[bx+4] - and [word bx+2],0 + mov [word bx+2],dx mov [bx],ax ; //magic = x->filemod; + endp @readmenu$qv + ;*************************************************************** ;_fastcall void isolseek(bx:const unsigned long *offset); ;*************************************************************** @@ -260,6 +203,69 @@ endp @strcmp$qpxzct1 +iso_read_hack: + ifdef NO386 + push dx + curseek + mov bx,[word _isostate.filesize] + sub bx,ax + mov ax,[(word _isostate.filesize)+2] + sbb ax,dx + ja @@cxok + je @@rem + xor cx,cx +@@rem: + cmp bx,cx + ja @@cxok + mov cx,bx +@@cxok: + pop dx + else + p386 + push edx + curseek + mov edx,[_isostate.filesize] + sub edx,eax + jnb @@rem + xor cx,cx +@@rem: + movzx eax,cx + cmp edx,eax + ja @@cxok + mov cx,dx +@@cxok: + pop edx + endif + or cx,cx + pop bx + jmp readfd + +iso_lseek_hack: + xchg ax,bx + pop bx + ifdef SEEK_CUR + cmp al,1 ; current + jne @@nocurrent + call dosfd ; lseek(,0L,SEEK_CUR) + jmp @doseek2 +@nocurrent: + endif + add dx,[word _isostate.fileofs] + adc cx,[(word _isostate.fileofs)+2] + cmp al,0 ; start + je @@doseek + add dx,[word _isostate.filesize] + adc cx,[(word _isostate.filesize)+2] +@@doseek: + call lseekset ; lseek(,0L,SEEK_SET) +@doseek2: + sub ax,[word _isostate.fileofs] + sbb dx,[(word _isostate.fileofs)+2] + ret + +iso_cleanup_hack: + mov ah,3Eh ; close file + jmp dosfd ifdef NO386 global N_LXLSH@ES:near N_LXLSH@ES: diff -r f17d3e9b8ddc -r c04335df099f linld/stuff/src/_ISOBEG.ASM --- a/linld/stuff/src/_ISOBEG.ASM Fri Jun 19 11:08:54 2020 -0400 +++ b/linld/stuff/src/_ISOBEG.ASM Fri Jun 19 15:46:21 2020 +0000 @@ -20,15 +20,8 @@ ends _DATA segment _BSS byte public use16 'BSS' - global _bss_start:byte label _bss_start byte -utoabuf db 6 dup(?) - - include "isostate.inc" - - extrn _isostate:isostate - ends _BSS segment _TEXT byte public use16 'CODE' @@ -37,205 +30,8 @@ global _text_start:byte label _text_start byte - extrn fold - extrn unfold - mov si,offset fold - mov di,offset unfold - mov ch,4 - cld - rep - movsw - -;*************************************************************** -; clear bss -;*************************************************************** - - mov si,offset _bss_start -clearbss: - mov [byte si],cl ; clear bss + heap - inc si - jne clearbss - -;*************************************************************** -; build arg -;*************************************************************** - - mov si,80h - lodsb - cbw - xchg ax,bx - mov [bx+si],bh ; set EOS -searchStart: - lodsb - cmp al,0 - je _abort - cmp al,' ' - je searchStart - dec si - mov di,offset filename - push di - mov ah,60h ; canonicalize filename - int 21h - jc _abort - ifdef WITH_LONG_FILENAME - pop si - mov ax,716Ch - xor bx,bx ; R/O - ;xor cx,cx ; attributes - cwd ; action = open - stc - int 21h - jnc opened - mov dx,si - else - pop dx - endif - mov ax,3d00h ; read-only+compatibility - ;mov cl,0 ; attribute mask - int 21h - jnc opened - -_abort: - mov dx,offset stopmsg - mov ah,9 - int 21h - int 20h -opened: - mov [_isostate.fd],ax - mov ax,offset bootdir - extrn iso_open:near - call iso_open -jc_abort: - jc _abort - -; patch magic -;*************************************************************** - - extrn @readmenu$qv:near - call @readmenu$qv - mov ax,[_isostate.filemod] - mov bx,10 - xor cx,cx -@@loop1: - xor dx,dx - div bx ; DX:AX = n%10:n/10 - push dx ; DL = n%10 - inc cx - or ax,ax - jnz @@loop1 - push ds - pop es - mov di,offset magic -@@loop2: - pop ax - add al,'0' - stosb - loop @@loop2 - -; patch initrd -;*************************************************************** - cwd - or [_isostate.curdirsize],-1 - jmp patchtest -found: - inc dh -patchtest: - push dx - extrn @isoreaddir$qv:near - call @isoreaddir$qv - pop dx - push ds - pop es - inc ax - jne patchlp - cmp dx,100h - je initrddone - mov di,offset dotgz - or dh,dh - je modify - add di,4 - mov si,offset rootfs - mov cx,3 - rep - movsw -modify: - xchg ax,dx - mov ah,'.' - stosw - mov ax,'zg' - stosw - mov ax,'!,' - stosw -initrddone: - -;*************************************************************** - - mov si, offset cmdline - mov di, 82h -copy: - mov ah,al - lodsb - cmp al,' ' - jne docopy - cmp al,ah - je copy -docopy: - stosb - cmp al,0 - jnz copy - xchg di,ax - sub al, 82h - mov [80h],al - - mov ax,offset linld - call iso_open - jc jc_abort - mov cx,[word _isostate.filesize] - mov dx,100h - jmp near unfold - -patchlp: - mov si,[_isostate.filename] - mov di,offset rootfs - mov cx,9 - rep - cmpsb - jcxz found - cmp cl,3 - ja patchtest - dec si - cmp dl,[si] - ja patchtest - mov dl,[si] - jmp patchtest - -stopmsg: - db "This program cannot be run in DOS mode$" -bootdir: - db "/boot",0 -linld: - db "linld.com",0 -cmdline: - db "-f " - ;db "image=\boot\" - ;db "bzImage " - db "initrd=" -rootfs: - db "rootfs" -dotgz: - db ".gz,! " - ; ".gz,rootfs4.gz,! " - ;db "rw " - db "autologin rdinit=/init.exe " - ;db "mode=menu " - db "magic=" -magic: - db "0 bootfrom=" - ; "65535 bootfrom=" -filename: - - -;*************************************************************** + extrn _isostate + dw _isostate ends _TEXT diff -r f17d3e9b8ddc -r c04335df099f linld/stuff/src/pipehole.awk --- a/linld/stuff/src/pipehole.awk Fri Jun 19 11:08:54 2020 -0400 +++ b/linld/stuff/src/pipehole.awk Fri Jun 19 15:46:21 2020 +0000 @@ -203,6 +203,19 @@ } } # file == "load.cpp" if (file == "iso9660.cpp") { + if (/curpos >= SECT/) isiso=10 + if (isiso == 10) { # ISO9660.LST + if (/cmp/) { + sub(/cmp /,"mov bx,") + sub(/i.*/,"i]") + print + $0=" cmp bh,2048/256" + } + if (/mov/) { + isiso=0 + next + } + } if (/<< SECTORBITS/) isiso=9 if (isiso == 9) { # ISO9660.LST if (/dx,/) next diff -r f17d3e9b8ddc -r c04335df099f syslinux/stuff/iso2exe/bootiso.S --- a/syslinux/stuff/iso2exe/bootiso.S Fri Jun 19 11:08:54 2020 -0400 +++ b/syslinux/stuff/iso2exe/bootiso.S Fri Jun 19 15:46:21 2020 +0000 @@ -77,7 +77,7 @@ call readsectorX // read isolinux boot sector cmpw (%bx), %cx jnc puts // read fail or no isohydrid boot sector - movw $patch,%si + call bootpartition // assume DS=SS SI=BX=7C00 CX=0100 DL= DI=table+66 popw %es popw %di // isolinux boot needs %es:%di and %dx putsret: @@ -102,10 +102,37 @@ nobsmsg: .asciz "No isolinux." - .org 0x0080 + .org 0x0080,0xEE ////////////////////////////// EXE/PE header ////////////////////////////////// + .org 0x0178,0xFF +////////////////////////// partition boot code //////////////////////////////// +// assume DS=SS SI=BX=7C00 CX=0100 DL= DI=table+66 - .org 0x01A0 +bootpartition: + movw $4,%cx + movw $16,%ax +next: + subw %ax,%di + cmpb %ch,-2(%di) // boot flag ? + loope next + cmpw $63,2-2(%di) // empty or isolinux partition ? + jbe default + .arch i486 + pushl $0 + pushl 8-2(%di) + pushw %cs + pushw %bx + pushw $1 + pushw %ax + movw %sp,%si // assume %ds = %ss + movb $0x42,%ah + int $0x13 + add $16,%sp + .arch i8086 +default: + ret + + .org 0x01A0,0xFF readsectorX: // read isolinux boot sector movb $0xA5, %cl // patched by installer readsector1: @@ -120,182 +147,239 @@ movw $0x0100, %cx movb $nobsmsg, %al ret - .org 0x01B8 + .org 0x01B8,0xEE // partition table -////////////////////////// partition boot code //////////////////////////////// -// assume DS=SS BX=7C00 CH=01 DL= SI=7DBE + .org 0x0270,0xFF - .org 0x7C00 - jmp bootpartition - .org 0x7C03 - .org 0x7DBE -table = moved+0x1BE -patch: - .byte 0,0,0 // head of original bs -partcode: - popw %si - xchgw %si,%di - call movepartition - pushw %cx - pushw %cx - decw %di - decw %di - movb $4,%cl - movw $16,%ax -next: - subw %ax,%di - cmpb %ch,(%di) // boot flag ? - loope next - pushw 10(%di) - pushw 8(%di) - pushw %cs - pushw %bx - movb $1,%cl - pushw %cx - pushw %ax - movw %sp,%si // assume %ds = %ss - pushw %bx - cmpw $63,2(%di) // empty or isolinux partition ? - jbe default - movb $0x42,%ah - int $0x13 -default: - ret - .org 0x7DF0 -bootpartition: - pushw %ds - popw %es - pushw %si - movw %bx,%di - movsw - movsb - movw $table-0x142,%di - pushw %di -movepartition: - movb $66,%cl // 0142 and 0042 - rep - movsb - ret - .org 0x7E00 - .org 0x7F40 ////////////////////////////// DOS EXE code /////////////////////////////////// +bootdir: + .asciz "/boot" +linld: + .asciz "linld.com" +cmdline: + .ascii "-f " +// .ascii "image=\boot\" +// .ascii "bzImage " + .ascii "initrd=" +rootfs: + .ascii "rootfs" +dotgz: + .ascii ".gz,! " +// .ascii ".gz,rootfs4.gz,! " +args: +// .ascii " rw " +// .ascii " mode=menu" + .ascii " autologin rdinit=/init.exe magic=" +magicstr: + .ascii "0 bootfrom=" +// .ascii "65535 bootfrom=" +filename: exestart: - movw 129, %ax - cmpb $0x2F, %al - je ishelp - cmpw $0x2F20, %ax -ishelp: - movw $0x3000+EXESTR(help), %ax - cwd // clear dx - pushw %dx // dos exit() - je abort - int $0x21 // get DOS version - addb $-3, %al - movb $EXESTR(noDOS3), %al - movw $0x100, %di - jc tst386 -abort: -goputs: - mov $EXEADRS(puts), %si - jmp *%si + movb $0x30,%ah // get DOS version + int $0x21 + cmpb $3,%al + jc goabort -tst386: - pushw %sp - popw %ax - xorw %sp, %ax // clear C - movb $EXESTR(vm86modemsg), %al - jnz is86 // 86/186 not a 286+ - .arch i486 -is386: - smsww %bx // not privileged - andb $1, %bl // clear C - jne isvm86 - movl %cr0, %ebx // privileged - incl %ebx - .arch i8086 - movb $EXESTR(rmPaging), %al - js abort -is86: - incw %ax - //movb $EXESTR(realmodemsg), %al -isvm86: - call goputs -//---------- - pushw %di -//------------- insert argv[0] in cmdline ----------------------- - xchgw %ax,%dx // %ax = 0 + cld + movw EXEADRS(comstart),%si + movw $0xF000,%di + movb $4,%ch // 2k min + rep + movsw // helper + movw $129,%si + leaw args-cmdline(%si),%di + movb -1(%si),%cl + pushw %si + rep + movsb // user args + xchgw %ax,%di + popw %di + movw $EXEADRS(cmdline),%si + movb $args-cmdline,%cl + rep + movsb // files + xchgw %ax,%di + movb $filename-args,%cl + rep + movsb // end + pushw %di // filename + +#define ISOSTATE 0xF000 +#define ISO_OPEN iso_open +#define ISO_READDIR *0xF004 +#define ISO_READMENU iso_readmenu +#define RUN_LINLD run_linld + movw ISOSTATE,%bp + xorw %ax,%ax + movw %bp,%di + movb $64,%cl + rep + stosb // clear BSS + movw %ax,%di movw 0x2C(%di),%es - movw %sp,%cx // big enough + decw %cx scalp: repne scasb scasb jne scalp - incw %di - movw %di,%bx - incw %di - pushw %di // %es:%di = programme pathname - repne - scasb - subw %di,%bx - notw %bx - movw $128,%si - addw %bx,(%si) - lodsb - xchgw %ax,%cx + scasw + movw %di,%si // %es:%di = programme pathname + + pushw %es + pushw %ds + popw %es + popw %ds + popw %di // filename + pushw %di + movb $0x60,%ah // canonicalize filename + int $0x21 + pushw %es + popw %ds +#define LONG_FILENAME +#ifdef LONG_FILENAME + popw %si + pushw %si + movw $0x716C,%ax + xorw %bx,%bx // R/O + xorw %cx,%cx // attributes + cwd // action = open + stc + int $0x21 + jnc opened +#endif + popw %dx + pushw %dx + movw $0x3D00,%ax +// movb $0,%cl + int $0x21 +goabort: + jc abort +opened: + movw %ax,4(%bp) // fd + + call ISO_READMENU + movw 6(%bp),%ax // magic = filemod + popw %bx + leaw magicstr-filename(%bx),%di + movb $10,%bl + xorw %cx,%cx +lp1: + xorw %dx,%dx + divw %bx + pushw %dx incw %cx + orw %ax,%ax + jnz lp1 +lp2: + popw %ax + addb $'0',%al + stosb // store magic + loop lp2 + + movw $EXEADRS(bootdir),%ax + call ISO_OPEN + orw $-1,18(%bp) // curdirsize = -1 + xorw %ax,%ax +found: + incb %ah +patchtest: + pushw %ax + call ISO_READDIR + pushw %ds + popw %es + incw %ax + popw %ax + movw $EXEADRS(rootfs),%si + je dopatch + movw %si,%di + movw 16(%bp),%si // filename + movw $9,%cx + rep + cmpsb + jcxz found + cmpb $3,%cl + ja patchtest + decw %si + cmpb (%si),%al + ja patchtest + lodsb + jmp patchtest +done: + movw $128,%ax + subw %ax,%si + xchgw %ax,%si + decw %ax + movb %al,(%si) // cmdline length + + movw $EXEADRS(linld),%ax + call ISO_OPEN + jc abort + movw 12(%bp),%cx // filesize + movw $0x100,%dx + call RUN_LINLD +abort: + movw $EXEADRS(stopmsg),%dx + movb $9,%ah + int $0x21 + int $0x20 +dopatch: pushw %si -p2lp: + cmpw $0x200,%ax + je initrddone + movw $EXEADRS(dotgz),%di + decb %ah + je modify + scasw + scasw // addw $4,%di + movsw + movsw + movsw +modify: + stosb + movw $129+dotgz-cmdline,%si + movsb + movsw + movsw +initrddone: + movw $129+rootfs-cmdline,%di + popw %si + movw $args-rootfs,%cx + rep + movsb + +shrink0: + movw $129,%si +shrink: + movw %si,%di lodsb - movb %al,-2(%bx,%si) - loop p2lp - popw %si - popw %bx - movb $0x20,%al -p1lp: - movb %al,(%si) - incw %si - movb %es:(%bx),%al - incw %bx - cmpw %bx,%di - ja p1lp -//---------- - popw %di - pushw %cs - popw %es -//---------- - movw comstart-end_header(%di), %si // .com address - pushw %di - movb $0x7C/2, %ch // 31K-31.5K, > com length - movb $0x80, %bh - movw $0xA5F3, (%bx) // rep movsw - movb $0xC3, 2(%bx) // ret - jmp *%bx + cmpb $0,%al + je done + cmpb $' ',%al + jne shrink + cmpb (%si),%al + jne shrink +pack: + lodsb + stosb + cmpb $0,%al + jne pack + jmp shrink0 + + .org 0x0400,0xEE + .org 0x0600,0xFF + .org 0x0750,0xBB +stopmsg: + .ascii "This program cannot be run in DOS mode.$" + .org 0x0778,0xEE + .org 0xF002-0xC0 +iso_open: + .word 0 + .word 0 +iso_readmenu: + .word 0 +run_linld: -vm86modemsg: -// --------------- Must be in 7F40 7FFF range ------------------------ - .ascii "v" // v86 mode - .ascii "86" // 86 mode - .byte EXESTR(mode) -rmPaging: - .ascii "X" // Xreal mode -realmodemsg: - .ascii "real" // real mode -// --------------- Must be in 7FC0 7FFF range ------------------------ -mode: - .ascii " mode" - .byte EXESTR(eol) -noDOS3: - .ascii "DOS3?" // DOS3? - .byte EXESTR(eol) -help: - .ascii "SliTaz iso boot" // SliTaz iso boot -eol: - .ascii "\r\n" - .byte 1 // puts will return - - .space 16,0 // ISO md5 - .org 0x8000 -////////////////////////// ISO9660 header ///////////////////////////////////// + .end diff -r f17d3e9b8ddc -r c04335df099f syslinux/stuff/iso2exe/iso2exe.sh --- a/syslinux/stuff/iso2exe/iso2exe.sh Fri Jun 19 11:08:54 2020 -0400 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Fri Jun 19 15:46:21 2020 +0000 @@ -79,7 +79,7 @@ add_win32exe() { SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c) - [ -n "$gpt" ] && n=1536 || n=512 + n=1536 SIZE=$(($SIZE+$n)) printf "Adding WIN32 file at %04X (%d bytes) ...\n" 0 $SIZE [ -n "$gpt" ] && printf "Adding GPT at %04X (1024 bytes) ...\n" 512 @@ -93,25 +93,20 @@ ddn if=/tmp/exe$$ of=$1 bs=1 skip=$cut seek=$(($n+$cut)) printf "Adding bootiso head at %04X...\n" 0 $0 --get bootiso.bin 2> /dev/null > /tmp/exe$$ - x=$(($(get 0x14 /tmp/exe$$ 1)+0x40)) - printf "Adding bootiso DOS stub at %04X...\n" $(($n+$x)) - ddn if=/tmp/exe$$ of=$1 bs=1 seek=$(($n+$x)) skip=$((0x7F00+$x)) count=$((256-$x)) - x=$(($n/256+1)) - store $((0x15)) $x /tmp/exe$$ 8 ### exe IP - store $((0x6c)) $x /tmp/exe$$ 8 ### puts data - ddn if=/tmp/exe$$ of=$1 bs=128 count=1 ### DOS header - ddn if=/tmp/exe$$ of=$1 bs=1 count=24 seek=$((0x1A0)) skip=$((0x1A0)) - ddn if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 store 510 $((0xAA55)) $1 - i=$SIZE; OFS=$(($SIZE+512)) - store 417 $(($i/512)) $1 8 ### isolinux boot sector - printf "Moving syslinux hybrid boot record at %04X (512 bytes) ...\n" $i - ddn if=$2 bs=1 count=512 of=$1 seek=$i - if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then # partition boot code - ddn if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE)) - ddn if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE)) - ddn if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i - fi + while read adrs sz; do + ddn if=/tmp/exe$$ of=$1 bs=1 count=$((0x$sz)) seek=$((0x$adrs)) skip=$((0x$adrs)) + done < rootfs.gz + p=$((4-($(stat -c %s rootfs.gz)%4))) + [ $p = 4 ] || dd if=/dev/zero bs=1 count=$p >> rootfs.gz rm -rf $TMP chmod 644 ${@/init/rootfs.gz} chown root.root ${@/init/rootfs.gz}