代码拉取完成,页面将自动刷新
grok the linux kernel via a cmake shim
I'm sure there are great ways to spelunk the kernel with an ide... This is my attempt to rig something together using a simple ruby script and a roll of duct tape.
compile_commands.json
for kernel using an intercepted buildcompile_commands.json
into an IDE friendly CMakeLists.txt
(Note: not fully tested. Requires some prior knowledge to work around typos etc)
scan-build
(a build interceptor)## requires python
pip install scan-build --user
## installs intercept-build tool in ~/.local/bin
OR
selinux
)git clone https://github.com/rizsotto/Bear && cd Bear
mkdir build && cd build
cmake .. && make
sudo make install
cd ../..
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git reset --hard v4.14-rc2 ## random known good version
make defconfig
## Note that we intercept the build
## _Either_
bear make -j 12 ## create compile_commands.json
## _Or_
~/.local/bin/intercept-build make -j 12 ## create compile_commands.json
cd ..
git clone https://github.com/habemus-papadum/kernel-grok.git
cd linux-stable
../kernel-grok/generate_cmake ## creates CMakeLists.txt
## test that generated cmake is valid
mkdir build
cd build
cmake .. && make -j12
generate-cmake -d
option if not using clion or if cmake build directory is not one level under
kernel source rootbear
/intercept-build
, a cmake shim is created that creates a single
cmake OBJECT
library (this is a somewhat obscure library type that as opposed to SHARED
performs no linking).-Ddefines
and so can jump to defintions and find usages etc, but also allows for testing whether edits to existing files compile -- perhaps 90% of the typical dev workflow.-d
option as well as the actual ruby code (which is pretty simple))此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。