| Index: scripts/newbitmaps/README
 | 
| diff --git a/scripts/newbitmaps/README b/scripts/newbitmaps/README
 | 
| index d07be4ddcf4c6b7bf7a869f2cdbeb175777de647..bc8cb8f93fbc831b1687fec868205b5cf344ccbd 100644
 | 
| --- a/scripts/newbitmaps/README
 | 
| +++ b/scripts/newbitmaps/README
 | 
| @@ -14,15 +14,15 @@ BIOS is compiled. The result is an opaque blob that cannot be viewed or
 | 
|  edited with linux-based tools.
 | 
|  
 | 
|  
 | 
| -New-style bitmaps:
 | 
| +New-style bitmaps (version 1.0):
 | 
|  
 | 
|  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.
 | 
| +different format. Each screen has 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:
 | 
| @@ -31,7 +31,7 @@ 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:
 | 
| +Manual 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
 | 
| @@ -41,11 +41,11 @@ 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.
 | 
| +  directory and running "../../bitmap_viewer hwid_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
 | 
| +* Now make changes to the hwid_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.
 | 
|  
 | 
| @@ -59,7 +59,7 @@ composited screens as described by the config file.
 | 
|  * 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
 | 
| +    bmpblk_utility -c hwid_unknown.yaml bmpblock.bin
 | 
|  
 | 
|  * Use the gbb_utility to modify the BIOS to contain our new set of bitmaps.
 | 
|  
 | 
| @@ -74,7 +74,7 @@ composited screens as described by the config file.
 | 
|  
 | 
|    Get a copy of the current BIOS.
 | 
|  
 | 
| -    flashrom -r bios.bin
 | 
| +    flashrom -p internal:bus=spi -r bios.bin
 | 
|  
 | 
|    Put our bmpblock in our copy of the BIOS
 | 
|  
 | 
| @@ -82,7 +82,7 @@ composited screens as described by the config file.
 | 
|  
 | 
|    Reflash the BIOS with the new content
 | 
|  
 | 
| -    flashrom -w bios.bin
 | 
| +    flashrom -p internal:bus=spi -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
 | 
| @@ -96,3 +96,92 @@ composited screens as described by the config file.
 | 
|      bmpblk_utility -y 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
 | 
| + file to see what it looks like. There's not (yet) a single tool that just
 | 
| + displays the raw binary.
 | 
| +
 | 
| +
 | 
| +
 | 
| +Automated instructions:
 | 
| +
 | 
| +If you've got a LOT of HWIDs to generate, this is one way to do it. You can
 | 
| +do this entirely outside of the chroot if you've built vboot_reference
 | 
| +natively and put the resulting binaries into your $PATH.
 | 
| +
 | 
| +
 | 
| +* First, we generate the strings and bitmaps for each HWID:
 | 
| +
 | 
| +    cd ./strings
 | 
| +    mkdir ./hwids
 | 
| +    cd ./hwids
 | 
| +
 | 
| +  Put the list of new HWIDs strings into a file 'w':
 | 
| +
 | 
| +    SAMS ALEX ALPHA-US
 | 
| +    SAMS ALEX ALPHA-GB
 | 
| +    SAMS ALEX ALPHA-FR
 | 
| +    SAMS ALEX ALPHA-DE
 | 
| +    SAMS ALEX ALPHA-ES
 | 
| +
 | 
| +  You need to generate the HWID checksum numbers. I wrote this script, named
 | 
| +  'hwidsum', to append the digits to the string:
 | 
| +
 | 
| +    #!/usr/bin/python
 | 
| +    import sys,zlib;
 | 
| +    me=' '.join(sys.argv[1:]);
 | 
| +    print me, ('%04u'%(zlib.crc32(me)&0xffffffffL))[-4:]
 | 
| +
 | 
| +
 | 
| +  Run another script like this to generate the checksums for the whole list:
 | 
| +
 | 
| +    #!/bin/bash
 | 
| +    while read STUFF; do
 | 
| +      full=$(hwidsum "$STUFF")
 | 
| +      str=$(echo "HWID ${full}" | sed 's/ /_/g').txt
 | 
| +      echo "$full" > "$str"
 | 
| +    done < w
 | 
| +
 | 
| +
 | 
| +  And now convert the text files into bmps:
 | 
| +
 | 
| +    ../text_to_bmp *.txt
 | 
| +
 | 
| +
 | 
| +* Move those HWID bmp files to the appropriate images directory:
 | 
| +
 | 
| +    pushd ../../images/1280x800/
 | 
| +    mkdir ./hwids
 | 
| +    mv ~1/*.bmp ./hwids/
 | 
| +
 | 
| +
 | 
| +* Generate the yaml files for all these new HWIDs:
 | 
| +
 | 
| +    ../make_yaml_from_hwids hwids/*.bmp
 | 
| +
 | 
| +
 | 
| +* Look at them with the bitmap viewer if you want.
 | 
| +
 | 
| +    ../../bitmap_viewer hwid_sams_alex_alpha-us_4504.yaml
 | 
| +
 | 
| +
 | 
| +* Convert the yaml files into bitmap blobs:
 | 
| +
 | 
| +    for i in *.yaml; do bmpblk_utility -c $i ${i%.yaml}.bin; done
 | 
| +
 | 
| +
 | 
| +* Test the bitmaps on a running system:
 | 
| +
 | 
| +  As root on an Alex, for example, you'd say something like this:
 | 
| +
 | 
| +    stop update-engine
 | 
| +    cd /mnt/stateful_partition
 | 
| +    flashrom -p internal:bus=spi -r bios.rom
 | 
| +    scp USER@HOST:/SOME/PATH/TO/hwid_sams_alex_alpha-us_4504.bin .
 | 
| +    gbb_utility -s \
 | 
| +      -i 'SAMS ALEX ALPHA-US 4504' \
 | 
| +      -b hwid_sams_alex_alpha-us_4504.bin
 | 
| +      bios.rom newbios.rom
 | 
| +    flashrom -p internal:bus=spi -w newbios.rom
 | 
| +
 | 
| +  Then reboot and see what happens.
 | 
| 
 |