wok annotate linld/stuff/tobzimage @ rev 18332
dropbear: add sshfbvnc (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Sep 09 09:27:57 2015 +0200 (2015-09-09) |
parents | 38b9b5003833 |
children | 86c9fae82f47 |
rev | line source |
---|---|
pascal@18228 | 1 #!/bin/sh |
pascal@18228 | 2 |
pascal@18231 | 3 if [ "$1" == "--build" ]; then #install-begin |
pascal@18233 | 4 cat tobzimage.bin | gzip -9 | uuencode -m - | sed \ |
pascal@18232 | 5 -e '/^tobzimage$/r/dev/stdin' -e '/^tobzimage$/d' \ |
pascal@18232 | 6 -e '/install-begin$/,/install-end$/d' -i $0 |
pascal@18231 | 7 exit |
pascal@18231 | 8 fi #install-end |
pascal@18228 | 9 [ -s "$1" -a "$2" ] || { |
pascal@18228 | 10 cat << EOT |
pascal@18228 | 11 Usage: $0 zImage-to-read bzImage-to-create [version-string] |
pascal@18228 | 12 EOT |
pascal@18228 | 13 exit 1 |
pascal@18228 | 14 } |
pascal@18228 | 15 |
pascal@18228 | 16 ddq() |
pascal@18228 | 17 { |
pascal@18228 | 18 dd "$@" 2> /dev/null |
pascal@18228 | 19 } |
pascal@18228 | 20 |
pascal@18228 | 21 get() |
pascal@18228 | 22 { |
pascal@18228 | 23 echo $( od -v -j $(($1)) -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} \ |
pascal@18228 | 24 -An $2 2>/dev/null ) |
pascal@18228 | 25 } |
pascal@18228 | 26 |
pascal@18228 | 27 store() |
pascal@18228 | 28 { |
pascal@18228 | 29 n=$3; for i in $(seq 8 8 $1); do |
pascal@18228 | 30 printf '\\\\x%02X' $(($n & 255)) |
pascal@18228 | 31 n=$(($n >> 8)) |
pascal@18228 | 32 done | xargs echo -en | ddq bs=1 conv=notrunc of=$4 seek=$(($2)) |
pascal@18228 | 33 } |
pascal@18228 | 34 |
pascal@18228 | 35 create_bzImage() |
pascal@18228 | 36 { |
pascal@18228 | 37 ddq bs=512 count=1 of=$1 |
pascal@18228 | 38 # from http://hg.slitaz.org/wok/file/7184ec55b1aa/linux/stuff/linux-header.u |
pascal@18228 | 39 uudecode <<EOT | ddq of=$1 conv=notrunc |
pascal@18228 | 40 begin-base64 644 - |
pascal@18228 | 41 TVrrIEAAAAACAAAQ//8ACASeAABfAvD/TmV4dCEHDQA/owCeUuiwAZkfoPF9 |
pascal@18228 | 42 QA+hxXd4XwZXsQbzpRYfZGaPR3jGRfg/+pdYQejIAL4AAoFMECCAxkQlm+hv |
pascal@18228 | 43 AVuJ5v9IEMdAFAiTgPMIdfOhFQJmix70AWZLZsHrBWZDvwAQOcd1AzWAFolE |
pascal@18228 | 44 G2a/gAAAAGYp+5xzAgHfUFZTMdtoAIAH6GEAW16MwbSHFgfNFVgFAAEQTB+/ |
pascal@18228 | 45 gAedd8WITB/GRBwQx0QTgAa0h80Vl80T6gAAIJBaOMF3NGDNE/noeABhUlAo |
pascal@18228 | 46 yHcCsAE5+HICifhQtALNE1pYctyVAdGO6QDXANcp11p0UozplTjBddSIyLEB |
pascal@18228 | 47 MM51zP7FgP1QdcW1AGC+GABT6KoAW+g+AHUVUpjNE7gBAs0TWtDUOmT+depG |
pascal@18228 | 48 SHXm650x0ugAAAYftD+J+cHhCInrzSGSFh+wMRwDtA67BwDNEDwNdPPDv2wE |
pascal@18228 | 49 ZMYFprgNAWQ6JXQKzRZ09JjNFo7nR8PoVgCg0QJAvoAAigxG86SXgHz/P77g |
pascal@18228 | 50 AnQyDwHgJAF1K45fLEM5D3X7jVcEtD3NIXInleiM/4AGoAA9uwICOV8EcgXH |
pascal@18228 | 51 RyeeCR5qTMsDdA6wDeiH/6w8AH/4w16/xp1oAJAXifwWBzHAuTsA86pPW1bD |
pascal@18228 | 52 AA== |
pascal@18228 | 53 ==== |
pascal@18228 | 54 EOT |
pascal@18228 | 55 # from tobzimage.S |
pascal@18228 | 56 uudecode <<EOT | gunzip >> $1 |
pascal@18230 | 57 tobzimage |
pascal@18228 | 58 EOT |
pascal@18228 | 59 if [ "$2" ]; then |
pascal@18228 | 60 s="$2" |
pascal@18228 | 61 [ -s "$2" ] && s="$(cat "$2")" |
pascal@18228 | 62 echo -e "\n$2" | tr '\n' '\r' | cat - /dev/zero | \ |
pascal@18228 | 63 dd conv=notrunc of=$1 bs=1 seek=640 count=383 |
pascal@18228 | 64 fi |
pascal@18228 | 65 setupsz=$(get 497 $1 1) |
pascal@18228 | 66 [ $setupsz -eq 0 ] && setupsz=4 |
pascal@18228 | 67 ddq bs=512 count=$setupsz >> $1 |
pascal@18228 | 68 store 8 497 $(($setupsz+1)) $1 |
pascal@18228 | 69 ddq >> $1 |
pascal@18228 | 70 } |
pascal@18228 | 71 |
pascal@18228 | 72 create_bzImage $2 "$3" < $1 |