# HG changeset patch # User Pascal Bellard # Date 1600611326 0 # Node ID 09d8c12d65144c8acbecf8d3be0e13dc43b93920 # Parent a17c0b257e4797aaca8ba3dd6b6fbfe50e4bd791 syslinux/taziso: add plop support diff -r a17c0b257e47 -r 09d8c12d6514 busybox/stuff/command_not_found --- a/busybox/stuff/command_not_found Fri Sep 18 18:47:32 2020 +0000 +++ b/busybox/stuff/command_not_found Sun Sep 20 14:15:26 2020 +0000 @@ -6,7 +6,7 @@ grep -E "(: ${PATH//:/|: })" | gzip -9 >$LIST && chmod 666 $LIST lookup() { - zcat $LIST | grep "/$2$1$" | if read pkg file; then + zcat $LIST 2> /dev/null | grep "/$2$1$" | if read pkg file; then cat < /dev/null } +ddn() +{ + ddq conv=notrunc $@ +} + get() { hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" "$2" @@ -43,10 +48,16 @@ ddq if=$file >> $1 } +maybe64() +{ + echo -n $1 + grep -q ' lm ' /proc/cpuinfo && [ -s ${1}64 ] && echo 64 +} + uncpio() { i=$1 - [ $0 = /init.exe ] && sed 's|$| |' /proc/cpuinfo | grep ' lm ' && [ -s ${i}64 ] && i=${i}64 + [ $0 = /init.exe ] && i=$(maybe64 $i) [ -s "$i" ] || return echo -en "\n Extracting $(basename $i) ..." case $(get 0 $i) in @@ -261,6 +272,7 @@ fi echo -en "\nInstall boot files..." for i in $media/boot/bzImage* $media/boot/*pxe* \ + $media/boot/plop.exe \ $media/boot/isolinux/he* $media/boot/isolinux/opt* \ $media/README $media/boot/memtest* ; do [ -s $i ] && cp $i $mnt/slitaz/boot @@ -479,6 +491,7 @@ EOT done </dev/null [ -s cmdline ] && cmdline="$cmdline $(cat cmdline)" && rm cmdline [ -s initrd ] && cat initrd >> initrd$$ && rm initrd - kernel=$media/boot/bzImage - grep -q ' lm ' /proc/cpuinfo && [ -s ${kernel}64 ] && kernel=${kernel}64 + kernel=$(maybe64 $media/boot/bzImage) . /etc/locale.conf kexec -l $kernel --initrd initrd$$ --command-line "$cmdline" && rm -f initrd$$ @@ -701,7 +713,7 @@ \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n" 12 70 [ $? -eq 0 ] || return fi - cp $media/boot/bzImage linux.exe + cp $(maybe64 $media/boot/bzImage) linux.exe du -h $PWD/linux.exe } @@ -796,6 +808,31 @@ gotcdfile '?pxe*' && mkfloppy $file } +plop() +{ + gotcdfile 'plop.exe' + if [ -z "$1" ]; then + $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \ + --yes-label "Install" --yesno \ +"\nBoot your operating system from a USB disk without BIOS support.\n" 0 0 + [ $? -eq 0 ] || return + fi + cp $file $(basename $file .exe).exe + du -h $PWD/$(basename $file .exe).exe +} + +fdplop() +{ + if [ -z "$1" ]; then + $DIALOG --clear --title " Create a Plop boot floppy " \ + --yes-label "Create floppy" --yesno \ +"\nBoot your operating system from a USB disk without BIOS support.\n\n +Please insert a blank disk in floppy drive.\n" 0 0 + [ $? -eq 0 ] || return + fi + gotcdfile 'plop.exe' && mkfloppy $file +} + menuitem() { [ "$3" ] && shift @@ -943,7 +980,7 @@ hasflavor() { - [ -x /usr/bin/tazlito ] && [ -s $media/boot/bzImage ] && menuitem "$@" + [ -x /usr/bin/tazlito ] && [ -s $(maybe64 $media/boot/bzImage) ] && menuitem "$@" } gotisomd5() @@ -1017,13 +1054,13 @@ rm -f /tmp/wait DEV="$(grep -l 1 /sys/block/*/removable | \ sed 's|/sys/block/\(.*\)/removable|\1|')" - grep -qs 1 /sys/block/$DEV/ro && return [ "$DEV" ] || return cat > /tmp/dialog$$ < /dev/null)\" " done) \ @@ -1060,18 +1097,16 @@ $(tazusbmsg)Please plug your USB stick in now.\n" 16 70 [ $? -eq 0 ] || return usbdev || return + fi - # perform dd in progress bar - max=$(($(stat -c %s "$ISO")/2048)) - i=0; ddq if="$ISO" bs=1024k | ( - while ddq bs=1024k count=1 ; do - i=$(($i + 1)) - [ $i -gt $max ] && break - echo $((($i*100)/$max)) | dialog --gauge \ - " The ISO image transfer can be long. Please wait..." \ - 6 70 0 > /dev/tty 2>&1 - done ) > $device - fi + # perform dd in progress bar + max=$(($(stat -c %s "$ISO")/1024/1024)) + i=0; while [ $i -le $max ]; do + ddq if="$ISO" bs=1024k count=1 skip=$i seek=$i of=$device + echo $((($i*100)/$max)) + i=$(($i+1)) + done | dialog --gauge " The ISO image transfer can be long. Please wait..." \ + 6 70 0 > /dev/tty 2>&1 # partition + fat32 format for the remaining space for p in 0 16; do @@ -1097,6 +1132,13 @@ fi } done + + # update boot/exe crc16 + i=$(($(get 2 $1) - 1 + ($(get 4 $1) - 1)*512)) + i=$(($(od -v -N $i -t u2 -w2 -An $device | \ + awk '{ i+= $0 } END { print (i % 65536) }') \ + + $(get $(($i+1)) $device 1))) + words2bin $(( (-$i -1) % 65536 )) | ddq bs=1 seek=18 of=$device } usbkey() @@ -1133,22 +1175,6 @@ tazusb gen-iso2usb "$ISO" $device } -dokexec() -{ - kexec -l $file || return - quit "kexec -e" -} - -runmemtest() -{ - gotcdfile 'memtest*' && dokexec -} - -runpxe() -{ - gotcdfile '?pxe*' && dokexec -} - flavdata() { [ $(get 1024 "$ISO") -eq 35615 ] && n=2 || n=$((1+$(get 417 "$ISO" 1))) @@ -1159,8 +1185,7 @@ hasflavinfo() { - [ "$(flavdata | ddq bs=1 count=7)" = \ - "0707010" ] && menuitem "$@" + [ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] && menuitem "$@" } showfavinfo() @@ -1278,19 +1303,16 @@ [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return n=$(($(get 497 $KERNEL 1)+1)) ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$ - uudecode <> /tmp/fd$$ - bytes2bin $n | ddq conv=notrunc \ - bs=1 seek=497 count=1 of=/tmp/fd$$ - words2bin $pos | ddq conv=notrunc \ - bs=1 seek=34 count=2 of=/tmp/fd$$ + bytes2bin $n | ddn bs=1 seek=497 of=/tmp/fd$$ + words2bin $pos | ddn bs=1 seek=34 of=/tmp/fd$$ [ $(get 518 $KERNEL 4) -ge 514 ] && - words2bin 32768 9 | ddq conv=notrunc \ - bs=1 seek=552 count=4 of=/tmp/fd$$ + words2bin 32768 9 | ddn bs=1 seek=552 of=/tmp/fd$$ fi syssize=$(echo $(get 500 /tmp/fd$$ 4)) ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \ @@ -1318,28 +1340,28 @@ len="$len $l"; l=0 done rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))} - words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \ - conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$ + words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddn \ + bs=1 seek=536 of=/tmp/fd$$ fi n=$(echo $len | wc -w) if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then i=$(($(get 494 /tmp/fd$$))) - bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \ - seek=496 count=1 of=/tmp/fd$$ + bytes2bin $(($i + ($n*4) - 256)) | ddn bs=1 \ + seek=496 of=/tmp/fd$$ else i=$(($pos + 0x1FC - ($n*4))) - bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \ - conv=notrunc seek=494 count=3 of=/tmp/fd$$ + bytes2bin $(($i % 256)) $((i / 256)) 252 | ddn bs=1 \ + seek=494 of=/tmp/fd$$ s=$(($i - 2*$(echo "$SIZES" | wc -w))) p=$(($s - $(ifmemcode | wc -c))) - ifmemcode | ddq bs=1 conv=notrunc seek=$p of=/tmp/fd$$ - words2bin $SIZES | ddq bs=1 conv=notrunc seek=$s of=/tmp/fd$$ + ifmemcode | ddn bs=1 seek=$p of=/tmp/fd$$ + words2bin $SIZES | ddn bs=1 seek=$s of=/tmp/fd$$ bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \ - ddq bs=1 conv=notrunc seek=60 of=/tmp/fd$$ + ddn bs=1 seek=60 of=/tmp/fd$$ fi for r in $len ; do - words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \ - bs=1 seek=$i count=4 of=/tmp/fd$$ + words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddn \ + bs=1 seek=$i of=/tmp/fd$$ i=$(($i + 4)) done split -b 1440k /tmp/fd$$ fd$$ @@ -1461,7 +1483,7 @@ $(cdfile 'md5sum*' "md5" "Check the ISO files") \ $(cdfile 'sha*sum*' "sha" "Check the ISO files") \ $(xfile isoinfo "infoiso" "ISO image info") \ -$(cdfilex boot/bzImage "bootiso" "Boot the ISO image") \ +$(cdfilex 'bzImage*' "bootiso" "Boot the ISO image") \ $(burnable "burniso" "Burn the ISO image") \ $(blankable "blankcd" "Blank the CD/DVD") \ $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \ @@ -1474,13 +1496,13 @@ $(hasflavor "flavor" "Get flavor file") \ $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \ $(cdfile linld.com "tazboot" "Get tazboot.exe Linux loader") \ -$(cdexe boot/bzImage "bzimage" "Get linux DOS/EXE file") \ +$(cdexe 'bzImage*' "bzimage" "Get linux DOS/EXE file") \ $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \ $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \ -$(cdfilex 'memtest*' "runmemtest" "Start Memtest86") \ $(cdexe '?pxe*' "pxe" "Get SliTaz Web boot DOS/EXE utility") \ $(cdfilef '?pxe*' "fdpxe" "Create a SliTaz Web boot floppy") \ -$(cdfilex '?pxe*' "runpxe" "Start the SliTaz Web boot utility") \ +$(cdexe 'plop.exe' "plop" "Get USB boot DOS/EXE utility") \ +$(cdfilef 'plop.exe' "fdplop" "Create a USB boot floppy") \ $(initxfile reboot "restart" "Restart the computer") \ $(initxfile poweroff "stop" "Power off") \ $(initx "bootlog" "Linux boot messages") \