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>
diff --git a/utility/bmpblk_util.c b/utility/bmpblk_util.c
index 84a48fb..49573af 100644
--- a/utility/bmpblk_util.c
+++ b/utility/bmpblk_util.c
@@ -285,20 +285,23 @@
if (img->compressed_size) {
sprintf(image_name, "img_%08x.bmp", offset);
if (img->tag == TAG_HWID) {
- fprintf(yfp, " %s: %s # %dx%d %d/%d tag=%d\n",
+ fprintf(yfp, " %s: %s # %dx%d %d/%d tag=%d fmt=%d\n",
RENDER_HWID, image_name,
img->width, img->height,
- img->compressed_size, img->original_size, img->tag);
+ img->compressed_size, img->original_size,
+ img->tag, img->format);
} else if (img->tag == TAG_HWID_RTOL) {
- fprintf(yfp, " %s: %s # %dx%d %d/%d tag=%d\n",
+ fprintf(yfp, " %s: %s # %dx%d %d/%d tag=%d fmt=%d\n",
RENDER_HWID_RTOL, image_name,
img->width, img->height,
- img->compressed_size, img->original_size, img->tag);
+ img->compressed_size, img->original_size,
+ img->tag, img->format);
} else {
- fprintf(yfp, " img_%08x: %s # %dx%d %d/%d tag=%d\n",
+ fprintf(yfp, " img_%08x: %s # %dx%d %d/%d tag=%d fmt=%d\n",
offset, image_name,
img->width, img->height,
- img->compressed_size, img->original_size, img->tag);
+ img->compressed_size, img->original_size,
+ img->tag, img->format);
}
if (todir) {
sprintf(full_path_name, "%s/%s", todir, image_name);
@@ -388,17 +391,23 @@
ImageInfo *iptr =
(ImageInfo *)(ptr + scr->images[i].image_info_offset);
if (iptr->tag == TAG_HWID) {
- fprintf(yfp, " - [%d, %d, %s]\n",
+ fprintf(yfp, " - [%d, %d, %s] # tag=%d fmt=%d c=%d %d/%d\n",
scr->images[i].x, scr->images[i].y,
- RENDER_HWID);
+ RENDER_HWID, iptr->tag, iptr->format, iptr->compression,
+ iptr->compressed_size, iptr->original_size);
} else if (iptr->tag == TAG_HWID_RTOL) {
- fprintf(yfp, " - [%d, %d, %s]\n",
+ fprintf(yfp, " - [%d, %d, %s] # tag=%d fmt=%d c=%d %d/%d\n",
scr->images[i].x, scr->images[i].y,
- RENDER_HWID_RTOL);
+ RENDER_HWID_RTOL, iptr->tag,
+ iptr->format, iptr->compression,
+ iptr->compressed_size, iptr->original_size);
} else {
- fprintf(yfp, " - [%d, %d, img_%08x]\n",
+ fprintf(yfp, " - [%d, %d, img_%08x]"
+ " # tag=%d fmt=%d c=%d %d/%d\n",
scr->images[i].x, scr->images[i].y,
- scr->images[i].image_info_offset);
+ scr->images[i].image_info_offset,
+ iptr->tag, iptr->format, iptr->compression,
+ iptr->compressed_size, iptr->original_size);
}
}
}