Skip to contentSkip to conversation

Build using O=path

DISCUSSION Tobin C. Harding 4 participants 6 messages Sep 10, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I'm unable to build the kernel using the O=path/to/out option. Am I doing something brain dead?

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config
$ make O=/abs/path/to/output
...
scripts/kconfig/conf  --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
...

So I tried copying the .config file to the output directory

$ cp .config /abs/path/to/output
$ make O=/abs/path/to/output
...
  Using /home/tobin/build/kernel/linux as source for kernel
  /home/tobin/build/kernel/linux is not clean, please run 'make mrproper'
  in the '/home/tobin/build/kernel/linux' directory.
/home/tobin/build/kernel/linux/Makefile:1091: recipe for target 'prepare3' failed
make[1]: *** [prepare3] Error 1
make[1]: Leaving directory '/home/tobin/build/kernel/output/master'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Same thing if I use KBUILD_OUTPUT instead of passing O=

thanks,
Tobin.

#1 lore raw

Hi,

Please try below steps,

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config
$ make menuconfig
$ make O=/abs/path/to/output

Thanks!

Quoted 37 lines · Tobin C. Harding

Hi,

I'm unable to build the kernel using the O=path/to/out option. Am I doing something brain dead?

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config
$ make O=/abs/path/to/output
...
scripts/kconfig/conf  --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
...

So I tried copying the .config file to the output directory

$ cp .config /abs/path/to/output
$ make O=/abs/path/to/output
...
  Using /home/tobin/build/kernel/linux as source for kernel
  /home/tobin/build/kernel/linux is not clean, please run 'make mrproper'
  in the '/home/tobin/build/kernel/linux' directory.
/home/tobin/build/kernel/linux/Makefile:1091: recipe for target 'prepare3'
failed
make[1]: *** [prepare3] Error 1
make[1]: Leaving directory '/home/tobin/build/kernel/output/master'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Same thing if I use KBUILD_OUTPUT instead of passing O=

Quoted 8 lines

thanks,
Tobin.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180910/3f93354c/attachment.html>

#2 lore raw
In reply to Tobin C. Harding
Quoted 6 lines · Tobin C. Harding

I'm unable to build the kernel using the O=path/to/out option. Am I doing something brain dead?

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config

All you are missing here is something like make defconfig (or olddefconfig or nconfig etc.) and you should be set; nothing brain dead here.

You can read Documentation/admin-guide/README.rst for more information about these targets, but mostly the reason for this is because the available configurations change just like the rest of the kernel. Bad Things? would happen if .config wasn't updated to reflect these changes.

Signature · 9 lines
Cheers,
Joey Pabalinas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180909/7a4742f7/attachment.sig>
#3 lore raw
Quoted 3 lines · Joey Pabalinas

All you are missing here is something like make defconfig (or olddefconfig or nconfig etc.) and you should be set; nothing brain dead here.

Except for me of course... That should have been make oldconfig not make defconfig which would overwrite your custom configuration file.

Signature · 9 lines
Cheers,
Joey Pabalinas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180909/d3a63bda/attachment.sig>
#4 lore raw
In reply to Tobin C. Harding

Hi,

Quoted 8 lines · Tobin C. Harding

Hi,

I'm unable to build the kernel using the O=path/to/out option. Am I doing something brain dead?

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config

Here you are copying a file in the source directory...

Quoted 10 lines
$ make O=/abs/path/to/output
...
scripts/kconfig/conf  --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
...
Quoted 8 lines

So I tried copying the .config file to the output directory

$ cp .config /abs/path/to/output
$ make O=/abs/path/to/output
...
  Using /home/tobin/build/kernel/linux as source for kernel
  /home/tobin/build/kernel/linux is not clean, please run 'make mrproper'
  in the '/home/tobin/build/kernel/linux' directory.

...and here's where the kernel complains about it.

You have to put your .config file in the out-of-tree build dir, not the source dir. BTW this also allows you to have multiple builds woth different configs in different directories, all from the same set of sources -- how would it be possible if the config were in the source dir?

So, fix it as:

cd $KERNEL
make mrproper
make O=/abs/path/to/output # BTW: can be also relative cd /abs/path/to/output
cp path/to/valid/config/file .config
make olddefconfig # might be not needed, but harmless anyway make

Signature · 1 line
Luca
#5 lore raw

Thanks Luca, you had the winning entry!

Quoted 26 lines · Luca Ceresoli

Hi,

Quoted 8 lines · Tobin C. Harding

Hi,

I'm unable to build the kernel using the O=path/to/out option. Am I doing something brain dead?

$ cd $KERNEL
$ make mrproper
$ cp path/to/valid/config/file .config

Here you are copying a file in the source directory...

Quoted 12 lines
$ make O=/abs/path/to/output
...
scripts/kconfig/conf  --syncconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
...

So I tried copying the .config file to the output directory

Quoted 8 lines
Quoted 6 lines
$ cp .config /abs/path/to/output
$ make O=/abs/path/to/output
...
  Using /home/tobin/build/kernel/linux as source for kernel
  /home/tobin/build/kernel/linux is not clean, please run 'make mrproper'
  in the '/home/tobin/build/kernel/linux' directory.

...and here's where the kernel complains about it.

Well explained, I did not garner this from the error messages. Thanks.

Quoted 10 lines

You have to put your .config file in the out-of-tree build dir, not the source dir. BTW this also allows you to have multiple builds woth different configs in different directories, all from the same set of sources -- how would it be possible if the config were in the source dir?

So, fix it as:

cd $KERNEL
make mrproper
make O=/abs/path/to/output # BTW: can be also relative

The key takeaway (for me) is that this invocation of make is expected to fail (since we have not created the output directory or config file yet).

Quoted 4 lines

cd /abs/path/to/output
cp path/to/valid/config/file .config
make olddefconfig # might be not needed, but harmless anyway make

I would not have realised that one can run make from the output directory.

thanks,
Tobin.