| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 #!/bin/bash -e | 
|  | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 
|  | 3 # Use of this source code is governed by a BSD-style license that can be | 
|  | 4 # found in the LICENSE file. | 
|  | 5 # | 
|  | 6 # This script searches the directory tree passed in as the parameter for | 
|  | 7 # bmp_*.fv files, figures out the FWID strings from files' names, verifies the | 
|  | 8 # FWIDs' integrity (by recalculating the CRC included in the FWID string) and | 
|  | 9 # then rebuilds the bitmaps with the appropriate text and target specific | 
|  | 10 # geometry. | 
|  | 11 # | 
|  | 12 | 
|  | 13 | 
|  | 14 # Given a string "<prefix>_<el1>_<el2>_.._<eln>_<suffix>" print string | 
|  | 15 # '<el1> <el2> .. <eln>', i.e. <prefix>_ and _<suffix> dropped and underscores | 
|  | 16 # replaced with spaces. | 
|  | 17 get_elements() { | 
|  | 18   echo $1 | awk 'BEGIN {FS="_"}; { | 
|  | 19     x = 2; | 
|  | 20     do { | 
|  | 21       printf "%s ", $x; | 
|  | 22       x += 1 | 
|  | 23     } while (x < (NF - 1)) | 
|  | 24     printf "%s", $(NF-1); | 
|  | 25   }' | 
|  | 26 } | 
|  | 27 | 
|  | 28 # Concatenate input parameters into a space separated string, calculate the | 
|  | 29 # string's CRC32 and print the last four hex digits of the crc. | 
|  | 30 signer() { | 
|  | 31    python -c "import sys,zlib; | 
|  | 32 me=' '.join(sys.argv[1:]); | 
|  | 33 print ('%04u'%(zlib.crc32(me)&0xffffffffL))[-4:]" $1 | 
|  | 34 } | 
|  | 35 | 
|  | 36 | 
|  | 37 if [ "$#" != "1" -o ! -d "$1" ]; then | 
|  | 38    echo "One parameter is required, the path to the chromeos release tree" >&2 | 
|  | 39    exit 1 | 
|  | 40 fi | 
|  | 41 | 
|  | 42 tree=$(readlink -f $1) | 
|  | 43 cd $(dirname "$0") | 
|  | 44 for f in $(find "${tree}" -type f -name 'bmp_*_[0-9]*.fv'); do | 
|  | 45   filename=$(basename "$f") | 
|  | 46   elements="$(get_elements $filename)" | 
|  | 47   signature=$(signer "${elements}") | 
|  | 48 | 
|  | 49   # Rebuild file name to verify CRC. | 
|  | 50   comp_name=bmp_${elements// /_}_${signature}.fv | 
|  | 51   if [ "${filename}" !=  "${comp_name}" ]; then | 
|  | 52     echo "skipping ${filename} (crc mismatch with ${comp_name})" | 
|  | 53     continue | 
|  | 54   fi | 
|  | 55   echo "Processing ${filename}" | 
|  | 56   case "${elements}" in | 
|  | 57     (*ACER*) geometry='1366x768' | 
|  | 58       ;; | 
|  | 59     (*MARIO*) geometry='1280x800' | 
|  | 60       ;; | 
|  | 61     (*) echo "skipping ${filename}, unknown target geometry" | 
|  | 62       echo | 
|  | 63       continue | 
|  | 64     ;; | 
|  | 65   esac | 
|  | 66   ./make_bmp_images.sh "${elements} ${signature}" "${geometry}" | 
|  | 67   echo | 
|  | 68 done | 
| OLD | NEW | 
|---|