wok-6.x diff syslinux/stuff/iso2exe/iso2exe.sh @ rev 23996
linld: add iso support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jan 08 20:15:35 2021 +0000 (2021-01-08) |
parents | 3d19917d3a03 |
children | 5c1ce90eb1d6 |
line diff
1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Sat Dec 12 10:41:29 2020 +0000 1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Fri Jan 08 20:15:35 2021 +0000 1.3 @@ -51,15 +51,6 @@ 1.4 rm -rf $TMP 1.5 } 1.6 1.7 -add_doscom() 1.8 -{ 1.9 - SIZE=$($0 --get boot.com | wc -c) 1.10 - OFS=$(( $OFS - $SIZE )) 1.11 - printf "Adding DOS boot file at %04X (%d bytes) ...\n" $OFS $SIZE 1.12 - $0 --get boot.com | ddn of=$1 bs=1 seek=$OFS 1.13 - store 64 $(($OFS+0xC0)) $1 1.14 -} 1.15 - 1.16 add_tazlito_info() 1.17 { 1.18 HOLE=$OFS 1.19 @@ -110,6 +101,20 @@ 1.20 store 454 $(($i/512)) $1 32 ### 446+8 OFFSET 1.21 store 458 $(($(stat -c %s $1)/512)) $1 32 ### 446+12 SIZE 1.22 fi 1.23 + mkdir /tmp/mnt$$ 1.24 + mount -o loop,ro $1 /tmp/mnt$$ 1.25 + if [ -s /tmp/mnt$$/boot/linld.com ]; then 1.26 + i=$(($(get 20 $1)-0xC0)) 1.27 + store $(($i-6)) $(($(stat -m /tmp/mnt$$/boot/linld.com | sed q)*2048)) $1 32 1.28 + store $(($i-2)) $(stat -c %s /tmp/mnt$$/boot/linld.com) $1 1.29 + r0="$(cd /tmp/mnt$$/boot/ ; ls rootfs.gz 2> /dev/null)" 1.30 + r1="$(cd /tmp/mnt$$/boot/ ; ls -r rootfs?*.gz 2> /dev/null | sed q)" 1.31 + [ "$r0" -a "$r1" ] && r0="$r0," 1.32 + echo -n "image=/boot/bzImage initrd=$r0$r1,! autologin rdinit=/init.exe" | \ 1.33 + ddn bs=1 of=$1 conv=notrunc seek=$(($i-134)) 1.34 + fi 1.35 + umount /tmp/mnt$$ 1.36 + rmdir /tmp/mnt$$ 1.37 } 1.38 1.39 add_fdbootstrap() 1.40 @@ -293,8 +298,8 @@ 1.41 --build) 1.42 shift 1.43 TMP=/tmp/iso2exe$$ 1.44 - dd if=/dev/zero bs=1k count=100 of=/tmp/fs$$ 1.45 - mke2fs /tmp/fs$$ 1.46 + ddq if=/dev/zero bs=1k count=100 of=/tmp/fs$$ 1.47 + mke2fs /tmp/fs$$ > /dev/null 1.48 mkdir $TMP 1.49 mount -o loop /tmp/fs$$ $TMP 1.50 rm -rf $TMP/* 1.51 @@ -307,7 +312,7 @@ 1.52 umount -d $TMP 1.53 rm -rf $TMP /tmp/fs$$ 1.54 p=$((4-($(stat -c %s rootfs.gz)%4))) 1.55 - [ $p = 4 ] || dd if=/dev/zero bs=1 count=$p >> rootfs.gz 1.56 + [ $p = 4 ] || ddq if=/dev/zero bs=1 count=$p >> rootfs.gz 1.57 chmod 644 ${@/init/rootfs.gz} 1.58 chown root.root ${@/init/rootfs.gz} 1.59 touch -t 197001010100.00 ${@/init/rootfs.gz} 1.60 @@ -328,7 +333,6 @@ 1.61 add_win32exe $DATA $2 > /dev/null 1.62 HSZ=$OFS 1.63 add_rootfs $DATA > /dev/null 1.64 - add_doscom $DATA > /dev/null 1.65 add_fdbootstrap $DATA > /dev/null 1.66 name=${3:-bootiso} 1.67 BOOTISOSZ=$((0x8000 - $OFS + $HSZ)) 1.68 @@ -574,7 +578,6 @@ 1.69 1.70 # keep the largest room for the tazlito info file 1.71 add_rootfs $1 1.72 - add_doscom $1 1.73 add_fdbootstrap $1 1.74 printf "%d free bytes in %04X..%04X\n" $(($OFS-$HOLE)) $HOLE $OFS 1.75 store 440 $(date +%s) $1 32