Code Monkey home page Code Monkey logo

kernel-hacking's Introduction

KernelTLV Linux Hacking Environment

Purpose

This project is a way to bring up a Linux kernel development environment quickly and easily, without using tools like QEMU or building a toolchain and cross-compiling. This is done by building a kernel from the Debian-supplied package and using it with the Debian distribution.

The project also includes khack, a utility for taking some guesswork out of the process of hacking on the kernel as well as serving as a guide for newcomers, as an alternative for reading a lot of material online and attempting to learn by trial and error.

Requirements

  1. Vagrant
  2. VirtualBox
  3. The vagrant-vbguest plugin (Run vagrant plugin install vagrant-vbguest).
  4. ~15GB of free space.

Usage

Run vagrant up where you cloned the repo (where Vagrantfile is) to create a shiny new VM with everything you need.

This will take a while.

Once it's done, run vagrant ssh to enter the machine and from there, depending on your level of familiarity with kernel development, either:

  • Newcomer - run khack for an explanation of what you can do here (WIP),
  • Experienced developer - run khack --help for a list of useful scripts,

or just ignore khack entirely and do your own thing.

Details

Inside the VM home directory, there will be:

  • linux-source: Linux kernel sources ready to be compiled with the minimal configuration from linux-config.
  • khack: The khack utility.
  • module: Scaffold code for a kernel module.
  • linux-config: Premade kernel configs.
  • system-config: Configuration files for different system-related programs, there's usually no need to touch this.
  • boot-backup: A backup of /boot, just in case.

khack, module and linux-config are set up to be shared with the host operating system, so you can use your favorite editor to edit files in them.
To edit the kernel source, see below. Everything else can be done the traditional way (compile and install the kernel, etc) or using khack for convenience.

Editing from host

We reveal the source via SMB/CIFS, to avoid issues with building the kernel on a VirtualBox shared directory. To mount:

Ubuntu

Via terminal:

sudo apt install cifs-utils
sudo mount -t cifs //localhost/kernel-source WHERE_TO_MOUNT -o port=10139,username=vagrant,password=vagrant,uid=$USER,gid=$USER

Via Nautilus:

smb://vagrant:vagrant@localhost:10139/kernel-source/

macOS

Via terminal:

sudo mount -t smbfs '//vagrant:vagrant@localhost:10139/kernel-source' WHERE_TO_MOUNT

Via Finder:

Use Connect to Server (cmd+K) with the URL smb://vagrant:vagrant@localhost:10139/.

khack

khack is meant to simplify hacking on the kernel and teach newcomers which commands actually work by, you know, showing that they actually work, saving learners from the frustration of trying to adjust incantations from an online tutorial written ten years ago.

Its source is available under khack and it can be used as simply khack within the VM as it is symlinked into the right place (see setup_vm.sh).

For example:

  • khack kernel make will build the kernel in ~\linux-source.
  • khack kernel install will install the built kernel so that it will run when the VM is restarted.
  • khack kernel running will report if the latest compiled kernel is actually running.

Experiment and have fun,

KernelTLV Team

kernel-hacking's People

Contributors

backslasher avatar dependabot[bot] avatar idoby avatar solebox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kernel-hacking's Issues

VirtualBox Guest additions error

I'm using Fedora 27 workstation
Installed the latest virtualbox 5.2.7
Installed the latest vagrant 2.0.2
After vagrant up virtualbox is trying to install 5.2.7 guest additions and then I see these errors:

VirtualBox Guest Additions: modprobe vboxsf failed An error occurred during installation of VirtualBox Guest Additions 5.2.7. Some functionality may not work as intended. In most cases it is OK that the "Window System drivers" installation failed. Job for vboxadd-service.service failed because the control process exited with error code. See "systemctl status vboxadd-service.service" and "journalctl -xe" for details. Unmounting Virtualbox Guest Additions ISO from: /mnt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.