lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <acb6aef1-c8b2-1f0b-3859-be72aad3e0eb@infradead.org>
Date:   Fri, 2 Apr 2021 11:49:10 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     James Courtier-Dutton <james.dutton@...il.com>,
        LKML Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Compiling Linux kernel into a build directory

On 4/2/21 11:29 AM, James Courtier-Dutton wrote:
> Hi,
> 
> Currently, when one builds the linux kernel, it places .o files all
> over the source code tree.
> Is there a way to have the linux kernel build, but place all the .o
> files into a separate build folder?
> Similar to how cmake or ninja work when building C source code.
> 
> One possible advantage of this approach is one can then put the build
> folder on a ram disk / tmpfs   and be able to compile and test much
> quicker.

That has been available for quite a long time now.
Just use "O=somebuilddir" on the make command line.

$ mkdir build
$ make O=build allnoconfig
$ make O=build all

AFAIK 'somebuilddir' can be a relative path (that's what
I use, in the kernel source tree) or an absolute path,
like O=/tmp/buildit .

>From kernel Makefile "help":
	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'


and from kernel Makefile comments:

# Kbuild will save output files in the current working directory.
# This does not need to match to the root of the kernel source tree.
#
# For example, you can do this:
#
#  cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile
#
# If you want to save output files in a different location, there are
# two syntaxes to specify it.
#
# 1) O=
# Use "make O=dir/to/store/output/files/"
#
# 2) Set KBUILD_OUTPUT
# Set the environment variable KBUILD_OUTPUT to point to the output directory.
# export KBUILD_OUTPUT=dir/to/store/output/files/; make
#
# The O= assignment takes precedence over the KBUILD_OUTPUT environment
# variable.


HTH.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