代码拉取完成,页面将自动刷新
同步操作将从 Phytium嵌入式软件/Phytium-Linux-Kernel 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
配置DHCP
root@18:/home/u18/phytium-linux-kernel# cat /etc/netplan/eth0.yaml
network:
ethernets:
eth0: # 配置的网卡名称
dhcp4: yes # 关闭dhcp4
version: 2
sudo netplan apply
#配置阿里源
root@18:/home/u18/phytium-linux-kernel# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
apt-get update
#安装git ssh
apt-get install git
apt-get install openssh-server
apt-get install lrzsz
#启动ssh,默认启动ssh
/etc/init.d/ssh start
sudo systemctl enable ssh
#vim
apt install vim
apt install vim-gtk3
apt install vim-tiny
apt install neovim
apt install vim-athena
#samba
sudo apt-get install samba samba-common
sudo smbpasswd -a u18
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo vim /etc/samba/smb.conf
在配置文件smb.conf的最后添加下面的内容:
[share]
# 注释而已
comment = share folder
browseable = yes
# 共享的目录
path = /home/u18
create mask = 0700
directory mask = 0700
valid users = u18
force user = u18
force group = u18
public = yes
available = yes
writable = yes
# 不允许guest
guest ok = no
sudo ufw disable
sudo ufw status
sudo service smbd restart
#dtc工具
apt install device-tree-compiler
#修改内核
1.打0001-ep.patch补丁
a.patch -p1 < 0001-ep.patch
2.修改dts编译Makefile,如下
diff --git a/arch/arm64/boot/dts/phytium/Makefile b/arch/arm64/boot/dts/phytium/Makefile
index 9f2f50346f..a6996121fc 100644
--- a/arch/arm64/boot/dts/phytium/Makefile
+++ b/arch/arm64/boot/dts/phytium/Makefile
@@ -15,6 +15,7 @@ dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-power-board.dtb
dtb-$(CONFIG_ARCH_PHYTIUM) += e2000q-hanwei-board.dtbvi
dtb-$(CONFIG_ARCH_PHYTIUM) += phytiumpi_firefly.dtb
dtb-$(CONFIG_ARCH_PHYTIUM) += e2000d-chillipi-edu-board.dtb
+dtb-$(CONFIG_ARCH_PHYTIUM) += pd2008-devboard-dsk.dtb
dtbo-$(CONFIG_ARCH_PHYTIUM) += px210.dtbo
dtbo-$(CONFIG_ARCH_PHYTIUM) += usb2_host_for_pe220x.dtbo
3.修改dts文件,根据pcie-phytium-ep.c代码,找到compatible匹配字符串,修改compatible字段以及local mem字段
ep0: ep@0x29030000 {
compatible = "phytium,pcie-ep-1.0";
peucx= <0x0>;
reg = <0x0 0x29101000 0x0 0x1000>,//peu hpb宾D嬾X余¨
<0x0 0x29030000 0x0 0x10000>,//peu1 c0 彎§佈¶余¨
<0x11 0x00000000 0x1 0x00000000>,//ep local mem
<0x0 0x90000000 0x0 0x100000>;//住¯被ep访轗®潚~Drc端潚~D作°佝~@罌~C佛´
reg-names = "hpb", "reg", "mem" ,"rc";
max-outbound-regions = <3>;
max-functions = /bits/ 8 <1>;
};
4.根据需求调整BAR大小
root@18:/home/u18/phytium-linux-kernel-jxw# git diff drivers/pci/endpoint/functions/pci-epf-test.c
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index ef52f5097e..9c6739fdc9 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -78,7 +78,8 @@ static struct pci_epf_header test_header = {
.interrupt_pin = PCI_INTERRUPT_INTA,
};
-static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
+//static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
+static size_t bar_size[] = { 512, 512, 1024, 16384, 1024*1024*1024, 1024 };//调整BAR大小 BAR4配置为1G
static void pci_epf_test_dma_callback(void *param)
{
@@ -789,6 +790,10 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf)
for (bar = 0; bar < PCI_STD_NUM_BARS; bar += add) {
epf_bar = &epf->bar[bar];
+ //epf_bar->flags |= (PCI_BASE_ADDRESS_MEM_TYPE_64);//调整BAR为32或64位
+ //if (bar == 4)
+ // epf_bar->flags |= (PCI_BASE_ADDRESS_MEM_PREFETCH);//调整BAR是否预取
+
add = (epf_bar->flags & PCI_BASE_ADDRESS_MEM_TYPE_64) ? 2 : 1;
if (bar == test_reg_bar)
5.修改飞腾epc驱动bug,如下
diff --git a/drivers/pci/controller/pcie-phytium-register.h b/drivers/pci/controller/pcie-phytium-register.h
index 9ef1ea4a8b..62788c8053 100644
--- a/drivers/pci/controller/pcie-phytium-register.h
+++ b/drivers/pci/controller/pcie-phytium-register.h
@@ -33,7 +33,7 @@
#define MSIX_DISABLE (0 << 15)
#define PHYTIUM_PCI_BAR_0 0xe4
-#define PHYTIUM_PCI_BAR(bar_num) (0xe4 + bar_num * 4)
+#define PHYTIUM_PCI_BAR(bar_num) (0xe4 + (bar_num) * 4)
#define BAR_IO_TYPE (1 << 0)
#define BAR_MEM_TYPE (0 << 0)
#define BAR_MEM_64BIT (1 << 2)
编译内核
1.编译内核
mkdir ../510-out-jxw
make O=../510-out-jxw/ clean
make phytium_defconfig O=../510-out-jxw/
#修改../510-out-jxw/.config, 设置CONFIG_PCIE_PHYTIUM_EP=m
make -j8 O=../510-out-jxw/ ARCH=arm64
2.编译dtb文件
make -j8 O=../510-out-jxw/ ARCH=arm64 dtbs
3.安装modules
make O=../510-out-jxw/ ARCH=arm64 INSTALL_MOD_PATH=/ modules_install
4.挂载NVMe第一个分区到/mnt,拷贝编译好的Image和dtb文件到mnt目录下,并修改文件名。
mount /dev/nvme0n1p1 /mnt/
cp ../510-out-jxw/arch/arm64/boot/Image /mnt/Image-d2000-jxw
cp ../510-out-jxw/arch/arm64/boot/dts/phytium/pd2008-devboard-dsk.dtb /mnt/d2000_ok_jxw.dtb
sync
umount /mnt
5.修改/etc/modules文件,自动加载pci_epf_test.ko和pci_endpoint_test.ko,如下
root@18:/home/u18/phytium-linux-kernel-jxw# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
pci_epf_test
pci_endpoint_test
6.搭建FT EP<------>RC
7.重启板子,进入uboot。修改bootcmd,如下
原始bootcmd定义为
bootcmd=setenv bootargs console=ttyAMA1,115200 earlycon=pl011,0x28001000 root=/dev/nvme0n1p2 rw rootwait;load nvme 0:1 0x90000000 d2000_ok.dtb;load nvme 0:1 0x90100000 Image-d2000;booti 0x90100000 -:- 0x90000000
修改命令如下:
#setenv bootcmd 'setenv bootargs 'console=ttyAMA1,115200 earlycon=pl011,0x28001000 cma=1536M root=/dev/nvme0n1p2 rw rootwait';load nvme 0:1 0x90000000 d2000_ok_jxw.dtb;load nvme 0:1 0x90100000 Image-d2000-jxw;booti 0x90100000 -:- 0x90000000'
#saveenv
#boot
- 其中cma=1536M,预留cma为1.5G,用于为BAR分配以及DMA缓存预留连续的物理地址。
- load nvme 0:1 0x90000000 d2000_ok_jxw.dtb;load nvme 0:1 0x90100000 Image-d2000-jxw 指定dtb和Image从NVMe0中第一个分区中的Image-d2000-jxw和d2000_ok_jxw.dtb拷贝到内存对应位置。
.
8.设备起来后,执行如下:
9.
mount -t configfs none /sys/kernel/config
mkdir /sys/kernel/config/pci_ep/functions/pci_epf_test/func1
echo 0x104c > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/vendorid
echo 0xb500 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/deviceid
echo 32 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/msi_interrupts
ln -s /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 /sys/kernel/config/pci_ep/controllers/29101000.ep/
echo 1 > /sys/kernel/config/pci_ep/controllers/29101000.ep/start
mount -t configfs none /sys/kernel/config
mkdir /sys/kernel/config/pci_ep/functions/pci_epf_test/func1
echo 0x104c > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/vendorid
echo 0xb501 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/deviceid
echo 32 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/msi_interrupts
ln -s /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 /sys/kernel/config/pci_ep/controllers/29101000.ep/
echo 1 > /sys/kernel/config/pci_ep/controllers/29101000.ep/start
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。