summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel.bbclass97
-rw-r--r--meta/classes/module.bbclass9
-rw-r--r--meta/recipes-kernel/linux/linux-yocto.inc6
3 files changed, 48 insertions, 64 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index a9a8f4fe9b..3eb6659a75 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -115,78 +115,51 @@ kernel_do_install() {
115 install -d ${D}/etc/modprobe.d 115 install -d ${D}/etc/modprobe.d
116 fi 116 fi
117 117
118 118 #
119 # Support for external module building - create a minimal copy of the
120 # kernel source tree.
121 #
122 kerneldir=${STAGING_KERNEL_DIR}
123 install -d $kerneldir
119 124
120 # 125 #
121 # Support for external module building - create a minimal copy of the kernel source tree 126 # Copy the entire source tree. In case an external build directory is
127 # used, copy the build directory over first, then copy over the source
128 # dir. This ensures the original Makefiles are used and not the
129 # redirecting Makefiles in the build directory.
122 # 130 #
123 kerneldir=${D}/kernel/ 131 # work and sysroots can be on different partitions, so we can't rely on
124 132 # hardlinking, unfortunately.
125 # Take care of arch specific headers 133 #
126 # Kernel 2.6.27 moved headers from includes/asm-${ARCH} to arch/${ARCH}/include/asm 134 cp -fR * $kerneldir
127 if [ -e arch/${ARCH}/include/asm/ ] ; then 135 cp .config $kerneldir
128 install -d $kerneldir/arch/${ARCH}/ 136 if [ ! "${S}" == "${B}" ]; then
129 cp -fR arch/${ARCH}/* $kerneldir/arch/${ARCH}/ 137 cp -fR ${S}/* $kerneldir
130
131 # Check for arch/x86 on i386
132 elif [ -d arch/x86/include/asm/ ]; then
133 if [ -e include/asm ] ; then
134 install -d $kerneldir/include/asm/
135 cp -fR arch/x86/include/asm/* $kerneldir/include/asm/
136 fi
137 install -d $kerneldir/arch/x86/include
138 cp -fR arch/x86/* $kerneldir/arch/x86/
139 fi 138 fi
139 echo "LINUX BUILD TREE COPIED TO SYSROOTS"
140 du -hs $kerneldir
140 141
141 # Take care of the rest of the main directories we need 142 #
142 for entry in drivers/crypto drivers/media include scripts; do 143 # Clean and remove files not needed for building modules.
143 if [ -d $entry ]; then 144 # Some distributions go through a lot more trouble to strip out
144 mkdir -p $kerneldir/$entry 145 # unecessary headers, for now, we just prune the obvious bits.
145 cp -fR $entry/* $kerneldir/$entry/ 146 #
146 fi 147 # We don't want to leave host-arch binaries in /sysroots, so
147 done 148 # we clean the scripts dir while leaving the generated config
148 149 # and include files.
149 install -m 0644 .config $kerneldir/config-${KERNEL_VERSION} 150 #
150 ln -sf config-${KERNEL_VERSION} $kerneldir/.config 151 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean
151 ln -sf config-${KERNEL_VERSION} $kerneldir/kernel-config 152 make -C $kerneldir _mrproper_scripts
152 echo "${KERNEL_VERSION}" >$kerneldir/kernel-abiversion 153 find $kerneldir -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \;
153 echo "${S}" >$kerneldir/kernel-source 154 find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
154 echo "${KERNEL_CCSUFFIX}" >$kerneldir/kernel-ccsuffix
155 echo "${KERNEL_LDSUFFIX}" >$kerneldir/kernel-ldsuffix
156 [ -e vmlinux ] && install -m 0644 vmlinux $kerneldir/
157 install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
158 install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
159 [ -e Module.symvers ] && install -m 0644 Module.symvers $kerneldir/
160
161 # Copy over the main Makefiles
162 [ -e Rules.make ] && install -m 0644 Rules.make $kerneldir/
163 [ -e Makefile ] && install -m 0644 Makefile $kerneldir/
164 # Check if arch/${ARCH}/Makefile exists and install it
165 if [ -e arch/${ARCH}/Makefile ]; then
166 install -d $kerneldir/arch/${ARCH}
167 install -m 0644 arch/${ARCH}/Makefile* $kerneldir/arch/${ARCH}
168 # Otherwise check arch/x86/Makefile for i386 and x86_64 on kernels >= 2.6.24
169 elif [ -e arch/x86/Makefile ]; then
170 install -d $kerneldir/arch/x86
171 install -m 0644 arch/x86/Makefile* $kerneldir/arch/x86
172 fi
173 155
174 # Remove the following binaries which cause strip errors 156 # Remove the following binaries which cause strip errors
175 # during do_package for cross-compiled platforms 157 # during do_package for cross-compiled platforms
176 bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \ 158 bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
177 arch/powerpc/boot/mktree scripts/bin2c scripts/conmakehash \ 159 arch/powerpc/boot/mktree"
178 scripts/ihex2fw scripts/kallsyms scripts/pnmtologo scripts/basic/docproc \
179 scripts/basic/fixdep scripts/basic/hash scripts/dtc/dtc \
180 scripts/genksyms/genksyms scripts/kconfig/conf scripts/mod/mk_elfconfig \
181 scripts/mod/modpost scripts/recordmcount"
182 rm -rf $kerneldir/scripts/*.o
183 rm -rf $kerneldir/scripts/basic/*.o
184 rm -rf $kerneldir/scripts/kconfig/*.o
185 rm -rf $kerneldir/scripts/mod/*.o
186 rm -rf $kerneldir/scripts/dtc/*.o
187 for entry in $bin_files; do 160 for entry in $bin_files; do
188 rm -f $kerneldir/$entry 161 rm -f $kerneldir/$entry
189 done 162 done
190} 163}
191 164
192sysroot_stage_all_append() { 165sysroot_stage_all_append() {
diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index bbceaf7219..572df0d295 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -3,14 +3,19 @@ DEPENDS += "virtual/kernel"
3 3
4inherit module-base 4inherit module-base
5 5
6# Ensure the hostprogs are available for module compilation 6#
7module_do_compile_prepend() { 7# Ensure the hostprogs are available for module compilation. Modules that
8# inherit this recipe and override do_compile() should be sure to call
9# do_make_scripts() or ensure the scripts are built independently.
10#
11do_make_scripts() {
8 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 12 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
9 oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \ 13 oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
10 -C ${STAGING_KERNEL_DIR} scripts 14 -C ${STAGING_KERNEL_DIR} scripts
11} 15}
12 16
13module_do_compile() { 17module_do_compile() {
18 do_make_scripts
14 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 19 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
15 oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \ 20 oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
16 KERNEL_SRC=${STAGING_KERNEL_DIR} \ 21 KERNEL_SRC=${STAGING_KERNEL_DIR} \
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 0812144d46..c304d009eb 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -21,3 +21,9 @@ inherit kernel-yocto
21require linux-dtb.inc 21require linux-dtb.inc
22 22
23B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build" 23B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build"
24
25do_install_append(){
26 if [ -n "${KMETA}" ]; then
27 rm -rf ${STAGING_KERNEL_DIR}/${KMETA}
28 fi
29}