首页 > 其他分享 >EDK2+Vscode Build Debug 环境配置

EDK2+Vscode Build Debug 环境配置

时间:2022-09-01 21:45:05浏览次数:43  
标签:EDK2 配置 BaseTools Vscode GCC5 Build workspaceFolder build

  1. 配置shell 环境

    使用工作区配置 .vscode/settings.json

  "terminal.integrated.env.linux": {

    "WORKSPACE"      : "${workspaceFolder}",

    "EDK_TOOLS_PATH" : "${workspaceFolder}/BaseTools",

    "CONF_PATH"      : "${workspaceFolder}/Conf",

    "PYTHONPATH"     : "${workspaceFolder}/BaseTools/Source/Python",

    "PATH"           : "${workspaceFolder}/BaseTools/BinWrappers/PosixLike:${workspaceFolder}/BaseTools/Bin/Linux-x86_64:${env:PATH}"

  }

此步用来代替source edksetup.sh 步骤,同时将Python 模块的路径配置好。

  1. 配置Debug 任务

    工作区新建debug配置文件 .vscode/launch.json

{

  // 使用 IntelliSense 了解相关属性。

  // 悬停以查看现有属性的描述。

  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

  "version": "0.2.0",

  "configurations": [

    {

      "name": "Build OVMF_IA32X64",

      "type": "python",

      "request": "launch",

      "program": "${workspaceFolder}/BaseTools/Source/Python/build/build.py",

      "args": [ "-t", "GCC5", "-a", "X64", "-a", "IA32", "-p" , "OvmfPkg/OvmfPkgIa32X64.dsc"],

      "console": "integratedTerminal",

      "justMyCode": true

    }

  ]

}

 

至此, 你可以看到Debug栏的调试Build 任务的配置, 点击即可进行BUILD 过程的debug。

  1. 配置Build 任务

    工作服新建任务配置文件

    这里配置了三个任务, 两个OVMF的, 一个AARCH64的。

    如果需要编译ARM的固件, 记得安装对应的GCC版本, 我这里使用的是SUSE Linux, 所以对应的AARCH64 的GCC 工具名为aarch64-suse-linux-gcc,如果你不知道自己用的是哪个,可以输入aarch64 然后按tab键自动补全, 这样你就知道你自己对应平台对应的GCC 前缀。

    知道前缀之后,然后就需要在 1 步骤中加入一行,在我这里是  "GCC5_AARCH64_PREFIX" : "aarch64-suse-linux-", 配置完成之后就可以运行任务,选择ArmVirtQemu的任务编译了。

  // See https://go.microsoft.com/fwlink/?LinkId=733558

  // for the documentation about the tasks.json format

  "version": "2.0.0",

  "tasks": [

    {

      "label": "Build_OVMF_IA32X64",

      "type": "shell",

      "command": "build",

      "args": [

        "-t",

        "GCC5",

        "-a",

        "X64",

        "-a",

        "IA32",

        "-p",

        "OvmfPkg/OvmfPkgIa32X64.dsc"

      ],

      "group": {

        "kind": "build",

        "isDefault": true

      },

      "problemMatcher": []

    },

    {

      "label": "Build_OVMF_X64",

      "type": "shell",

      "command": "build",

      "args": [

        "-t",

        "GCC5",

        "-a",

        "X64",

        "-p",

        "OvmfPkg/OvmfPkgX64.dsc"

      ],

      "group": "build"

    },

    {

      "label": "Build_ArmVirtQemu",

      "type": "shell",

      "command": "build",

      "args": [ "-t", "GCC5", "-a", "AARCH64", "-p" , "ArmVirtPkg/ArmVirtQemu.dsc"],

      "group": "build"

    }

 

  ]

}

 

标签:EDK2,配置,BaseTools,Vscode,GCC5,Build,workspaceFolder,build
From: https://www.cnblogs.com/bigbigworf/p/16647914.html

相关文章