Browse Source

add kernel-headers package to support linux-headers for linux kernel 6.6

Signed-off-by: weishanshan1084 <weishanshan1084@phytium.com.cn>
pull/26/head
weishanshan1084 6 months ago
parent
commit
b4cbf10de3
  1. BIN
      board/phytium/common/linux-4.19/scripts/basic/fixdep
  2. BIN
      board/phytium/common/linux-4.19/scripts/genksyms/genksyms
  3. BIN
      board/phytium/common/linux-4.19/scripts/mod/modpost
  4. BIN
      board/phytium/common/linux-5.10/scripts/basic/fixdep
  5. BIN
      board/phytium/common/linux-5.10/scripts/mod/modpost
  6. BIN
      board/phytium/common/linux-6.6/scripts/asn1_compiler
  7. BIN
      board/phytium/common/linux-6.6/scripts/basic/fixdep
  8. BIN
      board/phytium/common/linux-6.6/scripts/dtc/dtc
  9. BIN
      board/phytium/common/linux-6.6/scripts/dtc/fdtoverlay
  10. BIN
      board/phytium/common/linux-6.6/scripts/kallsyms
  11. BIN
      board/phytium/common/linux-6.6/scripts/kconfig/conf
  12. BIN
      board/phytium/common/linux-6.6/scripts/mod/mk_elfconfig
  13. BIN
      board/phytium/common/linux-6.6/scripts/mod/modpost
  14. BIN
      board/phytium/common/linux-6.6/scripts/sorttable
  15. 104
      board/phytium/common/post-build.sh
  16. 52
      board/phytium/genimage-5.10.cfg
  17. 1
      package/Config.in
  18. 5
      package/kernel-headers/Config.in
  19. 19
      package/kernel-headers/kernel-headers.mk
  20. 28
      package/kernel-headers/kernel_headers_install.sh
  21. 1
      system/Config.in

BIN
board/phytium/common/linux-4.19/scripts/basic/fixdep

Binary file not shown.

BIN
board/phytium/common/linux-4.19/scripts/genksyms/genksyms

Binary file not shown.

BIN
board/phytium/common/linux-4.19/scripts/mod/modpost

Binary file not shown.

BIN
board/phytium/common/linux-5.10/scripts/basic/fixdep

Binary file not shown.

BIN
board/phytium/common/linux-5.10/scripts/mod/modpost

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/asn1_compiler

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/basic/fixdep

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/dtc/dtc

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/dtc/fdtoverlay

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/kallsyms

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/kconfig/conf

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/mod/mk_elfconfig

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/mod/modpost

Binary file not shown.

BIN
board/phytium/common/linux-6.6/scripts/sorttable

Binary file not shown.

104
board/phytium/common/post-build.sh

