-
-
Save patbonecrusher/4832303096be5080aade41b575e70264 to your computer and use it in GitHub Desktop.
IntelliSense config file for Linux kernel X86_64.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Linux", | |
"includePath": [ | |
"${workspaceFolder}", | |
"LINUX_PATH/include", | |
"LINUX_PATH/include/uapi", | |
"LINUX_PATH/include/generated", | |
"LINUX_PATH/arch/x86/include", | |
"LINUX_PATH/arch/x86/include/uapi", | |
"LINUX_PATH/arch/x86/include/generated" | |
], | |
"defines": [ | |
"__KERNEL__" | |
], | |
"intelliSenseMode": "clang-x64", | |
"browse": { | |
"path": [ | |
"${workspaceFolder}", | |
"LINUX_PATH/include", | |
"LINUX_PATH/mm", | |
"LINUX_PATH/fs", | |
"LINUX_PATH/kernel" | |
], | |
"limitSymbolsToIncludedHeaders": true, | |
"databaseFilename": "" | |
}, | |
"compilerPath": "/usr/bin/gcc", | |
"cStandard": "c89", | |
"cppStandard": "c++17" | |
} | |
], | |
"version": 3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Build Kernel for ARM", | |
"type": "shell", | |
"command": "make", | |
"args": [ | |
"ARCH=arm", | |
"KERNEL_SRC=${workspaceFolder}", | |
"CROSS_COMPILE=arm-linux-gnueabi-", | |
"O=${workspaceFolder}/build_arm", | |
"-j4" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
] | |
}, | |
{ | |
"label": "Clean", | |
"type": "shell", | |
"command": "make", | |
"args": [ | |
"ARCH=arm", | |
"CROSS_COMPILE=arm-linux-gnueabi-", | |
"O=${workspaceFolder}/build_arm", | |
"clean" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
] | |
}, | |
{ | |
"label": "Configure", | |
"type": "shell", | |
"command": "make", | |
"args": [ | |
"ARCH=arm", | |
"CROSS_COMPILE=arm-linux-gnueabi-", | |
"O=${workspaceFolder}/build_arm", | |
"defconfig" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import os.path | |
import json | |
if __name__ == '__main__': | |
desc = '''Insert macro definition configured linux kernel for VSCode configuration.''' | |
arg_parser = argparse.ArgumentParser(description=desc) | |
arg_parser.add_argument('-k', '--kernel-path', | |
action='store', | |
required=True, | |
help='Specify kernel path. Need configured properly') | |
arg_parser.add_argument('-f', '--file', | |
action='store', | |
required=True, | |
help='c_cpp_properties.json for VSCode') | |
args = arg_parser.parse_args() | |
autoconf_path = os.path.join( | |
args.kernel_path, "include/generated/autoconf.h") | |
if not os.path.exists(args.kernel_path) or \ | |
not os.path.exists(args.file): | |
print('Check files') | |
exit(1) | |
defines = [] | |
with open(autoconf_path) as fp: | |
for raw_line in fp.readlines(): | |
if not raw_line.startswith('#define'): | |
continue | |
slines = raw_line.split() | |
k = slines[1] | |
v = slines[2] | |
defines.append('{}={}'.format(k, v)) | |
with open(args.file) as fp: | |
properties = json.load(fp) | |
for conf in properties['configurations']: | |
if 'defines' in conf.keys(): | |
conf['defines'].extend(defines) | |
with open(args.file, 'w') as fp: | |
json.dump(properties, fp, indent=4) | |
print('Added {} macros'.format(len(defines))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Build a kernel module for x86_64", | |
"type": "shell", | |
"command": "make KERNEL_SRC=LINUX_PATH", | |
"args": [ | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment