I'd like to submit a request to change the method to check if CGROUPS support is enabled and available or not. I'm referring to the kernel/controllers/xxx testcase. I'm using the LTP-full-20090430 cross-compiled for SH based arch with a kernel 2.6.23. The used/released  method placed inside kernel/controllers/Makefile, tries to understand if the cgroups (and others related...) support has been enabled in the current kernel, performing a check in the root filesystem under "/proc". It makes something like that:
CHECK_CGROUP := $(shell test -f /proc/cgroups && echo 'cgroup')
Now, in the context of LTP built for i386, the above check works fine. But what happen if LTP is cross-built ? Unfortunately, the "/proc" entry checked by the above Makefile rule, is the ones placed in the host and not the "/proc" of the  target root filesysetm (in my case SH based target). This is wrong! Moreover,  "/proc" is an entry which makes sense at runtime while it is useless at built time so the above check is "always" not applicable in case of LTP is built for other arch different from i386. In order to cover the scenario in which LTP is cross-built, I've patched the Makefile , replacing the above rule with the following ones: The above checked header file "cgroupstats.h" is placed in the target rootfs.  If the cgroups support is available (and enabled...likely ;-) the above header is placed in the target rootfs. In that way, in case of cross-compilation (the env CROSS_COMPILE was defined) the check will be done in the header file instead of  /proc. The env TARGET_DIR works like a "--prefix" fixing the path of the cross-target rootfs. Of course, If you have another checks/methods which can be done to understand -at build time- if cgroups support is available and/or enabled -for target platform-, please feel free to post a comment to LTP. Anyway, I'll attach the patch I've applied in our system. Advices and feedbacks are welcome!. Signed-off-by: Francesco Rundo <francesco.rundo@st.com>.
1 file changed