kmake - maintain kernel dependencies by extending Kbuild
kmake(1) runs on top of make(1) using a set of Makefiles to extend the Kbuild's features.
It enhances the kernel build-system with the build of a tiny rootfs and an additional Qemu target to emulate the linux kernel alongside a userland.
The userland is a tiny InitRAMFS cpio archive based on a static build of busybox(1). It contains many common UNIX utilities into a single small executable.
Build the man page using asciidoctor
$ make doc
asciidoctor -b manpage -o kmake.1 kmake.1.adoc
gzip -c kmake.1 >kmake.1.gz
rm kmake.1
Run the following command to install kmake(1)
$ sudo make install
Traditional variables DESTDIR and PREFIX can be overridden
$ sudo make install PREFIX=/opt/kmake
or
$ make install DESTDIR=$PWD/pkg PREFIX=/usr
Here is a quick example to try kmake(1) on host.
Fetch the kernel sources using the target linux_download
from kmake(1)
$ make linux_download
...
Go in the sources and configure linux using the host features and save the configuration into .config file
$ cd linux
$ make menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/mconf.o
YACC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in arch/x86/configs/x86_64_defconfig
#
configuration written to .config
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
Use kmake(1) to build the kernel image
$ kmake
Note: It is equivalent to run make(1)
$ make
Fetch the busybox sources using the target busybox_download
from kmake(1)
$ kmake busybox_download
...
... and then use kmake(1) to build the userland archive
$ kmake initramfs.cpio
Use the target runqemu
from kmake(1) to emulate the kernel alongside the
userland using qemu(1)
$ kmake runqemu
Check for kmake(1) man-page and its examples.
Enjoy!
Report bugs at https://github.com/gportay/kmake/issues
Written by Gaël PORTAY gael.portay@gmail.com
Copyright (C) 2019 Gaël PORTAY 2018 Savoir-Faire Linux Inc.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.