Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: '2'

# use int names from stdbigos/types.h
# use int names from libcore/types.h
- key: google-runtime-int.UnsignedTypePrefix
value: 'u'
- key: google-runtime-int.SignedTypePrefix
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ jobs:

- name: Install dependencies
run: |
# I swear if there is an easier way please help
curl -L https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-darwin-arm64.tar.gz -o riscv-toolchain.tar.gz
tar -xvf riscv-toolchain.tar.gz
echo "$GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-14.2.0-2/bin" >> $GITHUB_PATH
brew install llvm lld cmake qemu dosfstools e2fsprogs mtools include-what-you-use

- name: Generate and build
Expand Down Expand Up @@ -184,6 +188,10 @@ jobs:

- name: Install dependencies
run: |
# I swear if there is an easier way please help
curl -L https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-darwin-arm64.tar.gz -o riscv-toolchain.tar.gz
tar -xvf riscv-toolchain.tar.gz
echo "$GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-14.2.0-2/bin" >> $GITHUB_PATH
brew install llvm lld cmake qemu dosfstools e2fsprogs mtools include-what-you-use

- name: Generate and build
Expand Down
2 changes: 2 additions & 0 deletions CMake/toolchains/riscv64-clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ set(CMAKE_ASM_USING_LINKER_LLD "-fuse-ld=lld")
set(CMAKE_LINKER_TYPE LLD)
find_program(CMAKE_C_COMPILER clang REQUIRED)
find_program(CMAKE_ASM_COMPILER clang REQUIRED)

find_program(CMAKE_OBJCOPY NAMES riscv64-linux-gnu-objcopy riscv64-unknown-linux-gnu-objcopy riscv64-unknown-elf-objcopy riscv64-elf-objcopy riscv-none-elf-objcopy REQUIRED)
2 changes: 1 addition & 1 deletion CMake/toolchains/riscv64-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
set(CMAKE_C_COMPILER_TARGET riscv64-linux-gnu)
set(CMAKE_ASM_COMPILER_TARGET riscv64-linux-gnu)

set(RISCV_LINKER_FLAGS "-nostdlib")
set(RISCV_SHARED_FLAGS "-march=${RISCV_ARCH} -mabi=${RISCV_ABI}")
set(RISCV_LINKER_FLAGS "-nostdlib ${RISCV_SHARED_FLAGS}")

set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${RISCV_SHARED_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RISCV_SHARED_FLAGS} -ffreestanding -mcmodel=${RISCV_CMODEL} -fno-stack-protector")
Expand Down
2 changes: 2 additions & 0 deletions CMake/toolchains/riscv64-gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ if (NOT RISCV_TOOLCHAIN_PREFIX)
endif()

find_program(CMAKE_C_COMPILER "${RISCV_TOOLCHAIN_PREFIX}gcc" REQUIRED)
find_program(CMAKE_AR "${RISCV_TOOLCHAIN_PREFIX}gcc-ar" REQUIRED)
find_program(CMAKE_RANLIB "${RISCV_TOOLCHAIN_PREFIX}gcc-ranlib" REQUIRED)
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ if(BIGOS_BUILD_TESTS)
else()
include(CMake/Linters.cmake)
add_subdirectory(src)
add_subdirectory(external/efi)
endif()
21 changes: 21 additions & 0 deletions external/efi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
project(gnu-efi LANGUAGES C)

add_library(gnu-efi INTERFACE)

set(EFI_DIR ${PROJECT_SOURCE_DIR})

set(LINKER_SCRIPT ${EFI_DIR}/lib/elf_riscv64_efi.lds)

target_link_options(gnu-efi INTERFACE
-T ${LINKER_SCRIPT} ${EFI_DIR}/lib/crt0-efi-riscv64.o
LINKER:-nostdlib,-znocombreloc,-Bsymbolic)

target_compile_options(gnu-efi INTERFACE
-fPIC -ffreestanding
-fno-stack-protector -fno-stack-check
-fshort-wchar -mabi=lp64d -march=rv64g
)

target_include_directories(gnu-efi SYSTEM INTERFACE ${EFI_DIR}/include/efi)
target_link_directories(gnu-efi INTERFACE ${EFI_DIR}/lib)
target_link_libraries(gnu-efi INTERFACE efi gnuefi)
90 changes: 90 additions & 0 deletions external/efi/include/efi/efi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*++

