summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2012-11-14 15:10:17 +0800
committerGerrit <chrome-bot@google.com>2012-11-14 17:59:04 -0800
commit8e32e75f4ff03118d43fede3eee2057c80dd40e1 (patch)
tree09e68a5754f2ba8ded2afdbf486138557d990234
parent0c69afc5b391ad833fc184eef8423032b9b5705a (diff)
downloadvboot-8e32e75f4ff03118d43fede3eee2057c80dd40e1.tar.gz
newbitmaps: Get rid of ImageMagick and use PIL for image processing.
To simplify dependency (and prepare for building inside chroot), we need to get rid of dependency for ImageMagick, which is now entirely replaceable by Python Image Library. BRANCH=none BUG=none TEST=make # pass Change-Id: Ie3d3a4ac399b2fe58aa75f8e02e4475bcba21c51 Reviewed-on: https://gerrit.chromium.org/gerrit/37985 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
-rw-r--r--scripts/newbitmaps/Makefile2
-rw-r--r--scripts/newbitmaps/README44
-rwxr-xr-xscripts/newbitmaps/images/make_default_yaml6
-rwxr-xr-xscripts/newbitmaps/strings/build_font9
-rwxr-xr-xscripts/newbitmaps/strings/localized_text/build_message2
-rwxr-xr-xscripts/newbitmaps/strings/text_to_png2
6 files changed, 41 insertions, 24 deletions
diff --git a/scripts/newbitmaps/Makefile b/scripts/newbitmaps/Makefile
index 819974d2..295eb7f8 100644
--- a/scripts/newbitmaps/Makefile
+++ b/scripts/newbitmaps/Makefile
@@ -23,7 +23,7 @@ default: outside_chroot strings images
outside_chroot:
@if [ -e /etc/debian_chroot ]; then \
- echo "ImageMagick is too complex to build inside the chroot."; \
+ echo "PIL color quantization is broken inside the chroot."; \
echo "You must be outside the chroot to do this"; \
echo "(and you probably shouldn't be doing it anyway)."; \
exit 1; \
diff --git a/scripts/newbitmaps/README b/scripts/newbitmaps/README
index 0d8a6b49..362aa108 100644
--- a/scripts/newbitmaps/README
+++ b/scripts/newbitmaps/README
@@ -85,22 +85,35 @@ bitmap block structure incompatible with previous versions.
Instructions for manually rebuilding things:
-We do most of the image manipulation using ImageMagick, which is much easier
-and simpler to do OUTSIDE of the chroot. So the first step is to just build
-vboot_reference outside of the chroot.
+Some libraries and programs (ex, PIL, pango-view) used in generating image files
+need fonts set properly or specific version (ex, PIL is broken inside chroot),
+and simpler to do OUTSIDE of the chroot.
- cd src/platform/vboot_reference
- make
+On Ubuntu, you need to install following packages:
+
+ sudo apt-get install libpango1.0-dev python-imaging
+
+And you probably want to make sure all required fonts are installed:
+
+ sudo apt-get install fonts-nanum fonts-ipafont-gothic ttf-indic-fonts \
+ fonts-droid
+
+If you want to use the "bitmap viewer" utility, add these packages:
+
+ sudo apt-get install python-yaml python-wxgtk2.8
-You'll probably need to install several additional packages to make this
-work. On Ubuntu you may find you need libtspi-dev, uuid-dev, and
-imagemagick. If you want to use scripts/newbitmaps/bitmap_viewer, you may
-need python-yaml and python-wxgtk2.8.
+We also need some utilities from ChromiumOS source tree. You need to install
+dependency libraries for them:
+ sudo apt-get install libtspi-dev uuid-dev libyaml-dev liblzml-dev
+
+Now, time to build the utilities in vboot_reference outside of the chroot:
+
+ cd src/platform/vboot_reference
+ make
Once you've built vboot_reference you'll find the executables in
-./build/utility/ (and ./build/cgpt/cgpt, if you want it). Put these
-somewhere in your $PATH.
+./build/utility/bmpblk*. Put these somewhere in your $PATH.
Now you should be able to just run "make" and everything will be
regenerated:
@@ -108,8 +121,15 @@ regenerated:
cd scripts/newbitmaps
make
-This should generate BIOS bmpblock file for all platforms.
+This should generate BIOS bmpblock file for all platforms cross all locales,
+which takes a long time.
+
+If you simply want to build a en-US x standard resolution, do:
+ cd scripts/newbitmaps
+ make strings # You can do this only one time unless mofidication was made.
+ cd images
+ make # Builds only "STD" profile and only few seconds.
You can use the gbb_utility to modify your BIOS to contain this new set of
bitmaps:
diff --git a/scripts/newbitmaps/images/make_default_yaml b/scripts/newbitmaps/images/make_default_yaml
index 0cb42fd7..38b01e41 100755
--- a/scripts/newbitmaps/images/make_default_yaml
+++ b/scripts/newbitmaps/images/make_default_yaml
@@ -74,8 +74,10 @@ set_centered_y_percent() {
define_image() {
local image_name="$1"
local file_name="$2"
- local w="$(identify -format "%[fx:w]" "$file_name")"
- local h="$(identify -format "%[fx:h]" "$file_name")"
+ local script="import Image;s = Image.open('$file_name').size;print s[0],s[1]"
+ local image_size="$(python -c "$script")"
+ local w="${image_size%% *}"
+ local h="${image_size##* }"
eval "export cache_w_$image_name=$w"
eval "export cache_h_$image_name=$h"
eval "export $image_name=$file_name"
diff --git a/scripts/newbitmaps/strings/build_font b/scripts/newbitmaps/strings/build_font
index d7a66716..2ffd3fd1 100755
--- a/scripts/newbitmaps/strings/build_font
+++ b/scripts/newbitmaps/strings/build_font
@@ -34,13 +34,8 @@ main() {
done
echo "Converting glyph images..."
- "$SCRIPT_DIR/text_to_png" --margin=0 --font="$FONT" --color="$COLOR" \
- "$output/*.txt"
-
- echo "Adding vertical margin to images..."
- for i in $output/*.png; do
- convert $i -bordercolor white -border 0x$MARGIN $i
- done
+ "$SCRIPT_DIR/text_to_png" --font="$FONT" --color="$COLOR" \
+ --margin="$MARGIN 0" "$output/*.txt"
}
set -e
diff --git a/scripts/newbitmaps/strings/localized_text/build_message b/scripts/newbitmaps/strings/localized_text/build_message
index c4888417..e896c49b 100755
--- a/scripts/newbitmaps/strings/localized_text/build_message
+++ b/scripts/newbitmaps/strings/localized_text/build_message
@@ -17,7 +17,7 @@ die() {
get_width() {
local input="$1"
- identify -format "%w" "$input"
+ python -c "import Image; print Image.open('$input').size[0]"
}
do_locale() {
diff --git a/scripts/newbitmaps/strings/text_to_png b/scripts/newbitmaps/strings/text_to_png
index 988903c3..9f76cc5a 100755
--- a/scripts/newbitmaps/strings/text_to_png
+++ b/scripts/newbitmaps/strings/text_to_png
@@ -98,7 +98,7 @@ for txtfile in $*; do
--hinting=full \
--background="$bgcolor" --foreground="$color" \
--font="$font $pointsize" --dpi 72 \
- --margin=$margin \
+ --margin="$margin" \
--align="$align" \
$params $file_opt \
--output "$pngfile" \