vscode: Refactor and add missing import
Thx to bear project
This commit is contained in:
parent
5686c97114
commit
ca2332a6c9
3 changed files with 47 additions and 13 deletions
27
.vscode/c_cpp_properties.json
vendored
27
.vscode/c_cpp_properties.json
vendored
|
@ -2,12 +2,35 @@
|
|||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
// BEGIN: Obtained from compile_commands.json generated with bear command
|
||||
// Defined with -I args
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${env:C_INCLUDE_PATH}"
|
||||
"${env:LINUX_MODULES_FOLDER}/source/arch/x86/include",
|
||||
"${env:LINUX_MODULES_FOLDER}/source/include",
|
||||
"${env:LINUX_MODULES_FOLDER}/source/arch/x86/include/uapi",
|
||||
"${env:LINUX_MODULES_FOLDER}/source/include/uapi",
|
||||
"${env:LINUX_MODULES_FOLDER}/build/arch/x86/include/generated",
|
||||
"${env:LINUX_MODULES_FOLDER}/build/include"
|
||||
],
|
||||
"defines": [],
|
||||
// Defined with -include
|
||||
"forcedInclude": [
|
||||
"${env:LINUX_MODULES_FOLDER}/source/include/linux/compiler-version.h",
|
||||
"${env:LINUX_MODULES_FOLDER}/source/include/linux/kconfig.h",
|
||||
"${env:LINUX_MODULES_FOLDER}/source/include/linux/compiler_types.h"
|
||||
],
|
||||
// Defined with -D
|
||||
"defines": [
|
||||
"__KERNEL__",
|
||||
"DCC_USING_FENTRY",
|
||||
"MODULE",
|
||||
"KBUILD_BASENAME=\"test_module\"",
|
||||
"KBUILD_MODNAME=\"test_module\"",
|
||||
"__KBUILD_MODNAME=kmod_test_module"
|
||||
],
|
||||
// END
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
|
|
12
README.md
12
README.md
|
@ -44,3 +44,15 @@ sudo rmmod [module_name].ko
|
|||
|
||||
- https://www.kernel.org/doc/html/latest/
|
||||
- https://elixir.bootlin.com/linux/v6.13/source/
|
||||
|
||||
## Notes
|
||||
|
||||
1. Find required headers files
|
||||
|
||||
```
|
||||
nix shell nixpkgs#bear
|
||||
cd 01_basic_module/
|
||||
bear --append --output ../.vscode/compile_commands.json -- make -C $LINUX_MODULES_FOLDER/build M=$PWD modules
|
||||
```
|
||||
|
||||
Search -I args and -D args
|
|
@ -21,7 +21,6 @@
|
|||
packages = [ linux.moduleBuildDependencies ];
|
||||
|
||||
LINUX_MODULES_FOLDER = "${linux.dev}/lib/modules/${linux.modDirVersion}";
|
||||
C_INCLUDE_PATH = "${linux.dev}/lib/modules/${linux.modDirVersion}/source/include";
|
||||
|
||||
shellHook = ''
|
||||
echo "Current Linux Kernel used : ${linux.version}"
|
||||
|
|
Loading…
Add table
Reference in a new issue