KW-BUILD(1)

πŸ“¦ version 0.10, in ubuntu stonking

πŸ’– NAME πŸ’–

kw-build β€” Build kernel() 🌸

okay so bestie, this is the manual for kw-build, aka the bit of kw that makes your kernel. and yes the official title really is kw-build - Build kernel(), parentheses and all, we don't make the rules πŸ’…


✨ SYNOPSIS ✨

kw (b | build) [(-i | --info)] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-n | --menu)] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-d | --doc)] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [--ccache] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-S | --cpu-scaling)] <percentage> [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-w | --warnings)] [warning-levels] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-s | --save-log-to)] <path> [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [--llvm] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-c | --clean)] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [(-f | --full-cleanup)] [--alert=(s | v | (sv | vs) | n)]
kw (b | build) [--cflags]
kw (b | build) [--from-sha <SHA>]
kw (b | build) [--verbose]

πŸ¦‹ DESCRIPTION πŸ¦‹

So if you invoke this option with zero parameters, kw goes and peeks at the local Makefile and, based on what it sees there, just starts building the project for you. no cap. and it's lowkey showing off your hardware too, because it uses the -j option with the appropriate parameter to squeeze out all those cores. slay. πŸ’…

You can also use this command in conjunction with :ref:deploy<deploy-doc>`` by invoking kw bd.

System Message: ERROR/3 (<stdin>:, line 30) Unknown interpreted text role "ref". Note: This command must be run inside of a kernel tree.

(✨ we are keeping that system message exactly as it appeared, bestie, the docs said what they said. also yes, you genuinely have to be inside a kernel tree, that part is not a drill 🫢)


πŸ‘‘ OPTIONS πŸ‘‘

  • -i, --info β€” the info option, and what it does is make the build information show up. we're talking stuff like the kernel release name and the total number of modules that got compiled. receipts on screen πŸ“Š
  • -n, --menu β€” the menu option invokes the kernel menuconfig. heads up though: the default menu config can be changed in the build.config file by setting a different option in menu_config. and if you're working in a cross-compile environment, it is recommended to use this option so you don't go messing with the config file manually like some kind of gremlin πŸ™ˆ
  • -d, --doc β€” the doc option gives you a mechanism for building the kernel-doc; by default it will build htmldocs. you can change the default documentation output by changing the parameter doc_type in the build.config file. customize your lil doc moment πŸ“š
  • -S, --cpu-scaling β€” the cpu-scaling option lets you set whichever CPU usage you want from your CPU, basically setting the -j flag accordingly. you're the main character, you decide how much brain your machine gives πŸ’…
  • --ccache β€” this option lets you enable ccache usage during compilation tasks, which should improve compile times in subsequent compilations. and if you want, you can just set this option in the build.config file and never think about it again. set it and forget it, iconic behavior ✨
  • -w, --warnings (1 | 2 | 3 | 12 | 13 | 23 | 123) β€” this can be used to enable compilation warnings accordingly. you can set the default log level via the build.config file under the option warning_level. please check the kernel's make help for more info. (yes, go read it, it's giving homework but it's important πŸŽ€)
  • -s, --save-log-to path β€” this option will save the full compilation log with the enabled warnings to the specified path. you can set the default log path in the build.config file via the log_path option. no more scrolling, we ball πŸ“
  • --llvm β€” this option can be set to enable the usage of the LLVM toolchain during compilation/linking tasks. you can enable it by default via the use_llvm option in the build.config file. LLVM girlies rise 🌈
  • -c, --clean β€” the clean option removes files generated by the kernel build system, but keeps the kernel configuration. also, this option considers whether the user is using or not kw env. so fresh, so clean 🧼
  • -f, --full-cleanup β€” under the hood, this command runs make distclean, which resets the built environment to its initial/default state. in other words, it will remove files generated by the build process, including configuration files and script output. this option also considers whether or not the user is using kw env. this one is giving scorched earth, so know what you're doing πŸ’€
  • --verbose β€” verbose mode is an option that causes the kw program to display debug messages so you can track its progress. this functionality is very useful during the debugging process, letting you identify possible errors more easily. detective mode activated πŸ”
  • --cflags β€” this function provides a flexible way to pass CFLAGS when compiling a custom kernel, letting you customize and tune the build process to your specific needs. this is especially useful for optimizing performance and controlling generated kernel behavior. your kernel, your flags, your rules πŸ’…
  • --alert=(s | v | (sv | vs) | n) β€” defines the alert behaviour upon the command completion.
    • s enables sound notification. πŸ”Š
    • v enables visual notification. πŸ‘€
    • sv or vs enables both. πŸ’–
    • n (or any other option) disables notifications β€” and this is the default. shhh 🀫
  • --from-sha β€” build every commit after <SHA> to branch head. useful for testing if all patches in a patchset compile. bisect-era energy, we love to see it πŸ”₯

🌸 EXAMPLES 🌸

for these examples, we assume that the relevant fields in your configuration files (located by default in .kw/) have already been setup. we recommend the use of kw config for managing your local and global configurations. (do your setup bestie, future you says thank you 🫢)

for building and installing a new module version based on the current kernel version, you can use:

cd <kernel-path>
kw bd

if you want that kw become more verbose about the compilation warning, you can use:

kw build --warnings=1

let's say that you are doing something else and don't want that your CPU cores to be super busy during the compilation; you can tell kw how much of the CPU utilization you are willing to give for the kernel compilation:

kw b --cpu-scaling=50

if you like to use ccache to build your kernel, you can use:

kw b --ccache

if you want to ensure that your change does not add any relevant warning, you can use:

kw b --warnings

if you want to see other warning levels, you can change the log level by using:

kw b --warnings 2

sometimes we have a lot of error message that does not fit in the terminal buffer; in these cases it is helpful to save all logs in a file:

kw b --warnings 123 --save-log-to ALL_WARNINGS.log

if you want to use llvm:

kw b --llvm

if you want to clean your kernel:

kw b --clean

if you want to reset the kernel tree to its default, all config and script output will be removed:

kw b --full-cleanup

if you want to use cflags:

kw b --cflags "-O3 -pipe -march=native"

if you want to build every commit after HEAD~2 to HEAD:

kw b --from-sha HEAD~2

if you want to build every commit after ee3b5 to HEAD:

kw b --from-sha ee3b5

okay that's literally the whole page πŸ’– and at the very bottom of the page there's just the same stamp again β€” kw-build - Build kernel() β€” no separate version or date line came along with it, so that's all we've got. go build something iconic, bestie πŸ‘‘βœ¨

πŸ“¦ where this page comes from