如下网址为飞腾适配的buildroot项目,其中说明支持飞腾腾珑E2000开发板和腾锐D2000开发板。
https://gitee.com/phytium_embedded/phytium-linux-buildroot
以下尝试编译针对腾锐D2000开发板镜像。首先下载buildroot:
$ git clone https://gitee.com/phytium_embedded/phytium-linux-buildroot.git
查看支持的Phytium开发板:
$ cd phytium-linux-buildroot/
$
$ make list-defconfigs | grep phytiumphytium_d2000-64b-efi_defconfig - Build for phytium_d2000-64b-efiphytium_d2000_debian_defconfig - Build for phytium_d2000_debianphytium_d2000_debian_desktop_defconfig - Build for phytium_d2000_debian_desktopphytium_d2000_defconfig - Build for phytium_d2000phytium_d2000_ubuntu_defconfig - Build for phytium_d2000_ubuntuphytium_e2000_debian_defconfig - Build for phytium_e2000_debianphytium_e2000_debian_desktop_defconfig - Build for phytium_e2000_debian_desktopphytium_e2000_defconfig - Build for phytium_e2000phytium_e2000_ubuntu_defconfig - Build for phytium_e2000_ubuntuphytium_e2000_ubuntu_desktop_defconfig - Build for phytium_e2000_ubuntu_desktopphytium_e2000_xenomai_defconfig - Build for phytium_e2000_xenomaiphytium_initrd_defconfig - Build for phytium_initrd
使用默认的第一个phytium_d2000-64b-efi_defconfig配置,首先修复其中的几个错误,对于4.19版本内核,sdk.config配置已经不存在,更改为defconfig文件。另外,飞腾的内核代码库已经迁移到gitee,修改对应的URL和版本。
$ vi configs/phytium_d2000-64b-efi_defconfig30 # Kernel31 BR2_LINUX_KERNEL=y32 BR2_LINUX_KERNEL_CUSTOM_VERSION=y33 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19"34 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y35 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y36 BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"37 BR2_LINUX_KERNEL_CUSTOM_GIT=y38 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm64/configs/sdk.config"39 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="ssh://git@gitlab.phytium.com.cn:12022/embedded/linux/linux-4.19.git"40 41 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="349e93465734b958647552a1d3d1d2072efd0b89"
查看当前gitee上飞腾内核的版本信息。
$ git clone https://gitee.com/phytium_embedded/phytium-linux-kernel.git
$
$ cd phytium-linux-kernel
$
$ ls arch/arm64/configs/
defconfig e2000_defconfig
$
$ git log
commit e92ac4aa0b2e3ca7ef4d5c3667d6000a45410a8f (HEAD -> master, origin/master, origin/HEAD)
Author: liutianyu1250 <liutianyu1250@phytium.com.cn>
Date: Fri Nov 18 17:05:45 2022 +0800drivers: net/ethernet/phytium: modify 'macb_tx_restart' to prevent wrong tx restart.Signed-off-by: liutianyu1250 <liutianyu1250@phytium.com.cn>
修改phytium_d2000-64b-efi_defconfig配置文件如下:
38 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm64/configs/defconfig"39 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://gitee.com/phytium_embedded/phytium-linux-kernel.git"40 41 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="e92ac4aa0b2e3ca7ef4d5c3667d6000a45410a8f"
执行编译。
$ make phytium_d2000-64b-efi_defconfig
$ make
编译过程中遇到如下的错误,找不到rproc_handle_ipi函数。
LD vmlinux.oMODPOST vmlinux.o
/home/kai/work/phytium-linux-buildroot/output/host/bin/aarch64-none-linux-gnu-ld: warning: -z norelro ignored
/home/kai/work/phytium-linux-buildroot/output/host/bin/aarch64-none-linux-gnu-ld: arch/arm64/kernel/smp.o: in function `handle_IPI':
/home/kai/work/phytium-linux-buildroot/output/build/linux-custom/arch/arm64/kernel/smp.c:921: undefined reference to `rproc_handle_ipi'
/home/kai/work/phytium-linux-buildroot/output/build/linux-custom/arch/arm64/kernel/smp.c:921:(.text+0x86c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `rproc_handle_ipi'
make[2]: *** [Makefile:1050: vmlinux] Error 1
make[1]: *** [package/pkg-generic.mk:292: /home/kai/work/phytium-linux-buildroot/output/build/linux-custom/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
kai@thunderbolt:~/work/phytium-linux-buildroot$
原因是defconfig内核配置文件没有选择CONFIG_REMOTEPROC配置,修改如下:
vi output/build/linux-e92ac4aa0b2e3ca7ef4d5c3667d6000a45410a8f/arch/arm64/configs/defconfig596 CONFIG_ARM_SMMU_V3=y
597 CONFIG_REMOTEPROC=y
598 CONFIG_PHYTIUM_REMOTEPROC=m
重新make menuconfig之后,新旧配置文件对比如下。
$ cd output/build/linux-e92ac4aa0b2e3ca7ef4d5c3667d6000a45410a8f
$
$ diff -bup .config.old .config
--- .config.old 2022-12-06 08:49:35.519201902 +0000
+++ .config 2022-12-06 11:22:09.142811620 +0000
@@ -5302,18 +5302,24 @@ CONFIG_QCOM_IOMMU=y## Remoteproc drivers#
-# CONFIG_REMOTEPROC is not set
+CONFIG_REMOTEPROC=y
+# CONFIG_QCOM_ADSP_PIL is not set
+# CONFIG_QCOM_Q6V5_PIL is not set
+# CONFIG_QCOM_Q6V5_WCSS is not set
+# CONFIG_QCOM_SYSMON is not set
+# CONFIG_QCOM_WCNSS_PIL is not set
+CONFIG_PHYTIUM_REMOTEPROC=y## Rpmsg drivers#CONFIG_RPMSG=y
-# CONFIG_RPMSG_CHAR is not set
+CONFIG_RPMSG_CHAR=yCONFIG_RPMSG_QCOM_GLINK_NATIVE=yCONFIG_RPMSG_QCOM_GLINK_RPM=y# CONFIG_RPMSG_QCOM_GLINK_SMEM is not setCONFIG_RPMSG_QCOM_SMD=y
-# CONFIG_RPMSG_VIRTIO is not set
+CONFIG_RPMSG_VIRTIO=y# CONFIG_SOUNDWIRE is not set
对于buildroot配置文件phytium_d2000_defconfig,其使用的内核配置也是defconfig,也存在同样的问题。对于使用内核配置文件e2000_defconfig的情况,已经配置了CONFIG_REMOTEPROC选项,应当没有问题。