{"id":13510834,"url":"https://github.com/kerneltlv/kernel-hacking","last_synced_at":"2025-03-30T17:31:28.373Z","repository":{"id":46908072,"uuid":"112339204","full_name":"kerneltlv/kernel-hacking","owner":"kerneltlv","description":"An environment and set of utilities aimed at making kernel hacking simple and accessible","archived":false,"fork":false,"pushed_at":"2023-07-22T14:33:52.000Z","size":68,"stargazers_count":63,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T08:47:53.199Z","etag":null,"topics":["kernel","kernel-compilation","kernel-developers","kernel-driver","kernel-hacking","kernel-module","kernel-modules","kernel-source","learn","learn-to-code","learning","learning-by-doing","linux","linux-drivers","linux-kernel","linux-kernel-module","literate-programming","newcomers","operating-system","operating-systems"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kerneltlv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-28T13:30:50.000Z","updated_at":"2025-01-08T06:32:22.000Z","dependencies_parsed_at":"2024-01-13T19:37:58.893Z","dependency_job_id":"dc7b49a0-113f-45e8-973c-ab74a4069638","html_url":"https://github.com/kerneltlv/kernel-hacking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerneltlv%2Fkernel-hacking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerneltlv%2Fkernel-hacking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerneltlv%2Fkernel-hacking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerneltlv%2Fkernel-hacking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kerneltlv","download_url":"https://codeload.github.com/kerneltlv/kernel-hacking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246355384,"owners_count":20763990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kernel","kernel-compilation","kernel-developers","kernel-driver","kernel-hacking","kernel-module","kernel-modules","kernel-source","learn","learn-to-code","learning","learning-by-doing","linux","linux-drivers","linux-kernel","linux-kernel-module","literate-programming","newcomers","operating-system","operating-systems"],"created_at":"2024-08-01T02:01:55.936Z","updated_at":"2025-03-30T17:31:28.366Z","avatar_url":"https://github.com/kerneltlv.png","language":"Python","funding_links":[],"categories":["Python","operating-system"],"sub_categories":[],"readme":"# KernelTLV Linux Hacking Environment\n\n## Purpose\nThis 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.\n\nThe 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.\n\n## Requirements\n1. [Vagrant](https://www.vagrantup.com/)\n1. [VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n1. The vagrant-vbguest plugin (Run `vagrant plugin install vagrant-vbguest`).\n1. ~15GB of free space.\n\n## Usage\nRun `vagrant up` where you cloned the repo (where `Vagrantfile` is) to create a shiny new VM with everything you need.\n\nThis will take a while.\n\nOnce it's done, run `vagrant ssh` to enter the machine and from there, depending on your level of familiarity with kernel development, either:\n\n* Newcomer - run `khack` for an explanation of what you can do here (WIP),\n* Experienced developer - run `khack --help` for a list of useful scripts,\n\nor just ignore khack entirely and do your own thing.\n\n## Details\nInside the VM home directory, there will be:\n* `linux-source`: Linux kernel sources ready to be compiled with the minimal configuration from `linux-config`.\n* `khack`: The khack utility.\n* `module`: Scaffold code for a kernel module.\n* `linux-config`: Premade kernel configs.\n* `system-config`: Configuration files for different system-related programs, there's usually no need to touch this.\n* `boot-backup`: A backup of `/boot`, just in case.\n\n`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.  \n**To edit the kernel source, see below.**\nEverything else can be done the traditional way (compile and install the kernel, etc) or using khack for convenience.\n\n## Editing from host\nWe reveal the source via SMB/CIFS, to avoid issues with building the kernel on a VirtualBox shared directory.\nTo mount:\n\n### Ubuntu\nVia terminal:\n```\nsudo apt install cifs-utils\nsudo mount -t cifs //localhost/kernel-source WHERE_TO_MOUNT -o port=10139,username=vagrant,password=vagrant,uid=$USER,gid=$USER\n```\nVia Nautilus:\n```\nsmb://vagrant:vagrant@localhost:10139/kernel-source/\n```\n\n### macOS\nVia terminal:\n```\nsudo mount -t smbfs '//vagrant:vagrant@localhost:10139/kernel-source' WHERE_TO_MOUNT\n```\nVia Finder:\n\nUse Connect to Server (cmd+K) with the URL `smb://vagrant:vagrant@localhost:10139/`.\n\n## khack\nkhack 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.\n\nIts 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`).\n\nFor example:\n\n* `khack kernel make` will build the kernel in `~\\linux-source`.\n* `khack kernel install` will install the built kernel so that it will run when the VM is restarted.\n* `khack kernel running` will report if the latest compiled kernel is actually running.\n\nExperiment and have fun,\n\nKernelTLV Team\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerneltlv%2Fkernel-hacking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkerneltlv%2Fkernel-hacking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerneltlv%2Fkernel-hacking/lists"}