summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-03-29 11:09:30 -0700
committerChromeBot <chrome-bot@google.com>2013-04-02 14:12:52 -0700
commit0c3ba249abb1dc60f5ebabccf84ff13206440b83 (patch)
tree81cd2ada3845b8bb4b83fde6e27050483d5b941e /host
parent28b65ca99f4042fcc1218a4c18297f7ffb32ea15 (diff)
downloadvboot-0c3ba249abb1dc60f5ebabccf84ff13206440b83.tar.gz
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>
Diffstat (limited to 'host')
-rw-r--r--host/arch/x86/lib/crossystem_arch.c4
-rw-r--r--host/include/cgpt_params.h98
-rw-r--r--host/include/crossystem.h2
-rw-r--r--host/include/vboot_host.h62
-rw-r--r--host/lib/include/crossystem_arch.h (renamed from host/include/crossystem_arch.h)0
-rw-r--r--host/lib/include/file_keys.h (renamed from host/include/file_keys.h)0
-rw-r--r--host/lib/include/fmap.h (renamed from host/include/fmap.h)0
-rw-r--r--host/lib/include/host_common.h (renamed from host/include/host_common.h)0
-rw-r--r--host/lib/include/host_key.h (renamed from host/include/host_key.h)0
-rw-r--r--host/lib/include/host_keyblock.h (renamed from host/include/host_keyblock.h)0
-rw-r--r--host/lib/include/host_misc.h (renamed from host/include/host_misc.h)0
-rw-r--r--host/lib/include/host_signature.h (renamed from host/include/host_signature.h)0
-rw-r--r--host/lib/include/signature_digest.h (renamed from host/include/signature_digest.h)0
13 files changed, 163 insertions, 3 deletions
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 23a3bcec..85c5c6b2 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -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"
diff --git a/host/include/cgpt_params.h b/host/include/cgpt_params.h
new file mode 100644
index 00000000..c8567e5b
--- /dev/null
+++ b/host/include/cgpt_params.h
@@ -0,0 +1,98 @@
+// 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 "gpt.h"
+
+enum {
+ CGPT_OK = 0,
+ CGPT_FAILED,
+};
+
+typedef struct CgptCreateParams {
+ char *drive_name;
+ int zap;
+} CgptCreateParams;
+
+typedef struct CgptAddParams {
+ char *drive_name;
+ uint32_t partition;
+ uint64_t begin;
+ uint64_t size;
+ Guid type_guid;
+ Guid unique_guid;
+ char *label;
+ int successful;
+ int tries;
+ int priority;
+ uint16_t raw_value;
+ int set_begin;
+ int set_size;
+ int set_type;
+ int set_unique;
+ int set_successful;
+ int set_tries;
+ int set_priority;
+ int set_raw;
+} CgptAddParams;
+
+typedef struct CgptShowParams {
+ char *drive_name;
+ int numeric;
+ int verbose;
+ int quick;
+ uint32_t partition;
+ int single_item;
+ int debug;
+ int num_partitions;
+} CgptShowParams;
+
+typedef struct CgptRepairParams {
+ char *drive_name;
+ int verbose;
+} CgptRepairParams;
+
+typedef struct CgptBootParams {
+ char *drive_name;
+ uint32_t partition;
+ char *bootfile;
+ int create_pmbr;
+} CgptBootParams;
+
+typedef struct CgptPrioritizeParams {
+ char *drive_name;
+ uint32_t set_partition;
+ int set_friends;
+ int max_priority;
+ int orig_priority;
+} CgptPrioritizeParams;
+
+typedef struct CgptFindParams {
+ char *drive_name;
+ int verbose;
+ int set_unique;
+ int set_type;
+ int set_label;
+ int oneonly;
+ int numeric;
+ uint8_t *matchbuf;
+ uint64_t matchlen;
+ uint64_t matchoffset;
+ uint8_t *comparebuf;
+ Guid unique_guid;
+ Guid type_guid;
+ char *label;
+ int hits;
+ int match_partnum; /* 1-based; 0 means no match */
+} CgptFindParams;
+
+typedef struct CgptLegacyParams {
+ char *drive_name;
+ int efipart;
+} CgptLegacyParams;
+
+#endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
diff --git a/host/include/crossystem.h b/host/include/crossystem.h
index 70e51d10..71acc841 100644
--- a/host/include/crossystem.h
+++ b/host/include/crossystem.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.
*/
diff --git a/host/include/vboot_host.h b/host/include/vboot_host.h
new file mode 100644
index 00000000..b22eea2d
--- /dev/null
+++ b/host/include/vboot_host.h
@@ -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_ */
diff --git a/host/include/crossystem_arch.h b/host/lib/include/crossystem_arch.h
index 4044c749..4044c749 100644
--- a/host/include/crossystem_arch.h
+++ b/host/lib/include/crossystem_arch.h
diff --git a/host/include/file_keys.h b/host/lib/include/file_keys.h
index 39fdc5ac..39fdc5ac 100644
--- a/host/include/file_keys.h
+++ b/host/lib/include/file_keys.h
diff --git a/host/include/fmap.h b/host/lib/include/fmap.h
index 7da2dd90..7da2dd90 100644
--- a/host/include/fmap.h
+++ b/host/lib/include/fmap.h
diff --git a/host/include/host_common.h b/host/lib/include/host_common.h
index 40ce212a..40ce212a 100644
--- a/host/include/host_common.h
+++ b/host/lib/include/host_common.h
diff --git a/host/include/host_key.h b/host/lib/include/host_key.h
index 018c25d3..018c25d3 100644
--- a/host/include/host_key.h
+++ b/host/lib/include/host_key.h
diff --git a/host/include/host_keyblock.h b/host/lib/include/host_keyblock.h
index ea88f19b..ea88f19b 100644
--- a/host/include/host_keyblock.h
+++ b/host/lib/include/host_keyblock.h
diff --git a/host/include/host_misc.h b/host/lib/include/host_misc.h
index 22b31415..22b31415 100644
--- a/host/include/host_misc.h
+++ b/host/lib/include/host_misc.h
diff --git a/host/include/host_signature.h b/host/lib/include/host_signature.h
index fb03c6c5..fb03c6c5 100644
--- a/host/include/host_signature.h
+++ b/host/lib/include/host_signature.h
diff --git a/host/include/signature_digest.h b/host/lib/include/signature_digest.h
index 40c27036..40c27036 100644
--- a/host/include/signature_digest.h
+++ b/host/lib/include/signature_digest.h