wok annotate linld/stuff/tobzimage @ rev 24556
updated flatpress (0.1010.2 -> 1.2.1)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Feb 25 14:05:00 2022 +0100 (2022-02-25) |
parents | 1c8a113c536a |
children |
rev | line source |
---|---|
pascal@18228 | 1 #!/bin/sh |
pascal@18228 | 2 |
pascal@18231 | 3 if [ "$1" == "--build" ]; then #install-begin |
pascal@19206 | 4 for i in elks linux001 ; do |
pascal@19206 | 5 i=${i}_patch |
pascal@19206 | 6 n=$(sed "/$i\$/!d;s/.*text:0*\\([^ ]*\\).*/\\1/" tobzimage.lst) |
pascal@19206 | 7 [ -n "$n" ] && sed -i "s/$i/$((0x200 + 0x$n))/" $0 |
pascal@19206 | 8 done |
pascal@18233 | 9 cat tobzimage.bin | gzip -9 | uuencode -m - | sed \ |
pascal@18232 | 10 -e '/^tobzimage$/r/dev/stdin' -e '/^tobzimage$/d' \ |
pascal@18232 | 11 -e '/install-begin$/,/install-end$/d' -i $0 |
pascal@18231 | 12 exit |
pascal@18231 | 13 fi #install-end |
pascal@18228 | 14 [ -s "$1" -a "$2" ] || { |
pascal@18228 | 15 cat << EOT |
pascal@18228 | 16 Usage: $0 zImage-to-read bzImage-to-create [version-string] |
pascal@18228 | 17 EOT |
pascal@18228 | 18 exit 1 |
pascal@18228 | 19 } |
pascal@18228 | 20 |
pascal@18228 | 21 ddq() |
pascal@18228 | 22 { |
pascal@18228 | 23 dd "$@" 2> /dev/null |
pascal@18228 | 24 } |
pascal@18228 | 25 |
pascal@18228 | 26 get() |
pascal@18228 | 27 { |
pascal@18228 | 28 echo $( od -v -j $(($1)) -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} \ |
pascal@18228 | 29 -An $2 2>/dev/null ) |
pascal@18228 | 30 } |
pascal@18228 | 31 |
pascal@18228 | 32 store() |
pascal@18228 | 33 { |
pascal@18228 | 34 n=$3; for i in $(seq 8 8 $1); do |
pascal@18228 | 35 printf '\\\\x%02X' $(($n & 255)) |
pascal@18228 | 36 n=$(($n >> 8)) |
pascal@18228 | 37 done | xargs echo -en | ddq bs=1 conv=notrunc of=$4 seek=$(($2)) |
pascal@18228 | 38 } |
pascal@18228 | 39 |
pascal@18228 | 40 create_bzImage() |
pascal@18228 | 41 { |
pascal@18228 | 42 ddq bs=512 count=1 of=$1 |
pascal@19210 | 43 [ "$(od -j 486 $1 -An -N 4 -a|sed 's/ //g')" == "ELKS" ] && iselks=1 |
pascal@19206 | 44 [ " $(get 0x3F $1 2)" == " 15080" ] && islinux001=1 && cp $1 $1$$ |
pascal@18228 | 45 # from http://hg.slitaz.org/wok/file/7184ec55b1aa/linux/stuff/linux-header.u |
pascal@18228 | 46 uudecode <<EOT | ddq of=$1 conv=notrunc |
pascal@18228 | 47 begin-base64 644 - |
pascal@18228 | 48 TVrrIEAAAAACAAAQ//8ACASeAABfAvD/TmV4dCEHDQA/owCeUuiwAZkfoPF9 |
pascal@18228 | 49 QA+hxXd4XwZXsQbzpRYfZGaPR3jGRfg/+pdYQejIAL4AAoFMECCAxkQlm+hv |
pascal@18228 | 50 AVuJ5v9IEMdAFAiTgPMIdfOhFQJmix70AWZLZsHrBWZDvwAQOcd1AzWAFolE |
pascal@18228 | 51 G2a/gAAAAGYp+5xzAgHfUFZTMdtoAIAH6GEAW16MwbSHFgfNFVgFAAEQTB+/ |
pascal@18228 | 52 gAedd8WITB/GRBwQx0QTgAa0h80Vl80T6gAAIJBaOMF3NGDNE/noeABhUlAo |
pascal@18228 | 53 yHcCsAE5+HICifhQtALNE1pYctyVAdGO6QDXANcp11p0UozplTjBddSIyLEB |
pascal@18228 | 54 MM51zP7FgP1QdcW1AGC+GABT6KoAW+g+AHUVUpjNE7gBAs0TWtDUOmT+depG |
pascal@18228 | 55 SHXm650x0ugAAAYftD+J+cHhCInrzSGSFh+wMRwDtA67BwDNEDwNdPPDv2wE |
pascal@18228 | 56 ZMYFprgNAWQ6JXQKzRZ09JjNFo7nR8PoVgCg0QJAvoAAigxG86SXgHz/P77g |
pascal@18228 | 57 AnQyDwHgJAF1K45fLEM5D3X7jVcEtD3NIXInleiM/4AGoAA9uwICOV8EcgXH |
pascal@18228 | 58 RyeeCR5qTMsDdA6wDeiH/6w8AH/4w16/xp1oAJAXifwWBzHAuTsA86pPW1bD |
pascal@18228 | 59 AA== |
pascal@18228 | 60 ==== |
pascal@18228 | 61 EOT |
pascal@18228 | 62 # from tobzimage.S |
pascal@18228 | 63 uudecode <<EOT | gunzip >> $1 |
pascal@18230 | 64 tobzimage |
pascal@18228 | 65 EOT |
pascal@19206 | 66 s="$2" |
pascal@19206 | 67 [ -s "$s" ] && s="$(cat "$s")" |
pascal@19206 | 68 [ -z "$s" ] && s="$(basename "$1")" |
pascal@19206 | 69 echo -e "\n$s" | tr '\n' '\r' | cat - /dev/zero | \ |
pascal@19206 | 70 ddq conv=notrunc of=$1 bs=1 seek=768 count=255 |
pascal@18228 | 71 setupsz=$(get 497 $1 1) |
pascal@18228 | 72 [ $setupsz -eq 0 ] && setupsz=4 |
pascal@19206 | 73 if [ "$islinux001" == "1" ]; then |
pascal@19206 | 74 cat $1$$ /dev/zero | ddq bs=512 count=$setupsz >> $1 |
pascal@19206 | 75 rm -f $1$$ |
pascal@19206 | 76 else |
pascal@19206 | 77 ddq bs=512 count=$setupsz >> $1 |
pascal@19210 | 78 if [ "$(od -j 1026 $1 -An -N 4 -a|sed 's/ //g')" == "HdrS" ] && |
pascal@19210 | 79 [ $(($(get 1041 $1 1) & 1)) -eq 1 ]; then |
pascal@19210 | 80 echo "Already a bzImage file, abort." |
pascal@19210 | 81 rm -f $1 |
pascal@19210 | 82 exit 1 |
pascal@19210 | 83 fi |
pascal@19206 | 84 fi |
pascal@18228 | 85 store 8 497 $(($setupsz+1)) $1 |
pascal@19206 | 86 syssz=$(get 500 $1 2) |
pascal@19206 | 87 [ $syssz -eq 0 ] && syssz=$((($filesz+15-512)/16-($setupsz*32))) |
pascal@19206 | 88 [ "$islinux001" == "1" ] && syssz=$((($filesz+15-512)/16)) |
pascal@19206 | 89 store 16 500 $syssz $1 |
pascal@19206 | 90 [ "$iselks" == "1" ] && store 16 elks_patch 37008 $1 |
pascal@19206 | 91 [ "$islinux001" == "1" ] && store 16 linux001_patch 37008 $1 |
pascal@18228 | 92 ddq >> $1 |
pascal@18228 | 93 } |
pascal@18228 | 94 |
pascal@19206 | 95 filesz=$(stat -c %s $1) |
pascal@18228 | 96 create_bzImage $2 "$3" < $1 |