diff --git a/scripts/newbitmaps/Makefile b/scripts/newbitmaps/Makefile index 819974d2b1..295eb7f80a 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 0d8a6b49ed..362aa108c6 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. + +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 + +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 -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. - - 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 0cb42fd7ba..38b01e412d 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 d7a6671619..2ffd3fd1d5 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 c488841758..e896c49b6b 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 988903c354..9f76cc5ac7 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" \