| Index: src/platform/vboot_reference/cgptlib/cgpt.c
|
| diff --git a/src/platform/vboot_reference/cgptlib/cgpt.c b/src/platform/vboot_reference/cgptlib/cgpt.c
|
| index 4504a618a548a5c109bd7aae2d7b7d5431959565..48654731773c42ab2ea9e4dbeedd90ab6c93f948 100644
|
| --- a/src/platform/vboot_reference/cgptlib/cgpt.c
|
| +++ b/src/platform/vboot_reference/cgptlib/cgpt.c
|
| @@ -4,24 +4,42 @@
|
| */
|
|
|
| #include "cgpt.h"
|
| +#include <string.h>
|
| +#include "gpt.h"
|
| +#include "utility.h"
|
|
|
| /* stub code */
|
| static int start[] = { 34, 10034 };
|
|
|
| -int GPTInit(GPTData_t *gpt) {
|
| +int GptInit(GptData_t *gpt) {
|
| + int valid_headers[2] = {1, 1};
|
| +
|
| + /* check header signature */
|
| + if (Memcmp(gpt->primary_header, GPT_HEADER_SIGNATURE,
|
| + GPT_HEADER_SIGNATURE_SIZE))
|
| + valid_headers[0] = 0;
|
| + if (Memcmp(gpt->secondary_header, GPT_HEADER_SIGNATURE,
|
| + GPT_HEADER_SIGNATURE_SIZE))
|
| + valid_headers[1] = 0;
|
| +
|
| + if (!valid_headers[0] && !valid_headers[1])
|
| + return GPT_ERROR_INVALID_HEADERS;
|
| +
|
| gpt->current_kernel = 1;
|
| - return 0;
|
| + return GPT_SUCCESS;
|
| }
|
|
|
| -int GPTNextKernelEntry(GPTData_t *gpt, uint64_t *start_sector, uint64_t *size) {
|
| +int GptNextKernelEntry(GptData_t *gpt, uint64_t *start_sector, uint64_t *size) {
|
| + /* FIXME: the following code is not really code, just returns anything */
|
| gpt->current_kernel ^= 1;
|
| if (start_sector) *start_sector = start[gpt->current_kernel];
|
| if (size) *size = 10000;
|
| - return 0;
|
| + return GPT_SUCCESS;
|
| }
|
|
|
| -int GPTUpdateKernelEntry(GPTData_t *gpt, uint32_t update_type) {
|
| +int GptUpdateKernelEntry(GptData_t *gpt, uint32_t update_type) {
|
| + /* FIXME: the following code is not really code, just return anything */
|
| gpt->modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1) <<
|
| gpt->current_kernel;
|
| - return 0;
|
| + return GPT_SUCCESS;
|
| }
|
|
|