Files
OpenCellular/firmware/lib/include/bmpblk_font.h
Bill Richardson 0a9977e161 bmpblock v1.2 - render HWID inside vboot_reference
The vboot_api.h doesn't require the BIOS display the ASCII HWID in
a graphical form (ARM U-Boot doesn't know how), so we have to do it
ourselves. This change makes that possible.

Summary of changes:
* bmpblk_font.h defines a structure to map ASCII chars to BMPs
* bmpblk_font utility generates that font structure
* bmpblock format is bumped to version 1.2
  - YAML file specifies font to use for $HWID
  - make_default_yaml updated to emit the new format
  - README updated to describe the difference

BUG=chromium-os:18631
TEST=manual

I've tested this on ARM, like so:

Inside the chroot, build a U-Boot that uses it:

  emerge-tegra2_kaen vboot_reference vboot_reference-firmware
  emerge-tegra2_kaen tegra-bct tegra2-public-firmware-fdts \
                     chromeos-u-boot chromeos-bootimage

Outside chroot, but in src/platform/vboot_reference:

  make
  <copy ./build/utility/bmpblk_font and ./build/utility/bmpblk_utility to
    somewhere in your $PATH>
  make clean

  cd scripts/newbitmaps/fonts
  bmpblk_font --outfile ../images/hwid_fonts.bin outdir/*

  cd scripts/newbitmaps/images
  make arm
  cd out_arm
  <edit DEFAULT.yaml>
  bmpblk_utility -z 2 -c DEFAULT.yaml arm_bmpblock.bin

  <use gbb_utility to replace the bitmaps in the U-Boot image, boot it>

The HWID string is displayed.

Change-Id: I782004a0f30c57fa1f3bb246e8c59a02c5e9f561
Reviewed-on: http://gerrit.chromium.org/gerrit/6544
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-24 09:27:12 -07:00

66 lines
2.2 KiB
C

/* 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.
*
* This describes the internal format used to pack a set of character glpyhs so
* we can render strings by drawing one character at a time.
*
* The format is this:
*
* +-------------------------+
* | FontArrayHeader |
* +-------------------------+
* | FontArrayEntryHeader[0] |
* +-------------------------+
* | raw image data[0] |
* +-------------------------+
* | FontArrayEntryHeader[1] |
* +-------------------------+
* | raw image data[1] |
* +-------------------------+
* | FontArrayEntryHeader[2] |
* +-------------------------+
* | raw image data[2] |
* +-------------------------+
* ...
* +-------------------------+
* | FontArrayEntryHeader[n] |
* +-------------------------+
* | raw image data[n] |
* +-------------------------+
*
* The FontArrayHeader describes how many characters will be encoded.
* Each character encoding consists of a FontArrayEntryHeader followed
* immediately by the raw image data for that character.
*/
#ifndef VBOOT_REFERENCE_BMPBLK_FONT_H_
#define VBOOT_REFERENCE_BMPBLK_FONT_H_
#include "bmpblk_header.h"
__pragma(pack(push, 1)) /* Support packing for MSVC. */
#define FONT_SIGNATURE "FONT"
#define FONT_SIGNATURE_SIZE 4
typedef struct FontArrayHeader {
uint8_t signature[FONT_SIGNATURE_SIZE];
uint32_t num_entries; /* Number of chars encoded here. */
} __attribute__((packed)) FontArrayHeader;
typedef struct FontArrayEntryHeader {
uint32_t ascii; /* What to show. Could even be UTF? */
ImageInfo info; /* Describes the bitmap. */
/* The image to use follows immediately, NOT compressed. It's uncompressed
* because each glyph is only a few hundred bytes, but they have much in
* common (colormaps, for example). When we add the whole font blob to the
* bmpblk, it will be compressed as a single item there.
*/
} __attribute__((packed)) FontArrayEntryHeader;
__pragma(pack(pop)) /* Support packing for MSVC. */
#endif /* VBOOT_REFERENCE_BMPBLK_FONT_H_ */