mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.
BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD \
vboot_reference \
chromeos-cryptohome \
chromeos-installer \
chromeos-u-boot \
peach-u-boot \
depthcharge
Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
ChromeBot
parent
28b65ca99f
commit
0c3ba249ab
15
Makefile
15
Makefile
@@ -160,6 +160,9 @@ endif
|
||||
# Create / use dependency files
|
||||
CFLAGS += -MMD -MF $@.d
|
||||
|
||||
# These are required to access large disks and files on 32-bit systems.
|
||||
CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
|
||||
# Code coverage
|
||||
ifneq (${COV},)
|
||||
COV_FLAGS = -O0 --coverage
|
||||
@@ -660,7 +663,8 @@ hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main
|
||||
|
||||
${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
|
||||
-Ihost/include \
|
||||
-Ihost/arch/${ARCH}/include
|
||||
-Ihost/arch/${ARCH}/include \
|
||||
-Ihost/lib/include
|
||||
|
||||
# TODO: better way to make .a than duplicating this recipe each time?
|
||||
${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS}
|
||||
@@ -687,6 +691,8 @@ ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS}
|
||||
.PHONY: cgpt
|
||||
cgpt: ${CGPT}
|
||||
|
||||
${CGPT_OBJS}: INCLUDES += -Ihost/include
|
||||
|
||||
${CGPT}: LDFLAGS += -static
|
||||
${CGPT}: LDLIBS += -luuid
|
||||
|
||||
@@ -704,7 +710,10 @@ cgpt_install: ${CGPT}
|
||||
# Utilities
|
||||
|
||||
# These have their own headers too.
|
||||
${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
|
||||
${BUILD}/utility/%: INCLUDES += \
|
||||
-Ihost/include \
|
||||
-Ihost/lib/include \
|
||||
-Iutility/include
|
||||
|
||||
# Utilities for auto-update toolkits must be statically linked.
|
||||
${UTIL_BINS_STATIC}: LDFLAGS += -static
|
||||
@@ -855,7 +864,7 @@ ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o
|
||||
|
||||
# Allow multiple definitions, so tests can mock functions from other libraries
|
||||
${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
|
||||
${BUILD}/tests/%: INCLUDES += -Ihost/include
|
||||
${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include
|
||||
${BUILD}/tests/%: LDLIBS += -lrt -luuid
|
||||
${BUILD}/tests/%: LIBS += ${TESTLIB}
|
||||
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
* files for more details.
|
||||
*/
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
const char* progname;
|
||||
const char* command;
|
||||
void (*uuid_generator)(uint8_t* buffer);
|
||||
|
||||
25
cgpt/cgpt.h
25
cgpt/cgpt.h
@@ -5,11 +5,6 @@
|
||||
#ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
|
||||
#define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <fcntl.h>
|
||||
#include <features.h>
|
||||
#include <stdint.h>
|
||||
@@ -20,13 +15,6 @@
|
||||
#include "cgptlib.h"
|
||||
|
||||
|
||||
// Just for clarity
|
||||
enum {
|
||||
CGPT_OK = 0,
|
||||
CGPT_FAILED,
|
||||
};
|
||||
|
||||
|
||||
struct legacy_partition {
|
||||
uint8_t status;
|
||||
uint8_t f_head;
|
||||
@@ -67,19 +55,6 @@ int DriveOpen(const char *drive_path, struct drive *drive, int mode);
|
||||
int DriveClose(struct drive *drive, int update_as_needed);
|
||||
int CheckValid(const struct drive *drive);
|
||||
|
||||
/* GUID conversion functions. Accepted format:
|
||||
*
|
||||
* "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
|
||||
*
|
||||
* At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
|
||||
* '\0').
|
||||
*/
|
||||
#define GUID_STRLEN 37
|
||||
int StrToGuid(const char *str, Guid *guid);
|
||||
void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
|
||||
int GuidEqual(const Guid *guid1, const Guid *guid2);
|
||||
int GuidIsZero(const Guid *guid);
|
||||
|
||||
/* Constant global type values to compare against */
|
||||
extern const Guid guid_chromeos_firmware;
|
||||
extern const Guid guid_chromeos_kernel;
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "utility.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static const char* DumpCgptAddParams(const CgptAddParams *params) {
|
||||
static char buf[256];
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "cgpt_params.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "endian.h"
|
||||
|
||||
#include "vboot_host.h"
|
||||
|
||||
int CgptGetBootPartitionNumber(CgptBootParams *params) {
|
||||
struct drive drive;
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
* files for more details.
|
||||
*/
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
@@ -22,8 +20,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "crc32.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
void Error(const char *format, ...) {
|
||||
va_list ap;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
int CgptCreate(CgptCreateParams *params) {
|
||||
struct drive drive;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
// FIXME: currently we only support 512-byte sectors.
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
int CgptLegacy(CgptLegacyParams *params) {
|
||||
struct drive drive;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// We need a sorted list of priority groups, where each element in the list
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
int CgptRepair(CgptRepairParams *params) {
|
||||
struct drive drive;
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "cgpt_params.h"
|
||||
#include "crc32.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
/* Generate output like:
|
||||
*
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <string.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cgpt_params.h"
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cgpt.h"
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include "cgpt_params.h"
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "vboot_host.h"
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
|
||||
@@ -41,11 +41,9 @@
|
||||
* | List of locale names |
|
||||
* +-----------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_REFERENCE_BMPBLK_HEADER_H_
|
||||
#define VBOOT_REFERENCE_BMPBLK_HEADER_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define BMPBLOCK_SIGNATURE "$BMP"
|
||||
#define BMPBLOCK_SIGNATURE_SIZE (4)
|
||||
@@ -130,14 +128,6 @@ typedef enum ImageFormat {
|
||||
FORMAT_FONT,
|
||||
} ImageFormat;
|
||||
|
||||
/* Constants for ImageInfo.compression */
|
||||
typedef enum Compression {
|
||||
COMPRESS_NONE = 0,
|
||||
COMPRESS_EFIv1, /* The x86 BIOS only supports this */
|
||||
COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
|
||||
MAX_COMPRESS,
|
||||
} Compression;
|
||||
|
||||
/*
|
||||
* These magic image names can be used in the .yaml file to indicate that the
|
||||
* ASCII HWID should be displayed. For RENDER_HWID, the image coordinates
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
*
|
||||
* Data structure of Google Binary Block (GBB)
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_REFERENCE_GBB_HEADER_H_
|
||||
#define VBOOT_REFERENCE_GBB_HEADER_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define GBB_HEADER_SIZE 128
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
*/
|
||||
#ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_
|
||||
#define VBOOT_REFERENCE_CGPTLIB_GPT_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define GPT_HEADER_SIGNATURE "EFI PART"
|
||||
#define GPT_HEADER_SIGNATURE2 "CHROMEOS"
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#ifndef TPM_LITE_TLCL_H_
|
||||
#define TPM_LITE_TLCL_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "tss_constants.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
* Some TPM constants and type definitions for standalone compilation for use
|
||||
* in the firmware
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
|
||||
#define VBOOT_REFERENCE_TSS_CONSTANTS_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define TPM_MAX_COMMAND_SIZE 4096
|
||||
#define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
#ifndef VBOOT_REFERENCE_VBOOT_API_H_
|
||||
#define VBOOT_REFERENCE_VBOOT_API_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "bmpblk_header.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Error codes */
|
||||
@@ -814,6 +812,14 @@ VbError_t VbExDecompress(void *inbuf, uint32_t in_size,
|
||||
uint32_t compression_type,
|
||||
void *outbuf, uint32_t *out_size);
|
||||
|
||||
/* Constants for compression_type */
|
||||
enum {
|
||||
COMPRESS_NONE = 0,
|
||||
COMPRESS_EFIv1, /* The x86 BIOS only supports this */
|
||||
COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
|
||||
MAX_COMPRESS,
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute legacy boot option.
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#ifndef VBOOT_REFERENCE_NVSTORAGE_H_
|
||||
#define VBOOT_REFERENCE_NVSTORAGE_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#define VBNV_BLOCK_SIZE 16 /* Size of NV storage block in bytes */
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_
|
||||
#define VBOOT_REFERENCE_VBOOT_STRUCT_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* Public key data */
|
||||
typedef struct VbPublicKey {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cgptlib.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "crc32.h"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cgptlib.h"
|
||||
#include "cgptlib_internal.h"
|
||||
#include "crc32.h"
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
/* polynomial $edb88320 */
|
||||
/* */
|
||||
/* -------------------------------------------------------------------- */
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "crc32.h"
|
||||
|
||||
static uint32_t crc32_tab[] = {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "crc8.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* arrays corresponding to various combinations of algorithms for RSA signatures.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* support multiple RSA key lengths and hash digest algorithms.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "vboot_api.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Implementation of RSA utility functions.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "stateful_util.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* Open Source Project (platorm/system/core.git/libmincrypt/sha.c
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Utility functions for message digest functions.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "utility.h"
|
||||
#include "vboot_api.h"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
|
||||
#define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "vboot_api.h"
|
||||
#include "vboot_nvstorage.h"
|
||||
#include "vboot_struct.h"
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
|
||||
#define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
|
||||
|
||||
#include "sysincludes.h"
|
||||
#include "vboot_api.h"
|
||||
#include "vboot_nvstorage.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* stored in the TPM NVRAM.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "rollback_index.h"
|
||||
|
||||
#include "tss_constants.h"
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
* Functions for updating the TPM state with the status of boot path.
|
||||
*/
|
||||
|
||||
#include "tpm_bootmode.h"
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "tpm_bootmode.h"
|
||||
#include "tss_constants.h"
|
||||
|
||||
const char* kBootStateSHA1Digests[] = {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* stored in the TPM NVRAM.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "crc8.h"
|
||||
#include "rollback_index.h"
|
||||
#include "tlcl.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Implementations of stateful memory operations.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "stateful_util.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
* Functions for updating the TPM state with the status of boot path.
|
||||
*/
|
||||
|
||||
#include "tpm_bootmode.h"
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "tlcl.h"
|
||||
#include "tpm_bootmode.h"
|
||||
#include "utility.h"
|
||||
#include "vboot_api.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "tlcl.h"
|
||||
#include "tlcl_internal.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "tlcl.h"
|
||||
#include "tlcl_internal.h"
|
||||
#include "tlcl_structures.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
int SafeMemcmp(const void *s1, const void *s2, size_t n) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* High-level firmware wrapper API - entry points for init, firmware selection
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "gbb_header.h"
|
||||
#include "load_firmware_fw.h"
|
||||
#include "rollback_index.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* High-level firmware wrapper API - entry points for init, firmware selection
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "gbb_header.h"
|
||||
#include "load_firmware_fw.h"
|
||||
#include "rollback_index.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* High-level firmware wrapper API - entry points for kernel selection
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "gbb_header.h"
|
||||
#include "load_kernel_fw.h"
|
||||
#include "rollback_index.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Delay/beep functions used in dev-mode kernel selection.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "crc32.h"
|
||||
#include "gbb_header.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* (Firmware portion)
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "vboot_api.h"
|
||||
#include "vboot_common.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* (Firmware portion)
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "vboot_api.h"
|
||||
#include "vboot_common.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Display functions used in kernel selection.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "bmpblk_font.h"
|
||||
#include "gbb_header.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* (Firmware portion)
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "gbb_header.h"
|
||||
#include "load_firmware_fw.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* (Firmware portion)
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cgptlib.h"
|
||||
#include "cgptlib_internal.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
/* Non-volatile storage routines.
|
||||
*/
|
||||
#include "sysincludes.h"
|
||||
|
||||
|
||||
#include "crc8.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "cgptlib.h"
|
||||
#include "load_firmware_fw.h"
|
||||
#include "load_kernel_fw.h"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "vboot_api.h"
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "sysincludes.h"
|
||||
|
||||
#include "vboot_api.h"
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* equivalents.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
#include "tlcl.h"
|
||||
#include "tlcl_internal.h"
|
||||
@@ -24,6 +26,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define TPM_DEVICE_PATH "/dev/tpm0"
|
||||
/* Retry failed open()s for 5 seconds in 10ms polling intervals. */
|
||||
#define OPEN_RETRY_DELAY_NS (10 * 1000 * 1000)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* equivalents.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Stub implementations of firmware-provided API functions.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Stub implementations of disk APIs.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Stub implementations of firmware-provided API functions.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Stub implementations of firmware-provided API functions.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <linux/nvram.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -14,10 +15,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "host_common.h"
|
||||
|
||||
#include "crossystem.h"
|
||||
#include "crossystem_arch.h"
|
||||
#include "host_common.h"
|
||||
#include "utility.h"
|
||||
#include "vboot_common.h"
|
||||
#include "vboot_nvstorage.h"
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
// Copyright (c) 2013 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.
|
||||
|
||||
#ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
|
||||
#define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cgpt.h"
|
||||
#include "gpt.h"
|
||||
|
||||
// This file defines the internal methods that use the user-mode cgpt programatically.
|
||||
// This is the interface for the callers such as the cgpt tool or the C++ post installer
|
||||
// executable.
|
||||
enum {
|
||||
CGPT_OK = 0,
|
||||
CGPT_FAILED,
|
||||
};
|
||||
|
||||
typedef struct CgptCreateParams {
|
||||
char *drive_name;
|
||||
@@ -46,8 +48,6 @@ typedef struct CgptShowParams {
|
||||
uint32_t partition;
|
||||
int single_item;
|
||||
int debug;
|
||||
|
||||
// This is filled in by the relevant methods in CgptShow.c
|
||||
int num_partitions;
|
||||
} CgptShowParams;
|
||||
|
||||
@@ -65,7 +65,6 @@ typedef struct CgptBootParams {
|
||||
|
||||
typedef struct CgptPrioritizeParams {
|
||||
char *drive_name;
|
||||
|
||||
uint32_t set_partition;
|
||||
int set_friends;
|
||||
int max_priority;
|
||||
@@ -74,7 +73,6 @@ typedef struct CgptPrioritizeParams {
|
||||
|
||||
typedef struct CgptFindParams {
|
||||
char *drive_name;
|
||||
|
||||
int verbose;
|
||||
int set_unique;
|
||||
int set_type;
|
||||
@@ -89,7 +87,7 @@ typedef struct CgptFindParams {
|
||||
Guid type_guid;
|
||||
char *label;
|
||||
int hits;
|
||||
int match_partnum; // 0 for no match, 1-N for match
|
||||
int match_partnum; /* 1-based; 0 means no match */
|
||||
} CgptFindParams;
|
||||
|
||||
typedef struct CgptLegacyParams {
|
||||
@@ -97,32 +95,4 @@ typedef struct CgptLegacyParams {
|
||||
int efipart;
|
||||
} CgptLegacyParams;
|
||||
|
||||
// create related methods.
|
||||
int CgptCreate(CgptCreateParams *params);
|
||||
|
||||
// add/attribute/details related methods
|
||||
int CgptAdd(CgptAddParams *params);
|
||||
int CgptSetAttributes(CgptAddParams *params);
|
||||
int CgptGetPartitionDetails(CgptAddParams *params);
|
||||
|
||||
// boot related methods.
|
||||
int CgptBoot(CgptBootParams *params);
|
||||
int CgptGetBootPartitionNumber(CgptBootParams *params);
|
||||
|
||||
// show/get related methods.
|
||||
int CgptShow(CgptShowParams *params);
|
||||
int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
|
||||
|
||||
// repair related methods.
|
||||
int CgptRepair(CgptRepairParams *params);
|
||||
|
||||
// priority related methods.
|
||||
int CgptPrioritize(CgptPrioritizeParams *params);
|
||||
|
||||
// find related methods.
|
||||
void CgptFind(CgptFindParams *params);
|
||||
|
||||
// legacy related methods.
|
||||
int CgptLegacy(CgptLegacyParams *params);
|
||||
|
||||
#endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*/
|
||||
|
||||
62
host/include/vboot_host.h
Normal file
62
host/include/vboot_host.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
* vboot-related functions exported for use by userspace programs
|
||||
*/
|
||||
|
||||
#ifndef VBOOT_HOST_H_
|
||||
#define VBOOT_HOST_H_
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/****************************************************************************/
|
||||
/* EFI GPT manipulation */
|
||||
|
||||
#include "cgpt_params.h"
|
||||
|
||||
/* partition table manipulation */
|
||||
int CgptCreate(CgptCreateParams *params);
|
||||
int CgptAdd(CgptAddParams *params);
|
||||
int CgptSetAttributes(CgptAddParams *params);
|
||||
int CgptGetPartitionDetails(CgptAddParams *params);
|
||||
int CgptBoot(CgptBootParams *params);
|
||||
int CgptGetBootPartitionNumber(CgptBootParams *params);
|
||||
int CgptShow(CgptShowParams *params);
|
||||
int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
|
||||
int CgptRepair(CgptRepairParams *params);
|
||||
int CgptPrioritize(CgptPrioritizeParams *params);
|
||||
void CgptFind(CgptFindParams *params);
|
||||
int CgptLegacy(CgptLegacyParams *params);
|
||||
|
||||
/* GUID conversion functions. Accepted format:
|
||||
*
|
||||
* "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
|
||||
*
|
||||
* At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
|
||||
* '\0').
|
||||
*/
|
||||
#define GUID_STRLEN 37
|
||||
int StrToGuid(const char *str, Guid *guid);
|
||||
void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
|
||||
int GuidEqual(const Guid *guid1, const Guid *guid2);
|
||||
int GuidIsZero(const Guid *guid);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Kernel command line */
|
||||
|
||||
/* TODO(wfrichar): This needs a better location */
|
||||
#define MAX_KERNEL_CONFIG_SIZE 4096
|
||||
|
||||
/* Use this to obtain the body load address from the kernel preamble */
|
||||
#define USE_PREAMBLE_LOAD_ADDR (~0)
|
||||
|
||||
/* Returns a new copy of the kernel cmdline. The caller must free it. */
|
||||
char *FindKernelConfig(const char *filename,
|
||||
uint64_t kernel_body_load_address);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* VBOOT_HOST_H_ */
|
||||
@@ -6,6 +6,7 @@
|
||||
* is a quick and dirty test for detecting integer overflow issues.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* is a quick and dirty test for detecting integer overflow issues.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for firmware image library.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for checking firmware rollback-prevention logic.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Splicing tests for the firmware image verification library.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Timing benchmark for verifying a firmware image.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for kernel image library.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for checking kernel rollback-prevention logic.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Splicing tests for the kernel image verification library.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Timing benchmark for verifying a firmware image.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for rollback_index functions
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Tests for do-nothing rollback_index functions with disabled TPM
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "utility.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cryptolib.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define _STUB_IMPLEMENTATION_
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user