diff --git a/board/phytium/common/linux-4.19/scripts/basic/fixdep b/board/phytium/common/linux-4.19/scripts/basic/fixdep deleted file mode 100755 index e88975ce..00000000 Binary files a/board/phytium/common/linux-4.19/scripts/basic/fixdep and /dev/null differ diff --git a/board/phytium/common/linux-4.19/scripts/genksyms/genksyms b/board/phytium/common/linux-4.19/scripts/genksyms/genksyms deleted file mode 100755 index fc7af3df..00000000 Binary files a/board/phytium/common/linux-4.19/scripts/genksyms/genksyms and /dev/null differ diff --git a/board/phytium/common/linux-4.19/scripts/mod/modpost b/board/phytium/common/linux-4.19/scripts/mod/modpost deleted file mode 100755 index b4a97962..00000000 Binary files a/board/phytium/common/linux-4.19/scripts/mod/modpost and /dev/null differ diff --git a/board/phytium/common/linux-5.10/scripts/basic/fixdep b/board/phytium/common/linux-5.10/scripts/basic/fixdep deleted file mode 100755 index 5285f284..00000000 Binary files a/board/phytium/common/linux-5.10/scripts/basic/fixdep and /dev/null differ diff --git a/board/phytium/common/linux-5.10/scripts/mod/modpost b/board/phytium/common/linux-5.10/scripts/mod/modpost deleted file mode 100755 index 7ddfbabc..00000000 Binary files a/board/phytium/common/linux-5.10/scripts/mod/modpost and /dev/null differ diff --git a/board/phytium/common/linux-6.6/scripts/asn1_compiler b/board/phytium/common/linux-6.6/scripts/asn1_compiler new file mode 100755 index 00000000..2a7ae6f4 Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/asn1_compiler differ diff --git a/board/phytium/common/linux-6.6/scripts/basic/fixdep b/board/phytium/common/linux-6.6/scripts/basic/fixdep new file mode 100755 index 00000000..9188a165 Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/basic/fixdep differ diff --git a/board/phytium/common/linux-6.6/scripts/dtc/dtc b/board/phytium/common/linux-6.6/scripts/dtc/dtc new file mode 100755 index 00000000..f16c5b06 Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/dtc/dtc differ diff --git a/board/phytium/common/linux-6.6/scripts/dtc/fdtoverlay b/board/phytium/common/linux-6.6/scripts/dtc/fdtoverlay new file mode 100755 index 00000000..a2c4c8a7 Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/dtc/fdtoverlay differ diff --git a/board/phytium/common/linux-6.6/scripts/kallsyms b/board/phytium/common/linux-6.6/scripts/kallsyms new file mode 100755 index 00000000..e7021c5c Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/kallsyms differ diff --git a/board/phytium/common/linux-6.6/scripts/kconfig/conf b/board/phytium/common/linux-6.6/scripts/kconfig/conf new file mode 100755 index 00000000..8e21f559 Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/kconfig/conf differ diff --git a/board/phytium/common/linux-6.6/scripts/mod/mk_elfconfig b/board/phytium/common/linux-6.6/scripts/mod/mk_elfconfig new file mode 100755 index 00000000..f992efcd Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/mod/mk_elfconfig differ diff --git a/board/phytium/common/linux-6.6/scripts/mod/modpost b/board/phytium/common/linux-6.6/scripts/mod/modpost new file mode 100755 index 00000000..aca799ff Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/mod/modpost differ diff --git a/board/phytium/common/linux-6.6/scripts/sorttable b/board/phytium/common/linux-6.6/scripts/sorttable new file mode 100755 index 00000000..bc39e3ad Binary files /dev/null and b/board/phytium/common/linux-6.6/scripts/sorttable differ diff --git a/board/phytium/common/post-build.sh b/board/phytium/common/post-build.sh index 167576d0..bca7b039 100755 --- a/board/phytium/common/post-build.sh +++ b/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 diff --git a/board/phytium/genimage-5.10.cfg b/board/phytium/genimage-5.10.cfg deleted file mode 100644 index a4c2e386..00000000 --- a/board/phytium/genimage-5.10.cfg +++ /dev/null @@ -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 - } -} diff --git a/package/Config.in b/package/Config.in index 0acc2466..0ae457cc 100644 --- a/package/Config.in +++ b/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" diff --git a/package/kernel-headers/Config.in b/package/kernel-headers/Config.in new file mode 100644 index 00000000..6b8cdf77 --- /dev/null +++ b/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. diff --git a/package/kernel-headers/kernel-headers.mk b/package/kernel-headers/kernel-headers.mk new file mode 100644 index 00000000..b38c4b06 --- /dev/null +++ b/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)) diff --git a/package/kernel-headers/kernel_headers_install.sh b/package/kernel-headers/kernel_headers_install.sh new file mode 100755 index 00000000..e74ac14c --- /dev/null +++ b/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 diff --git a/system/Config.in b/system/Config.in index 50f9379e..b67d6213 100644 --- a/system/Config.in +++ b/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.