wok rev 24943

BootProg: clear cmdline (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 20 16:57:09 2022 +0000 (7 months ago)
parents d1f31f5f6401
children 27c5a4be1423
files BootProg/stuff/boot32.asm BootProg/stuff/bootex.asm BootProg/stuff/bootprog.sh
line diff
     1.1 --- a/BootProg/stuff/boot32.asm	Wed Apr 20 15:10:50 2022 +0000
     1.2 +++ b/BootProg/stuff/boot32.asm	Wed Apr 20 16:57:09 2022 +0000
     1.3 @@ -256,6 +256,7 @@
     1.4  
     1.5          sub     di, bp
     1.6          jae     FileReadContinue
     1.7 +        xor     ax, ax
     1.8          pop     bp
     1.9  
    1.10  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.11 @@ -316,7 +317,6 @@
    1.12          push    di
    1.13          push    ds
    1.14          pop     es
    1.15 -        xor     ax, ax
    1.16          mov     [80h], ax               ; clear cmdline
    1.17          dec     ax                      ; both FCB in the PSP don't have a valid drive identifier
    1.18  
     2.1 --- a/BootProg/stuff/bootex.asm	Wed Apr 20 15:10:50 2022 +0000
     2.2 +++ b/BootProg/stuff/bootex.asm	Wed Apr 20 16:57:09 2022 +0000
     2.3 @@ -226,12 +226,12 @@
     2.4          popa                            ; restore ax, cx, si, di
     2.5  
     2.6          add     di, byte 32
     2.7 -        cmp     di, bp
     2.8 -        jne     FindNameCycle           ; next root entry
     2.9 +        sub     bp, byte 32
    2.10 +        jnz     FindNameCycle           ; next root entry
    2.11          popf                            ; restore carry="not last sector" flag
    2.12          jc      RootDirReadContinue     ; continue to the next root dir cluster
    2.13  FindNameFailed:                         ; end of root directory (dir end reached)
    2.14 -;        mov     dx, [bx]                ; restore BIOS boot drive number
    2.15 +        mov     dx, [bx]                ; restore BIOS boot drive number
    2.16          call    Error
    2.17          db      "File not found."
    2.18  FindNameFound:
    2.19 @@ -242,16 +242,16 @@
    2.20  ;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.21  
    2.22          push    es
    2.23 -        xor     bp, bp
    2.24  FileReadContinue:
    2.25          shr     bp, 4                   ; bytes to paragraphs
    2.26          mov     di, es
    2.27          add     di, bp                  ; adjust segment for next sector
    2.28          mov     es, di                  ; es:0 updated
    2.29 -        call    ReadCluster             ; read one cluster of root dir
    2.30 +        call    ReadCluster             ; read one more sector of the boot file
    2.31          sub     [bx+FileSize], ebp
    2.32          ja      FileReadContinue
    2.33          mov     dx, [bx]                ; restore BIOS boot drive number
    2.34 +        xor     ax, ax
    2.35          pop     bp
    2.36  
    2.37  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.38 @@ -312,7 +312,6 @@
    2.39          push    di
    2.40          push    ds
    2.41          pop     es
    2.42 -        xor     ax, ax
    2.43          mov     [80h], ax               ; clear cmdline
    2.44          dec     ax                      ; both FCB in the PSP don't have a valid drive identifier
    2.45  
    2.46 @@ -392,8 +391,6 @@
    2.47  ;;         ES:0   -> next address    ;;
    2.48  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.49  
    2.50 -ReadSector:
    2.51 -
    2.52          xor     ebp, ebp
    2.53          inc     bp
    2.54  
     3.1 --- a/BootProg/stuff/bootprog.sh	Wed Apr 20 15:10:50 2022 +0000
     3.2 +++ b/BootProg/stuff/bootprog.sh	Wed Apr 20 16:57:09 2022 +0000
     3.3 @@ -5,21 +5,21 @@
     3.4  Example: $0 /dev/fd0 STARTUP.BIN
     3.5  EOT
     3.6  
     3.7 -ddo="dd of=$1 bs=1 conv=notrunc"
     3.8 +xd="dd of=$1 bs=1 conv=notrunc"
     3.9  while read c o b f; do
    3.10  	[ "${FAT:-$(dd if="$1" bs=1 count=5 skip=$c)}" = "$f" ] || continue
    3.11  	echo "Install $f bootsector on $1."
    3.12  	for a in "$((o+b)) seek=$o count=$((512-o))" "$b count=11"; do
    3.13 -		sed '1,/^exit 1/d' $0 | unlzma | $ddo skip=$a
    3.14 +		sed '1,/^exit 1/d' $0 | unlzma | $xd skip=$a
    3.15  	done
    3.16  	[ "$2" ] && echo "Set boot file '$2'" && echo -n "$2" | case "$f" in
    3.17  	E*)	sed 's| |.|;s| ||g' | cat - /dev/zero;;
    3.18  	*)	tr a-z A-Z | sed 's|\.|       |;s|^\(.\{8\}\) *|\1|;s|$|   |'
    3.19 -	esac | $ddo seek=499 count=11
    3.20 +	esac | $xd seek=499 count=11
    3.21  	[ "$f" = "EXFAT" ] && dd if="$1" bs=512 count=11 | od -v -An -t u1 -w1 - | LANG=C awk '
    3.22  BEGIN { a=0;i=-1;m=0xFFFFFFFE }
    3.23  { if (++i!=106 && i!=107 && i!=112) a=or(and(lshift(a,31),m),and(rshift(a,1),m/2))+$1 }
    3.24 -END { b=a/256;c=b/256; for (i=0;i<128;i++) printf "%c%c%c%c",a%256,b%256,c%256,(c/256)%256 }' | $ddo seek=5632
    3.25 +END { b=a/256;c=b/256; for (i=0;i<128;i++) printf "%c%c%c%c",a%256,b%256,c%256,(c/256)%256 }' | $xd seek=5632
    3.26  	exit 0
    3.27  done 2>/dev/null <<EOT
    3.28  54	62	0	FAT12