EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Data Structures | Defines | Typedefs | Enumerations | Functions | Variables

BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c File Reference

#include "CommonLib.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <Common/UefiBaseTypes.h>
#include "ParseInf.h"
#include "EfiUtilityMsgs.h"

Go to the source code of this file.

Data Structures

struct  _DRIVE_TYPE_DESC
struct  _DRIVE_INFO
struct  _PATH_INFO

Defines

#define UTILITY_NAME   "GnuGenBootSector"
#define UTILITY_MAJOR_VERSION   0
#define UTILITY_MINOR_VERSION   1
#define MAX_DRIVE   26
#define PARTITION_TABLE_OFFSET   0x1BE
#define SIZE_OF_PARTITION_ENTRY   0x10
#define PARTITION_ENTRY_STARTLBA_OFFSET   8
#define PARTITION_ENTRY_NUM   4
#define DRIVE_UNKNOWN   0
#define DRIVE_NO_ROOT_DIR   1
#define DRIVE_REMOVABLE   2
#define DRIVE_FIXED   3
#define DRIVE_REMOTE   4
#define DRIVE_CDROM   5
#define DRIVE_RAMDISK   6
#define DRIVE_TYPE_ITEM(x)   {x, #x}

Typedefs

typedef struct _DRIVE_TYPE_DESC DRIVE_TYPE_DESC
typedef struct _DRIVE_INFO DRIVE_INFO
typedef struct _PATH_INFO PATH_INFO

Enumerations

enum  PATH_TYPE {
  PathUnknown, PathFile, PathFloppy, PathUsb,
  PathIde, PathUnknown, PathFile, PathFloppy,
  PathUsb, PathIde
}
enum  ERROR_STATUS {
  ErrorSuccess, ErrorFileCreate, ErrorFileReadWrite, ErrorNoMbr,
  ErrorFatType, ErrorPath, ErrorSuccess, ErrorFileCreate,
  ErrorFileReadWrite, ErrorNoMbr, ErrorFatType, ErrorPath
}

Functions

UINTN GetLogicalDrives (void)
ERROR_STATUS GetPathInfo (PATH_INFO *PathInfo)
VOID ListDrive (VOID)
ERROR_STATUS ProcessBsOrMbr (PATH_INFO *InputInfo, PATH_INFO *OutputInfo, BOOLEAN ProcessMbr)
VOID Version (VOID)
VOID PrintUsage (VOID)
int main (int argc, char *argv[])

Variables

DRIVE_TYPE_DESC DriveTypeDesc []
CHAR8ErrorStatusDesc []

Detailed Description

Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Module Name:

GnuGenBootSector.c

Abstract: Reading/writing MBR/DBR. NOTE: If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written. If we process DBR, we will patch MBR to set first partition active if no active partition exists.

Definition in file GnuGenBootSector.c.


Define Documentation

#define DRIVE_CDROM   5

Definition at line 58 of file GnuGenBootSector.c.

#define DRIVE_FIXED   3

Definition at line 56 of file GnuGenBootSector.c.

#define DRIVE_NO_ROOT_DIR   1

Definition at line 54 of file GnuGenBootSector.c.

#define DRIVE_RAMDISK   6

Definition at line 59 of file GnuGenBootSector.c.

#define DRIVE_REMOTE   4

Definition at line 57 of file GnuGenBootSector.c.

#define DRIVE_REMOVABLE   2

Definition at line 55 of file GnuGenBootSector.c.

#define DRIVE_TYPE_ITEM (   x)    {x, #x}

Definition at line 66 of file GnuGenBootSector.c.

#define DRIVE_UNKNOWN   0

Definition at line 53 of file GnuGenBootSector.c.

#define MAX_DRIVE   26

Definition at line 44 of file GnuGenBootSector.c.

#define PARTITION_ENTRY_NUM   4

Definition at line 51 of file GnuGenBootSector.c.

#define PARTITION_ENTRY_STARTLBA_OFFSET   8

Definition at line 49 of file GnuGenBootSector.c.

#define PARTITION_TABLE_OFFSET   0x1BE

Definition at line 45 of file GnuGenBootSector.c.

#define SIZE_OF_PARTITION_ENTRY   0x10

Definition at line 47 of file GnuGenBootSector.c.

#define UTILITY_MAJOR_VERSION   0

Definition at line 41 of file GnuGenBootSector.c.

#define UTILITY_MINOR_VERSION   1

Definition at line 42 of file GnuGenBootSector.c.

#define UTILITY_NAME   "GnuGenBootSector"

Definition at line 36 of file GnuGenBootSector.c.


Typedef Documentation

typedef struct _DRIVE_INFO DRIVE_INFO
typedef struct _PATH_INFO PATH_INFO

Enumeration Type Documentation

Enumerator:
ErrorSuccess 
ErrorFileCreate 
ErrorFileReadWrite 
ErrorNoMbr 
ErrorFatType 
ErrorPath 
ErrorSuccess 
ErrorFileCreate 
ErrorFileReadWrite 
ErrorNoMbr 
ErrorFatType 
ErrorPath 

Definition at line 100 of file GnuGenBootSector.c.

enum PATH_TYPE
Enumerator:
PathUnknown 
PathFile 
PathFloppy 
PathUsb 
PathIde 
PathUnknown 
PathFile 
PathFloppy 
PathUsb 
PathIde 

Definition at line 85 of file GnuGenBootSector.c.


Function Documentation

UINTN GetLogicalDrives ( void  )

Definition at line 120 of file GnuGenBootSector.c.

ERROR_STATUS GetPathInfo ( PATH_INFO PathInfo)

Get path information, including physical path for Linux platform.

Parameters:
PathInfoPoint to PATH_INFO structure.
Returns:
whether path is valid.

Definition at line 132 of file GnuGenBootSector.c.

VOID ListDrive ( VOID  )

Definition at line 184 of file GnuGenBootSector.c.

int main ( int  argc,
char *  argv[] 
)

Definition at line 303 of file GnuGenBootSector.c.

VOID PrintUsage ( VOID  )

Definition at line 284 of file GnuGenBootSector.c.

ERROR_STATUS ProcessBsOrMbr ( PATH_INFO InputInfo,
PATH_INFO OutputInfo,
BOOLEAN  ProcessMbr 
)

Writing or reading boot sector or MBR according to the argument.

Parameters:
InputInfoPATH_INFO instance for input path
OutputInfoPATH_INFO instance for output path
ProcessMbrTRUE is to process MBR, otherwise, processing boot sector
Returns:
ERROR_STATUS

Definition at line 201 of file GnuGenBootSector.c.

VOID Version ( VOID  )

Displays the standard utility information to SDTOUT

Definition at line 274 of file GnuGenBootSector.c.


Variable Documentation

Initial value:
 {
  "Success",
  "Failed to create files",
  "Failed to read/write files",
  "No MBR exists",
  "Failed to detect Fat type",
  "Inavlid path"
}

Definition at line 109 of file GnuGenBootSector.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines