Add stuff to support new bitmap format.
Add bitmap_viewer program (to run OUTSIDE of chroot) and example bitmaps (to be replaced by the REAL bitmaps for each platform). BUG=chromium-os:10949 TEST=none These are just nonessential tools and examples. No regression testing needed. Change-Id: I7f9aab30809251e4c62d71bfa73293d0b4d97196 Review URL: http://codereview.chromium.org/6598046
110
scripts/newbitmaps/README
Normal file
@@ -0,0 +1,110 @@
|
||||
This directory contains examples of the new-style BIOS bitmaps, and a simple
|
||||
(and ugly) tool to view the configuration file that describes how each
|
||||
screen is displayed.
|
||||
|
||||
Old-style bitmaps:
|
||||
|
||||
In the Cr-48 BIOS there are four BIOS screens that may be presented to the
|
||||
user. Each contains a graphic, a URL, and some informative text. The screens
|
||||
are single bitmap images, hardcoded in read-only BIOS (because they have to
|
||||
display even when the R/W BIOS and SSD are both completely erased). They can
|
||||
be replaced at manufacturing time, but creating the screens is difficult.
|
||||
The format is a compressed EFI firmware volume that is generated when the
|
||||
BIOS is compiled. The result is an opaque blob that cannot be viewed or
|
||||
edited with linux-based tools.
|
||||
|
||||
|
||||
New-style bitmaps:
|
||||
|
||||
Future BIOSes will continue to display the same basic screens, but using a
|
||||
different format. Each screen will have separate bitmaps for the basic
|
||||
graphic, the URL, and the informative text, and will be displayed by
|
||||
rendering each component in order. This will allow us to modify and replace
|
||||
any bitmap (most frequently the HWID), using standard command-line tools
|
||||
such as imagemagick. Compositing each screen in this way also means that we
|
||||
can easily provide localized BIOS screens or custom messages.
|
||||
|
||||
|
||||
Note:
|
||||
|
||||
Because the bitmap images and display code is part of the Read-Only BIOS,
|
||||
back-porting the new-style bitmaps to older devices is not possible.
|
||||
|
||||
|
||||
Instructions:
|
||||
|
||||
The bmpblk_utility reads a config file and produces a binary bmpblock. The
|
||||
config file lists the individual bitmaps and describes where to place each
|
||||
one when displaying each screen. The bmpblock is then written into the BIOS
|
||||
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 used OUTSIDE of the
|
||||
chroot. Test it by changing to the scripts/newbitmaps/images/1280x800
|
||||
directory and running "../../bitmap_viewer unknown.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 unknown.yaml config file, and use the
|
||||
bitmap_viewer to see how the layout looks. Hit Ctrl-R in the small window
|
||||
to reload the config file without restarting.
|
||||
|
||||
* The bitmap_viewer can display images in several different formats, 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
|
||||
|
||||
* When you have the screens tweaked to your satisfaction, generate the
|
||||
binary bmpblock to embed into the BIOS.
|
||||
|
||||
bmpblk_utility -c unknown.yaml bmpblock.bin
|
||||
|
||||
* Use the gbb_utility to modify the BIOS to contain our new set of bitmaps.
|
||||
We will need to pad our replacement bmpblock to match the size of the
|
||||
original.
|
||||
|
||||
NOTE: These commands are run (as root) on the device under test!
|
||||
|
||||
NOTE: This will only work if the BIOS write-protection is disabled!
|
||||
|
||||
Copy our new bmpblock over.
|
||||
|
||||
cd /mnt/stateful_partition
|
||||
scp USER@SOMEHOST:/SOMEPATH/bmpblock.bin .
|
||||
|
||||
Get a copy of the current BIOS.
|
||||
|
||||
flashrom -r bios.bin
|
||||
|
||||
Extract the current bmpblock from the BIOS, and see how big it is.
|
||||
|
||||
gbb_utility -g -b oldblob bios.bin
|
||||
ls -l oldblob
|
||||
|
||||
Pad our bmpblock to the same size (for example, 253568 bytes)
|
||||
|
||||
dd if=bmpblock.bin bs=253568 count=1 of=newblob
|
||||
|
||||
Put our bmpblock in our copy of the BIOS
|
||||
|
||||
gbb_utility -s newblob bios.bin
|
||||
|
||||
Reflash the BIOS with the new content
|
||||
|
||||
flashrom -w bios.bin
|
||||
|
||||
* 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
|
||||
to cycle among them with the arrow keys.
|
||||
|
||||
* 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.
|
||||
|
||||
bmpblk_utility bmpblock.bin
|
||||
|
||||
bmpblk_utility -y bmpblock.bin
|
||||
|
||||
cd /SOME/SCRATCH/DIR
|
||||
bmpblk_utility -x bmpblock.bin
|
||||
34
scripts/newbitmaps/bitmap_viewer
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python -tt
|
||||
# Copyright (c) 2011 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.
|
||||
|
||||
"""Quick-and-dirty viewer for bmpblock yaml files"""
|
||||
import os
|
||||
import sys
|
||||
import wx
|
||||
|
||||
from lib import bmpblock
|
||||
from lib import pixcontrol
|
||||
from lib import pixdisplay
|
||||
|
||||
class MyApp(wx.App):
|
||||
|
||||
def OnInit(self):
|
||||
self._bmpblock = bmpblock.BmpBlock(sys.argv[1])
|
||||
progname = os.path.basename(sys.argv[0])
|
||||
self._mainframe = pixcontrol.Frame(self._bmpblock, progname)
|
||||
self._mainframe.Show()
|
||||
self.SetTopWindow(self._mainframe)
|
||||
self._imgframe = pixdisplay.Frame(self._bmpblock, sys.argv[1])
|
||||
self._imgframe.Show()
|
||||
return True
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "You must specify a config.yaml file to view"
|
||||
sys.exit(1)
|
||||
MyApp(False).MainLoop()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
BIN
scripts/newbitmaps/images/1280x800/Developer.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1280x800/Recovery.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1280x800/RecoveryMissingOS.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1280x800/RecoveryNoOS.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1280x800/de_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
scripts/newbitmaps/images/1280x800/de_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
scripts/newbitmaps/images/1280x800/de_model.bmp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
scripts/newbitmaps/images/1280x800/de_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
scripts/newbitmaps/images/1280x800/de_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
scripts/newbitmaps/images/1280x800/en_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
scripts/newbitmaps/images/1280x800/en_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
scripts/newbitmaps/images/1280x800/en_model.bmp
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
scripts/newbitmaps/images/1280x800/en_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
scripts/newbitmaps/images/1280x800/en_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
scripts/newbitmaps/images/1280x800/es_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
scripts/newbitmaps/images/1280x800/es_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
scripts/newbitmaps/images/1280x800/es_model.bmp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
scripts/newbitmaps/images/1280x800/es_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
scripts/newbitmaps/images/1280x800/es_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
scripts/newbitmaps/images/1280x800/fr_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
scripts/newbitmaps/images/1280x800/fr_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
scripts/newbitmaps/images/1280x800/fr_model.bmp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
scripts/newbitmaps/images/1280x800/fr_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
scripts/newbitmaps/images/1280x800/fr_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
scripts/newbitmaps/images/1280x800/hwid_unknown.bmp
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
164
scripts/newbitmaps/images/1280x800/unknown.yaml
Normal file
@@ -0,0 +1,164 @@
|
||||
|
||||
bmpblock: 1.0
|
||||
|
||||
compression: 1
|
||||
|
||||
images:
|
||||
|
||||
# The HWID must change for every BOM
|
||||
|
||||
hwid: hwid_unknown.bmp
|
||||
|
||||
# This URL never changes
|
||||
|
||||
url: url.bmp
|
||||
|
||||
# These are from the UI people
|
||||
|
||||
devmode_bg: Developer.bmp
|
||||
remove_bg: Recovery.bmp
|
||||
yuck_bg: RecoveryNoOS.bmp
|
||||
insert_bg: RecoveryMissingOS.bmp
|
||||
|
||||
# The following strings must be approved by the localization people
|
||||
|
||||
en_model: en_model.bmp
|
||||
en_devmode_text: en_devmode_text.bmp
|
||||
en_remove_text: en_remove_text.bmp
|
||||
en_yuck_text: en_yuck_text.bmp
|
||||
en_insert_text: en_insert_text.bmp
|
||||
|
||||
de_model: de_model.bmp
|
||||
de_devmode_text: de_devmode_text.bmp
|
||||
de_remove_text: de_remove_text.bmp
|
||||
de_yuck_text: de_yuck_text.bmp
|
||||
de_insert_text: de_insert_text.bmp
|
||||
|
||||
es_model: es_model.bmp
|
||||
es_devmode_text: es_devmode_text.bmp
|
||||
es_remove_text: es_remove_text.bmp
|
||||
es_yuck_text: es_yuck_text.bmp
|
||||
es_insert_text: es_insert_text.bmp
|
||||
|
||||
fr_model: fr_model.bmp
|
||||
fr_devmode_text: fr_devmode_text.bmp
|
||||
fr_remove_text: fr_remove_text.bmp
|
||||
fr_yuck_text: fr_yuck_text.bmp
|
||||
fr_insert_text: fr_insert_text.bmp
|
||||
|
||||
screens:
|
||||
en_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [274, 470, en_devmode_text]
|
||||
|
||||
en_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [198, 488, en_remove_text]
|
||||
|
||||
en_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [163, 488, en_yuck_text]
|
||||
|
||||
en_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [277, 470, en_insert_text]
|
||||
|
||||
|
||||
de_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [234, 452, de_devmode_text]
|
||||
|
||||
de_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [224, 470, de_remove_text]
|
||||
|
||||
de_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [216, 470, de_yuck_text]
|
||||
|
||||
de_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [222, 470, de_insert_text]
|
||||
|
||||
|
||||
es_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [165, 470, es_devmode_text]
|
||||
|
||||
es_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [122, 488, es_remove_text]
|
||||
|
||||
es_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [130, 470, es_yuck_text]
|
||||
|
||||
es_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [202, 470, es_insert_text]
|
||||
|
||||
|
||||
|
||||
fr_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [195, 470, fr_devmode_text]
|
||||
|
||||
fr_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [144, 488, fr_remove_text]
|
||||
|
||||
fr_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [166, 470, fr_yuck_text]
|
||||
|
||||
fr_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [238, 470, fr_insert_text]
|
||||
|
||||
|
||||
|
||||
localizations:
|
||||
|
||||
# This determines the order in which the localizations appear. The first
|
||||
# one is the default.
|
||||
|
||||
- [ en_devel, en_remove, en_yuck, en_insert ]
|
||||
- [ es_devel, es_remove, es_yuck, es_insert ]
|
||||
- [ fr_devel, fr_remove, fr_yuck, fr_insert ]
|
||||
- [ de_devel, de_remove, de_yuck, de_insert ]
|
||||
BIN
scripts/newbitmaps/images/1280x800/url.bmp
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
scripts/newbitmaps/images/1366x768/Developer.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1366x768/Recovery.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1366x768/RecoveryMissingOS.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1366x768/RecoveryNoOS.bmp
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
scripts/newbitmaps/images/1366x768/de_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
scripts/newbitmaps/images/1366x768/de_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
scripts/newbitmaps/images/1366x768/de_model.bmp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
scripts/newbitmaps/images/1366x768/de_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
scripts/newbitmaps/images/1366x768/de_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
scripts/newbitmaps/images/1366x768/en_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
scripts/newbitmaps/images/1366x768/en_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
scripts/newbitmaps/images/1366x768/en_model.bmp
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
scripts/newbitmaps/images/1366x768/en_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
scripts/newbitmaps/images/1366x768/en_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
scripts/newbitmaps/images/1366x768/es_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
scripts/newbitmaps/images/1366x768/es_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
scripts/newbitmaps/images/1366x768/es_model.bmp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
scripts/newbitmaps/images/1366x768/es_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
scripts/newbitmaps/images/1366x768/es_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
scripts/newbitmaps/images/1366x768/fr_devmode_text.bmp
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
scripts/newbitmaps/images/1366x768/fr_insert_text.bmp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
scripts/newbitmaps/images/1366x768/fr_model.bmp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
scripts/newbitmaps/images/1366x768/fr_remove_text.bmp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
scripts/newbitmaps/images/1366x768/fr_yuck_text.bmp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
scripts/newbitmaps/images/1366x768/hwid_unknown.bmp
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
164
scripts/newbitmaps/images/1366x768/unknown.yaml
Normal file
@@ -0,0 +1,164 @@
|
||||
|
||||
bmpblock: 1.0
|
||||
|
||||
compression: 1
|
||||
|
||||
images:
|
||||
|
||||
# The HWID must change for every BOM
|
||||
|
||||
hwid: hwid_unknown.bmp
|
||||
|
||||
# This URL never changes
|
||||
|
||||
url: url.bmp
|
||||
|
||||
# These are from the UI people
|
||||
|
||||
devmode_bg: Developer.bmp
|
||||
remove_bg: Recovery.bmp
|
||||
yuck_bg: RecoveryNoOS.bmp
|
||||
insert_bg: RecoveryMissingOS.bmp
|
||||
|
||||
# The following strings must be approved by the localization people
|
||||
|
||||
en_model: en_model.bmp
|
||||
en_devmode_text: en_devmode_text.bmp
|
||||
en_remove_text: en_remove_text.bmp
|
||||
en_yuck_text: en_yuck_text.bmp
|
||||
en_insert_text: en_insert_text.bmp
|
||||
|
||||
de_model: de_model.bmp
|
||||
de_devmode_text: de_devmode_text.bmp
|
||||
de_remove_text: de_remove_text.bmp
|
||||
de_yuck_text: de_yuck_text.bmp
|
||||
de_insert_text: de_insert_text.bmp
|
||||
|
||||
es_model: es_model.bmp
|
||||
es_devmode_text: es_devmode_text.bmp
|
||||
es_remove_text: es_remove_text.bmp
|
||||
es_yuck_text: es_yuck_text.bmp
|
||||
es_insert_text: es_insert_text.bmp
|
||||
|
||||
fr_model: fr_model.bmp
|
||||
fr_devmode_text: fr_devmode_text.bmp
|
||||
fr_remove_text: fr_remove_text.bmp
|
||||
fr_yuck_text: fr_yuck_text.bmp
|
||||
fr_insert_text: fr_insert_text.bmp
|
||||
|
||||
screens:
|
||||
en_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [274, 470, en_devmode_text]
|
||||
|
||||
en_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [198, 488, en_remove_text]
|
||||
|
||||
en_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [163, 488, en_yuck_text]
|
||||
|
||||
en_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [264, 559, en_model]
|
||||
- [277, 470, en_insert_text]
|
||||
|
||||
|
||||
de_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [234, 452, de_devmode_text]
|
||||
|
||||
de_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [224, 470, de_remove_text]
|
||||
|
||||
de_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [216, 470, de_yuck_text]
|
||||
|
||||
de_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [265, 559, de_model]
|
||||
- [222, 470, de_insert_text]
|
||||
|
||||
|
||||
es_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [165, 470, es_devmode_text]
|
||||
|
||||
es_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [122, 488, es_remove_text]
|
||||
|
||||
es_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [130, 470, es_yuck_text]
|
||||
|
||||
es_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, es_model]
|
||||
- [202, 470, es_insert_text]
|
||||
|
||||
|
||||
|
||||
fr_devel:
|
||||
- [ 0, 0, devmode_bg]
|
||||
- [195, 470, fr_devmode_text]
|
||||
|
||||
fr_remove:
|
||||
- [ 0, 0, remove_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [144, 488, fr_remove_text]
|
||||
|
||||
fr_yuck:
|
||||
- [ 0, 0, yuck_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [166, 470, fr_yuck_text]
|
||||
|
||||
fr_insert:
|
||||
- [ 0, 0, insert_bg]
|
||||
- [324, 559, hwid]
|
||||
- [195, 509, url]
|
||||
- [260, 559, fr_model]
|
||||
- [238, 470, fr_insert_text]
|
||||
|
||||
|
||||
|
||||
localizations:
|
||||
|
||||
# This determines the order in which the localizations appear. The first
|
||||
# one is the default.
|
||||
|
||||
- [ en_devel, en_remove, en_yuck, en_insert ]
|
||||
- [ es_devel, es_remove, es_yuck, es_insert ]
|
||||
- [ fr_devel, fr_remove, fr_yuck, fr_insert ]
|
||||
- [ de_devel, de_remove, de_yuck, de_insert ]
|
||||
BIN
scripts/newbitmaps/images/1366x768/url.bmp
Normal file
|
After Width: | Height: | Size: 21 KiB |
6
scripts/newbitmaps/lib/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright (c) 2011 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.
|
||||
import bmpblock
|
||||
import pixcontrol
|
||||
import pixdisplay
|
||||
104
scripts/newbitmaps/lib/bmpblock.py
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/python -tt
|
||||
# Copyright (c) 2011 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.
|
||||
|
||||
"""A BmpBlock class"""
|
||||
|
||||
import os
|
||||
import types
|
||||
import yaml
|
||||
|
||||
class BmpBlock(object):
|
||||
"""A wrapper for the config.yaml file.
|
||||
It has a few special attributes to specify which part we're focusing on.
|
||||
"""
|
||||
|
||||
def __init__(self, filename=None):
|
||||
self.yaml = None
|
||||
self.filename = None
|
||||
self.current_screen = None
|
||||
self.filename = filename # always set, so we can reload
|
||||
if filename:
|
||||
self.LoadFile(filename)
|
||||
|
||||
def LoadFile(self, filename):
|
||||
"""Load the specified yaml file and verify that it's a valid BmpBlock"""
|
||||
print "Loading", filename
|
||||
with open(filename, 'rb') as f:
|
||||
stuff = yaml.safe_load(f)
|
||||
# FIXME: This is pretty lame. We should be able to find images using a
|
||||
# default directory path instead of using chdir.
|
||||
if os.path.dirname(filename):
|
||||
os.chdir(os.path.dirname(filename))
|
||||
if self.IsValidSyntax(stuff):
|
||||
self.yaml = stuff
|
||||
self.current_screen = sorted(self.yaml["screens"].keys())[0]
|
||||
|
||||
def Reload(self):
|
||||
tmp = self.current_screen
|
||||
self.LoadFile(self.filename)
|
||||
if tmp in self.yaml["screens"]:
|
||||
self.current_screen = tmp
|
||||
|
||||
def IsValidSyntax(self, thing):
|
||||
"""Raise an error if the specified dict is not a valid BmpBlock structure"""
|
||||
|
||||
assert isinstance(thing, dict)
|
||||
assert thing["bmpblock"] == 1.0
|
||||
|
||||
seen_images = {}
|
||||
seen_screens = {}
|
||||
|
||||
images = thing["images"]
|
||||
assert isinstance(images, dict)
|
||||
assert len(images) > 0
|
||||
# image values should all be filenames (ie, strings)
|
||||
for val in images.values():
|
||||
assert val and isinstance(val, types.StringTypes)
|
||||
|
||||
screens = thing["screens"]
|
||||
assert isinstance(screens, dict)
|
||||
assert screens
|
||||
# screen values should all be lists of 3-tuples
|
||||
for scrname, imglist in screens.items():
|
||||
assert len(imglist) <= 8
|
||||
for img in imglist:
|
||||
assert 3 == len(img)
|
||||
# must have defined all referenced bitmaps
|
||||
x,y,i = img
|
||||
assert i in images
|
||||
seen_images[i] = True
|
||||
|
||||
localizations = thing["localizations"]
|
||||
assert hasattr(localizations, '__iter__')
|
||||
assert localizations
|
||||
# localizations should all be lists with the same number of screens
|
||||
len0 = len(localizations[0])
|
||||
assert len0
|
||||
for elt in localizations:
|
||||
assert len0 == len(elt)
|
||||
# we must have defined all referenced screens
|
||||
for scr in elt:
|
||||
assert scr in screens
|
||||
seen_screens[scr] = True
|
||||
|
||||
for unused_img in [x for x in images if x not in seen_images]:
|
||||
print " Unused image:", unused_img
|
||||
for unused_scr in [x for x in screens if x not in seen_screens]:
|
||||
print " Unused screen:", unused_scr
|
||||
|
||||
return True
|
||||
|
||||
def RegisterScreenDisplayObject(self, displayer):
|
||||
"""Register an object with a .Redisplay() function to display updates."""
|
||||
self.displayer = displayer
|
||||
|
||||
|
||||
def Redisplay(self):
|
||||
"""Redisplay contents."""
|
||||
if self.displayer:
|
||||
if self.current_screen:
|
||||
sc = self.yaml['screens'][self.current_screen]
|
||||
slist = [(x,y,self.yaml['images'][z]) for x,y,z in sc]
|
||||
self.displayer.DisplayScreen(self.current_screen, slist)
|
||||
102
scripts/newbitmaps/lib/pixcontrol.py
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/python -tt
|
||||
# Copyright (c) 2011 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.
|
||||
|
||||
"""Edit buttons for bmpblock object"""
|
||||
|
||||
import wx
|
||||
|
||||
class Frame(wx.Frame):
|
||||
|
||||
def __init__(self, bmpblock=None, title=None):
|
||||
wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(200,400))
|
||||
menuFile = wx.Menu()
|
||||
m_about = menuFile.Append(wx.ID_ANY, "About...\tCtrl+A")
|
||||
menuFile.AppendSeparator()
|
||||
m_reload = menuFile.Append(wx.ID_ANY, "Reload\tCtrl+R")
|
||||
m_quit = menuFile.Append(wx.ID_ANY, "Quit\tCtrl+Q")
|
||||
menuBar = wx.MenuBar()
|
||||
menuBar.Append(menuFile, "&File")
|
||||
self.SetMenuBar(menuBar)
|
||||
self.CreateStatusBar()
|
||||
self.Bind(wx.EVT_MENU, self.OnAbout, m_about)
|
||||
self.Bind(wx.EVT_MENU, self.OnReload, m_reload)
|
||||
self.Bind(wx.EVT_MENU, self.OnQuit, m_quit)
|
||||
self.Bind(wx.EVT_CLOSE, self.OnQuit)
|
||||
|
||||
acctbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('A'), m_about.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('R'), m_reload.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('Q'), m_quit.GetId())
|
||||
])
|
||||
|
||||
self.SetAcceleratorTable(acctbl)
|
||||
|
||||
# create UI components
|
||||
panel = wx.Panel(self)
|
||||
button_reload = wx.Button(panel, label="Reload File")
|
||||
self.screenlist = wx.ListBox(panel, wx.ID_ANY)
|
||||
|
||||
# connect events
|
||||
self.Bind(wx.EVT_BUTTON, self.OnReload, button_reload)
|
||||
self.Bind(wx.EVT_LISTBOX, self.OnSelected, self.screenlist)
|
||||
self.Bind(wx.EVT_IDLE, self.OnIdle)
|
||||
|
||||
# place the componenents
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(button_reload)
|
||||
sizer.Add(wx.StaticText(panel, wx.ID_ANY, "Screens"))
|
||||
sizer.Add(self.screenlist, 1, wx.EXPAND)
|
||||
|
||||
panel.SetSizer(sizer)
|
||||
panel.Fit()
|
||||
|
||||
# now, what are we looking at?
|
||||
self.bmpblock = bmpblock
|
||||
self.UpdateControls()
|
||||
self.do_update = True
|
||||
self.screenlist.SetFocus()
|
||||
|
||||
def OnAbout(self, event):
|
||||
"""Display basic information about this application."""
|
||||
msg = ("Yes, all this does right now is display the screens from the config"
|
||||
" file. You still have to edit, save, and reload in order to see any"
|
||||
" changes. Learning python and wxpython is my 20% project (actually"
|
||||
" it's more like 5%). Feel free to improve things.\n\t-- bill")
|
||||
wx.MessageBox(msg, "About", wx.OK | wx.ICON_INFORMATION, self)
|
||||
|
||||
def OnQuit(self, event):
|
||||
"""Close all application windows and quit."""
|
||||
wx.GetApp().ExitMainLoop()
|
||||
|
||||
def OnReload(self, event):
|
||||
"""Tell the model object to refresh the view that the user sees.
|
||||
FIXME: The model itself should know to do this without being told.
|
||||
"""
|
||||
self.bmpblock.Reload()
|
||||
self.do_update = True;
|
||||
self.UpdateControls()
|
||||
|
||||
def OnSelected(self, event):
|
||||
"""User may have picked one of the pulldowns."""
|
||||
if event.IsSelection():
|
||||
self.bmpblock.current_screen = event.GetString()
|
||||
self.do_update = True
|
||||
event.Skip()
|
||||
|
||||
def UpdateControls(self):
|
||||
"""Reload all the buttons with the current model information."""
|
||||
screens = self.bmpblock.yaml["screens"]
|
||||
self.screenlist.Clear()
|
||||
self.screenlist.AppendItems(sorted(screens.keys()))
|
||||
current = self.bmpblock.current_screen
|
||||
self.screenlist.SetStringSelection(current)
|
||||
self.SetStatusText(self.bmpblock.filename)
|
||||
|
||||
def OnIdle(self, event=None):
|
||||
"""What to do, what to do..."""
|
||||
if self.do_update:
|
||||
# FIXME: The model should know when to do this itself, right?
|
||||
self.bmpblock.Redisplay()
|
||||
self.do_update = False
|
||||
62
scripts/newbitmaps/lib/pixdisplay.py
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/python -tt
|
||||
# Copyright (c) 2011 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.
|
||||
|
||||
"""Display for bmpblock object."""
|
||||
import wx
|
||||
|
||||
class MyPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent, wx.ID_ANY)
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
self.parent = parent
|
||||
self.imglist = ()
|
||||
|
||||
def OnPaint(self, evt=None):
|
||||
if (evt):
|
||||
dc = wx.PaintDC(self)
|
||||
else:
|
||||
dc = wx.ClientDC(self)
|
||||
|
||||
done_first = False
|
||||
# The first image in the sequence may be used by the BIOS to set the
|
||||
# display resolution. Regardless, it should match the desired or default
|
||||
# resolution so that any previous screens get cleared.
|
||||
for x, y, filename in self.imglist:
|
||||
img = wx.Image(filename, wx.BITMAP_TYPE_ANY)
|
||||
if (not done_first):
|
||||
size = img.GetSize()
|
||||
self.SetMinSize(size)
|
||||
self.SetSize(size)
|
||||
self.Fit()
|
||||
w,h = self.parent.GetBestSize()
|
||||
self.parent.SetDimensions(-1, -1, w, h, wx.SIZE_AUTO)
|
||||
done_first = True
|
||||
bmp = img.ConvertToBitmap()
|
||||
dc.DrawBitmap(bmp, x, y)
|
||||
|
||||
|
||||
class Frame(wx.Frame):
|
||||
|
||||
def __init__(self, bmpblock=None, title=None):
|
||||
wx.Frame.__init__(self, None, wx.ID_ANY, title=title)
|
||||
self.CreateStatusBar()
|
||||
self.SetStatusText(title)
|
||||
self.Bind(wx.EVT_CLOSE, self.OnQuit)
|
||||
|
||||
self.bmpblock = bmpblock
|
||||
if self.bmpblock:
|
||||
self.bmpblock.RegisterScreenDisplayObject(self)
|
||||
|
||||
self.p = MyPanel(self)
|
||||
|
||||
|
||||
def OnQuit(self, event):
|
||||
wx.GetApp().ExitMainLoop()
|
||||
|
||||
def DisplayScreen(self, name, imglist):
|
||||
self.SetStatusText(name)
|
||||
self.p.imglist = imglist
|
||||
self.p.OnPaint()
|
||||
3
scripts/newbitmaps/strings/README
Normal file
@@ -0,0 +1,3 @@
|
||||
These text files and the text_to_bmp script are here for reference only, to
|
||||
give an idea of the messages we're trying to convey. Real linguists and
|
||||
graphic artists will probably sneer at these.
|
||||
3
scripts/newbitmaps/strings/de_devmode_text.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Die Überprüfung von Chrome OS ist deaktiviert.
|
||||
Drücken Sie die Leertaste,
|
||||
um mit der Wiederherstellung zu beginnen.
|
||||
2
scripts/newbitmaps/strings/de_insert_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Chrome OS ist nicht vorhanden oder beschädigt
|
||||
Bitte schließen Sie ein Wiederherstellungsgerät an.
|
||||
1
scripts/newbitmaps/strings/de_model.txt
Normal file
@@ -0,0 +1 @@
|
||||
Modell:
|
||||
2
scripts/newbitmaps/strings/de_remove_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Bitte entfernen Sie sämtliche USB- und SD-Geräte,
|
||||
um mit der Wiederherstellung zu beginnen.
|
||||
2
scripts/newbitmaps/strings/de_yuck_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Das angeschlossene Gerät enthält kein Chrome OS.
|
||||
Bitte versuchen Sie ein anderes.
|
||||
2
scripts/newbitmaps/strings/en_devmode_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Chrome OS verification is turned off.
|
||||
Press space to begin recovery.
|
||||
2
scripts/newbitmaps/strings/en_insert_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Chrome OS is missing or damaged.
|
||||
Please connect a recovery device.
|
||||
1
scripts/newbitmaps/strings/en_model.txt
Normal file
@@ -0,0 +1 @@
|
||||
Model:
|
||||
1
scripts/newbitmaps/strings/en_remove_text.txt
Normal file
@@ -0,0 +1 @@
|
||||
Please remove all USB and SD devices to begin recovery.
|
||||
1
scripts/newbitmaps/strings/en_yuck_text.txt
Normal file
@@ -0,0 +1 @@
|
||||
The device you inserted does not contain Chrome OS. Try another?
|
||||
2
scripts/newbitmaps/strings/es_devmode_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
La verificación del systema operativo esta apagada.
|
||||
Presione la barra de espacio para empezar el recobro del systema.
|
||||
2
scripts/newbitmaps/strings/es_insert_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
El systema operativo de Chrome falta o esta dañado.
|
||||
Por favor conecte un dispositivo de recobro del systema.
|
||||
1
scripts/newbitmaps/strings/es_model.txt
Normal file
@@ -0,0 +1 @@
|
||||
Modelo:
|
||||
1
scripts/newbitmaps/strings/es_remove_text.txt
Normal file
@@ -0,0 +1 @@
|
||||
Por favor quite todos los USB y SD para comenzar la recuperación del systema.
|
||||
2
scripts/newbitmaps/strings/es_yuck_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
El dispositivo que ha insertado no contiene es systema operativo de Chrome.
|
||||
¿Desea probar otro?
|
||||
2
scripts/newbitmaps/strings/fr_devmode_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
La vérification de Chrome OS est désactivée.
|
||||
Tappez la touche "espace" pour commencer la réparation.
|
||||
2
scripts/newbitmaps/strings/fr_insert_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Chrome OS est absent ou corrompu.
|
||||
Veuillez insérer un périphérique de réparation.
|
||||
1
scripts/newbitmaps/strings/fr_model.txt
Normal file
@@ -0,0 +1 @@
|
||||
Modèle:
|
||||
1
scripts/newbitmaps/strings/fr_remove_text.txt
Normal file
@@ -0,0 +1 @@
|
||||
Enlevez tous les périphériques USB et SD pour commencer la réparation.
|
||||
2
scripts/newbitmaps/strings/fr_yuck_text.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Le périphérique que vous avez inséré ne contient pas Chrome OS.
|
||||
Essayez un autre?
|
||||
1
scripts/newbitmaps/strings/hwid.txt
Normal file
@@ -0,0 +1 @@
|
||||
DANGER! UNOFFICIAL BIOS!
|
||||
53
scripts/newbitmaps/strings/text_to_bmp
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash -e
|
||||
# Copyright (c) 2011 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.
|
||||
#
|
||||
# Render a text file into a bitmap.
|
||||
#
|
||||
|
||||
# Image parameters
|
||||
bg='#607c91'
|
||||
bluecolor='#9ccaec'
|
||||
bluefont="Helvetica-Narrow"
|
||||
bluepointsize=19
|
||||
whitefont="Helvetica-Narrow"
|
||||
whitepointsize=30
|
||||
|
||||
|
||||
tmpdir=$(mktemp -d /tmp/tmp.bmp.XXXXXX)
|
||||
trap "rm -rf $tmpdir" EXIT
|
||||
label_file="${tmpdir}/label.txt"
|
||||
|
||||
for txtfile in $*; do
|
||||
bmpfile="${txtfile%.*}".bmp
|
||||
perl -p -e 'BEGIN{ $/=undef; }' \
|
||||
-e 's/^\s+//s;' -e 's/\s+$//s;' \
|
||||
"$txtfile" > "$label_file"
|
||||
|
||||
case "$txtfile" in
|
||||
*.txt)
|
||||
convert \
|
||||
-background "$bg" -fill "$bluecolor" \
|
||||
-font "$bluefont" -pointsize "$bluepointsize" \
|
||||
-bordercolor "$bg" -border 0x1 -gravity Center \
|
||||
label:'@'"$label_file" \
|
||||
-colors 256 -compress none -alpha off \
|
||||
"$bmpfile"
|
||||
echo "wrote $bmpfile"
|
||||
;;
|
||||
*.TXT)
|
||||
convert \
|
||||
-background "$bg" -fill "white" \
|
||||
-font "$whitefont" -pointsize "$whitepointsize" \
|
||||
-bordercolor "$bg" -border 0x10 -gravity Center \
|
||||
label:'@'"$label_file" \
|
||||
-colors 256 -compress none -alpha off \
|
||||
"$bmpfile"
|
||||
echo "wrote $bmpfile"
|
||||
;;
|
||||
*)
|
||||
echo "Ignoring $txtfile. Filname should end with .txt or .TXT"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
1
scripts/newbitmaps/strings/url.TXT
Normal file
@@ -0,0 +1 @@
|
||||
http://google.com/chromeos/recovery
|
||||