Reputation: 9363
When debugging kernel, I often rebuild the kernel with just make. Even if I just modify one-liner, I have to pass through all the below commands:
make[1]: Nothing to be done for `all'.
CHK include/generated/uapi/linux/version.h
make[1]: Nothing to be done for `relocs'.
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
PASYMS arch/x86/realmode/rm/pasyms.h
LDS arch/x86/realmode/rm/realmode.lds
LD arch/x86/realmode/rm/realmode.elf
RELOCS arch/x86/realmode/rm/realmode.relocs
OBJCOPY arch/x86/realmode/rm/realmode.bin
AS arch/x86/realmode/rmpiggy.o
CHK kernel/config_data.h
LD arch/x86/realmode/built-in.o
VDSOSYM arch/x86/vdso/vdso-syms.lds
VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds
VDSOSYM arch/x86/vdso/vdso32-syscall-syms.lds
VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds
VDSOSYM arch/x86/vdso/vdso32-syms.lds
LD arch/x86/vdso/built-in.o
LD arch/x86/built-in.o
CC drivers/gpu/drm/i915/i915_debugfs.o
LD drivers/gpu/drm/i915/i915.o
LD drivers/gpu/drm/i915/built-in.o
LD drivers/gpu/drm/built-in.o
LD drivers/gpu/built-in.o
LD drivers/built-in.o
CHK include/generated/uapi/linux/version.h
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `relocs'.
LINK vmlinux
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
KSYM .tmp_kallsyms1.o
KSYM .tmp_kallsyms2.o
LD vmlinux
SORTEX vmlinux
SYSMAP System.map
Building modules, stage 2.
VOFFSET arch/x86/boot/voffset.h
CC arch/x86/boot/version.o
OBJCOPY arch/x86/boot/compressed/vmlinux.bin
GZIP arch/x86/boot/compressed/vmlinux.bin.gz
MKPIGGY arch/x86/boot/compressed/piggy.S
AS arch/x86/boot/compressed/piggy.o
LD arch/x86/boot/compressed/vmlinux
ZOFFSET arch/x86/boot/zoffset.h
OBJCOPY arch/x86/boot/vmlinux.bin
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Setup is 16688 bytes (padded to 16896 bytes).
System is 4107 kB
CRC 9346a092
Kernel: arch/x86/boot/bzImage is ready (#29)
MODPOST 664 modules
For passing all over the above commands, it almost take 1~2 minutes, which I still feel boring. Is there any kind of tricks to reduce the kernel re-build time?
Upvotes: 2
Views: 3304
Reputation: 6786
Check out some of the options from make help
in the kernel source directory.
$make help
Other generic targets:
all - Build all targets marked with [*]
- vmlinux - Build the bare kernel
- modules - Build all modules modules_install - Install all modules to INSTALL_MOD_PATH (default: /) firmware_install- Install all firmware to INSTALL_FW_PATH (default: $(INSTALL_MOD_PATH)/lib/firmware) dir/ - Build all files in dir and below dir/file.[oisS] - Build specified target only dir/file.lst - Build specified mixed source/assembly target only (requires a recent binutils and recent build (System.map)) dir/file.ko - Build module including final link
modules_prepare - Set up for building external modules tags/TAGS- Generate tags file for editors cscope - Generate cscope index gtags - Generate GNU GLOBAL index kernelrelease
- Output the release version string kernelversion - Output the version stored in Makefile image_name - Output the image name
headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
It depends on the changes you are doing. If the changes are specific to a kernel module. then you module should be ready to load and test.
$make M=/path/to/module/dir/
If the changes are in the config and require re-generating the build scripts
$make prepare $make scripts $make M=/path/to/module/dir/
In some cases if its required to regenerate just the vmlinux
$make vmlinux
Upvotes: 0
Reputation: 1545
The -j
flag will tell make
how many jobs to do in parallel. Eg. make -j4
will do four jobs in parallel.
Regarding what should you set -j
to; I don't believe there's a straightforward answer.
There's a good thread about it here: GNU make: should the number of jobs equal the number of CPU cores in a system?
Upvotes: 1