{"id":15003632,"url":"https://github.com/aboehm/clt2024-rust-kernel-module","last_synced_at":"2025-09-23T03:42:41.865Z","repository":{"id":225214345,"uuid":"765375776","full_name":"aboehm/clt2024-rust-kernel-module","owner":"aboehm","description":"Chemnitzer Linux Tage 2024: Workshop Rust-Kernel-Modul selber bauen","archived":false,"fork":false,"pushed_at":"2024-03-19T16:22:52.000Z","size":1283,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-02T08:03:18.428Z","etag":null,"topics":["linux-kernel","rust","workshop"],"latest_commit_sha":null,"homepage":"https://chemnitzer.linux-tage.de/2024/en/programm/beitrag/175","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aboehm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-29T19:53:54.000Z","updated_at":"2024-06-26T08:43:17.000Z","dependencies_parsed_at":"2024-03-19T16:53:29.188Z","dependency_job_id":null,"html_url":"https://github.com/aboehm/clt2024-rust-kernel-module","commit_stats":null,"previous_names":["aboehm/clt2024-rust-kernel-module"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboehm%2Fclt2024-rust-kernel-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboehm%2Fclt2024-rust-kernel-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboehm%2Fclt2024-rust-kernel-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aboehm%2Fclt2024-rust-kernel-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aboehm","download_url":"https://codeload.github.com/aboehm/clt2024-rust-kernel-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238955775,"owners_count":19558454,"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":["linux-kernel","rust","workshop"],"created_at":"2024-09-24T18:59:33.897Z","updated_at":"2025-09-23T03:42:41.796Z","avatar_url":"https://github.com/aboehm.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust on Linux Workshop\n\nFiles for Rust for Linux Workshop at the Chemnitzer Linux Tage 2024. The slides are located under [slides/SLIDES.md](slides/SLIDES.md).\n\nYou will find the solution for the workshop task in [`linux/samples/rust/rust_chrdev_solution.rs`](https://github.com/aboehm/linux/blob/v6.7-rust-clt24/samples/rust/rust_chrdev_solution.rs)\n\n## Overview\n\nDirectory structure\n\n```text\n├── build               -- Temporary build directory\n│   ├── bzImage         -- The kernel\n│   ├── initramfs       -- Our minimal RootFS directory\n│   └── initramfs.cpio  -- The packed minimal RootFS\n├── docker\n│   └── Dockerfile      -- Container specification of the build environment\n├── linux               -- Linux kernel sources\n├── linux-config        -- Kernel configs\n├── rust-module         -- Rust kernel module template\n└── scripts             -- Some useful scripts to build the project\n```\n\n## Prepare\n\nInstall the required tools\n\n```sh\n# Debian/Ubuntu\napt-get install git podman qemu-system-x86\n```\n\nClone the repository\n\n```\ngit clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/aboehm/clt2024-rust-kernel-module.git \n```\n\n### Containered tools\n\nThe environment require `podman`/`buildah` or `docker`. The scripts will check which one installed.\n\nIt's optional to build the build environment container. You can pull it from [docker hub](https://hub.docker.com/r/aboehm/clt2024-rust-on-linux-workshop) instead.\n\nTo build the container with all required tools run\n\n\n```sh\n./scripts/build-builder\n# Enforce to use buildah\nDOCKER_BIN=buildah ./scripts/build-builder\n# Enforce to use docker\nDOCKER_BIN=docker ./scripts/build-builder\n```\n\nTo enter the build environment run\n\n```sh\n./scripts/enter-build-env\n# Enforce to use podman\nDOCKER_BIN=podman ./scripts/enter-build-env\n# Enforce to use docker\nDOCKER_BIN=docker ./scripts/enter-build-env\n```\n\n## Development\n\n### Configure the kernel\n\nCopy the prepared kernel config from [linux-config/v6.7-rust-clt24](linux-config/v6.7-rust-clt24) to `linux/.config`.\nAfter you can modify the configuration.\n\n```sh\nmake LLVM=1 menuconfig\n```\n\n### Build everything\n\nStart the build process\n\n```\n# Build the kernel and modules\nmake -j`nproc` LLVM=1 all\n# Install the module into \nmake LLVM=1 INSTALL_MOD_PATH=\u003cpath to initramfs\u003e modules_install\n```\n\nAfter some minutes the should be store under `arch/x86/boot/bzImage`.\n\nYou can run the kernel with [QEMU](https://qemu.org)\n\n```sh\nqemu-system-x86_64 --kernel arch/x86/boot/bzImage\n```\n\n### Repetitive steps via helper scripts\n\nThere're several helper scripts to run some required commands.\n\nBuild the kernel and modules and install the modules into initramfs\n\n```sh\n./scripts/build-kernel\n```\n\nGenerate a new *initramfs* image\n\n```sh\n./scripts/gen-initramfs\n```\n\nRun the built kernel with initramfs\n\n```sh\n./scripts/run-kernel\n```\n\nYou get a serial console on the terminal and can load the module.\n\nAll these commands can be run at once with\n\n```sh\n./scripts/dev-cycle\n```\n\n## Trouble shooting\n\n### Permission issues\n\nWhen using docker without the provided scripts file will be created or written as root. Change the user by running\n\n```sh\nsudo chown -R $(id -u):$(id -g) .\n```\n\n### Version errors during the build of the kernel module\n\nRemove the already build kernel under `build/bzImage`.\n\n### There're a lot of old files in the booted RootFS\n\nFiles in the initramfs directory will overwritten but not deleted. Delete all files of `build/initramfs`.\n\n### Rust option is missing in the kernel configuration dialog\n\nMaybe some build commands were executed without `LLVM=1`. Copy the configuration again and run `make LLVM=1 menuconfig` again to select your module. Ensure you add the LLVM parameter to each call of `make`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faboehm%2Fclt2024-rust-kernel-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faboehm%2Fclt2024-rust-kernel-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faboehm%2Fclt2024-rust-kernel-module/lists"}