Error when compiling kernel with RCN's bb-kernel script

A student of mine posted this and documented well. I’m getting the same error so I’m hoping someone here can help.

–Mark

I seem to be having an error compiling the kernel on my Linux virtual machine.

The virtual machine has 4GB ram, 32GB hard disk space, and four processor cores. Here you can see the complete setup. The operating system is ubuntu 16.04 LTS, complete details here.

From the initial boot of the system, I ran the following 7 commands:

sudo apt install git
**git clone git****://[github.com/RobertCNelson/bb-kernel.git](http://github.com/RobertCNelson/bb-kernel.git)**
**cd bb-kernel**
**git checkout am33x-v4.4**
sudo apt-get update
sudo apt-get install device-tree-compiler lzma lzop libncurses5-dev:amd64
**./build_kernel.sh**

The output can be seen here. Most of the compilation was uneventful, but there is a warning on line 2362 of the paste, and an error starting on line 2656. The error reads:

`

kernel/cpuset.c:2101:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .fork  = cpuset_fork,
           ^
kernel/cpuset.c:2101:11: note: (near initialization for 'cpuset_cgrp_subsys.fork')
  CC [M]  crypto/lz4.o
  CC [M]  crypto/lz4hc.o
  CC      block/bsg-lib.o
  CC [M]  crypto/ansi_cprng.o
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'kernel/cpuset.o' failed
make[1]: *** [kernel/cpuset.o] Error 1
Makefile:947: recipe for target 'kernel' failed
make: *** [kernel] Error 2
make: *** Waiting for unfinished jobs....

`

Has anyone else had similar problems? Has anyone successfully compiled the kernel?

Thanks,

Ricky

I also noticed it 4.4.22, looks to be a gcc6 issue,

I have the am33x-v4.4 branch set on gcc5:

https://github.com/RobertCNelson/bb-kernel/blob/am33x-v4.4/version.sh#L21

Regards,

This is the offending commit:

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/kernel/cpuset.c?id=06ec7a1d7646833cac76516fe78a23577cdb4a8a

Regards,

It's missing this change that landed in v4.5.x

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/cgroup-defs.h?id=b53202e6308939d33ba0c78712e850f891b4e76f

Regards,

and pushed, only built tested on am33x-v4.4/am33x-rt-v4.4

Regards,

Robert:
That fixed it. Thanks!

One question: How did you figure out where the problem was? This is a good lesson for my students.

–Mark

Google: git bisect

— Graham

In the case of this bug, it helps that i build on every distro:

[TXT] COMPLETE-4.4.22-bone13-jessie-armhf.txt 2016-09-27 07:31 775K
[TXT] COMPLETE-4.4.22-bone13-sid-armhf.txt 2016-09-27 06:52 382K
[TXT] COMPLETE-4.4.22-bone13-stretch-armhf.txt 2016-09-27 03:54 379K
[TXT] COMPLETE-4.4.22-bone13-trusty-armhf.txt 2016-09-27 06:41 773K
[TXT] COMPLETE-4.4.22-bone13-wheezy-armhf.txt 2016-09-27 05:35 775K
[TXT] COMPLETE-4.4.22-bone13-xenial-armhf.txt 2016-09-27 07:01 429K
[TXT] COMPLETE-4.4.22-bone13-yakkety-armhf.txt 2016-09-27 07:27 392K

You'll notice ^, sid/stretch/xenial/yakkety are slightly smaller then
jessie/trusty/wheezy..

jessie: 4.9.2 (good)
sid: 6.2.0 (fail)
stretch: 6.1.1 (fail)
trusty: 4.8.4 (good)
wheezy: 4.6.3 (good)
xenial: 5.4.0 (fail, didn't notice this till now, so it's a gcc5+ bug..)
yakkety: 6.2.0 (fail)

Then we take a look at the file, kernel/cpuset.c:

  CC kernel/cpuset.o
  CC [M] sound/core/seq/seq_midi_event.o
  CC drivers/base/devres.o
kernel/cpuset.c:2101:11: error: initialization from incompatible
pointer type [-Werror=incompatible-pointer-types]
  .fork = cpuset_fork,
           ^~~~~~~~~~~
kernel/cpuset.c:2101:11: note: (near initialization for
'cpuset_cgrp_subsys.fork')

as every had been working pre 4.4.22, we look at the change log on that file..

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/log/kernel/cpuset.c?id=refs/tags/v4.4.22

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/kernel/cpuset.c?id=06ec7a1d7646833cac76516fe78a23577cdb4a8a

This was a backport on mainline, adding ".fork" option to the
cpuset_cgrp_subsys struct..

So let's take a look at the cgroup_subsys and see if anything had
changed between v4.4.21 and mainline..

http://lxr.free-electrons.com/source/include/linux/cgroup-defs.h?v=4.4#L416

void (*fork)(struct task_struct *task, void *priv);

http://lxr.free-electrons.com/source/include/linux/cgroup-defs.h?v=4.5#L430

void (*fork)(struct task_struct *task);

so the "void *priv" had been removed..

That led me to this change:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/cgroup-defs.h?id=b53202e6308939d33ba0c78712e850f891b4e76f

I added it to my tree and ran a full rebuild to make sure nothing else
depended on the now gone (void *priv) option..

Regards,