mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Provide implementations for "boot" and "legacy" that error out in MTD mode and "repair" that is a no-op. Eventually if/when we add redundancy, repair will do something, but boot/legacy never will. BUG=chromium:221745 BRANCH=none TEST=none Original-Change-Id: Ie537f20d8dff9d14fb83d0431bd48453bff0217d Reviewed-on: https://gerrit.chromium.org/gerrit/46883 Commit-Queue: Albert Chaulk <achaulk@chromium.org> Reviewed-by: Albert Chaulk <achaulk@chromium.org> Tested-by: Albert Chaulk <achaulk@chromium.org> (cherry picked from commit 00c4bc52e35c7c77ebe73322693a457b3dd072f9) Change-Id: I90e6118114554a05245fb8cfcec9567c4705ea96 Reviewed-on: https://gerrit.chromium.org/gerrit/49790 Reviewed-by: Albert Chaulk <achaulk@chromium.org> Tested-by: Albert Chaulk <achaulk@chromium.org> Commit-Queue: Albert Chaulk <achaulk@chromium.org>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
// Copyright (c) 2012 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.
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "cgpt.h"
|
|
#include "cgptlib_internal.h"
|
|
#include "vboot_host.h"
|
|
|
|
int CgptRepair(CgptRepairParams *params) {
|
|
struct drive drive;
|
|
|
|
if (params == NULL)
|
|
return CGPT_FAILED;
|
|
|
|
if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR))
|
|
return CGPT_FAILED;
|
|
|
|
if (drive.is_mtd) {
|
|
// Nothing to do
|
|
DriveClose(&drive, 0);
|
|
return 0;
|
|
}
|
|
|
|
int gpt_retval = GptSanityCheck(&drive.gpt);
|
|
if (params->verbose)
|
|
printf("GptSanityCheck() returned %d: %s\n",
|
|
gpt_retval, GptError(gpt_retval));
|
|
|
|
GptRepair(&drive.gpt);
|
|
if (drive.gpt.modified & GPT_MODIFIED_HEADER1)
|
|
printf("Primary Header is updated.\n");
|
|
if (drive.gpt.modified & GPT_MODIFIED_ENTRIES1)
|
|
printf("Primary Entries is updated.\n");
|
|
if (drive.gpt.modified & GPT_MODIFIED_ENTRIES2)
|
|
printf("Secondary Entries is updated.\n");
|
|
if (drive.gpt.modified & GPT_MODIFIED_HEADER2)
|
|
printf("Secondary Header is updated.\n");
|
|
|
|
return DriveClose(&drive, 1);
|
|
}
|