| OLD | NEW | 
|    1 This directory contains examples of the new-style BIOS bitmaps, and a simple |    1 This directory contains examples of the new-style BIOS bitmaps, and a simple | 
|    2 (and ugly) tool to view the configuration file that describes how each |    2 (and ugly) tool to view the configuration file that describes how each | 
|    3 screen is displayed. |    3 screen is displayed. | 
|    4  |    4  | 
|    5 Old-style bitmaps: |    5 Old-style bitmaps: | 
|    6  |    6  | 
|    7 In the Cr-48 BIOS there are four BIOS screens that may be presented to the |    7 In the Cr-48 BIOS there are four BIOS screens that may be presented to the | 
|    8 user. Each contains a graphic, a URL, and some informative text. The screens |    8 user. Each contains a graphic, a URL, and some informative text. The screens | 
|    9 are single bitmap images, hardcoded in read-only BIOS (because they have to |    9 are single bitmap images, hardcoded in read-only BIOS (because they have to | 
|   10 display even when the R/W BIOS and SSD are both completely erased). They can |   10 display even when the R/W BIOS and SSD are both completely erased). They can | 
|   11 be replaced at manufacturing time, but creating the screens is difficult. |   11 be replaced at manufacturing time, but creating the screens is difficult. | 
|   12 The format is a compressed EFI firmware volume that is generated when the |   12 The format is a compressed EFI firmware volume that is generated when the | 
|   13 BIOS is compiled. The result is an opaque blob that cannot be viewed or |   13 BIOS is compiled. The result is an opaque blob that cannot be viewed or | 
|   14 edited with linux-based tools. |   14 edited with linux-based tools. | 
|   15  |   15  | 
|   16  |   16  | 
|   17 New-style bitmaps: |   17 New-style bitmaps (version 1.0): | 
|   18  |   18  | 
|   19 Future BIOSes will continue to display the same basic screens, but using a |   19 Future BIOSes will continue to display the same basic screens, but using a | 
|   20 different format. Each screen will have separate bitmaps for the basic |   20 different format. Each screen has separate bitmaps for the basic graphic, | 
|   21 graphic, the URL, and the informative text, and will be displayed by |   21 the URL, and the informative text, and will be displayed by rendering each | 
|   22 rendering each component in order. This will allow us to modify and replace |   22 component in order. This will allow us to modify and replace any bitmap | 
|   23 any bitmap (most frequently the HWID), using standard command-line tools |   23 (most frequently the HWID), using standard command-line tools such as | 
|   24 such as imagemagick. Compositing each screen in this way also means that we |   24 imagemagick. Compositing each screen in this way also means that we can | 
|   25 can easily provide localized BIOS screens or custom messages. |   25 easily provide localized BIOS screens or custom messages. | 
|   26  |   26  | 
|   27  |   27  | 
|   28 Note: |   28 Note: | 
|   29  |   29  | 
|   30 Because the bitmap images and display code is part of the Read-Only BIOS, |   30 Because the bitmap images and display code is part of the Read-Only BIOS, | 
|   31 back-porting the new-style bitmaps to older devices is not possible. |   31 back-porting the new-style bitmaps to older devices is not possible. | 
|   32  |   32  | 
|   33  |   33  | 
|   34 Instructions: |   34 Manual instructions: | 
|   35  |   35  | 
|   36 The bmpblk_utility reads a config file and produces a binary bmpblock. The |   36 The bmpblk_utility reads a config file and produces a binary bmpblock. The | 
|   37 config file lists the individual bitmaps and describes where to place each |   37 config file lists the individual bitmaps and describes where to place each | 
|   38 one when displaying each screen. The bmpblock is then written into the BIOS |   38 one when displaying each screen. The bmpblock is then written into the BIOS | 
|   39 image with the gbb_utility. The bitmap_viewer program lets you view the |   39 image with the gbb_utility. The bitmap_viewer program lets you view the | 
|   40 composited screens as described by the config file. |   40 composited screens as described by the config file. | 
|   41  |   41  | 
|   42 * First, get the bitmap_viewer working. This is best used OUTSIDE of the |   42 * First, get the bitmap_viewer working. This is best used OUTSIDE of the | 
|   43   chroot. Test it by changing to the scripts/newbitmaps/images/1280x800 |   43   chroot. Test it by changing to the scripts/newbitmaps/images/1280x800 | 
|   44   directory and running "../../bitmap_viewer unknown.yaml". You may need to |   44   directory and running "../../bitmap_viewer hwid_unknown.yaml". You may | 
|   45   install some additional packages. For example, on Ubuntu you'll probably |   45   need to install some additional packages. For example, on Ubuntu you'll | 
|   46   need to install the "python-yaml" and "python-wxgtk2.8" packages. |   46   probably need to install the "python-yaml" and "python-wxgtk2.8" packages. | 
|   47  |   47  | 
|   48 * Now make changes to the unknown.yaml config file, and use the |   48 * Now make changes to the hwid_unknown.yaml config file, and use the | 
|   49   bitmap_viewer to see how the layout looks. Hit Ctrl-R in the small window |   49   bitmap_viewer to see how the layout looks. Hit Ctrl-R in the small window | 
|   50   to reload the config file without restarting. |   50   to reload the config file without restarting. | 
|   51  |   51  | 
|   52 * The bitmap_viewer can display images in several different formats, but the |   52 * The bitmap_viewer can display images in several different formats, but the | 
|   53   BIOS is very limited (and may differ between x86 and ARM). For x86, ensure |   53   BIOS is very limited (and may differ between x86 and ARM). For x86, ensure | 
|   54   that you're using the proper format by converting any new bitmaps with a |   54   that you're using the proper format by converting any new bitmaps with a | 
|   55   command like this: |   55   command like this: | 
|   56  |   56  | 
|   57     convert IN.bmp -colors 256 -compress none -alpha off OUT.bmp |   57     convert IN.bmp -colors 256 -compress none -alpha off OUT.bmp | 
|   58  |   58  | 
|   59 * When you have the screens tweaked to your satisfaction, generate the |   59 * When you have the screens tweaked to your satisfaction, generate the | 
|   60   binary bmpblock to embed into the BIOS. |   60   binary bmpblock to embed into the BIOS. | 
|   61  |   61  | 
|   62     bmpblk_utility -c unknown.yaml bmpblock.bin |   62     bmpblk_utility -c hwid_unknown.yaml bmpblock.bin | 
|   63  |   63  | 
|   64 * Use the gbb_utility to modify the BIOS to contain our new set of bitmaps. |   64 * Use the gbb_utility to modify the BIOS to contain our new set of bitmaps. | 
|   65  |   65  | 
|   66   NOTE: These commands are run (as root) on the device under test! |   66   NOTE: These commands are run (as root) on the device under test! | 
|   67  |   67  | 
|   68   NOTE: This will only work if the BIOS write-protection is disabled! |   68   NOTE: This will only work if the BIOS write-protection is disabled! | 
|   69  |   69  | 
|   70   Copy our new bmpblock over. |   70   Copy our new bmpblock over. | 
|   71  |   71  | 
|   72     cd /mnt/stateful_partition |   72     cd /mnt/stateful_partition | 
|   73     scp USER@SOMEHOST:/SOMEPATH/bmpblock.bin . |   73     scp USER@SOMEHOST:/SOMEPATH/bmpblock.bin . | 
|   74  |   74  | 
|   75   Get a copy of the current BIOS. |   75   Get a copy of the current BIOS. | 
|   76  |   76  | 
|   77     flashrom -r bios.bin |   77     flashrom -p internal:bus=spi -r bios.bin | 
|   78  |   78  | 
|   79   Put our bmpblock in our copy of the BIOS |   79   Put our bmpblock in our copy of the BIOS | 
|   80  |   80  | 
|   81     gbb_utility -s -b bmpblock.bin bios.bin |   81     gbb_utility -s -b bmpblock.bin bios.bin | 
|   82  |   82  | 
|   83   Reflash the BIOS with the new content |   83   Reflash the BIOS with the new content | 
|   84  |   84  | 
|   85     flashrom -w bios.bin |   85     flashrom -p internal:bus=spi -w bios.bin | 
|   86  |   86  | 
|   87 * Reboot. You should see your new bitmaps appear whenever the BIOS screens |   87 * Reboot. You should see your new bitmaps appear whenever the BIOS screens | 
|   88   are displayed. If you have more than one localization, you should be able |   88   are displayed. If you have more than one localization, you should be able | 
|   89   to cycle among them with the arrow keys. |   89   to cycle among them with the arrow keys. | 
|   90  |   90  | 
|   91 * If you want to examine a binary bmpblock that you've pulled from a BIOS |   91 * If you want to examine a binary bmpblock that you've pulled from a BIOS | 
|   92   image, the bmpblk_utility has options to display or unpack the binary. |   92   image, the bmpblk_utility has options to display or unpack the binary. | 
|   93  |   93  | 
|   94     bmpblk_utility bmpblock.bin |   94     bmpblk_utility bmpblock.bin | 
|   95  |   95  | 
|   96     bmpblk_utility -y bmpblock.bin |   96     bmpblk_utility -y bmpblock.bin | 
|   97  |   97  | 
|   98     bmpblk_utility -x -d /SOME/SCRATCH/DIR bmpblock.bin |   98     bmpblk_utility -x -d /SOME/SCRATCH/DIR bmpblock.bin | 
 |   99  | 
 |  100  Once you've unpacked it you can use the bitmap_viewer on the unpacked yaml | 
 |  101  file to see what it looks like. There's not (yet) a single tool that just | 
 |  102  displays the raw binary. | 
 |  103  | 
 |  104  | 
 |  105  | 
 |  106 Automated instructions: | 
 |  107  | 
 |  108 If you've got a LOT of HWIDs to generate, this is one way to do it. You can | 
 |  109 do this entirely outside of the chroot if you've built vboot_reference | 
 |  110 natively and put the resulting binaries into your $PATH. | 
 |  111  | 
 |  112  | 
 |  113 * First, we generate the strings and bitmaps for each HWID: | 
 |  114  | 
 |  115     cd ./strings | 
 |  116     mkdir ./hwids | 
 |  117     cd ./hwids | 
 |  118  | 
 |  119   Put the list of new HWIDs strings into a file 'w': | 
 |  120  | 
 |  121     SAMS ALEX ALPHA-US | 
 |  122     SAMS ALEX ALPHA-GB | 
 |  123     SAMS ALEX ALPHA-FR | 
 |  124     SAMS ALEX ALPHA-DE | 
 |  125     SAMS ALEX ALPHA-ES | 
 |  126  | 
 |  127   You need to generate the HWID checksum numbers. I wrote this script, named | 
 |  128   'hwidsum', to append the digits to the string: | 
 |  129  | 
 |  130     #!/usr/bin/python | 
 |  131     import sys,zlib; | 
 |  132     me=' '.join(sys.argv[1:]); | 
 |  133     print me, ('%04u'%(zlib.crc32(me)&0xffffffffL))[-4:] | 
 |  134  | 
 |  135  | 
 |  136   Run another script like this to generate the checksums for the whole list: | 
 |  137  | 
 |  138     #!/bin/bash | 
 |  139     while read STUFF; do | 
 |  140       full=$(hwidsum "$STUFF") | 
 |  141       str=$(echo "HWID ${full}" | sed 's/ /_/g').txt | 
 |  142       echo "$full" > "$str" | 
 |  143     done < w | 
 |  144  | 
 |  145  | 
 |  146   And now convert the text files into bmps: | 
 |  147  | 
 |  148     ../text_to_bmp *.txt | 
 |  149  | 
 |  150  | 
 |  151 * Move those HWID bmp files to the appropriate images directory: | 
 |  152  | 
 |  153     pushd ../../images/1280x800/ | 
 |  154     mkdir ./hwids | 
 |  155     mv ~1/*.bmp ./hwids/ | 
 |  156  | 
 |  157  | 
 |  158 * Generate the yaml files for all these new HWIDs: | 
 |  159  | 
 |  160     ../make_yaml_from_hwids hwids/*.bmp | 
 |  161  | 
 |  162  | 
 |  163 * Look at them with the bitmap viewer if you want. | 
 |  164  | 
 |  165     ../../bitmap_viewer hwid_sams_alex_alpha-us_4504.yaml | 
 |  166  | 
 |  167  | 
 |  168 * Convert the yaml files into bitmap blobs: | 
 |  169  | 
 |  170     for i in *.yaml; do bmpblk_utility -c $i ${i%.yaml}.bin; done | 
 |  171  | 
 |  172  | 
 |  173 * Test the bitmaps on a running system: | 
 |  174  | 
 |  175   As root on an Alex, for example, you'd say something like this: | 
 |  176  | 
 |  177     stop update-engine | 
 |  178     cd /mnt/stateful_partition | 
 |  179     flashrom -p internal:bus=spi -r bios.rom | 
 |  180     scp USER@HOST:/SOME/PATH/TO/hwid_sams_alex_alpha-us_4504.bin . | 
 |  181     gbb_utility -s \ | 
 |  182       -i 'SAMS ALEX ALPHA-US 4504' \ | 
 |  183       -b hwid_sams_alex_alpha-us_4504.bin | 
 |  184       bios.rom newbios.rom | 
 |  185     flashrom -p internal:bus=spi -w newbios.rom | 
 |  186  | 
 |  187   Then reboot and see what happens. | 
| OLD | NEW |