Skip to content

Commit

Permalink
File Licensing:: Part 5 (misc)
Browse files Browse the repository at this point in the history
  • Loading branch information
LensPlaysGames committed Oct 26, 2022
1 parent f26f1b5 commit 0175985
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 16 deletions.
28 changes: 14 additions & 14 deletions OVMFbin/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# OVMF
OVMF is a project by TianoCore that targets accurate emulation of real UEFI hardware in virtual environments.

OVMF is part of why this whole project exists; without it
LensorOS would need to be tested on real hardware at every step...
OVMF is part of why this whole project exists; without it
LensorOS would need to be tested on real hardware at every step...
Suffice to say I'm very grateful.

Due to OVMF depending on the (humongous) EDK2 code-base to
create the OVMF images that are required for QEMU to run,
I provide some pre-built images so everybody that wants to
Due to OVMF depending on the (humongous) EDK2 code-base to
create the OVMF images that are required for QEMU to run,
I provide some pre-built images so everybody that wants to
emulate LensorOS doesn't have to build EDK2 + OVMF from source.

If you would prefer to build OVMF anyway, due to trying to target a different architecture
If you would prefer to build OVMF anyway, due to trying to target a different architecture
or just the ones included being out of date, here are the resources needed to build them yourself:
- [EDK2 Source from GitHub](https://github.com/tianocore/edk2)
- This includes OVMF, as well as about 30 other packages. We will only be using two of them:
- `MdeModulePkg`
- `OvmfPkg`
- EDK2 has a slightly convoluted build system, but it's nothing too bad if you made it through the cross compiler.
- EDK2 has a slightly convoluted build system, but it's nothing too bad if you made it through the cross compiler.
I found the following resources immensely helpful for the initial EDK2 build (all links wayback machined for posterity):
- [EDK2 Common Instructions](https://github.com/tianocore/tianocore.github.io/wiki/Common-instructions)
- [Using EDK2 with Native GCC](https://github.com/tianocore/tianocore.github.io/wiki/Using-EDK-II-with-Native-GCC)
Expand All @@ -28,7 +28,7 @@ or just the ones included being out of date, here are the resources needed to bu

As with most large builds, utilize the `make -j` flag to allow for more jobs to happen at once (multi-threading).
The general consensus is to pick somewhere around the amount of CPU cores you have.
Whichever you pick, more jobs happening at once means faster builds
Whichever you pick, more jobs happening at once means faster builds
(and with large ones like the ones upcoming, you will definitely want them to be sped up).

Before you do anything, ensure the following pre-requisites are installed:
Expand All @@ -48,7 +48,7 @@ cd edk2
git submodule update --init
```

Next, compile the build tools that EDK2 uses to build itself, then
Next, compile the build tools that EDK2 uses to build itself, then
setup a basic configuration, then re-build the tools once more :^).
```bash
cd $HOME/EDK2/edk2
Expand All @@ -57,15 +57,15 @@ make -C BaseTools
make -C BaseTools
```

For EDK2 to work properly, it needs to be told where a few things
For EDK2 to work properly, it needs to be told where a few things
are installed on the system (namely, it's `BaseTools` directory).
```bash
cd $HOME/EDK2/edk2
export EDK_TOOLS_PATH=$HOME/EDK2/edk2/BaseTools
. edksetup.sh BaseTools
```

Once the build tools have been built and setup correctly,
Once the build tools have been built and setup correctly,
configuration files should have been made in the `$HOME/EDK2/edk2/Conf` directory. \
Find the following lines within `target.txt`:
- "TARGET = DEBUG"
Expand All @@ -77,15 +77,15 @@ Replace them with the following:
- "TARGET_ARCH = X64"
- "TOOL_CHAIN_TAG = GCC5"

You may be tempted (like me), to try out different versions of GCC,
You may be tempted (like me), to try out different versions of GCC,
but it turns out `GCC5` is EDK2's way of saying GCC5 *or greater*.

To build `MdeModulePkg`, a dependency of `OvmfPkg`, run the following one-liner:
```bash
cd $HOME/EDK2/edk2 && build -p MdeModulePkg/MdeModulePkg.dsc
```

With `MdeModulePkg` built, we can move on to building `OvmfPkg` to get our `.fd` files
With `MdeModulePkg` built, we can move on to building `OvmfPkg` to get our `.fd` files
that are necessary for QEMU to boot into a UEFI environment:
```bash
cd $HOME/EDK2/edk2 && build -p OvmfPkg/OvmfPkgX64.dsc
Expand All @@ -103,5 +103,5 @@ Within the `Build` sub-directory you should be able to find two files within `Ov
- `OVMF_CODE.fd`
- `OVMF_VARS.fd`

These can be copied to `LensorOS/OVMFbin/` and, if correctly renamed,
These can be copied to `LensorOS/OVMFbin/` and, if correctly renamed,
will be used by QEMU to boot from when the `run` batch/shell script is used.
18 changes: 18 additions & 0 deletions kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Copyright 2022, Contributors To LensorOS.
# All rights reserved.
#
# This file is part of LensorOS.
#
# LensorOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LensorOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LensorOS. If not, see <https://www.gnu.org/licenses

cmake_minimum_required( VERSION 3.20 )
set( LensorOS_VERSION 0.0.1 )
set( LensorOS_LANGUAGES ASM_NASM CXX )
Expand Down
18 changes: 18 additions & 0 deletions kernel/config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Copyright 2022, Contributors To LensorOS.
# All rights reserved.
#
# This file is part of LensorOS.
#
# LensorOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LensorOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LensorOS. If not, see <https://www.gnu.org/licenses

# LensorOS Build Configuration
# Settings and Options

Expand Down
19 changes: 19 additions & 0 deletions kernel/kernel.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/* Copyright 2022, Contributors To LensorOS.
* All rights reserved.
*
* This file is part of LensorOS.
*
* LensorOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LensorOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LensorOS. If not, see <https://www.gnu.org/licenses
*/

OUTPUT_FORMAT(elf64-x86-64)
ENTRY(_start)
SECTIONS
Expand Down
22 changes: 20 additions & 2 deletions kernel/lensor_gnu_toolchain.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Copyright 2022, Contributors To LensorOS.
# All rights reserved.
#
# This file is part of LensorOS.
#
# LensorOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# LensorOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LensorOS. If not, see <https://www.gnu.org/licenses

include( "${CMAKE_CURRENT_LIST_DIR}/config.cmake" )

# Until a LensorOS config is added to the CMake source code,
Expand All @@ -24,14 +42,14 @@ endif()

# Look for LensorOS Toolchain executables.
find_program(
CMAKE_C_COMPILER
CMAKE_C_COMPILER
${ARCH}-lensor-gcc
HINTS
${TOOLCHAIN_HINTS}
REQUIRED
)
find_program(
CMAKE_CXX_COMPILER
CMAKE_CXX_COMPILER
${ARCH}-lensor-g++
HINTS
${TOOLCHAIN_HINTS}
Expand Down

0 comments on commit 0175985

Please sign in to comment.