简体   繁体   English

如何建立freebsd内核?

[英]How to build freebsd kernel ?

According to freeBSD handbook, we need to use the following targets to build the freeBSD kernel :- 根据freeBSD手册,我们需要使用以下目标来构建freeBSD内核:

make KERNCONF=config_file buildkernel

Now, even if I make a small change in a single source file, it takes a long time to compile the kernel. 现在,即使我在单个源文件中进行了很小的更改,编译内核仍需要很长时间。 I am pretty sure that it is because, everything is built again including the files which were not affected in anyway. 我非常确定这是因为,所有内容都重新构建,包括无论如何都不会受到影响的文件。

This is creating a very big problem for me as the build time is very large (around 45 minutes) . 这对于我来说是一个很大的问题,因为构建时间非常长(大约45分钟)。

How can I only build the freeBSD kernel and not rebuild it ? 我如何只构建freeBSD内核而不重建它?

I have looked at the handbook and the Makefile but couldn't find any information related to it. 我查看了手册和Makefile,但找不到与之相关的任何信息。

Use make KERNCONF=config_file buildkernel -DNO_CLEAN . 使用make KERNCONF=config_file buildkernel -DNO_CLEAN See the build man page for more details. 有关更多详细信息,请参见构建手册页

PS You can put KERNCONF=config_file in /etc/make.conf and NO_CLEAN=true in /etc/src.conf to avoid having to type it every time, so you don't have a chance to accidentally forget. PS您可以将KERNCONF=config_file放在/etc/make.conf而将NO_CLEAN=true放在/etc/src.conf以避免每次都要键入它,因此您没有机会意外忘记。

If you only changed a piece of kernel source and not the kernel config, use KERNFAST. 如果您仅更改了一部分内核源而不是内核配置,请使用KERNFAST。 Like this: make buildkernel KERNFAST=1. 像这样:使buildkernel KERNFAST = 1。 It's so useful I've got this in my ~/.zshrc: 它非常有用,我可以在〜/ .zshrc中找到它:

alias 'mbir'='make -j4 buildkernel installkernel KERNFAST=1 && reboot' 别名'mbir'='make -j4 buildkernel installkernel KERNFAST = 1 && reboot'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM