summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/kernel-devsrc.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/kernel-devsrc.bb')
-rw-r--r--meta/recipes-kernel/linux/kernel-devsrc.bb444
1 files changed, 272 insertions, 172 deletions
diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index dadeade3aa..fafab475f3 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -5,7 +5,7 @@ development or external module builds"
5 5
6SECTION = "kernel" 6SECTION = "kernel"
7 7
8LICENSE = "GPLv2" 8LICENSE = "GPL-2.0-only"
9 9
10inherit linux-kernel-base 10inherit linux-kernel-base
11 11
@@ -47,21 +47,21 @@ do_install() {
47 # create a /usr/src/kernel symlink to /lib/modules/<version>/source 47 # create a /usr/src/kernel symlink to /lib/modules/<version>/source
48 mkdir -p ${D}/usr/src 48 mkdir -p ${D}/usr/src
49 ( 49 (
50 cd ${D}/usr/src 50 cd ${D}/usr/src
51 lnr ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}/source kernel 51 ln -rs ${D}${KERNEL_BUILD_ROOT}${KERNEL_VERSION}/source kernel
52 ) 52 )
53 53
54 # for on target purposes, we unify build and source 54 # for on target purposes, we unify build and source
55 ( 55 (
56 cd $kerneldir 56 cd $kerneldir
57 ln -s build source 57 ln -s build source
58 ) 58 )
59 59
60 # first copy everything 60 # first copy everything
61 ( 61 (
62 cd ${S} 62 cd ${S}
63 cp --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") $kerneldir/build 63 cp --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") $kerneldir/build
64 cp --parents $(find -type f -name "Build" -o -name "Build.include") $kerneldir/build 64 cp --parents $(find -type f -name "Build" -o -name "Build.include") $kerneldir/build
65 ) 65 )
66 66
67 # then drop all but the needed Makefiles/Kconfig files 67 # then drop all but the needed Makefiles/Kconfig files
@@ -70,92 +70,113 @@ do_install() {
70 70
71 # now copy in parts from the build that we'll need later 71 # now copy in parts from the build that we'll need later
72 ( 72 (
73 cd ${B} 73 cd ${B}
74 74
75 cp Module.symvers $kerneldir/build 75 if [ -s Module.symvers ]; then
76 cp System.map* $kerneldir/build 76 cp Module.symvers $kerneldir/build
77 if [ -s Module.markers ]; then 77 fi
78 cp Module.markers $kerneldir/build 78 cp System.map* $kerneldir/build
79 fi 79 if [ -s Module.markers ]; then
80 80 cp Module.markers $kerneldir/build
81 cp -a .config $kerneldir/build 81 fi
82 82
83 # This scripts copy blow up QA, so for now, we require a more 83 cp -a .config $kerneldir/build
84 # complex 'make scripts' to restore these, versus copying them 84
85 # here. Left as a reference to indicate that we know the scripts must 85 # This scripts copy blow up QA, so for now, we require a more
86 # be dealt with. 86 # complex 'make scripts' to restore these, versus copying them
87 # cp -a scripts $kerneldir/build 87 # here. Left as a reference to indicate that we know the scripts must
88 88 # be dealt with.
89 # although module.lds can be regenerated on target via 'make modules_prepare' 89 # cp -a scripts $kerneldir/build
90 # there are several places where 'makes scripts prepare' is done, and that won't 90
91 # regenerate the file. So we copy it onto the target as a migration to using 91 # although module.lds can be regenerated on target via 'make modules_prepare'
92 # modules_prepare 92 # there are several places where 'makes scripts prepare' is done, and that won't
93 cp -a --parents scripts/module.lds $kerneldir/build/ 2>/dev/null || : 93 # regenerate the file. So we copy it onto the target as a migration to using
94 # modules_prepare
95 cp -a --parents scripts/module.lds $kerneldir/build/ 2>/dev/null || :
94 96
95 if [ -d arch/${ARCH}/scripts ]; then 97 if [ -d arch/${ARCH}/scripts ]; then
96 cp -a arch/${ARCH}/scripts $kerneldir/build/arch/${ARCH} 98 cp -a arch/${ARCH}/scripts $kerneldir/build/arch/${ARCH}
97 fi 99 fi
98 if [ -f arch/${ARCH}/*lds ]; then 100 if [ -f arch/${ARCH}/*lds ]; then
99 cp -a arch/${ARCH}/*lds $kerneldir/build/arch/${ARCH} 101 cp -a arch/${ARCH}/*lds $kerneldir/build/arch/${ARCH}
100 fi 102 fi
101 103
102 rm -f $kerneldir/build/scripts/*.o 104 rm -f $kerneldir/build/scripts/*.o
103 rm -f $kerneldir/build/scripts/*/*.o 105 rm -f $kerneldir/build/scripts/*/*.o
104 106
105 if [ "${ARCH}" = "powerpc" ]; then 107 if [ "${ARCH}" = "powerpc" ]; then
106 if [ -e arch/powerpc/lib/crtsavres.S ] || 108 if [ -e arch/powerpc/lib/crtsavres.S ] ||
107 [ -e arch/powerpc/lib/crtsavres.o ]; then 109 [ -e arch/powerpc/lib/crtsavres.o ]; then
108 cp -a --parents arch/powerpc/lib/crtsavres.[So] $kerneldir/build/ 110 cp -a --parents arch/powerpc/lib/crtsavres.[So] $kerneldir/build/
109 fi 111 fi
110 fi 112 fi
111 113
112 if [ "${ARCH}" = "arm64" ]; then 114 if [ "${ARCH}" = "arm64" -o "${ARCH}" = "riscv" ]; then
113 cp -a --parents arch/arm64/kernel/vdso/vdso.lds $kerneldir/build/ 115 if [ -e arch/${ARCH}/kernel/vdso/vdso.lds ]; then
114 fi 116 cp -a --parents arch/${ARCH}/kernel/vdso/vdso.lds $kerneldir/build/
115 117 fi
116 cp -a include $kerneldir/build/include 118 fi
117 119 if [ "${ARCH}" = "powerpc" ]; then
118 # we don't usually copy generated files, since they can be rebuilt on the target, 120 cp -a --parents arch/powerpc/kernel/vdso32/vdso32.lds $kerneldir/build 2>/dev/null || :
119 # but without this file, we get a forced syncconfig run in v5.8+, which prompts and 121 cp -a --parents arch/powerpc/kernel/vdso64/vdso64.lds $kerneldir/build 2>/dev/null || :
120 # breaks workflows. 122 # v5.19+
121 cp -a --parents include/generated/autoconf.h $kerneldir/build 2>/dev/null || : 123 cp -a --parents arch/powerpc/kernel/vdso/vdso*.lds $kerneldir/build 2>/dev/null || :
122 124 fi
123 if [ -e $kerneldir/include/generated/.vdso-offsets.h.cmd ]; then 125
124 rm $kerneldir/include/generated/.vdso-offsets.h.cmd 126 cp -a include $kerneldir/build/include
125 fi 127
128 # we don't usually copy generated files, since they can be rebuilt on the target,
129 # but without this file, we get a forced syncconfig run in v5.8+, which prompts and
130 # breaks workflows.
131 cp -a --parents include/generated/autoconf.h $kerneldir/build 2>/dev/null || :
132
133 rm -f $kerneldir/include/generated/.vdso-offsets.h.cmd
134 rm -f $kerneldir/build/include/generated/.vdso-offsets.h.cmd
135 rm -f $kerneldir/build/include/generated/.compat_vdso-offsets.h.cmd
136 rm -f $kerneldir/build/include/generated/.vdso32-offsets.h.cmd
126 ) 137 )
127 138
128 # now grab the chunks from the source tree that we need 139 # now grab the chunks from the source tree that we need
129 ( 140 (
130 cd ${S} 141 cd ${S}
142
143 cp -a scripts $kerneldir/build
144
145 # for v6.1+ (otherwise we are missing multiple default targets)
146 cp -a --parents Kbuild $kerneldir/build 2>/dev/null || :
131 147
132 cp -a scripts $kerneldir/build 148 # For v6.6+ the debian packing is moved out to seperate rules file
149 # Remove as we else would ned to RDEPEND on make
150 rm $kerneldir/build/scripts/package/debian/rules 2>/dev/null || :
133 151
134 # if our build dir had objtool, it will also be rebuilt on target, so 152 # if our build dir had objtool, it will also be rebuilt on target, so
135 # we copy what is required for that build 153 # we copy what is required for that build
136 if [ -f ${B}/tools/objtool/objtool ]; then 154 if [ -f ${B}/tools/objtool/objtool ]; then
137 # these are a few files associated with objtool, since we'll need to 155 # these are a few files associated with objtool, since we'll need to
138 # rebuild it 156 # rebuild it
139 cp -a --parents tools/build/Build.include $kerneldir/build/ 157 cp -a --parents tools/build/Build.include $kerneldir/build/
140 cp -a --parents tools/build/Build $kerneldir/build/ 158 cp -a --parents tools/build/Build $kerneldir/build/
141 cp -a --parents tools/build/fixdep.c $kerneldir/build/ 159 cp -a --parents tools/build/fixdep.c $kerneldir/build/
142 cp -a --parents tools/scripts/utilities.mak $kerneldir/build/ 160 cp -a --parents tools/scripts/utilities.mak $kerneldir/build/
143 161
144 # extra files, just in case 162 # extra files, just in case
145 cp -a --parents tools/objtool/* $kerneldir/build/ 163 cp -a --parents tools/objtool/* $kerneldir/build/
146 cp -a --parents tools/lib/* $kerneldir/build/ 164 cp -a --parents tools/lib/* $kerneldir/build/
147 cp -a --parents tools/lib/subcmd/* $kerneldir/build/ 165 cp -a --parents tools/lib/subcmd/* $kerneldir/build/
148 166
149 cp -a --parents tools/include/* $kerneldir/build/ 167 cp -a --parents tools/include/* $kerneldir/build/
150 168
151 cp -a --parents $(find tools/arch/${ARCH}/ -type f) $kerneldir/build/ 169 cp -a --parents $(find tools/arch/${ARCH}/ -type f) $kerneldir/build/
152 fi 170 fi
153 171
154 if [ "${ARCH}" = "arm64" ]; then 172 if [ "${ARCH}" = "arm64" ]; then
155 # arch/arm64/include/asm/xen references arch/arm 173 # arch/arm64/include/asm/xen references arch/arm
156 cp -a --parents arch/arm/include/asm/xen $kerneldir/build/ 174 cp -a --parents arch/arm/include/asm/xen $kerneldir/build/
157 # arch/arm64/include/asm/opcodes.h references arch/arm 175 # arch/arm64/include/asm/opcodes.h references arch/arm
158 cp -a --parents arch/arm/include/asm/opcodes.h $kerneldir/build/ 176 cp -a --parents arch/arm/include/asm/opcodes.h $kerneldir/build/
177
178 # v6.1+
179 cp -a --parents arch/arm64/kernel/asm-offsets.c $kerneldir/build/
159 180
160 cp -a --parents arch/arm64/kernel/vdso/*gettimeofday.* $kerneldir/build/ 181 cp -a --parents arch/arm64/kernel/vdso/*gettimeofday.* $kerneldir/build/
161 cp -a --parents arch/arm64/kernel/vdso/sigreturn.S $kerneldir/build/ 182 cp -a --parents arch/arm64/kernel/vdso/sigreturn.S $kerneldir/build/
@@ -163,106 +184,174 @@ do_install() {
163 cp -a --parents arch/arm64/kernel/vdso/gen_vdso_offsets.sh $kerneldir/build/ 184 cp -a --parents arch/arm64/kernel/vdso/gen_vdso_offsets.sh $kerneldir/build/
164 185
165 cp -a --parents arch/arm64/kernel/module.lds $kerneldir/build/ 2>/dev/null || : 186 cp -a --parents arch/arm64/kernel/module.lds $kerneldir/build/ 2>/dev/null || :
166 fi
167 187
168 if [ "${ARCH}" = "powerpc" ]; then 188 # 5.13+ needs these tools
169 # 5.0 needs these files, but don't error if they aren't present in the source 189 cp -a --parents arch/arm64/tools/gen-cpucaps.awk $kerneldir/build/ 2>/dev/null || :
170 cp -a --parents arch/${ARCH}/kernel/syscalls/syscall.tbl $kerneldir/build/ 2>/dev/null || : 190 cp -a --parents arch/arm64/tools/cpucaps $kerneldir/build/ 2>/dev/null || :
171 cp -a --parents arch/${ARCH}/kernel/syscalls/syscalltbl.sh $kerneldir/build/ 2>/dev/null || : 191
172 cp -a --parents arch/${ARCH}/kernel/syscalls/syscallhdr.sh $kerneldir/build/ 2>/dev/null || : 192 # 5.19+
173 fi 193 cp -a --parents arch/arm64/tools/gen-sysreg.awk $kerneldir/build/ 2>/dev/null || :
194 cp -a --parents arch/arm64/tools/sysreg $kerneldir/build/ 2>/dev/null || :
195
196 if [ -e $kerneldir/build/arch/arm64/tools/gen-cpucaps.awk ]; then
197 sed -i -e "s,#!.*awk.*,#!${USRBINPATH}/env awk," $kerneldir/build/arch/arm64/tools/gen-cpucaps.awk
198 fi
199 if [ -e $kerneldir/build/arch/arm64/tools/gen-sysreg.awk ]; then
200 sed -i -e "s,#!.*awk.*,#!${USRBINPATH}/env awk," $kerneldir/build/arch/arm64/tools/gen-sysreg.awk
201 fi
202 fi
203
204 if [ "${ARCH}" = "powerpc" ]; then
205 # 5.0 needs these files, but don't error if they aren't present in the source
206 cp -a --parents arch/${ARCH}/kernel/syscalls/syscall.tbl $kerneldir/build/ 2>/dev/null || :
207 cp -a --parents arch/${ARCH}/kernel/syscalls/syscalltbl.sh $kerneldir/build/ 2>/dev/null || :
208 cp -a --parents arch/${ARCH}/kernel/syscalls/syscallhdr.sh $kerneldir/build/ 2>/dev/null || :
209 cp -a --parents arch/${ARCH}/kernel/vdso32/* $kerneldir/build/ 2>/dev/null || :
210 cp -a --parents arch/${ARCH}/kernel/vdso64/* $kerneldir/build/ 2>/dev/null || :
211
212 # v5.19+
213 cp -a --parents arch/powerpc/kernel/vdso/*.S $kerneldir/build 2>/dev/null || :
214 cp -a --parents arch/powerpc/kernel/vdso/*gettimeofday.* $kerneldir/build 2>/dev/null || :
215 cp -a --parents arch/powerpc/kernel/vdso/gen_vdso*_offsets.sh $kerneldir/build/ 2>/dev/null || :
216
217 # v6,1+
218 cp -a --parents arch/powerpc/kernel/asm-offsets.c $kerneldir/build/ 2>/dev/null || :
219 cp -a --parents arch/powerpc/kernel/head_booke.h $kerneldir/build/ 2>/dev/null || :
220 fi
221 if [ "${ARCH}" = "riscv" ]; then
222 cp -a --parents arch/riscv/kernel/vdso/*gettimeofday.* $kerneldir/build/
223 cp -a --parents arch/riscv/kernel/vdso/note.S $kerneldir/build/
224 # v6.1+
225 cp -a --parents arch/riscv/kernel/asm-offsets.c $kerneldir/build/
226 if [ -e arch/riscv/kernel/vdso/gen_vdso_offsets.sh ]; then
227 cp -a --parents arch/riscv/kernel/vdso/gen_vdso_offsets.sh $kerneldir/build/
228 fi
229 cp -a --parents arch/riscv/kernel/vdso/* $kerneldir/build/ 2>/dev/null || :
230 if [ -e arch/riscv/kernel/compat_vdso/gen_compat_vdso_offsets.sh ]; then
231 cp -a --parents arch/riscv/kernel/compat_vdso/gen_compat_vdso_offsets.sh $kerneldir/build/
232 fi
233 cp -a --parents arch/riscv/kernel/compat_vdso/* $kerneldir/build/ 2>/dev/null || :
234 fi
235
236 # include the machine specific headers for ARM variants, if available.
237 if [ "${ARCH}" = "arm" ]; then
238 cp -a --parents arch/${ARCH}/mach-*/include $kerneldir/build/
174 239
175 # include the machine specific headers for ARM variants, if available. 240 # include a few files for 'make prepare'
176 if [ "${ARCH}" = "arm" ]; then 241 cp -a --parents arch/arm/tools/gen-mach-types $kerneldir/build/
177 cp -a --parents arch/${ARCH}/mach-*/include $kerneldir/build/ 242 cp -a --parents arch/arm/tools/mach-types $kerneldir/build/
178 243
179 # include a few files for 'make prepare' 244 # 5.19+
180 cp -a --parents arch/arm/tools/gen-mach-types $kerneldir/build/ 245 cp -a --parents arch/arm/tools/gen-sysreg.awk $kerneldir/build/ 2>/dev/null || :
181 cp -a --parents arch/arm/tools/mach-types $kerneldir/build/
182 246
183 # ARM syscall table tools only exist for kernels v4.10 or later 247 # ARM syscall table tools only exist for kernels v4.10 or later
184 SYSCALL_TOOLS=$(find arch/arm/tools -name "syscall*") 248 SYSCALL_TOOLS=$(find arch/arm/tools -name "syscall*")
185 if [ -n "$SYSCALL_TOOLS" ] ; then 249 if [ -n "$SYSCALL_TOOLS" ] ; then
186 cp -a --parents $SYSCALL_TOOLS $kerneldir/build/ 250 cp -a --parents $SYSCALL_TOOLS $kerneldir/build/
187 fi 251 fi
188 252
189 cp -a --parents arch/arm/kernel/module.lds $kerneldir/build/ 2>/dev/null || : 253 cp -a --parents arch/arm/kernel/module.lds $kerneldir/build/ 2>/dev/null || :
190 fi 254 # v6.1+
191 255 cp -a --parents arch/arm/kernel/asm-offsets.c $kerneldir/build/ 2>/dev/null || :
192 if [ -d arch/${ARCH}/include ]; then 256 cp -a --parents arch/arm/kernel/signal.h $kerneldir/build/ 2>/dev/null || :
193 cp -a --parents arch/${ARCH}/include $kerneldir/build/ 257 fi
194 fi 258
195 259 if [ -d arch/${ARCH}/include ]; then
196 cp -a include $kerneldir/build 260 cp -a --parents arch/${ARCH}/include $kerneldir/build/
197 261 fi
198 cp -a --parents lib/vdso/* $kerneldir/build/ 2>/dev/null || : 262
199 263 cp -a include $kerneldir/build
200 cp -a --parents tools/include/tools/le_byteshift.h $kerneldir/build/ 264
201 cp -a --parents tools/include/tools/be_byteshift.h $kerneldir/build/ 265 cp -a --parents lib/vdso/* $kerneldir/build/ 2>/dev/null || :
202 266
203 # required for generate missing syscalls prepare phase 267 cp -a --parents tools/include/tools/le_byteshift.h $kerneldir/build/
204 cp -a --parents $(find arch/x86 -type f -name "syscall_32.tbl") $kerneldir/build 268 cp -a --parents tools/include/tools/be_byteshift.h $kerneldir/build/
205 cp -a --parents $(find arch/arm -type f -name "*.tbl") $kerneldir/build 2>/dev/null || : 269
206 270 # required for generate missing syscalls prepare phase
207 if [ "${ARCH}" = "x86" ]; then 271 cp -a --parents $(find arch/x86 -type f -name "syscall_32.tbl") $kerneldir/build
208 # files for 'make prepare' to succeed with kernel-devel 272 cp -a --parents $(find arch/arm -type f -name "*.tbl") $kerneldir/build 2>/dev/null || :
209 cp -a --parents $(find arch/x86 -type f -name "syscall_32.tbl") $kerneldir/build/ 273
210 cp -a --parents $(find arch/x86 -type f -name "syscalltbl.sh") $kerneldir/build/ 274 if [ "${ARCH}" = "x86" ]; then
211 cp -a --parents $(find arch/x86 -type f -name "syscallhdr.sh") $kerneldir/build/ 275 # files for 'make prepare' to succeed with kernel-devel
212 cp -a --parents $(find arch/x86 -type f -name "syscall_64.tbl") $kerneldir/build/ 276 cp -a --parents $(find arch/x86 -type f -name "syscall_32.tbl") $kerneldir/build/ 2>/dev/null || :
213 cp -a --parents arch/x86/tools/relocs_32.c $kerneldir/build/ 277 cp -a --parents $(find arch/x86 -type f -name "syscalltbl.sh") $kerneldir/build/ 2>/dev/null || :
214 cp -a --parents arch/x86/tools/relocs_64.c $kerneldir/build/ 278 cp -a --parents $(find arch/x86 -type f -name "syscallhdr.sh") $kerneldir/build/ 2>/dev/null || :
215 cp -a --parents arch/x86/tools/relocs.c $kerneldir/build/ 279 cp -a --parents $(find arch/x86 -type f -name "syscall_64.tbl") $kerneldir/build/ 2>/dev/null || :
216 cp -a --parents arch/x86/tools/relocs_common.c $kerneldir/build/ 280 cp -a --parents arch/x86/tools/relocs_32.c $kerneldir/build/
217 cp -a --parents arch/x86/tools/relocs.h $kerneldir/build/ 281 cp -a --parents arch/x86/tools/relocs_64.c $kerneldir/build/
218 cp -a --parents arch/x86/tools/gen-insn-attr-x86.awk $kerneldir/build/ 2>/dev/null || : 282 cp -a --parents arch/x86/tools/relocs.c $kerneldir/build/
219 cp -a --parents arch/x86/purgatory/purgatory.c $kerneldir/build/ 283 cp -a --parents arch/x86/tools/relocs_common.c $kerneldir/build/
220 284 cp -a --parents arch/x86/tools/relocs.h $kerneldir/build/
221 # 4.18 + have unified the purgatory files, so we ignore any errors if 285 cp -a --parents arch/x86/tools/gen-insn-attr-x86.awk $kerneldir/build/ 2>/dev/null || :
222 # these files are not present 286 cp -a --parents arch/x86/purgatory/purgatory.c $kerneldir/build/
223 cp -a --parents arch/x86/purgatory/sha256.h $kerneldir/build/ 2>/dev/null || : 287
224 cp -a --parents arch/x86/purgatory/sha256.c $kerneldir/build/ 2>/dev/null || : 288 # 4.18 + have unified the purgatory files, so we ignore any errors if
225 289 # these files are not present
226 cp -a --parents arch/x86/purgatory/stack.S $kerneldir/build/ 290 cp -a --parents arch/x86/purgatory/sha256.h $kerneldir/build/ 2>/dev/null || :
227 cp -a --parents arch/x86/purgatory/string.c $kerneldir/build/ 2>/dev/null || : 291 cp -a --parents arch/x86/purgatory/sha256.c $kerneldir/build/ 2>/dev/null || :
228 cp -a --parents arch/x86/purgatory/setup-x86_64.S $kerneldir/build/ 292
229 cp -a --parents arch/x86/purgatory/entry64.S $kerneldir/build/ 293 cp -a --parents arch/x86/purgatory/stack.S $kerneldir/build/
230 cp -a --parents arch/x86/boot/string.h $kerneldir/build/ 294 cp -a --parents arch/x86/purgatory/string.c $kerneldir/build/ 2>/dev/null || :
231 cp -a --parents arch/x86/boot/string.c $kerneldir/build/ 295 cp -a --parents arch/x86/purgatory/setup-x86_64.S $kerneldir/build/
232 cp -a --parents arch/x86/boot/compressed/string.c $kerneldir/build/ 2>/dev/null || : 296 cp -a --parents arch/x86/purgatory/entry64.S $kerneldir/build/
233 cp -a --parents arch/x86/boot/ctype.h $kerneldir/build/ 297 cp -a --parents arch/x86/boot/string.h $kerneldir/build/
234 298 cp -a --parents arch/x86/boot/string.c $kerneldir/build/
235 # objtool requires these files 299 cp -a --parents arch/x86/boot/compressed/string.c $kerneldir/build/ 2>/dev/null || :
236 cp -a --parents arch/x86/lib/inat.c $kerneldir/build/ 2>/dev/null || : 300 cp -a --parents arch/x86/boot/ctype.h $kerneldir/build/
237 cp -a --parents arch/x86/lib/insn.c $kerneldir/build/ 2>/dev/null || : 301
238 fi 302 # objtool requires these files
239 303 cp -a --parents arch/x86/lib/inat.c $kerneldir/build/ 2>/dev/null || :
240 if [ "${ARCH}" = "mips" ]; then 304 cp -a --parents arch/x86/lib/insn.c $kerneldir/build/ 2>/dev/null || :
241 cp -a --parents arch/mips/Kbuild.platforms $kerneldir/build/ 305
242 cp --parents $(find -type f -name "Platform") $kerneldir/build 306 # v6.1+
243 cp --parents arch/mips/boot/tools/relocs* $kerneldir/build 307 cp -a --parents arch/x86/kernel/asm-offsets* $kerneldir/build || :
244 cp -a --parents arch/mips/kernel/asm-offsets.c $kerneldir/build 308 # for capabilities.h, vmx.h
245 cp -a --parents kernel/time/timeconst.bc $kerneldir/build 309 cp -a --parents arch/x86/kvm/vmx/*.h $kerneldir/build || :
246 cp -a --parents kernel/bounds.c $kerneldir/build 310 # for lapic.h, hyperv.h ....
247 cp -a --parents Kbuild $kerneldir/build 311 cp -a --parents arch/x86/kvm/*.h $kerneldir/build || :
248 cp -a --parents arch/mips/kernel/syscalls/*.sh $kerneldir/build 2>/dev/null || : 312 fi
249 cp -a --parents arch/mips/kernel/syscalls/*.tbl $kerneldir/build 2>/dev/null || : 313
250 cp -a --parents arch/mips/tools/elf-entry.c $kerneldir/build 2>/dev/null || : 314 # moved from arch/mips to all arches for v6.1+
251 fi 315 cp -a --parents kernel/time/timeconst.bc $kerneldir/build 2>/dev/null || :
316 cp -a --parents kernel/bounds.c $kerneldir/build 2>/dev/null || :
317
318 if [ "${ARCH}" = "mips" ]; then
319 cp -a --parents arch/mips/Kbuild.platforms $kerneldir/build/
320 cp --parents $(find -type f -name "Platform") $kerneldir/build
321 cp --parents arch/mips/boot/tools/relocs* $kerneldir/build
322 cp -a --parents arch/mips/kernel/asm-offsets.c $kerneldir/build
323 cp -a --parents Kbuild $kerneldir/build
324 cp -a --parents arch/mips/kernel/syscalls/*.sh $kerneldir/build 2>/dev/null || :
325 cp -a --parents arch/mips/kernel/syscalls/*.tbl $kerneldir/build 2>/dev/null || :
326 cp -a --parents arch/mips/tools/elf-entry.c $kerneldir/build 2>/dev/null || :
327 fi
328
329 if [ "${ARCH}" = "loongarch" ]; then
330 cp -a --parents arch/loongarch/kernel/asm-offsets.c $kerneldir/build
331 cp -a --parents Kbuild $kerneldir/build
332 cp -a --parents arch/loongarch/vdso/*.S $kerneldir/build 2>/dev/null || :
333 cp -a --parents arch/loongarch/vdso/*gettimeofday.* $kerneldir/build 2>/dev/null || :
334 cp -a --parents arch/loongarch/vdso/*getcpu.* $kerneldir/build 2>/dev/null || :
335 cp -a --parents arch/loongarch/vdso/gen_vdso*_offsets.sh $kerneldir/build/ 2>/dev/null || :
336 fi
252 337
253 # required to build scripts/selinux/genheaders/genheaders 338 # required to build scripts/selinux/genheaders/genheaders
254 cp -a --parents security/selinux/include/* $kerneldir/build/ 339 cp -a --parents security/selinux/include/* $kerneldir/build/
255 340
256 # copy any localversion files 341 # copy any localversion files
257 cp -a localversion* $kerneldir/build/ 2>/dev/null || : 342 cp -a localversion* $kerneldir/build/ 2>/dev/null || :
258 ) 343 )
259 344
260 # Make sure the Makefile and version.h have a matching timestamp so that 345 # Make sure the Makefile and version.h have a matching timestamp so that
261 # external modules can be built 346 # external modules can be built
262 touch -r $kerneldir/build/Makefile $kerneldir/build/include/generated/uapi/linux/version.h 347 touch -r $kerneldir/build/Makefile $kerneldir/build/include/generated/uapi/linux/version.h
263 348
264 # Copy .config to include/config/auto.conf so "make prepare" is unnecessary. 349 # This fixes a warning that the compilers don't match when building a module
265 cp $kerneldir/build/.config $kerneldir/build/include/config/auto.conf 350 # Change: CONFIG_CC_VERSION_TEXT="x86_64-poky-linux-gcc (GCC) 12.2.0" to "gcc (GCC) 12.2.0"
351 # #define CONFIG_CC_VERSION_TEXT "x86_64-poky-linux-gcc (GCC) 12.2.0" to "gcc (GCC) 12.2.0"
352 sed -i 's/CONFIG_CC_VERSION_TEXT=".*\(gcc.*\)"/CONFIG_CC_VERSION_TEXT="\1"/' "$kerneldir/build/.config"
353 sed -i 's/#define CONFIG_CC_VERSION_TEXT ".*\(gcc.*\)"/#define CONFIG_CC_VERSION_TEXT "\1"/' $kerneldir/build/include/generated/autoconf.h
354 sed -i 's/CONFIG_CC_VERSION_TEXT=".*\(gcc.*\)"/CONFIG_CC_VERSION_TEXT="\1"/' $kerneldir/build/include/config/auto.conf
266 355
267 # make sure these are at least as old as the .config, or rebuilds will trigger 356 # make sure these are at least as old as the .config, or rebuilds will trigger
268 touch -r $kerneldir/build/.config $kerneldir/build/include/generated/autoconf.h 2>/dev/null || : 357 touch -r $kerneldir/build/.config $kerneldir/build/include/generated/autoconf.h 2>/dev/null || :
@@ -271,6 +360,13 @@ do_install() {
271 if [ -e "$kerneldir/build/include/config/auto.conf.cmd" ]; then 360 if [ -e "$kerneldir/build/include/config/auto.conf.cmd" ]; then
272 sed -i 's/ifneq "$(CC)" ".*-linux-.*gcc.*$/ifneq "$(CC)" "gcc"/' "$kerneldir/build/include/config/auto.conf.cmd" 361 sed -i 's/ifneq "$(CC)" ".*-linux-.*gcc.*$/ifneq "$(CC)" "gcc"/' "$kerneldir/build/include/config/auto.conf.cmd"
273 sed -i 's/ifneq "$(LD)" ".*-linux-.*ld.bfd.*$/ifneq "$(LD)" "ld"/' "$kerneldir/build/include/config/auto.conf.cmd" 362 sed -i 's/ifneq "$(LD)" ".*-linux-.*ld.bfd.*$/ifneq "$(LD)" "ld"/' "$kerneldir/build/include/config/auto.conf.cmd"
363 sed -i 's/ifneq "$(AR)" ".*-linux-.*ar.*$/ifneq "$(AR)" "ar"/' "$kerneldir/build/include/config/auto.conf.cmd"
364 sed -i 's/ifneq "$(OBJCOPY)" ".*-linux-.*objcopy.*$/ifneq "$(OBJCOPY)" "objcopy"/' "$kerneldir/build/include/config/auto.conf.cmd"
365 if [ "${ARCH}" = "powerpc" ]; then
366 sed -i 's/ifneq "$(NM)" ".*-linux-.*nm.*$/ifneq "$(NM)" "nm --synthetic"/' "$kerneldir/build/include/config/auto.conf.cmd"
367 else
368 sed -i 's/ifneq "$(NM)" ".*-linux-.*nm.*$/ifneq "$(NM)" "nm"/' "$kerneldir/build/include/config/auto.conf.cmd"
369 fi
274 sed -i 's/ifneq "$(HOSTCXX)" ".*$/ifneq "$(HOSTCXX)" "g++"/' "$kerneldir/build/include/config/auto.conf.cmd" 370 sed -i 's/ifneq "$(HOSTCXX)" ".*$/ifneq "$(HOSTCXX)" "g++"/' "$kerneldir/build/include/config/auto.conf.cmd"
275 sed -i 's/ifneq "$(HOSTCC)" ".*$/ifneq "$(HOSTCC)" "gcc"/' "$kerneldir/build/include/config/auto.conf.cmd" 371 sed -i 's/ifneq "$(HOSTCC)" ".*$/ifneq "$(HOSTCC)" "gcc"/' "$kerneldir/build/include/config/auto.conf.cmd"
276 sed -i 's/ifneq "$(CC_VERSION_TEXT)".*\(gcc.*\)"/ifneq "$(CC_VERSION_TEXT)" "\1"/' "$kerneldir/build/include/config/auto.conf.cmd" 372 sed -i 's/ifneq "$(CC_VERSION_TEXT)".*\(gcc.*\)"/ifneq "$(CC_VERSION_TEXT)" "\1"/' "$kerneldir/build/include/config/auto.conf.cmd"
@@ -283,9 +379,9 @@ do_install() {
283 # left as /usr/bin/python rootfs assembly will fail, since we only have python3 379 # left as /usr/bin/python rootfs assembly will fail, since we only have python3
284 # in the RDEPENDS (and the python3 package does not include /usr/bin/python) 380 # in the RDEPENDS (and the python3 package does not include /usr/bin/python)
285 for ss in $(find $kerneldir/build/scripts -type f -name '*'); do 381 for ss in $(find $kerneldir/build/scripts -type f -name '*'); do
286 sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss" 382 sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss"
287 sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss" 383 sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss"
288 sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss" 384 sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss"
289 done 385 done
290 386
291 chown -R root:root ${D} 387 chown -R root:root ${D}
@@ -294,13 +390,17 @@ do_install() {
294# Ensure we don't race against "make scripts" during cpio 390# Ensure we don't race against "make scripts" during cpio
295do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock" 391do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
296 392
297FILES_${PN} = "${KERNEL_BUILD_ROOT} ${KERNEL_SRC_PATH}" 393FILES:${PN} = "${KERNEL_BUILD_ROOT} ${KERNEL_SRC_PATH}"
298FILES_${PN}-dbg += "${KERNEL_BUILD_ROOT}*/build/scripts/*/.debug/*" 394FILES:${PN}-dbg += "${KERNEL_BUILD_ROOT}*/build/scripts/*/.debug/*"
299 395
300RDEPENDS_${PN} = "bc python3 flex bison ${TCLIBC}-utils" 396RDEPENDS:${PN} = "bc python3-core flex bison ${TCLIBC}-utils gawk"
301# 4.15+ needs these next two RDEPENDS 397# 4.15+ needs these next two RDEPENDS
302RDEPENDS_${PN} += "openssl-dev util-linux" 398RDEPENDS:${PN} += "openssl-dev util-linux"
303# and x86 needs a bit more for 4.15+ 399# and x86 needs a bit more for 4.15+
304RDEPENDS_${PN} += "${@bb.utils.contains('ARCH', 'x86', 'elfutils', '', d)}" 400RDEPENDS:${PN} += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-dev', '', d)}"
401# powerpc needs elfutils on 6.3+
402RDEPENDS:${PN} += "${@bb.utils.contains('ARCH', 'powerpc', 'elfutils-dev', '', d)}"
305# 5.8+ needs gcc-plugins libmpc-dev 403# 5.8+ needs gcc-plugins libmpc-dev
306RDEPENDS_${PN} += "gcc-plugins libmpc-dev" 404RDEPENDS:${PN} += "gcc-plugins libmpc-dev"
405# 5.13+ needs grep for powerpc
406RDEPENDS:${PN}:append:powerpc = " grep"