龙芯3A5000+7A1000安装loongnix系统并调试DPDK

1. 系统下载

下载路径,loongnix社区:Nginx Directory

2. 制作启动U盘

建议使用大于4G的U盘,从 Loongnix镜像站点下载系统镜像,然后在Linux下使用DD命令制作安装U盘。 Loongnix系统可启动终端,使用dd命令进行镜像制作。镜像制作命令如下:

dd  if=镜像文件地址  of=/dev下识别的U盘设备 bs=8M  &&  sync
举例
镜像文件为:/home/loongson/Loongnix-20.3.livecd.mate.loongarch64.iso
系统下识别的U盘设备: /dev/sdb  (可通过fdisk -l或者lsblk命令查看)
镜像制作命令:dd if=/home/loongson/Loongnix-20.3.livecd.mate.loongarch64.iso of=/dev/sdb  bs=8M  &&  sync
3. 引导后安装步骤,同其他Linux系统安装步骤一致,过程略。
4. 安装源配置
deb http://pkg.loongnix.cn/loongnix DaoXiangHu-stable main contrib non-free
deb-src http://pkg.loongnix.cn/loongnix DaoXiangHu-stable main contrib non-free
5. 查看系统信息

系统安装完成并重启后直接进入系统命令行登录界面,输入安装过程中设置的用户和密码,进入Loongnix操作系统,查看如下系统信息。

root@loongson-pc:~# cat /etc/os-release 
PRETTY_NAME="Loongnix GNU/Linux 20 (DaoXiangHu)"
NAME="Loongnix GNU/Linux"
VERSION_ID="20"
VERSION="20 (DaoXiangHu)"
VERSION_CODENAME=DaoXiangHu
ID=Loongnix
HOME_URL="https://www.loongnix.cn/"
SUPPORT_URL="https://www.loongnix.cn/"
BUG_REPORT_URL="http://www.loongnix.cn/"

6. 网卡配置 /etc/network/interfaces
6.1 动态IP配置

DHCP自动获取IP配置示例:

auto enp3s0
iface enp3s0 inet dhcp
hostname loongson
6.2  静态IP配置

静态IP地址示例:

auto enp3s0
iface enp3s0 inet static
address 192.168.0.3/24
broadcast 192.168.0.255
network 192.168.0.0
gateway 192.168.0.1
7. 开启sshd服务 

Loongnixi桌面系统默认关闭sshd服务,开启方法:

root@loongson-pc:~$ sudo apt install openssh-server
root@loongson-pc:~$ systemctl start ssh
root@loongson-pc:~$ systemctl status ssh
root@loongson-pc:~# systemctl enable ssh  //默认开启
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
8. 安装DPDK
8.1 igb_uio.ko模块的编译方法

igb_uio.ko模块是独立于dpdk提供的。 编译igb_uio.ko模块对应的代码获取位置是:dpdk-kmods - Kernel modules or add-ons 编译方法:

root@loongson-pc:~#  git clone git://dpdk.org/dpdk-kmods
正克隆到 'dpdk-kmods'...
remote: Enumerating objects: 537, done.
remote: Counting objects: 100% (537/537), done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 537 (delta 168), reused 372 (delta 85)
接收对象中: 100% (537/537), 120.94 KiB | 13.00 KiB/s, 完成.
处理 delta 中: 100% (168/168), 完成.
root@loongson-pc:~# cd dpdk-kmods/linux/igb_uio/
root@loongson-pc:~/dpdk-kmods/linux/igb_uio# ls
compat.h  igb_uio.c  Kbuild  Makefile
root@loongson-pc:~/dpdk-kmods/linux/igb_uio# make
make -C /lib/modules/4.19.0-19-loongson-3/build/ M=/root/dpdk-kmods/linux/igb_uio
make[1]: 进入目录“/usr/src/linux-headers-4.19.0-19-loongson-3”
  CC [M]  /root/dpdk-kmods/linux/igb_uio/igb_uio.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/dpdk-kmods/linux/igb_uio/igb_uio.mod.o
  LD [M]  /root/dpdk-kmods/linux/igb_uio/igb_uio.ko
make[1]: 离开目录“/usr/src/linux-headers-4.19.0-19-loongson-3”
 8.2 加载uio  igb_uio,绑定网卡,CPU隔离操作与DPDK操作方法一文一致
 8.3 设置大页内存
echo 60 > /sys/kernel/mm/hugepages/hugepages-32768kB/nr_hugepages
8.4 l2fwd编译并运行(使用编译好的二进制)
  ./l2fwd -l 2,3 --proc-type auto --socket-mem 1024 --file-prefix lwd0  -- -p 0x3 -T 5 --no-mac-updating &
 9. 配置测试仪打流测试
root@loongson-pc:~#   ./dpdk-l2fwd -l 2,3 --proc-type auto --socket-mem 1024 --file-prefix lwd0  -- -p 0x3 -T 5 --no-mac-updating 
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Auto-detected process type: PRIMARY
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/lwd0/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: bus:0 pci map fail!EAL: bus:0 pci map fail!EAL: Probe PCI driver: net_ngbe (8088:103) device: 0000:01:00.0 (socket 0)
EAL: Probe PCI driver: net_ngbe (8088:103) device: 0000:01:00.1 (socket 0)
EAL: bus:1 pci map fail!EAL: bus:1 pci map fail!EAL: No legacy callbacks, legacy socket not created
MAC updating disabled
Lcore 2: RX port 0 TX port 1
Lcore 3: RX port 1 TX port 0
Initializing port 0... done: 
Port 0, MAC address: 02:02:03:04:05:06

Initializing port 1... done: 
Port 1, MAC address: 02:02:03:04:05:07


Checking link status..........................................................................................done
Port 0 Link down
Port 1 Link down
L2FWD: entering main loop on lcore 3
L2FWD:  -- lcoreid=3 portid=1
L2FWD: entering main loop on lcore 2
L2FWD:  -- lcoreid=2 portid=0


Port statistics ====================================
Statistics for port 0 ------------------------------
Packets sent:                        0
Packets received:                    0
Packets dropped:                     0
Statistics for port 1 ------------------------------
Packets sent:                        0
Packets received:                    0
Packets dropped:                     0
Aggregate statistics ===============================
Total packets sent:                  0
Total packets received:              0
Total packets dropped:               0
====================================================


10. 龙芯系统默认没有lrzsz,且不能在线安装。离线安装方式如下:
10.1 下载lrzsz压缩包
wget https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz
10.2 解压
 tar zxvf lrzsz-0.12.20.tar.gz
10.3 进入解压目录
 cd lrzsz-0.12.20/
10.4 配置安装路径
./configure --prefix=/usr/local/lrzsz
10.5 编译和安装(切换为root 权限执行下面的命令)
make && make install
10.6 设置软连接
 ln -s /usr/local/lrzsz/bin/lrz /usr/bin/rz
 ln -s /usr/local/lrzsz/bin/lsz /usr/bin/sz

你可能感兴趣的:(linux,运维,服务器)