{"id":18457928,"url":"https://github.com/0xor0ne/docker-linux-kernel-builder","last_synced_at":"2026-05-07T18:35:42.792Z","repository":{"id":127661720,"uuid":"489055463","full_name":"0xor0ne/docker-linux-kernel-builder","owner":"0xor0ne","description":"Docker image for Linux kernel cross-compilation","archived":false,"fork":false,"pushed_at":"2022-05-07T17:29:24.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T16:21:34.572Z","etag":null,"topics":["cross-compilation","crosscompile","docker","kernel","linux","linux-kernel"],"latest_commit_sha":null,"homepage":"","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/0xor0ne.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":"2022-05-05T16:51:52.000Z","updated_at":"2025-03-30T11:58:37.000Z","dependencies_parsed_at":"2023-03-24T01:09:06.562Z","dependency_job_id":null,"html_url":"https://github.com/0xor0ne/docker-linux-kernel-builder","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/0xor0ne/docker-linux-kernel-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xor0ne%2Fdocker-linux-kernel-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xor0ne%2Fdocker-linux-kernel-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xor0ne%2Fdocker-linux-kernel-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xor0ne%2Fdocker-linux-kernel-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xor0ne","download_url":"https://codeload.github.com/0xor0ne/docker-linux-kernel-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xor0ne%2Fdocker-linux-kernel-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32750894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cross-compilation","crosscompile","docker","kernel","linux","linux-kernel"],"created_at":"2024-11-06T08:16:05.111Z","updated_at":"2026-05-07T18:35:42.761Z","avatar_url":"https://github.com/0xor0ne.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker (based) Linux Kernel Builder\n\nDocker image for cross-compiling the Linux kernel.\n\nCheck the [requirements](./docs/prerequisites.md) before proceeding.\n\n## Initial Setup\n\n### Linux kernel Source Code and Toolchain\n\nPut the archives containing the Linux Kernel source code and the toolchain in\nthe `files` directory.\n\nHere is an example showing how to download Linux Kernel 3.15.37 from\n[kernel.org](https://kernel.org/) and a toolchain provided by\n[Bootlin](https://toolchains.bootlin.com/) for arm64 architecture.\n\n```bash\n  curl --output files/kernel.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.37.tar.xz\n  curl --output files/toolchain.tar.bz2 https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--glibc--stable-2021.11-1.tar.bz2\n```\n\nSee the [documentation](./docs/download_lk_tc.md) for more examples and an\nautomated way to download both the Kernel source code and the toolchain.\n\n### Variables Setup\n\nEdit file `config.env` and modify the following variables:\n\n- LK_ARCHIVE_NAME: name of the archive containing the Linux Kernel source code\n  placed in `files` directory;\n- TC_ARCHIVE_NAME: name of the archive containing the toolchain placed in\n  `files` directory;\n- LK_ARCH: name of the target architecture (must match the used toolchain).\n  Examples are `arm`, `arm64` and `mips`\n\n## Building the Docker Image\n\nBuilding the Docker image is a two steps process. At first, a permanent volume\ncontaining both the toolchain and the kernel source code must be\ncreated with:\n\n```bash\n  ./scripts/docker_create_volume.sh\n```\n\nThen, the actual Docker image can be built with:\n\n```bash\n  ./scripts/docker_build.sh\n```\n\n## Configuring and Building the Linux Kernel\n\nIt is possible to invoke any available make target on the kernel source code by\nusing the script `scripts/make.sh`. For example, the following command will\nprint the kernel make help message:\n\n```bash\n  ./scripts/make.sh help\n```\n\nNOTE: the first time the container is executed it will take more time because a\nscript will take care of extracting the kernel source code and the toolchain\ncontained in the permanent volume.\n\n### Configuration\n\nThe kernel can be configured as usual. Here are a few examples:\n\n- Use the default configuration for the target architecture:\n\n```bash\n  ./scripts/make.sh defconfig\n```\n\n- Configure the kernel manually using a menu based program:\n\n```bash\n  ./scripts/make.sh menuconfig\n```\n\n- Use an existing configuration: save the existing configuration in\n  `shared/.config` and then run:\n\n```bash\n  ./scripts/make_olddefconfig.sh\n```\n\n- Configure the tiniest possible kernel for the target architecture (with this\n  configuration kernel modules are usually disabled):\n\n```bash\n  ./scripts/make.sh tinyconfig\n```\n\n\n### Kernel Build\n\nBuild the kernel with:\n\n```bash\n  ./scripts/make_all_install_retrieve.sh\n```\n\nat the end of the build process, the output artifacts will be placed in\n`shared/install`. Here you will find the kernel image (`vmlinux`), the symbol\ntable (`System.map`), the used configuration, the kernel headers (in `include`\ndirectory) and the kernel modules (in `lib` directory).\n\n### Cleaning Kernel Build\n\nThe kernel build directory can be cleaned as usual using the `clean` target or\nthe `mrproper` target (for removing also the configuration file). E.g.,\n\n```bash\n  ./scripts/make.sh mrproper\n```\n\n## Reset Docker Image and Volume\n\nIn order to start from scratch (remove the permanent volume, the Docker\nimage and the content of `shared` directory), you can remove everything with:\n\n```bash\n  ./scripts/docker_remove_all.sh\n```\n\n## TODOs\n\n- Add script for building out-of-tree kernel modules;\n- Add support for building Busybox for quick testing in Qemu;\n  - [see here](https://mgalgs.io/2021/03/23/how-to-build-a-custom-linux-kernel-for-qemu-using-docker.html)\n- Add support for [building the kernel with CLANG](https://www.kernel.org/doc/html/latest/kbuild/llvm.html#);\n- Add support for building experimental Rust based kernel modules.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xor0ne%2Fdocker-linux-kernel-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xor0ne%2Fdocker-linux-kernel-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xor0ne%2Fdocker-linux-kernel-builder/lists"}