All Projects → habemus-papadum → Kernel Grok

habemus-papadum / Kernel Grok

grok the kernel via a cmake shim

Labels

Projects that are alternatives of or similar to Kernel Grok

Sugar
Stars: ✭ 101 (-11.4%)
Mutual labels:  cmake
Kcp Bulild
Unity3D中可靠UDP网络库kcp的各平台动态库构建项目
Stars: ✭ 109 (-4.39%)
Mutual labels:  cmake
Caveexpress
CaveExpress is a classic 2D platformer with physics-based gameplay and dozens of levels. CavePacker is a Sokoban game.
Stars: ✭ 111 (-2.63%)
Mutual labels:  cmake
Cmakepchcompiler
CMake precompiled header support via custom PCH compiler extension
Stars: ✭ 105 (-7.89%)
Mutual labels:  cmake
Buildcache
A build cache
Stars: ✭ 107 (-6.14%)
Mutual labels:  cmake
Kepka
Unofficial Telegram Desktop messaging app
Stars: ✭ 109 (-4.39%)
Mutual labels:  cmake
Covise
Collaborative Visualization and Simulation Environment, OpenCOVER and OddLOT
Stars: ✭ 101 (-11.4%)
Mutual labels:  cmake
Ros Examples
This repository is home to a collection of ROS nodes that process 3D sensor information from Velodyne LIDAR
Stars: ✭ 113 (-0.88%)
Mutual labels:  cmake
Opengl Examples
Modern OpenGL (fixed pipeline free) examples based on http://open.gl
Stars: ✭ 108 (-5.26%)
Mutual labels:  cmake
Mybot ws
URDF model for Gazebo integrated with ROS
Stars: ✭ 111 (-2.63%)
Mutual labels:  cmake
Corrosion
Marrying Rust and CMake - Easy Rust and C/C++ Integration!
Stars: ✭ 106 (-7.02%)
Mutual labels:  cmake
Sdl2 Cmake Modules
Modern CMake modules for finding and using the SDL2 library as well as other related libraries: SDL2_image, SDL2_ttf, SDL2_net, SDL2_mixer and SDL2_gfx. (Targets: SDL2::Core, SDL2::Main, SDL2::Image, SDL2::TTF, SDL2::Net, SDL2::Mixer and SDL2::GFX). Mirror of https://gitlab.com/aminosbh/sdl2-cmake-modules
Stars: ✭ 108 (-5.26%)
Mutual labels:  cmake
Kicad Doc
KiCad new documentation repository [moved to https://gitlab.com/kicad]
Stars: ✭ 110 (-3.51%)
Mutual labels:  cmake
Sh3redux
SILENT HILL 3 Engine Remake in OpenGL and C++
Stars: ✭ 105 (-7.89%)
Mutual labels:  cmake
Nrf5 Sdk For Mesh
This repo is a "Release" clone of the zip files available @
Stars: ✭ 112 (-1.75%)
Mutual labels:  cmake
Cmake Example Library
How to install a library with cmake
Stars: ✭ 101 (-11.4%)
Mutual labels:  cmake
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-4.39%)
Mutual labels:  cmake
Sampgdk
Write SA-MP gamemodes in C/C++
Stars: ✭ 113 (-0.88%)
Mutual labels:  cmake
Qhttpengine
HTTP server for Qt applications
Stars: ✭ 112 (-1.75%)
Mutual labels:  cmake
Vrt
🔅 Ray tracing library for Vulkan API (indev)
Stars: ✭ 111 (-2.63%)
Mutual labels:  cmake

kernel-grok

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.

Nutshell:

  • create compile_commands.json for kernel using an intercepted build
  • use ruby script to convert compile_commands.json into an IDE friendly CMakeLists.txt

Possible steps

(Note: not fully tested. Requires some prior knowledge to work around typos etc)

  • Install scan-build (a build interceptor)
## requires python
pip install scan-build --user
## installs intercept-build tool in ~/.local/bin

OR

  • Install Bear (Another build interceptor; wont work on recent MacOs, likely thwarted by selinux)
git clone https://github.com/rizsotto/Bear && cd Bear
mkdir build && cd build
cmake .. && make 
sudo make install
cd ../..
  • Grab the kernel and build
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 .. 
  • Use our ruby script
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
  • Now open linux-stable/CMakeLists.txt in an ide (tried testing with clion; though takes about 10 minutes to index the project initially; at first it seemed like an epic fail, but seems quite usable after initial indexing and then restarting)
  • note generate-cmake -d option if not using clion or if cmake build directory is not one level under kernel source root

Theory of operation

  • using compilation database generated by bear/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).
  • The shim should properly properly compile -- though it just creates object files that are then abandoned (not linked into a final kernel). This means your ide can be used not only for semantic navigation e.g. it knows where to find headers and knows about -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.
  • Analogy might be Xcode projects generated by CMake. Can be used to make some edits, but larger things like adding files, etc cannot be done in Xcode. So after big changes e.g. new file, new kernel config, you must repeat intercepted KBuild, regenerate shim, and then reload project in ide
  • Use ide compilation to test if your edits compile (only worth it because it is easy to navigate to errors when you ide does the build). Use KBuild to create a proper image to run in qemu etc.
  • NOTE: Everything depends on the kernel actually being built at least once with normal Kbuild. There are generated files that are needed.
  • NOTE: Although a CMakeLists.txt is included in the repo for providing a quick look at what is being done, it should not be used -- GENERATE YOUR OWN
  • NOTE: linux assumes builds are done from the root src directory e.g. "in-tree". Some hacking is done to allow the cmake shim to work out of tree (again, cf. -d option as well as the actual ruby code (which is pretty simple))
  • NOTE: An alternative would be to use {spac}emacs + rtags -- TODO: compare and constrast vs clion
  • A similar approach can be taken to spelunk through other non-cmake projects , though each project will require some tinkering
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].