Copyright (c) 1998 Intel Corporation

Module Name:

efi.h

Abstract:

Public EFI header files



Revision History

--*/


// Add a predefined macro to detect usage of the library
#ifndef _GNU_EFI
#define _GNU_EFI
#endif

//
// Build flags on input
// EFI32
// EFI_DEBUG - Enable debugging code
// EFI_NT_EMULATOR - Building for running under NT
//


#ifndef _EFI_INCLUDE_
#define _EFI_INCLUDE_

#ifdef __cplusplus
extern "C" {
#endif

#define EFI_FIRMWARE_VENDOR L"INTEL"
#define EFI_FIRMWARE_MAJOR_REVISION 12
#define EFI_FIRMWARE_MINOR_REVISION 33
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))

#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__)
#include "x86_64/efibind.h"
#elif defined(_M_IX86) || defined(__i386__)
#include "ia32/efibind.h"
#elif defined(_M_IA64) || defined(__ia64__)
#include "ia64/efibind.h"
#elif defined (_M_ARM64) || defined(__aarch64__)
#include "aarch64/efibind.h"
#elif defined (_M_ARM) || defined(__arm__)
#include "arm/efibind.h"
#elif defined (_M_MIPS64) || defined(__mips64__) || defined(__mips64)
#include "mips64el/efibind.h"
#elif defined (__riscv) && __riscv_xlen == 64
#include "riscv64/efibind.h"
#elif defined (__loongarch64)
#include "loongarch64/efibind.h"
#else
#error Usupported architecture
#endif

#include "eficompiler.h"
#include "efidef.h"
#include "efidevp.h"
#include "efipciio.h"
#include "efiprot.h"
#include "eficon.h"
#include "eficonex.h"
#include "efiser.h"
#include "efi_nii.h"
#include "efipxebc.h"
#include "efinet.h"
#include "efiapi.h"
#include "efifs.h"
#include "efierr.h"
#include "efiui.h"
#include "efiip.h"
#include "efiudp.h"
#include "efitcp.h"
#include "efipoint.h"
#include "efishell.h"

#ifdef __cplusplus
}
#endif

#endif
78 changes: 78 additions & 0 deletions external/efi/include/efi/efi_nii.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#ifndef _EFI_NII_H
#define _EFI_NII_H

/*++
Copyright (c) 2000 Intel Corporation

Module name:
efi_nii.h

Abstract:

Revision history:
2000-Feb-18 M(f)J GUID updated.
Structure order changed for machine word alignment.
Added StringId[4] to structure.

2000-Feb-14 M(f)J Genesis.
--*/

#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \
{ 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} }

#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00010000
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION

typedef enum {
EfiNetworkInterfaceUndi = 1
} EFI_NETWORK_INTERFACE_TYPE;

typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {

UINT64 Revision;
// Revision of the network interface identifier protocol interface.

UINT64 ID;
// Address of the first byte of the identifying structure for this
// network interface. This is set to zero if there is no structure.
//
// For PXE/UNDI this is the first byte of the !PXE structure.

UINT64 ImageAddr;
// Address of the UNrelocated driver/ROM image. This is set
// to zero if there is no driver/ROM image.
//
// For 16-bit UNDI, this is the first byte of the option ROM in
// upper memory.
//
// For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM
// image.
//
// For H/W UNDI, this is set to zero.

UINT32 ImageSize;
// Size of the UNrelocated driver/ROM image of this network interface.
// This is set to zero if there is no driver/ROM image.

CHAR8 StringId[4];
// 4 char ASCII string to go in class identifier (option 60) in DHCP
// and Boot Server discover packets.
// For EfiNetworkInterfaceUndi this field is "UNDI".
// For EfiNetworkInterfaceSnp this field is "SNPN".

UINT8 Type;
UINT8 MajorVer;
UINT8 MinorVer;
// Information to be placed into the PXE DHCP and Discover packets.
// This is the network interface type and version number that will
// be placed into DHCP option 94 (client network interface identifier).
BOOLEAN Ipv6Supported;
UINT8 IfNum; // interface number to be used with pxeid structure
} EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;

// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL' GUID definition,
// from older versions of gnu-efi, is now obsoleted.
// Use 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID' instead.

#endif // _EFI_NII_H
Loading
Loading