Software Archive
Read-only legacy content
17061 Discussions

Documentation for kernel development?

Tim_C_
Beginner
537 Views

Are there any resources available for those who might wish to recompile the Linux kernel used on the Phi? Are there any tools in MPSS to help us recompile k1om Linux and/or boot it? I'm using MPSS 3.1.2.

I could hopefully hack my way through it, but I would hate to do so having missed some existing instructions or tools which could have made things easier.

0 Kudos
1 Solution
Evan_P_Intel
Employee
537 Views

The following procedure can be used to recompile the Intel Xeon Phi's kernel; I'll describe it in terms of the upcoming 3.2 release and then how 3.1 diverges so that this response remains useful longer. Assuming that you've installed MPSS (mpss-sdk-k1om-*.x86_64.rpm specifically) and have obtained mpss-src-3.2.tar from the MPSS release site:

tar -xf mpss-src-3.2.tar
tar -xf mpss-3.2/src/linux-2.6.38+mpss3.2.tar.bz2
. /opt/mpss/3.2/environment-setup-k1om-mpss-linux  # [1]
cd linux-2.6.38+mpss3.2/
cp /opt/mpss/3.2/sysroots/k1om-mpss-linux/boot/config-2.6.38.8+mpss3.2 .config  # [2]
make ARCH=k1om CROSS_COMPILE=k1om-mpss-linux-  # [3]

I recommend adding an appropriate amount of parallelism to [3] with e.g. “-j16”, as that significantly reduces how long it takes to complete.

For 3.1, replace [2] with the following (which works equally well on 3.2), since I'm unsure of where a pre-generated file can be found in that version:

MPSS_KCONFIGS="k1om mic-min mic-mpss"
sed -r `echo ${MPSS_KCONFIGS} | sed -e 's:\S\+:arch/x86/configs/&.uconfig:g'` \
    -e '1 i # KCONFIGS: '"${MPSS_KCONFIGS}" \
    -e 's:.*\b(CONFIG_INITRAMFS_SOURCE)\b.*:\1="":' \
    > .config.all
make ARCH=k1om CROSS_COMPILE=k1om-mpss-linux- \
    KCONFIG_ALLCONFIG=.config.all allnoconfig -j1

A final note: while [1] sets up the environment to facilitate cross-building userspace software for Xeon Phi, particularly when that software has not been autotool-ized, the only part that’s actually necessary in order to build the kernel is modifying the PATH environment variable:

PATH="$PATH:/opt/mpss/3.2/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux"

View solution in original post

0 Kudos
4 Replies
TaylorIoTKidd
New Contributor I
537 Views

The information you want might be in the MPSS readme. Take a look at http://software.intel.com/en-us/articles/intel-manycore-platform-software-stack-mpss.

Regards
--
Taylor
 

0 Kudos
Tim_C_
Beginner
537 Views

This doesn't seem to be the case.

I've managed to rebuild from the sources provided, although I'm not at all confident that I'm using the same kernel configuration or version as the distributed version: the configuration you get (config-mic-knc-2.6.38) when you extract the sources doesn't seem to be up to date with the sources.

0 Kudos
Evan_P_Intel
Employee
538 Views

The following procedure can be used to recompile the Intel Xeon Phi's kernel; I'll describe it in terms of the upcoming 3.2 release and then how 3.1 diverges so that this response remains useful longer. Assuming that you've installed MPSS (mpss-sdk-k1om-*.x86_64.rpm specifically) and have obtained mpss-src-3.2.tar from the MPSS release site:

tar -xf mpss-src-3.2.tar
tar -xf mpss-3.2/src/linux-2.6.38+mpss3.2.tar.bz2
. /opt/mpss/3.2/environment-setup-k1om-mpss-linux  # [1]
cd linux-2.6.38+mpss3.2/
cp /opt/mpss/3.2/sysroots/k1om-mpss-linux/boot/config-2.6.38.8+mpss3.2 .config  # [2]
make ARCH=k1om CROSS_COMPILE=k1om-mpss-linux-  # [3]

I recommend adding an appropriate amount of parallelism to [3] with e.g. “-j16”, as that significantly reduces how long it takes to complete.

For 3.1, replace [2] with the following (which works equally well on 3.2), since I'm unsure of where a pre-generated file can be found in that version:

MPSS_KCONFIGS="k1om mic-min mic-mpss"
sed -r `echo ${MPSS_KCONFIGS} | sed -e 's:\S\+:arch/x86/configs/&.uconfig:g'` \
    -e '1 i # KCONFIGS: '"${MPSS_KCONFIGS}" \
    -e 's:.*\b(CONFIG_INITRAMFS_SOURCE)\b.*:\1="":' \
    > .config.all
make ARCH=k1om CROSS_COMPILE=k1om-mpss-linux- \
    KCONFIG_ALLCONFIG=.config.all allnoconfig -j1

A final note: while [1] sets up the environment to facilitate cross-building userspace software for Xeon Phi, particularly when that software has not been autotool-ized, the only part that’s actually necessary in order to build the kernel is modifying the PATH environment variable:

PATH="$PATH:/opt/mpss/3.2/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux"
0 Kudos
Tim_C_
Beginner
537 Views

Awesome, thanks. This is exactly what I was hoping for and very helpful. Without these instructions I ended up building a kernel with transparent hugepages disabled, which exacerbated my performance issues.

0 Kudos
Reply