wok diff syslinux/stuff/iso2exe/iso2exe.sh @ rev 23863
syslinux/isoboot.s: accept user args
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jun 19 15:46:21 2020 +0000 (2020-06-19) |
parents | d33c3c211ef8 |
children | a2e843f5d9e4 |
line diff
1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Mon May 25 10:10:30 2020 +0000 1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Fri Jun 19 15:46:21 2020 +0000 1.3 @@ -79,7 +79,7 @@ 1.4 add_win32exe() 1.5 { 1.6 SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c) 1.7 - [ -n "$gpt" ] && n=1536 || n=512 1.8 + n=1536 1.9 SIZE=$(($SIZE+$n)) 1.10 printf "Adding WIN32 file at %04X (%d bytes) ...\n" 0 $SIZE 1.11 [ -n "$gpt" ] && printf "Adding GPT at %04X (1024 bytes) ...\n" 512 1.12 @@ -93,25 +93,20 @@ 1.13 ddn if=/tmp/exe$$ of=$1 bs=1 skip=$cut seek=$(($n+$cut)) 1.14 printf "Adding bootiso head at %04X...\n" 0 1.15 $0 --get bootiso.bin 2> /dev/null > /tmp/exe$$ 1.16 - x=$(($(get 0x14 /tmp/exe$$ 1)+0x40)) 1.17 - printf "Adding bootiso DOS stub at %04X...\n" $(($n+$x)) 1.18 - ddn if=/tmp/exe$$ of=$1 bs=1 seek=$(($n+$x)) skip=$((0x7F00+$x)) count=$((256-$x)) 1.19 - x=$(($n/256+1)) 1.20 - store $((0x15)) $x /tmp/exe$$ 8 ### exe IP 1.21 - store $((0x6c)) $x /tmp/exe$$ 8 ### puts data 1.22 - ddn if=/tmp/exe$$ of=$1 bs=128 count=1 ### DOS header 1.23 - ddn if=/tmp/exe$$ of=$1 bs=1 count=24 seek=$((0x1A0)) skip=$((0x1A0)) 1.24 - ddn if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 1.25 store 510 $((0xAA55)) $1 1.26 - i=$SIZE; OFS=$(($SIZE+512)) 1.27 - store 417 $(($i/512)) $1 8 ### isolinux boot sector 1.28 - printf "Moving syslinux hybrid boot record at %04X (512 bytes) ...\n" $i 1.29 - ddn if=$2 bs=1 count=512 of=$1 seek=$i 1.30 - if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then # partition boot code 1.31 - ddn if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE)) 1.32 - ddn if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE)) 1.33 - ddn if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i 1.34 - fi 1.35 + while read adrs sz; do 1.36 + ddn if=/tmp/exe$$ of=$1 bs=1 count=$((0x$sz)) seek=$((0x$adrs)) skip=$((0x$adrs)) 1.37 + done <<EOT 1.38 +0000 0080 1.39 +0178 0040 1.40 +0270 0190 1.41 +0750 0028 1.42 +EOT 1.43 + i=$((0x600)) 1.44 + store 417 $(($i/512)) $1 8 ### isolinux boot sector 1.45 + printf "Moving syslinux hybrid boot record at %04X (336 bytes) ...\n" $i 1.46 + OFS=$SIZE 1.47 + ddn if=$2 bs=1 count=336 of=$1 seek=$i 1.48 rm -f /tmp/exe$$ /tmp/coff$$ 1.49 if [ -z "$RECURSIVE_PARTITION" -a $(get 454 $1 4) -eq 0 ]; then 1.50 store 448 $((1+$i/512)) $1 8 ### 446+2 SECTOR 1.51 @@ -159,8 +154,8 @@ 1.52 SIZE=0; OFFSET=0 1.53 case "$1" in 1.54 win32.exe) [ $x -eq 2048 ] && x=10752 1.55 - [ $x -eq 1024 ] || SIZE=$(($x - 512));; 1.56 - syslinux.mbr) [ $x -eq 1024 ] || OFFSET=$(($x - 512)); SIZE=512;; 1.57 + [ $x -eq 1024 ] || SIZE=$x;; 1.58 + syslinux.mbr) [ $x -eq 1024 ] || OFFSET=$(($x - 512)); SIZE=336;; 1.59 flavor.info) [ $(get 22528 "$ISO") -eq 35615 ] && OFFSET=22528 1.60 [ $x -eq 2048 ] && x=$(get 0x25C "$ISO") && 1.61 SIZE=$(get 0x25E "$ISO") 1.62 @@ -308,6 +303,8 @@ 1.63 find $TMP -type f -print0 | xargs -0 chmod +x 1.64 find $TMP -print0 | xargs -0 touch -t 197001010100.00 1.65 ( cd $TMP; find dev init.exe | cpio -o -H newc ) | compress > rootfs.gz 1.66 + p=$((4-($(stat -c %s rootfs.gz)%4))) 1.67 + [ $p = 4 ] || dd if=/dev/zero bs=1 count=$p >> rootfs.gz 1.68 rm -rf $TMP 1.69 chmod 644 ${@/init/rootfs.gz} 1.70 chown root.root ${@/init/rootfs.gz}