Home | History | Annotate | Download | only in include
      1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  *
      5  * vboot-related functions exported for use by userspace programs
      6  */
      7 
      8 #ifndef VBOOT_HOST_H_
      9 #define VBOOT_HOST_H_
     10 #include <inttypes.h>
     11 #include <stdint.h>
     12 #include <stdlib.h>
     13 
     14 /****************************************************************************/
     15 /* EFI GPT manipulation */
     16 
     17 #include "cgpt_params.h"
     18 
     19 /* partition table manipulation */
     20 int CgptCreate(CgptCreateParams *params);
     21 int CgptAdd(CgptAddParams *params);
     22 int CgptSetAttributes(CgptAddParams *params);
     23 int CgptGetPartitionDetails(CgptAddParams *params);
     24 int CgptBoot(CgptBootParams *params);
     25 int CgptGetBootPartitionNumber(CgptBootParams *params);
     26 int CgptShow(CgptShowParams *params);
     27 int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
     28 int CgptRepair(CgptRepairParams *params);
     29 int CgptPrioritize(CgptPrioritizeParams *params);
     30 void CgptFind(CgptFindParams *params);
     31 int CgptLegacy(CgptLegacyParams *params);
     32 
     33 /* GUID conversion functions. Accepted format:
     34  *
     35  *   "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
     36  *
     37  * At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
     38  * '\0').
     39  */
     40 #define GUID_STRLEN 37
     41 int StrToGuid(const char *str, Guid *guid);
     42 void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
     43 int GuidEqual(const Guid *guid1, const Guid *guid2);
     44 int GuidIsZero(const Guid *guid);
     45 
     46 
     47 /****************************************************************************/
     48 /* Kernel command line */
     49 
     50 /* TODO(wfrichar): This needs a better location */
     51 #define MAX_KERNEL_CONFIG_SIZE     4096
     52 
     53 /* Use this to obtain the body load address from the kernel preamble */
     54 #define USE_PREAMBLE_LOAD_ADDR     (~0)
     55 
     56 /* Returns a new copy of the kernel cmdline. The caller must free it. */
     57 char *FindKernelConfig(const char *filename,
     58                        uint64_t kernel_body_load_address);
     59 
     60 /****************************************************************************/
     61 /* Kernel partition */
     62 
     63 /* Used to get a bootable vmlinuz from the kernel partition. vmlinuz_out must
     64  * be free'd after this function returns success. Success is indicated by a
     65  * zero return value.
     66  */
     67 int ExtractVmlinuz(void *kpart_data, size_t kpart_size,
     68 		   void **vmlinuz_out, size_t *vmlinuz_size);
     69 
     70 
     71 #endif  /* VBOOT_HOST_H_ */
     72