Skip to content

Instantly share code, notes, and snippets.

@klutchell
Created December 21, 2020 15:01
Show Gist options
  • Save klutchell/c2f3bc6bf59271316ba0bd0fdea97d79 to your computer and use it in GitHub Desktop.
Save klutchell/c2f3bc6bf59271316ba0bd0fdea97d79 to your computer and use it in GitHub Desktop.
--- poky/meta/recipes-kernel/linux/kernel-devsrc.bb 2020-12-01 11:02:39.510292328 -0500
+++ meta-balena-warrior/recipes-kernel/linux/kernel-devsrc.bb 2020-12-16 14:11:36.146363392 -0500
@@ -104,7 +104,9 @@
fi
if [ "${ARCH}" = "arm64" ]; then
- cp -a --parents arch/arm64/kernel/vdso/vdso.lds $kerneldir/build/
+ if [ -f "arch/arm64/kernel/vdso/vdso.lds" ]; then
+ cp -a --parents arch/arm64/kernel/vdso/vdso.lds $kerneldir/build/
+ fi
fi
cp -a include $kerneldir/build/include
@@ -140,13 +142,20 @@
cp -a --parents arch/arm/include/asm/xen $kerneldir/build/
# arch/arm64/include/asm/opcodes.h references arch/arm
cp -a --parents arch/arm/include/asm/opcodes.h $kerneldir/build/
+ # include a few files for 'make prepare'
+ cp -a --parents arch/arm/tools/gen-mach-types $kerneldir/build/
+ cp -a --parents arch/arm/tools/mach-types $kerneldir/build/
- cp -a --parents arch/arm64/kernel/vdso/gettimeofday.S $kerneldir/build/
+ cp -a --parents arch/arm64/kernel/vdso/*gettimeofday.* $kerneldir/build/
cp -a --parents arch/arm64/kernel/vdso/sigreturn.S $kerneldir/build/
cp -a --parents arch/arm64/kernel/vdso/note.S $kerneldir/build/
cp -a --parents arch/arm64/kernel/vdso/gen_vdso_offsets.sh $kerneldir/build/
-
- cp -a --parents arch/arm64/kernel/module.lds $kerneldir/build/
+ if [ -f "arch/arm64/kernel/vdso/vdso.lds.S" ]; then
+ cp -a --parents arch/arm64/kernel/vdso/vdso.lds.S $kerneldir/build/
+ fi
+ if [ -f "arch/arm64/kernel/module.lds" ]; then
+ cp -a --parents arch/arm64/kernel/module.lds $kerneldir/build/
+ fi
fi
if [ "${ARCH}" = "powerpc" ]; then
@@ -169,8 +178,9 @@
if [ -n "$SYSCALL_TOOLS" ] ; then
cp -a --parents $SYSCALL_TOOLS $kerneldir/build/
fi
-
- cp -a --parents arch/arm/kernel/module.lds $kerneldir/build/
+ if [ -f "arch/arm/kernel/module.lds" ]; then
+ cp -a --parents arch/arm/kernel/module.lds $kerneldir/build/
+ fi
fi
if [ -d arch/${ARCH}/include ]; then
@@ -179,11 +189,17 @@
cp -a include $kerneldir/build
+ cp -a --parents lib/vdso/* $kerneldir/build/ 2>/dev/null || :
+
cp -a --parents tools/include/tools/le_byteshift.h $kerneldir/build/
cp -a --parents tools/include/tools/be_byteshift.h $kerneldir/build/
# required for generate missing syscalls prepare phase
- cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $kerneldir/build
+ if [ -d "arch/x86/entry" ]; then
+ cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $kerneldir/build
+ else
+ cp -a --parents arch/x86/syscalls/syscall_32.tbl $kerneldir/build
+ fi
if [ "${ARCH}" = "x86" ]; then
# files for 'make prepare' to succeed with kernel-devel
@@ -240,6 +256,15 @@
# Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
cp $kerneldir/build/.config $kerneldir/build/include/config/auto.conf
+ # make the scripts python3 safe. We won't be running these, and if they are
+ # left as /usr/bin/python rootfs assembly will fail, since we only have python3
+ # in the RDEPENDS (and the python3 package does not include /usr/bin/python)
+ for ss in $(find $kerneldir/build/scripts -type f -name '*'); do
+ sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss"
+ sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss"
+ sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss"
+ done
+
chown -R root:root ${D}
}
@@ -249,7 +274,7 @@
FILES_${PN} = "${KERNEL_BUILD_ROOT} ${KERNEL_SRC_PATH}"
FILES_${PN}-dbg += "${KERNEL_BUILD_ROOT}*/build/scripts/*/.debug/*"
-RDEPENDS_${PN} = "bc python flex bison ${TCLIBC}-utils"
+RDEPENDS_${PN} = "bc python3 flex bison ${TCLIBC}-utils"
# 4.15+ needs these next two RDEPENDS
RDEPENDS_${PN} += "openssl-dev util-linux"
# and x86 needs a bit more for 4.15+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment