OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Utility for manipulating firmware screen block (BMPBLOCK) in GBB. | 5 // Utility for manipulating firmware screen block (BMPBLOCK) in GBB. |
6 // | 6 // |
7 | 7 |
8 #include "bmpblk_utility.h" | 8 #include "bmpblk_utility.h" |
9 | 9 |
10 #include <assert.h> | 10 #include <assert.h> |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 config_.localizations[i].size()); | 469 config_.localizations[i].size()); |
470 } | 470 } |
471 config_.header.number_of_imageinfos = config_.images_map.size(); | 471 config_.header.number_of_imageinfos = config_.images_map.size(); |
472 } | 472 } |
473 | 473 |
474 void BmpBlockUtil::pack_bmpblock() { | 474 void BmpBlockUtil::pack_bmpblock() { |
475 bmpblock_.clear(); | 475 bmpblock_.clear(); |
476 | 476 |
477 /* Compute the ImageInfo offsets from start of BMPBLOCK. */ | 477 /* Compute the ImageInfo offsets from start of BMPBLOCK. */ |
478 uint32_t current_offset = sizeof(BmpBlockHeader) + | 478 uint32_t current_offset = sizeof(BmpBlockHeader) + |
479 sizeof(ScreenLayout) * config_.screens_map.size(); | 479 sizeof(ScreenLayout) * (config_.header.number_of_localizations * |
| 480 config_.header.number_of_screenlayouts); |
480 for (unsigned int i = 0; i < config_.image_names.size(); ++i) { | 481 for (unsigned int i = 0; i < config_.image_names.size(); ++i) { |
481 string image_name = config_.image_names[i]; | 482 string image_name = config_.image_names[i]; |
482 ImageConfig &img = config_.images_map[image_name]; | 483 ImageConfig &img = config_.images_map[image_name]; |
483 img.offset = current_offset; | 484 img.offset = current_offset; |
484 current_offset += sizeof(ImageInfo) + | 485 current_offset += sizeof(ImageInfo) + |
485 config_.images_map[image_name].data.compressed_size; | 486 config_.images_map[image_name].data.compressed_size; |
486 /* Make it 4-byte aligned. */ | 487 /* Make it 4-byte aligned. */ |
487 if ((current_offset & 3) > 0) { | 488 if ((current_offset & 3) > 0) { |
488 current_offset = (current_offset & ~3) + 4; | 489 current_offset = (current_offset & ~3) + 4; |
489 } | 490 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 else if (extract_mode) { | 681 else if (extract_mode) { |
681 return dump_bmpblock(bmpblock_fn, 1, extract_dir, overwrite); | 682 return dump_bmpblock(bmpblock_fn, 1, extract_dir, overwrite); |
682 } else { | 683 } else { |
683 return dump_bmpblock(bmpblock_fn, show_as_yaml, 0, 0); | 684 return dump_bmpblock(bmpblock_fn, show_as_yaml, 0, 0); |
684 } | 685 } |
685 | 686 |
686 return 0; | 687 return 0; |
687 } | 688 } |
688 | 689 |
689 #endif // WITH_UTIL_MAIN | 690 #endif // WITH_UTIL_MAIN |
OLD | NEW |