Files
OpenCellular/scripts/bitmaps/process_all_targets.sh
Tom Wai-Hong Tam ab96acf97e On ARM, we need output geometry same as screen size instead of 800x600 and use 8bpp RLE format to encoding BMP.
Also make the script able to run at other directory.

BUG=chromium-os:11384
TEST=as follow:
$ cd /tmp
$ ~/$CHROMEOS/src/platform/vboot_reference/scripts/bitmaps/make_bmp_images.sh 'x86 HWID 1234' '1366x768' true
processing BlankBmp ...
processing DeveloperBmp ...
processing RecoveryBmp ...
processing RecoveryMissingOSBmp ...
processing RecoveryNoOSBmp ...
$ file out_x86_HWID_1234/DeveloperBmp/DeveloperBmp.bmp
out_x86_HWID_1234/DeveloperBmp/DeveloperBmp.bmp: PC bitmap, Windows 3.x format, 800 x 600 x 24
$ ~/$CHROMEOS/src/platform/vboot_reference/scripts/bitmaps/make_bmp_images.sh 'arm HWID 1234' '1366x768' false
processing BlankBmp ...
processing DeveloperBmp ...
processing RecoveryBmp ...
processing RecoveryMissingOSBmp ...
processing RecoveryNoOSBmp ...
$ file out_arm_HWID_1234/DeveloperBmp/DeveloperBmp.bmp out_arm_HWID_1234/DeveloperBmp/DeveloperBmp.bmp: PC bitmap, Windows 3.x format, 1366 x 768 x 8

Change-Id: Ia96a4e64f34350f8bd5fec51657d3cec85c4ab1c

Review URL: http://codereview.chromium.org/6273012
2011-01-28 09:39:31 +08:00

69 lines
2.0 KiB
Bash
Executable File

#!/bin/bash -e
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This script searches the directory tree passed in as the parameter for
# bmp_*.fv files, figures out the FWID strings from files' names, verifies the
# FWIDs' integrity (by recalculating the CRC included in the FWID string) and
# then rebuilds the bitmaps with the appropriate text and target specific
# geometry.
#
# Given a string "<prefix>_<el1>_<el2>_.._<eln>_<suffix>" print string
# '<el1> <el2> .. <eln>', i.e. <prefix>_ and _<suffix> dropped and underscores
# replaced with spaces.
get_elements() {
echo $1 | awk 'BEGIN {FS="_"}; {
x = 2;
do {
printf "%s ", $x;
x += 1
} while (x < (NF - 1))
printf "%s", $(NF-1);
}'
}
# Concatenate input parameters into a space separated string, calculate the
# string's CRC32 and print the last four hex digits of the crc.
signer() {
python -c "import sys,zlib;
me=' '.join(sys.argv[1:]);
print ('%04u'%(zlib.crc32(me)&0xffffffffL))[-4:]" $1
}
if [ "$#" != "1" -o ! -d "$1" ]; then
echo "One parameter is required, the path to the chromeos release tree" >&2
exit 1
fi
tree=$(readlink -f $1)
cd $(dirname "$0")
for f in $(find "${tree}" -type f -name 'bmp_*_[0-9]*.fv'); do
filename=$(basename "$f")
elements="$(get_elements $filename)"
signature=$(signer "${elements}")
# Rebuild file name to verify CRC.
comp_name=bmp_${elements// /_}_${signature}.fv
if [ "${filename}" != "${comp_name}" ]; then
echo "skipping ${filename} (crc mismatch with ${comp_name})"
continue
fi
echo "Processing ${filename}"
case "${elements}" in
(*ACER*) geometry='1366x768'
;;
(*MARIO*) geometry='1280x800'
;;
(*) echo "skipping ${filename}, unknown target geometry"
echo
continue
;;
esac
./make_bmp_images.sh "${elements} ${signature}" "${geometry}" "x86"
echo
done