Skip to content

Commit

Permalink
Add command line flag to show android-efi version
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-gh committed Feb 14, 2019
1 parent 3daa6c3 commit 4c016d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ enum command_line_argument {
KERNEL_PARAMETERS
};

#ifndef ANDROID_EFI_VERSION
#define ANDROID_EFI_VERSION "unknown"
#endif

#define STATE_SKIP_SPACES (1 << 0)
#define STATE_FOUND_DASH (1 << 1)
#define STATE_IMAGE_PATH (1 << 2)
Expand Down Expand Up @@ -56,6 +60,11 @@ static EFI_STATUS parse_command_line(EFI_LOADED_IMAGE_PROTOCOL *loaded_image, st
// additional kernel parameters
if (state & STATE_FOUND_DASH) {
if (c == L'-') {
if (StrnCmp(&opt[start], L"--version", length - start) == 0) {
Print(L"android-efi version " ANDROID_EFI_VERSION "\n");
return EFI_ABORTED;
}

argument = KERNEL_PARAMETERS;
state |= STATE_SKIP_SPACES;
continue;
Expand Down
4 changes: 3 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (C) 2017 lambdadroid

project('android-efi', 'c',
version: '0.3.0',
license: 'GPL-2.0',
default_options: [
'buildtype=debugoptimized',
Expand Down Expand Up @@ -46,7 +47,8 @@ android_efi_lib = shared_library('android-efi',
'-maccumulate-outgoing-args',
'-mno-red-zone',
'-mno-mmx',
'-DGNU_EFI_USE_MS_ABI'
'-DGNU_EFI_USE_MS_ABI',
'-DANDROID_EFI_VERSION="' + meson.project_version() + '"'
],
objects: [efi_crt],
link_args: [
Expand Down

0 comments on commit 4c016d2

Please sign in to comment.