wok-6.x rev 19848
syslinux/iso2exe: do not update hybrid mbr partitions
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Mar 15 12:56:01 2017 +0100 (2017-03-15) |
parents | f226094b72d6 |
children | 3378a0c35726 |
files | linld/stuff/src/_BEG.ASM syslinux/stuff/iso2exe/iso2exe.sh |
line diff
1.1 --- a/linld/stuff/src/_BEG.ASM Tue Mar 14 21:00:20 2017 +0200 1.2 +++ b/linld/stuff/src/_BEG.ASM Wed Mar 15 12:56:01 2017 +0100 1.3 @@ -35,19 +35,14 @@ 1.4 ;*************************************************************** 1.5 1.6 ; Check for oldies 1.7 - pushf 1.8 - mov bh, 0F0h 1.9 - push bx ; < 286 : flags[12..15] are forced 1 1.10 - popf ; = 286 : flags[12..15] are forced 0 1.11 - pushf ; > 286 : only flags[15] is forced 0 1.12 - pop dx 1.13 - popf 1.14 - add dh,bh ; NS=386+, NC=286 1.15 + push sp 1.16 + pop ax 1.17 mov bx,offset msg_badcpu 1.18 + sub ax,sp 1.19 ifndef NO386 1.20 - js no_vcpi ;it is a 86/186/286, not a 386+ 1.21 + jnz no_vcpi ;it is a 86/186 not a 286+ 1.22 else 1.23 - js endcpu 1.24 + jnz endcpu 1.25 endif 1.26 p386 1.27 ifdef EXTRA
2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Tue Mar 14 21:00:20 2017 +0200 2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Wed Mar 15 12:56:01 2017 +0100 2.3 @@ -34,21 +34,8 @@ 2.4 add_rootfs() 2.5 { 2.6 TMP=/tmp/iso2exe$$ 2.7 - mkdir -p $TMP/dev 2.8 - cp -a /dev/tty /dev/tty0 $TMP/dev 2.9 - $0 --get init > $TMP/init.exe 2.10 -# mount -o loop,ro $1 $TMP 2.11 -# oldslitaz="$(ls $TMP/boot/isolinux/splash.lss 2> /dev/null)" 2.12 -# umount -d $TMP 2.13 -# [ "$oldslitaz" ] && # for SliTaz <= 3.0 only... 2.14 -# grep -q mount.posixovl.iso2exe $TMP/init.exe && mkdir $TMP/bin && 2.15 -# cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe \ 2.16 -# 2> /dev/null && echo "Store mount.posixovl ($(wc -c \ 2.17 -# < /usr/sbin/mount.posixovl) bytes) ..." 2.18 - find $TMP -type f -print0 | xargs -0 chmod +x 2.19 - find $TMP -print0 | xargs -0 touch -t 197001010100.00 2.20 - ( cd $TMP ; find * | grep -v rootfs.gz | cpio -o -H newc ) | \ 2.21 - compress $TMP/rootfs.gz 2.22 + mkdir -p $TMP 2.23 + $0 --get rootfs.gz > $TMP/rootfs.gz 2.24 SIZE=$(wc -c < $TMP/rootfs.gz) 2.25 store 24 $SIZE $1 2.26 OFS=$(( $OFS - $SIZE )) 2.27 @@ -203,6 +190,53 @@ 2.28 esac 2.29 } 2.30 2.31 +trailer() 2.32 +{ 2.33 + OFFSET=$(stat -c %s "$1") 2.34 + [ $OFFSET -gt $HEAP ] && 2.35 + printf "%d free bytes in %04X..%04X\n" $(($OFFSET - $HEAP)) $HEAP $OFFSET 2.36 + if [ $(get 510 "$1") -eq 43605 ]; then 2.37 + echo "MBR partitions :" 2.38 + for i in 0 1 2 3; do 2.39 + SIZE=$(get $((446+12+16*i)) "$1" 4) 2.40 + [ $SIZE -eq 0 ] && continue 2.41 + OFFSET=$(get $((446+8+16*i)) "$1" 4) 2.42 + printf " $i:%08X %08X %02X\n" $OFFSET $SIZE \ 2.43 + $(get $((446+4+16*i)) "$1" 1) 2.44 + done 2.45 + if [ $(get 466 "$1") -eq 65263 ]; then 2.46 + echo "EFI partitions :" 2.47 + n=$(get 584 "$1" 1) 2.48 + s=$(get 596 "$1") 2.49 + o=$((($(get 552 "$1" 1)*512)-($(get 592 "$1")*$s))) 2.50 + i=0 2.51 + while [ $n -gt $i ]; do 2.52 + f=$(get $(($o+0x20)) "$1" 4) 2.53 + l=$(($(get $(($o+0x28)) "$1" 4)-$f)) 2.54 + [ $l -eq 0 ] && break 2.55 + printf " $i:%08X %08X %s\n" $f $(($l+1)) \ 2.56 + "$(od -An -N 36 -w -j $(($o+0x38)) -t a "$1" \ 2.57 + | sed 's/\( nul\)*//g;s/ //g;s/ sp//')" 2.58 + o=$(($o+$s)) 2.59 + i=$(($i+1)) 2.60 + done 2.61 + fi 2.62 + fi 2.63 + o=2048 2.64 + if [ $(get $o "$1") -eq 19792 ]; then 2.65 + echo "Apple partitions :" 2.66 + i=0 2.67 + while [ $(get $o "$1") -eq 19792 ]; do 2.68 + f=$((0x$(od -An -N 4 -j $(($o+8)) -t x1 "$1" | sed 's/ //g'))) 2.69 + l=$((0x$(od -An -N 4 -j $(($o+0x54)) -t x1 "$1" | sed 's/ //g'))) 2.70 + printf " $i:%08X %08X %s\n" $f $l \ 2.71 + "$(ddq bs=1 skip=$(($o+16)) count=32 if="$1")" 2.72 + o=$(($o+2048)) 2.73 + i=$(($i+1)) 2.74 + done 2.75 + fi 2.76 +} 2.77 + 2.78 list() 2.79 { 2.80 HEAP=0 2.81 @@ -219,49 +253,7 @@ 2.82 [ $OFFSET -ge $HEAP ] && HEAP=$(($OFFSET+$SIZE)) 2.83 printf "$f at %04X ($SIZE bytes).\n" $OFFSET 2.84 done 2.85 - OFFSET=$(stat -c %s "$ISO") 2.86 - [ $OFFSET -gt $HEAP ] && 2.87 - printf "%d free bytes in %04X..%04X\n" $(($OFFSET - $HEAP)) $HEAP $OFFSET 2.88 - if [ $(get 510 "$ISO") -eq 43605 ]; then 2.89 - echo "MBR partitions :" 2.90 - for i in 0 1 2 3; do 2.91 - SIZE=$(get $((446+12+16*i)) "$ISO" 4) 2.92 - [ $SIZE -eq 0 ] && continue 2.93 - OFFSET=$(get $((446+8+16*i)) "$ISO" 4) 2.94 - printf " $i:%08X %08X %02X\n" $OFFSET $SIZE \ 2.95 - $(get $((446+4+16*i)) "$ISO" 1) 2.96 - done 2.97 - if [ $(get 466 "$ISO") -eq 65263 ]; then 2.98 - echo "EFI partitions :" 2.99 - n=$(get 584 "$ISO" 1) 2.100 - s=$(get 596 "$ISO") 2.101 - o=$((($(get 552 "$ISO" 1)*512)-($(get 592 "$ISO")*$s))) 2.102 - i=0 2.103 - while [ $n -gt $i ]; do 2.104 - f=$(get $(($o+0x20)) "$ISO" 4) 2.105 - l=$(($(get $(($o+0x28)) "$ISO" 4)-$f)) 2.106 - [ $l -eq 0 ] && break 2.107 - printf " $i:%08X %08X %s\n" $f $(($l+1)) \ 2.108 - "$(od -An -N 36 -w -j $(($o+0x38)) -t a "$ISO" \ 2.109 - | sed 's/\( nul\)*//g;s/ //g;s/ sp//')" 2.110 - o=$(($o+$s)) 2.111 - i=$(($i+1)) 2.112 - done 2.113 - fi 2.114 - fi 2.115 - o=2048 2.116 - if [ $(get $o "$ISO") -eq 19792 ]; then 2.117 - echo "Apple partitions :" 2.118 - i=0 2.119 - while [ $(get $o "$ISO") -eq 19792 ]; do 2.120 - f=$((0x$(od -An -N 4 -j $(($o+8)) -t x1 "$ISO" | sed 's/ //g'))) 2.121 - l=$((0x$(od -An -N 4 -j $(($o+0x54)) -t x1 "$ISO" | sed 's/ //g'))) 2.122 - printf " $i:%08X %08X %s\n" $f $l \ 2.123 - "$(ddq bs=1 skip=$(($o+16)) count=32 if="$ISO")" 2.124 - o=$(($o+2048)) 2.125 - i=$(($i+1)) 2.126 - done 2.127 - fi 2.128 + trailer $ISO 2.129 } 2.130 2.131 restore_hybrid_mbr() 2.132 @@ -298,9 +290,18 @@ 2.133 case "$1" in 2.134 --build) 2.135 shift 2.136 - ls -l $@ 2.137 + TMP=/tmp/iso2exe$$ 2.138 + mkdir -p $TMP/dev 2.139 + cp -a /dev/tty /dev/tty0 $TMP/dev 2.140 + cat init > $TMP/init.exe 2.141 + find $TMP -type f -print0 | xargs -0 chmod +x 2.142 + find $TMP -print0 | xargs -0 touch -t 197001010100.00 2.143 + ( cd $TMP ; find * | grep -v rootfs.gz | cpio -o -H newc ) | \ 2.144 + compress rootfs.gz 2.145 + rm -rf $TMP 2.146 + ls -l $@ rootfs.gz 2.147 cat >> $0 <<EOM 2.148 -$(tar cf - $@ | compress | uuencode -m -) 2.149 +$(tar cf - ${@/init/rootfs.gz} | compress | uuencode -m -) 2.150 EOT 2.151 EOM 2.152 sed -i '/^case/,/^esac/d' $0 2.153 @@ -574,6 +575,7 @@ 2.154 md5sum | cut -c-32 | sed 's/\(..\)/\\x\1/g')" | \ 2.155 ddq bs=16 seek=2047 conv=notrunc of=$1 2.156 fi 2.157 + HEAP=$(($(custom_config_sector $1)*2048)) 2.158 if [ "$append$initrd" ]; then 2.159 echo -n "Adding custom config... " 2.160 DATA=/tmp/$(basename $0)$$ 2.161 @@ -583,16 +585,15 @@ 2.162 [ -s "$initrd" ] && echo "initrd:$(stat -c %s $initrd)" >> $DATA && 2.163 cat $initrd >> $DATA 2.164 echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \ 2.165 - ddq bs=2k seek=$(custom_config_sector $1) of=$1 conv=notrunc 2.166 + ddq bs=2k seek=$(custom_config_sector $1) of=$1 2.167 newsz=$(stat -c %s $1) 2.168 + mb=$(((($newsz -1)/1048576)+1)) 2.169 + HEAP=$(($mb*1048576)) 2.170 + ddq bs=1048576 seek=$mb count=0 of=$1 2.171 + h=$(get 417 "$1" 1) 2.172 + [ -z "$RECURSIVE_PARTITION" ] || h=0 2.173 for i in 0 1 2 3 ; do 2.174 [ $(get $((0x1BE+16*i)) $1 2) == $((0x0080)) ] || continue 2.175 - mb=$(((($newsz -1)/1024/1024)+1)) 2.176 - h=$((512*$(get 417 "$1" 1))) 2.177 - store $((0x1C5+16*i)) $(($mb-1)) $1 8 2.178 - store $(($h+0x1C5+16*i)) $(($mb-1)) $1 8 2.179 - store $(($h+0x1CA+16*i)) $(($mb*2048)) $1 32 2.180 - [ -z "$RECURSIVE_PARTITION" ] || h=0 2.181 store $((0x1CA+16*i)) $(($mb*2048-$h)) $1 32 2.182 done 2.183 if [ $newsz -gt $isosz ]; then 2.184 @@ -612,6 +613,7 @@ 2.185 store 18 $(( (-$n -1) % 65536 )) $1 2.186 fi 2.187 echo " done." 2.188 + trailer $1 2.189 } 2.190 2.191 main "$@" <<EOT