@ -1,112 +1,8 @@
#!/usr/bin/env bash
deploy_kernel_headers_510 () {
topdir=$(pwd)
pdir=$1
version=$2
srctree=$pdir/lib/modules/$version/source
objtree=$pdir/lib/modules/$version/build
cd $objtree
mkdir debian
(
cd $srctree
find . arch/arm64 -maxdepth 1 -name Makefile\*
find include scripts -type f -o -type l
find arch/arm64 -name Kbuild.platforms -o -name Platform
find $(find arch/arm64 -name include -o -name scripts -type d) -type f
) > debian/hdrsrcfiles
{
if grep -q "^CONFIG_STACK_VALIDATION=y" include/config/auto.conf; then
echo tools/objtool/objtool
fi
find arch/arm64/include Module.symvers include scripts -type f
if grep -q "^CONFIG_GCC_PLUGINS=y" include/config/auto.conf; then
find scripts/gcc-plugins -name \*.so
fi
} > debian/hdrobjfiles
destdir=$pdir/usr/src/linux-headers-$version
mkdir -p $destdir
tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
rm -rf debian
# copy .config manually to be where it's expected to be
cp .config $destdir/.config
# used to build dma
cp drivers/dma/dmaengine.h $1/usr/include
cp drivers/dma/virt-dma.h $1/usr/include
find $destdir -name "*.o" -type f -exec rm -rf {} \;
cd $topdir
cp -r board/phytium/common/linux-5.10/scripts $destdir
rm -rf $srctree
rm -rf $objtree
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
}
deploy_kernel_headers_419 () {
topdir=$(pwd)
pdir=$1
version=$2
srctree=$pdir/lib/modules/$version/source
objtree=$pdir/lib/modules/$version/build
cd $objtree
mkdir debian
(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles"
(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
(cd $srctree; find arch/arm64 -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
(cd $srctree; find $(find arch/arm64 -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
if grep -q '^CONFIG_STACK_VALIDATION=y' .config ; then
(cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
fi
(cd $objtree; find arch/arm64/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
if grep -q '^CONFIG_GCC_PLUGINS=y' .config ; then
(cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
fi
destdir=$pdir/usr/src/linux-headers-$version
mkdir -p "$destdir"
(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -)
(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -)
(cd $objtree; cp .config $destdir/.config) # copy .config manually to be where it's expected to be
(cd $srctree; cp --parents tools/include/tools/be_byteshift.h $destdir)
(cd $srctree; cp --parents tools/include/tools/le_byteshift.h $destdir)
(cd $srctree; cp drivers/dma/dmaengine.h $1/usr/include) # used to build dma
(cd $srctree; cp drivers/dma/virt-dma.h $1/usr/include)
find $destdir -name "*.o" -type f -exec rm -rf {} \;
cd $topdir
cp -r board/phytium/common/linux-4.19/scripts $destdir
rm -rf "$objtree/debian"
rm -rf $srctree
rm -rf $objtree
ln -sf "/usr/src/linux-headers-$version" "$pdir/lib/modules/$version/build"
}
main()
{
# $1 - the current rootfs directory, skeleton-custom or target
if [ ! -d $1/lib/modules ]; then
make linux-rebuild ${O:+O=$O}
fi
KERNELVERSION=`ls $1/lib/modules`
if grep -Eq "^BR2_ROOTFS_LINUX_HEADERS=y$" ${BR2_CONFIG} && [ -L $1/lib/modules/${KERNELVERSION}/source ]; then
if [[ ${KERNELVERSION} = 5.10* || ${KERNELVERSION} = 5.15* ]];then
deploy_kernel_headers_510 $1 ${KERNELVERSION}
elif [[ ${KERNELVERSION} = 4.19* ]];then
deploy_kernel_headers_419 $1 ${KERNELVERSION}
else
echo "error: linux kernel version is not 4.19, 5.10, or 5.15."
fi
fi
if grep -Eq "^BR2_ROOTFS_CHOWN=y$" ${BR2_CONFIG}; then
ln -sf /lib/systemd/system/systemd-rootfs-chown.service $1/etc/systemd/system/multi-user.target.wants/systemd-rootfs-chown.service
fi

52
board/phytium/genimage-5.10.cfg

@ -1,52 +0,0 @@
image efi-part.vfat {
vfat {
file EFI {
image = "efi-part/EFI"
}
file Image {
image = "Image"
}
files = {
"e2000d-chillipi-edu-board.dtb",
"e2000d-demo-board.dtb",
"e2000d-miniitx-board.dtb",
"e2000d-power-board.dtb",
"e2000q-come-board.dtb",
"e2000q-demo-board.dtb",
"e2000q-edu-board.dtb",
"e2000q-hanwei-board.dtb",
"e2000q-miniitx-board.dtb",
"e2000q-vpx-board.dtb",
"e2000s-demo-board.dtb",
"pd1904-devboard-d4-dsk.dtb",
"pd2008-devboard-dsk.dtb",
"pd2308-demo-a.dtb",
"pd2308-demo-b.dtb",
"ps2316-devboard-16c-dsk.dtb",
"phytiumpi_firefly.dtb"
}
}
size = 400M
}
image disk.img {
hdimage {
partition-table-type = "gpt"
}
partition boot {
image = "efi-part.vfat"
partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
offset = 32K
bootable = true
}
partition root {
partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4
partition-uuid = "0a52c129-7e0f-43ad-989f-d96b07ccdbb2"
image = "rootfs.ext2"
size = 11G
}
}

1
package/Config.in

@ -254,6 +254,7 @@ menu "Filesystem and flash utilities"
source "package/zerofree/Config.in"
source "package/zfs/Config.in"
source "package/rootfs-chown/Config.in"
source "package/kernel-headers/Config.in"
endmenu
menu "Fonts, cursors, icons, sounds and themes"

5
package/kernel-headers/Config.in

@ -0,0 +1,5 @@
config BR2_PACKAGE_KERNEL_HEADERS
bool "linux kernel headers"
help
This package is used to provide Linux kernel headers for
building out-of-tree kernel modules.

19
package/kernel-headers/kernel-headers.mk

@ -0,0 +1,19 @@
################################################################################
#
# kernel-headers
#
################################################################################
# This package is used to provide Linux kernel headers for
# building out-of-tree kernel modules.
KERNEL_HEADERS_DEPENDENCIES = linux
define KERNEL_HEADERS_CONFIGURE_CMDS
cp $(KERNEL_HEADERS_PKGDIR)/kernel_headers_install.sh $(@D)
endef
define KERNEL_HEADERS_INSTALL_TARGET_CMDS
$(@D)/kernel_headers_install.sh $(TARGET_DIR) $(LINUX_VERSION_PROBED) $(LINUX_DIR)
endef
$(eval $(generic-package))

28
package/kernel-headers/kernel_headers_install.sh

@ -0,0 +1,28 @@
#!/usr/bin/env bash
deploy_kernel_headers_6_6 () {
topdir=$(pwd)
pdir=$1
version=$2
srctree=$3
rm -rf $pdir/usr/src/linux-headers-$version
rm -rf $pdir/lib/modules/$version/build
cd ${srctree}
srctree=${srctree} SRCARCH=arm64 KCONFIG_CONFIG=.config \
${srctree}/scripts/package/install-extmod-build $pdir/usr/src/linux-headers-$version
# used to build dma
cp drivers/dma/dmaengine.h $1/usr/include
cp drivers/dma/virt-dma.h $1/usr/include
find $pdir/usr/src/linux-headers-$version -name "*.o" -type f -exec rm -rf {} \;
cd $topdir
cp -r board/phytium/common/linux-6.6/scripts $pdir/usr/src/linux-headers-$version
mkdir -p $pdir/lib/modules/$version/
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
}
# $1: $(TARGET_DIR)
# $2: $(LINUX_VERSION_PROBED)
# $3: $(LINUX_DIR)
if [[ $2 = 6.6* ]];then
deploy_kernel_headers_6_6 $1 $2 $3
fi

1
system/Config.in

@ -83,6 +83,7 @@ config BR2_TARGET_GENERIC_HOSTNAME
config BR2_ROOTFS_LINUX_HEADERS
bool "custom kernel headers"
select BR2_PACKAGE_KERNEL_HEADERS
help
Custom kernel headers for Ubuntu or Debian.

Loading…
Cancel
Save