VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/Library/AndroidBootImgLib.h@ 88384

Last change on this file since 88384 was 85718, checked in by vboxsync, 5 years ago

Devices/EFI: Merge edk-stable202005 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/** @file
2
3 Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
4 Copyright (c) 2017, Linaro.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef __ABOOTIMG_H__
11#define __ABOOTIMG_H__
12
13#include <Library/BaseLib.h>
14#include <Library/DebugLib.h>
15#include <Library/MemoryAllocationLib.h>
16
17#include <Uefi/UefiBaseType.h>
18#include <Uefi/UefiSpec.h>
19
20#define ANDROID_BOOTIMG_KERNEL_ARGS_SIZE 512
21
22#define ANDROID_BOOT_MAGIC "ANDROID!"
23#define ANDROID_BOOT_MAGIC_LENGTH (sizeof (ANDROID_BOOT_MAGIC) - 1)
24
25// No documentation for this really - sizes of fields has been determined
26// empirically.
27#pragma pack(1)
28/* https://android.googlesource.com/platform/system/core/+/master/mkbootimg/bootimg.h */
29typedef struct {
30 UINT8 BootMagic[ANDROID_BOOT_MAGIC_LENGTH];
31 UINT32 KernelSize;
32 UINT32 KernelAddress;
33 UINT32 RamdiskSize;
34 UINT32 RamdiskAddress;
35 UINT32 SecondStageBootloaderSize;
36 UINT32 SecondStageBootloaderAddress;
37 UINT32 KernelTaggsAddress;
38 UINT32 PageSize;
39 UINT32 Reserved[2];
40 CHAR8 ProductName[16];
41 CHAR8 KernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE];
42 UINT32 Id[32];
43} ANDROID_BOOTIMG_HEADER;
44#pragma pack ()
45
46/* Check Val (unsigned) is a power of 2 (has only one bit set) */
47#define IS_POWER_OF_2(Val) ((Val) != 0 && (((Val) & ((Val) - 1)) == 0))
48/* Android boot image page size is not specified, but it should be power of 2
49 * and larger than boot header */
50#define IS_VALID_ANDROID_PAGE_SIZE(Val) \
51 (IS_POWER_OF_2(Val) && (Val > sizeof(ANDROID_BOOTIMG_HEADER)))
52
53EFI_STATUS
54AndroidBootImgGetImgSize (
55 IN VOID *BootImg,
56 OUT UINTN *ImgSize
57 );
58
59EFI_STATUS
60AndroidBootImgBoot (
61 IN VOID *Buffer,
62 IN UINTN BufferSize
63 );
64
65#endif /* __ABOOTIMG_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette