This set of scripts have a simple mission: reduce the overhead with infrastructure setup for Linux development. We export all the scripts functionality via bashrc, to make the commands available in any place you want to work.
Kworkflow stands for Kernel Workflow.
You have to figure out the correct package name in your distro for the following dependencies:
If you want to use the default alert system (for commands that may take longer to run), you will also need to install:
If you want to use Qemu, we recommend the following steps:
- Create an Qemu image as a qcow2;
- Create a working directory:
- After you have your image, we recommend you to setup basic stuff (this can vary depends on the distribution you choose - kernel setup, ssh, etc);
In the main directory, type:
./setup.sh -i bash --login
This command will install
~/.config/kw, and add the following lines at the end of your
# kw source /home/<user>/.config/kw/kw.sh
To check if the installations was ok, type:
Finally, everytime that you want to update your
kwjust pull from this repository and install again (
./setup -iremove legacy files and intall new one).
Global configuration file
All the default configurations used by kworflow can be seen at "~/.config/kw/etc/kworkflow.config"; this config file has a comment on each configuration option. Finally, it is important to highlight that kw loads de default configurations; next, it tries to find a local configuration file (detailed ahead) and overwrite the global option by the ones read from the local config file.
Local configuration file
One of the features of this project, it is the ability to set a specific set of configuration per directory. For example, if you have a particular kernel tree named 'drm-work' and want a different configuration from the default you can follow these steps:
cp kworkflow.config.example /path/to/your/kernel/tree/drm-work/kworkflow.config
Note: the default name must be
- Change the options inside:
qemu_hw_options=-enable-kvm -daemonize -m 3G -smp cores=4,cpus=4 qemu_net_options=-net nic -net user,hostfwd=tcp::2222-:22,smb=$HOME qemu_path_image=$HOME/p/virty.qcow2
- Done, every time you execute any command in the root dir of drm-work the configuration file will be read. If file does not exists, the default operation will be used.
Build a Kernel and install in the Qemu image:
Mount Qemu image to transfer data:
Umount Qemu image:
Show variable status used by
Turn on vm:
Run checkpatch in a target (directory of file):
kw codestyle|c <DIRECTORY_PATH | FILE_PATH>
Get maintainers (directory or file): The option [-a|--authors] will print the file author of FILE_PATH or the authors of the files under DIRECTORY_PATH (non-recursively). Files with more than one author will have their authors separated by ",". Use with care, because sometimes, authors include also "," in their names (e.g. "Company X, Inc.").
kw maintainers|m [-a|--authors] <DIRECTORY_PATH | FILE_PATH>
Search for a regex in a directory or file:
kw explore <EXPRESSION> <DIRECTORY_PATH | FILE_PATH>
Search for a word added in a git commit:
kw explore log <EXRESSION> [-p] <DIRECTORY_PATH | FILE PATH>
You can put your VM in a status that is ready for work with the prepare command. However, there is some basic steps for it work well:
- Add your public key in the VM on the authorized_keys file;
- Remove the requirement for password in the VM to became root. Something like that:
user ALL=(ALL) NOPASSWD: ALL
If you have everything set, just execute the command:
Some commands take considerable time to execute. So kw gives you an option to be notified when they finish. That way, you can do something else while they run. The commands with this feature available are: prepare, build, install, mount, umount, new and bi. To enable the notification, use the option "--alert=vs", e.g.:
kw prepare --alert=vs
There are four options to --alert=, which are vs|sv, v, s, n.
- v enables visual notification
- s enables sound notification
- vs or sv enables both
- n (or any other option) disable notifications
The default option, when --alert= is not given is n. It can be configured at the kworflow.config file.
Tests rely on
run_tests.shautomatically uses a
shunit2executable if detected in
$PATH(as is the case for package distributions). Otherwise, a
shunit2script is expected to be present at
tests/(downloadable from https://github.com/kward/shunit2).
You can either run all tests with:
List all available test files:
Or run individual test files:
run_tests.sh test tfile1 tfile2 tfile3
Tests rely on some external files, that are downloaded automatically when you first try to run a test. You can, however, force
run_tests.shto prepare the environment for running tests, with:
Also, if you already have the test's environment prepared but wants to update the external files, there's an option to upgrade the environment:
run_tests.sh prepare -f|--force-update
Please note that run_tests.sh must be run from the directory it is in, i.e. the root of the repository. Otherwise, it may not execute properly.