| November 16, 2009 11:00 PM PST | |
1. Prepare for build
a. su into root.
b. Create a ~/.rpmmacros file containing:
%_topdir %(echo $HOME)/rpmbuild
%_smp_mflags -j3
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
%_default_patch_fuzz 2
#end of file
fuzz=2 is critical to allow the 915 patches to merge correctly.
_smp_mflags -jN, N should be set to the number of processor cores on your build system
2. Setup and do initial build. Download the kernel source from a source repository:
(Used http://repo.moblin.org/moblin/releases/2.1/source/kernel-2.6.31.5-10.1.moblin2.src.rpm)
a. Extract the rpm:
$ rpm -ivh kernel-2.6.31.5-10.1.moblin2.src.rpm
b. Prepare and do initial build to rpm:
$ cd rpmbuild/SPECS
c. Remove lines 762 & 763, 'BuildKernel %make_target %kernel_image menlow' & 'BuildKernel %make_target %kernel_image ivi'
$ rpmbuild -bc --target=i586 kernel.spec
The previous step ensures you have the components to build successfully.
3. Rebuild with gcc:
$ cd rpmbuild/BUILD/kernel-2.6.31/linux-2.6.31
$ make clean
$ make bzImage
$ make modules
$ make modules_install
$ make install
Test the image on your netbook by rebooting the system and selecting the kernel at the grub screen.
Rebuild with Intel Compiler
1. Perform step 1 in the previous section
2. Setup Intel Compiler environment:
a. Set the compiler environment:
$ source /opt/intel/Compiler/11.1/XXX/bin/ia32/iccvars_ia32.sh
where XXX is the particular version you are using.
3. Make source code modifications.
a. Modify include/linux/compiler-intel.h and add the following line at
the end of the file:
#undef __compiler_offsetof
b. Modify arch/x86/include/asm/xor_32.h at line 843, change
: "+r" (lines),
To:
: "+rm" (lines),
This change is required because the code is written to work with gcc's assumption that the stack is 16 byte aligned (contrary to the ABI) and thus there is one additional register available.
c. Add libirc_s.a to the link command by modifying Makefile at line 699. Change:
--start-group $(vmlinux-main) --end-group
to:
--start-group $(vmlinux-main) /opt/intel/Compiler/11.1/XXX/lib/ia32/libirc_s.a
--end-group
d. Modify arch/x86/include/asm/delay.h and remove the references to __bad_udelay and replace the calls to it with 0.
e. Modify include/linux/log2.h and remove the references to ____ilog2_NaN() and replace the calls to it with 0.
f. Modify line 47 of arch/x86/kernel/acpi/realmode/Makefile adding a reference to libirc_s.a as follows:
WAKEUP_OBJS = $(addprefix $(obj)/,$(wakeup-y)) /opt/intel/Compiler/11.1/053/lib/ia32/libirc_s.a
g. Modify line 89 of arch/x86/boot/Makefile adding a reference to libirc_s.a as follows:
SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) /opt/intel/Compiler/11.1/053/lib/ia32/libirc_s.a
h. Modify kernel/trace/trace_events.c by adding the following line of code (line 915) at the start of event_create_dir():
if (call->system==NULL) return -1;
This change is due to a kernel issue where the source code makes alignment assumptions that are not enforced in the kernel source code. This change is merely a workaround, not a fix for the real issue.
i. Modify the intelwrapper file documented at www.linuxdna.com and make the following changes:
- Enable script to replace -march=i686 | -mtune=pentium3 | -mtune=generic with ‘'
- Enable script to replace -O2 | -Os with ‘-O3 -ip -xSSE3_ATOM'
Performance BKM: The goal of this option change is to enable higher performance. Note that the default kernel options uses things such as -mnosse and -fno-omit-frame-pointer which can override the higher optimizations in some places.
- Enable script to call gcc to compile drivers/net/wimax/i2400m/fw.c | lib/libcrc32c* | crypto/testmgr* - this is required because 11.1 does not yet support some instances of variable length arrays
- Enable script to call gcc to compile arch/x86/boot/compressed/misc.c - issue with PIC in icc
- Enable script to call gcc to compile drivers/block/spectra/ffsport.c - inline asm issue
4. Start the build:
$ cd <build path>/rpmbuild/BUILD/kernel-2.6.31/linux-2.6.31
$ make clean
$ make HOSTCC=intelwrapper CC=intelwrapper CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_MODPOST_WARN=n bzImage
$ make HOSTCC=intelwrapper CC=intelwrapper CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_MODPOST_WARN=n modules
$ make HOSTCC=intelwrapper CC=intelwrapper CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_MODPOST_WARN=n modules_install
$ make HOSTCC=intelwrapper CC=intelwrapper CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_MODPOST_WARN=n install
The make install step will install the kernel and modify grub so that the kernel can be selected upon bootup.
To build with other configurations, such as the mrst config:cp configs/kernel-mrst.config .config and go to step 4.
| Optimization Notice |
|---|
|
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 |
This article applies to: Intel® AppUp(SM) Developer Community, Intel C++ Tool Suite for MIDs, Intel® C++ Compiler for Linux* Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (1) 
Trackbacks (0)
Leave a comment 
Maximillian Domeika (Intel)
|

Daniel Kuhne
i get error: linux-firmware is needed by kernel-2.6.31.6-36.1.moblin2.src
when running
$ rpmbuild -bc --target=i586 kernel.spec
Do know how to solve it?
Best regards,
Daniel.