sudo apt install python python3 python3-distutils
sudo apt install gcc-arm-none-eabi
sudo apt install uuid-dev
sudo apt install build-essential
sudo apt install bison
sudo apt install flex# Go to the directory you want to work in
export WORKSPACE=$PWD
# Download edk2 and acpica
git clone https://github.com/acpica/acpica.git
git clone https://github.com/tianocore/edk2.git
# Download submodules
cd edk2
git submodule update --init
cd ..# Compile acpica tools
make -C $WORKSPACE/acpica -j$(nproc)
# Set environment variables
export GCC5_ARM_PREFIX=arm-none-eabi-
export IASL_PREFIX=$WORKSPACE/acpica/generate/unix/bin/
export PYTHON_COMMAND=/usr/bin/python3
# Configure the edk2 environment
source edk2/edksetup.sh
# Compile edk2 BaseTools
make -C edk2/BaseTools -j$(nproc)
# Compile OVMF
build -a ARM -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc -b RELEASE -j$(nproc)rm -f flash0.img flash1.img
dd if=/dev/zero bs=1M count=64 of=flash0.img
dd if=/dev/zero bs=1M count=64 of=flash1.img
dd if=QEMU_EFI.fd bs=1M of=flash0.img conv=notruncqemu-system-arm \
-m 1024 \
-cpu cortex-a15 \
-M virt \
-pflash flash0.img \
-pflash flash1.img \
-nographic \
-drive \
file=fat:rw:boot/ \
-smp '4'CONFIG_DEBUG_INFO=y
CONFIG_GDB_SCRIPTS=y{
"version": "2.0.0",
"tasks": [
{
"label": "Build Kernel for ARM",
"type": "shell",
"command": "make",
"args": [
"ARCH=arm",
"CROSS_COMPILE=arm-linux-gnueabihf-",
"-j6"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Copy zImage",
"command": "cp",
"args": [
"arch/arm/boot/zImage",
"../emulation/boot/efi/boot/bootarm.efi"
],
"dependsOn":["Build Kernel for ARM"]
},
{
"label": "Run qemu",
"command": "/usr/bin/qemu-system-arm -m 1024 -cpu cortex-a15 -M virt -pflash flash0.img -pflash flash1.img -nographic -drive file=fat:rw:boot/ -smp '4' -s",
"options": {
"cwd": "${workspaceFolder}/../emulation"
},
"type": "shell",
"isBackground": true,
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
],
"dependsOn":["Copy zImage"]
},
{
"label": "Terminate All Tasks",
"command": "echo ${input:terminate}",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
} {
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Run",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/vmlinux",
"miDebuggerServerAddress": "localhost:1234",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"targetArchitecture": "arm",
"preLaunchTask": "Run qemu",
"postDebugTask": "Terminate All Tasks",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/include",
"${workspaceFolder}/include/uapi",
"${workspaceFolder}/include/generated",
"${workspaceFolder}/arch/arm/include",
"${workspaceFolder}/arch/arm/include/uapi",
"${workspaceFolder}/arch/arm/include/generated"
],
"defines": [
"__KERNEL__"
],
"compilerPath": "/usr/bin/arm-linux-gnueabihf-gcc",
"cStandard": "gnu17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-arm",
"browse": {
"path": [
"${workspaceFolder}",
"${workspaceFolder}/include",
"${workspaceFolder}/mm",
"${workspaceFolder}/fs",
"${workspaceFolder}/kernel"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}