git-build-kernel
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
git push build kernel April 2013 Kamal Mostafa <[email protected]> Copyright 2022 Canonical Ltd. Copyright (c) 2022 Krzysztof Kozlowski <[email protected]> SPDX-License-Identifier: GPL-3.0-only ------------------------------------- Automatic kernel build, just by pushing any branch (or tag or sha or ref) to a special "branch name" on the build server. Example: (this makes it go!) ----vvvvvvvvvvvvvv kamal@laptop:~/ubuntu-raring$ git push tangerine master:build-x86_64 Total 0 (delta 0), reused 0 (delta 0) remote: building ... (ok to interrupt, build will continue) ... remote: git-build-kernel remote: defconfig: defconfig remote: arch: x86_64 remote: cc: ccache remote: starting build in tangerine:/tmp/kernel-kamal-Um4LxEzU ... remote: build log: tangerine:/tmp/kernel-kamal-Um4LxEzU/build.log remote: elapsed: 00:00:11 load average: 0.30, 0.71, 1.32 remote: build completed OK. build log: remote: tangerine:/tmp/kernel-kamal-Um4LxEzU/build.log To ssh:https://kamal@tangerine/home/kamal/src/linux/ubuntu-raring * [new branch] master -> build-x86_64 The destination branch should be of format: TARGET[-ARCH[-CONFIG]] where: - TARGET, required, valid options: build|dt_binding_check|dtbs|dtbs_w1|dtbs_check|dtbs_check_w1 - ARCH, optional, default: x86_64 - CONFIG, optional, default: defconfig Any local branch will work, so all of these are valid: git push tangerine master:build git push tangerine master:build-arm64 git push tangerine master:build-riscv git push tangerine master:dt_binding_check-arm64 git push tangerine master:dtbs_check-arm-qcom git push tangerine master-next:build-arm64-allyesconfig git push tangerine HEAD:build-arm-multi_v7 git push tangerine HEAD:build-arm-multi_v7_defconfig Features: - Ridiculously easy to use. - No locally installed tools required other than 'git'. - Works with a bare or a populated remote git repo. - Implements the standard proper fdr clean/build/binary-something sequence. - Constructs source packages in a chroot for improved reproducibility. - Can build multiple branches from the same repo simultaneously. - Builds are done on /tmp, so be sure it is tmpfs and you have a lot of RAM, for best experience. After the build, logs are left in /tmp, but no build output/binaries. - Recognized cross-compile architectures: x86_64, i386, alpha, arm, arm64, m68k, mips, powerpc, powerpc64, riscv, s390, sparc Notes: - The 'build-.*' branch you push to will get removed after the build so as to not junk up your remote repo. Its always okay to just delete those branches manually too (i.e. if the build server reboots and leaves them). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To set up your git push auto-builder 1. On the build server, clone Linux kernel repo, go to .git/hooks/ directory, and create a symlink to the builder's post-receive script. This post-receive MUST be created as a symlink (not a copy): git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cd linux/.git/hooks/ ln -s ~/git-build-kernel/post-receive . 2. On the build server, install necessary cross-compilers and tools (e.g. dtschema, yamllint). 3. Optionally, on the build server, setup cleanup script in crontab, e.g.: 0 5 * * 1 ${HOME}/git-build-kernel/gbk-cleanup --age 7 --user "${LOGNAME}" 4. On your local machine, set up a git remote to point to your repo on the build server, e.g: git remote add tangerine \ ssh:https://YOURUSERNAME@tangerine:~/linux 5. Try a push to one of the special branch names (above). Enjoy!