mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 18:55:24 +00:00
Scale the HWID font to match the rest of the text.
BUG=chromium-os:18631 TEST=manual Boot to recovery mode screen. HWID should be the same size and shape as the rest of the text. Change-Id: Iee0b0611c1319a304d911b710dd7f35ef999a1eb Reviewed-on: http://gerrit.chromium.org/gerrit/6667 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
@@ -71,56 +71,85 @@ image name. For example:
|
|||||||
en
|
en
|
||||||
|
|
||||||
The old v1.1 bmpblock will be accepted by the vboot wrapper, but a $HWID
|
The old v1.1 bmpblock will be accepted by the vboot wrapper, but a $HWID
|
||||||
screen without a corresponding font will be silently ignored.
|
screen without a corresponding font should be silently ignored.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Instructions:
|
--------------------------------------------
|
||||||
|
Instructions for manually rebuilding things:
|
||||||
|
|
||||||
The bmpblk_utility reads a config file and produces a binary bmpblock. The
|
We do most of the image manipulation using ImageMagick, which is much easier
|
||||||
config file lists the individual bitmaps and describes where to place each
|
and simpler to do OUTSIDE of the chroot. So the first step is to just build
|
||||||
one when displaying each screen. The bmpblock is then written into the BIOS
|
vboot_reference outside of the chroot.
|
||||||
image with the gbb_utility. The bitmap_viewer program lets you view the
|
|
||||||
composited screens as described by the config file.
|
|
||||||
|
|
||||||
* First, get the bitmap_viewer working. This is best done OUTSIDE of the
|
cd src/platform/vboot_reference
|
||||||
chroot. Test it by changing to the scripts/newbitmaps/images/16x9_generic
|
make
|
||||||
directory and running "../../bitmap_viewer DEFAULT.yaml". You may
|
|
||||||
need to install some additional packages. For example, on Ubuntu you'll
|
|
||||||
probably need to install the "python-yaml" and "python-wxgtk2.8" packages.
|
|
||||||
|
|
||||||
* Now make changes to the DEFAULT.yaml config file, and use bitmap_viewer to
|
You'll probably need to install several additional packages to make this
|
||||||
see how the layout looks. Hit Ctrl-R in the small window to reload the
|
work. In addition, scripts/newbitmaps/bitmap_viewer is a python script that
|
||||||
config file without restarting.
|
may require some packages of its own. Test it by changing to the
|
||||||
|
scripts/newbitmaps/images directory and running
|
||||||
|
|
||||||
* The bitmap_viewer tool can display images in several different formats,
|
../bitmap_viewer DEFAULT.yaml
|
||||||
but the BIOS is very limited (and may differ between x86 and ARM). For
|
|
||||||
x86, ensure that you're using the proper format by converting any new
|
|
||||||
bitmaps with a command like this:
|
|
||||||
|
|
||||||
convert IN.bmp -colors 256 -compress none -alpha off OUT.bmp
|
On Ubuntu you may find you need libtspi-dev, uuid-dev, imagemagick,
|
||||||
|
python-yaml, and python-wxgtk2.8, among others.
|
||||||
|
|
||||||
* When you have the screens tweaked to your satisfaction, generate the
|
|
||||||
binary bmpblock to embed into the BIOS.
|
|
||||||
|
|
||||||
bmpblk_utility -c DEFAULT.yaml bmpblock.bin
|
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.
|
||||||
|
|
||||||
* Use the gbb_utility to modify the BIOS to contain this new set of bitmaps.
|
|
||||||
|
|
||||||
NOTE: These commands are run (as root) on the device under test!
|
Create the font file:
|
||||||
|
|
||||||
NOTE: This will only work if the BIOS write-protection is disabled!
|
cd scripts/newbitmaps/fonts
|
||||||
|
./make_ascii_bmps.py
|
||||||
|
bmpblk_font --outfile ../images/hwid_fonts.bin outdir/*
|
||||||
|
|
||||||
Copy our new bmpblock over.
|
Create and examine the localized images:
|
||||||
|
|
||||||
|
For x86:
|
||||||
|
|
||||||
|
cd scripts/newbitmaps/images
|
||||||
|
make x86
|
||||||
|
cd out_x86
|
||||||
|
../../bitmap_viewer DEFAULT.yaml
|
||||||
|
bmpblock_utility -c DEFAULT.yaml bmpblock.bin
|
||||||
|
|
||||||
|
For arm:
|
||||||
|
|
||||||
|
cd scripts/newbitmaps/images
|
||||||
|
make arm
|
||||||
|
cd out_arm
|
||||||
|
../../bitmap_viewer DEFAULT.yaml
|
||||||
|
bmpblock_utility -c DEFAULT.yaml bmpblock.bin
|
||||||
|
|
||||||
|
|
||||||
|
Now use the gbb_utility to modify your BIOS to contain this new set of
|
||||||
|
bitmaps:
|
||||||
|
|
||||||
|
gbb_utility -s -b PATH/TO/YOUR/bmpblock.bin OLDBIOS.bin NEWBIOS.bin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You can do that last step on the chromebook device itself, provided that the
|
||||||
|
BIOS write-protection is disabled. gbb_utility should be in the rootfs:
|
||||||
|
|
||||||
|
Become root:
|
||||||
|
|
||||||
|
sudo bash
|
||||||
|
|
||||||
|
Copy your new bmpblock over:
|
||||||
|
|
||||||
cd /mnt/stateful_partition
|
cd /mnt/stateful_partition
|
||||||
scp USER@SOMEHOST:/SOMEPATH/bmpblock.bin .
|
scp USER@SOMEHOST:/SOMEPATH/bmpblock.bin .
|
||||||
|
|
||||||
Get a copy of the current BIOS.
|
Get a copy of the current BIOS:
|
||||||
|
|
||||||
flashrom -p internal:bus=spi -r bios.bin
|
flashrom -p internal:bus=spi -r bios.bin
|
||||||
|
|
||||||
Put the new bmpblock in the copy of the BIOS
|
Put the new bmpblock in the copy of the BIOS:
|
||||||
|
|
||||||
gbb_utility -s -b bmpblock.bin bios.bin
|
gbb_utility -s -b bmpblock.bin bios.bin
|
||||||
|
|
||||||
@@ -128,11 +157,12 @@ composited screens as described by the config file.
|
|||||||
|
|
||||||
flashrom -p internal:bus=spi -w bios.bin
|
flashrom -p internal:bus=spi -w bios.bin
|
||||||
|
|
||||||
* Reboot. You should see your new bitmaps appear whenever the BIOS screens
|
Reboot. You should see your new bitmaps appear whenever the BIOS screens
|
||||||
are displayed. If you have more than one localization, you should be able
|
are displayed. If you have more than one localization, you should be able
|
||||||
to cycle among them with the arrow keys.
|
to cycle among them with the arrow keys.
|
||||||
|
|
||||||
* If you want to examine a binary bmpblock that you've pulled from a BIOS
|
|
||||||
|
If you want to examine a binary bmpblock that you've pulled from a BIOS
|
||||||
image, the bmpblk_utility has options to display or unpack the binary.
|
image, the bmpblk_utility has options to display or unpack the binary.
|
||||||
|
|
||||||
bmpblk_utility bmpblock.bin
|
bmpblk_utility bmpblock.bin
|
||||||
@@ -141,6 +171,6 @@ composited screens as described by the config file.
|
|||||||
|
|
||||||
bmpblk_utility -x -d /SOME/SCRATCH/DIR bmpblock.bin
|
bmpblk_utility -x -d /SOME/SCRATCH/DIR bmpblock.bin
|
||||||
|
|
||||||
Once you've unpacked it you can use the bitmap_viewer on the unpacked yaml
|
Once you've unpacked it you can use the bitmap_viewer on the unpacked
|
||||||
file to see what it looks like. There's not (yet) a single tool that
|
config.yaml file to see what it looks like. There's not (yet) a single tool
|
||||||
directly displays the raw binary.
|
that directly displays the raw binary.
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ def main():
|
|||||||
'-border', '0x3',
|
'-border', '0x3',
|
||||||
'-gravity', 'Center',
|
'-gravity', 'Center',
|
||||||
'-pointsize', options.size,
|
'-pointsize', options.size,
|
||||||
|
'-resize', '120%x100', # Yes, magic.
|
||||||
|
'-scale', '59%x78%', # Here, too.
|
||||||
'label:%s' % ascii,
|
'label:%s' % ascii,
|
||||||
'-remap', gradient_file,
|
'-remap', gradient_file,
|
||||||
'-compress', 'none',
|
'-compress', 'none',
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
TARGETS=x86 arm
|
TARGETS=x86 arm
|
||||||
|
|
||||||
|
DEFAULT_LOCALES=en fr es it de nl
|
||||||
|
|
||||||
|
|
||||||
BASE_IMAGES=Devmode.bmp Insert.bmp Remove.bmp Yuck.bmp
|
BASE_IMAGES=Devmode.bmp Insert.bmp Remove.bmp Yuck.bmp
|
||||||
OTHER_IMAGES=Url.bmp hwid_unknown.bmp
|
OTHER_IMAGES=Url.bmp hwid_unknown.bmp
|
||||||
FONTS=hwid_fonts.bin
|
FONTS=hwid_fonts.bin
|
||||||
@@ -48,18 +51,20 @@ x86::
|
|||||||
done
|
done
|
||||||
# copy stuff we need
|
# copy stuff we need
|
||||||
cp "${FONTS}" "out_$@"
|
cp "${FONTS}" "out_$@"
|
||||||
# scale the background pictures exactly
|
# scale the background pictures exactly...
|
||||||
for i in ${BASE_IMAGES}; do \
|
@for i in ${BASE_IMAGES}; do \
|
||||||
|
echo " out_$@/$$i"; \
|
||||||
convert $$i -scale "${_x86_max}" "out_$@/$$i"; \
|
convert $$i -scale "${_x86_max}" "out_$@/$$i"; \
|
||||||
done
|
done
|
||||||
# scale the localized string images using percentages
|
# scale the localized string images using percentages...
|
||||||
for i in ${OTHER_IMAGES} localized_images/*/*.bmp; do \
|
@for i in ${OTHER_IMAGES} localized_images/*/*.bmp; do \
|
||||||
|
echo " out_$@/$$i"; \
|
||||||
convert $$i -scale "${_x86_scale}" "out_$@/$$i"; \
|
convert $$i -scale "${_x86_scale}" "out_$@/$$i"; \
|
||||||
done
|
done
|
||||||
# produce the new yaml
|
# produce the new yaml
|
||||||
cd "out_$@" && ../make_default_yaml
|
cd "out_$@" && ../make_default_yaml ${DEFAULT_LOCALES}
|
||||||
# Note: hand-edit the new DEFAULT.yaml to select the shipping locales,
|
# Note: manually use bmpblk_utility to create the binary from out_$@
|
||||||
# then use bmpblk_utility to create the binary.
|
|
||||||
|
|
||||||
|
|
||||||
arm::
|
arm::
|
||||||
@@ -74,20 +79,23 @@ arm::
|
|||||||
-colors 256 -unique-colors "out_$@/base_cmap.png"
|
-colors 256 -unique-colors "out_$@/base_cmap.png"
|
||||||
convert localized_images/*/*.bmp -append \
|
convert localized_images/*/*.bmp -append \
|
||||||
-colors 256 -unique-colors "out_$@/loc_cmap.png"
|
-colors 256 -unique-colors "out_$@/loc_cmap.png"
|
||||||
# scale the background pictures exactly
|
# scale the background pictures exactly...
|
||||||
for i in ${BASE_IMAGES}; do \
|
@for i in ${BASE_IMAGES}; do \
|
||||||
|
echo " out_$@/$$i"; \
|
||||||
convert $$i -scale "${_arm_max}" \
|
convert $$i -scale "${_arm_max}" \
|
||||||
-remap "out_$@/base_cmap.png" "out_$@/$$i"; \
|
-remap "out_$@/base_cmap.png" "out_$@/$$i"; \
|
||||||
done
|
done
|
||||||
# scale the localized string images using percentages
|
# scale the localized string images using percentages...
|
||||||
for i in ${OTHER_IMAGES} localized_images/*/*.bmp; do \
|
@for i in ${OTHER_IMAGES} localized_images/*/*.bmp; do \
|
||||||
|
echo " out_$@/$$i"; \
|
||||||
convert $$i -scale "${_arm_scale}" \
|
convert $$i -scale "${_arm_scale}" \
|
||||||
-remap "out_$@/loc_cmap.png" "out_$@/$$i"; \
|
-remap "out_$@/loc_cmap.png" "out_$@/$$i"; \
|
||||||
done
|
done
|
||||||
# produce the new yaml
|
# produce the new yaml
|
||||||
cd "out_$@" && ../make_default_yaml
|
cd "out_$@" && ../make_default_yaml ${DEFAULT_LOCALES}
|
||||||
# Note: hand-edit the new DEFAULT.yaml to select the shipping locales,
|
perl -i -p -e 's/^compression:.*/compression: 2/;' "out_$@/DEFAULT.yaml"
|
||||||
# then use bmpblk_utility to create the binary.
|
# Note: manually use bmpblk_utility to create the binary from out_$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -12,6 +12,19 @@ yaml_file="DEFAULT.yaml"
|
|||||||
locales="en es_419 pt_BR en_GB fr es pt_PT ca it de el nl da no sv fi et lv lt ru pl cs sk hu sl sr hr bg ro uk tr iw ar fa hi th vi id fil zh_CN zh_TW ko ja"
|
locales="en es_419 pt_BR en_GB fr es pt_PT ca it de el nl da no sv fi et lv lt ru pl cs sk hu sl sr hr bg ro uk tr iw ar fa hi th vi id fil zh_CN zh_TW ko ja"
|
||||||
localedir="./localized_images"
|
localedir="./localized_images"
|
||||||
|
|
||||||
|
# Accept optional args which are the locales to emit. Default is all of 'em.
|
||||||
|
if [ -n "$*" ]; then
|
||||||
|
# Make sure all the args actually match
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ ! -d "$localedir/$arg" ]; then
|
||||||
|
echo "$0: locale \"$arg\" is unknown" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
locales="$*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Arbitrary padding
|
# Arbitrary padding
|
||||||
ypad=5
|
ypad=5
|
||||||
xpad=10
|
xpad=10
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ class BmpBlock(object):
|
|||||||
"""Raise an error if the specified dict is not a valid BmpBlock structure"""
|
"""Raise an error if the specified dict is not a valid BmpBlock structure"""
|
||||||
|
|
||||||
assert isinstance(thing, dict)
|
assert isinstance(thing, dict)
|
||||||
assert thing["bmpblock"] == 1.0 or thing["bmpblock"] == 1.1
|
|
||||||
|
|
||||||
seen_images = {"$HWID":1, "$HWID.rtol":2}
|
seen_images = {"$HWID":1, "$HWID.rtol":2}
|
||||||
seen_screens = {}
|
seen_screens = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user