Re: [regression ?] kbuild: fix building bzImage with CONFIG_TRIM_UNUSED_KSYMS enabled

From: Sergey Senozhatsky
Date: Sat Dec 10 2016 - 02:23:16 EST


On (12/09/16 13:07), Nicolas Pitre wrote:
[..]
> > build:
> > make -j4 > build_log 2>&1
> >
> > package:
> > make -j4 INSTALL_MOD_PATH="${pkgdir}" modules_install >> build_log 2>&1
>
> Weird.

it is. sorry for long reply, it took me some time to track it down.
turned out, the script also does `prepare' and `kernelrelease'. so
the sequence of commands in my build script is

make prepare
make kernelrelease
# functon build
make -j4
# finction package
make -j4 INSTALL_MOD_PATH=XXXX modules_install


now. the problem here is that, apparently, and I didn't know that,
"make prepare" and "make kernelrelease" are executed twice.

- first time when I build the kernel
make prepare
make kernelrelease
make -j4

- second time when I install the modules
make prepare
make kernelrelease
make -j4 INSTALL_MOD_PATH=XXXX modules_install


so this will not install modules:
make prepare; make kernelrelease; make -j4; make prepare; make kernelrelease; make -j4 INSTALL_MOD_PATH=/tmp/MODULES modules_install

and this will:
make prepare; make kernelrelease; make -j4; make kernelrelease; make -j4 INSTALL_MOD_PATH=/tmp/MODULES modules_install


> You must have CONFIG_TRIM_UNUSED_KSYMS=y in your .config, right?

yes.

> What if you set it to n instead without reverting 865563924022d8. Do you
> still have the same issue?

!CONFIG_TRIM_UNUSED_KSYMS or !865563924022d8 builds just fine with extra
`make prepare'.
no `extra make prepare' builds ok regardless the state of Makefile/config
files.

I guess you don't need my .config any more.

-ss