Links:
|
1 2 3 |
# https://perasoinc.com/perspectus-series/ # http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_CM4 # https://device.report/manual/7926893 |
Собственно где брать heders-linux debian bookworm:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
0.Пере установкой хедеров убедимся что все пакеты для сборки стоят: apt update apt upgrade -y apt install git make gcc linux-libc-dev pkg-config libncurses-dev flex bison libssl-dev libelf-dev dwarves rsync bc fakeroot build-essential xz-utils libncurses5-dev apt install gcc-arm-linux-gnueabihf #apt install linux-headers-amd64 #для x86 apt install build-essential pkg-config libnl-3-dev libnl-genl-3-dev cmake jq vim # apt install hostapd wpasupplicant 1. Из документации по orangepi хедеры на текущее ядро лежат в каталоге /opt Проверив этот каталог мы увидим deb файл, который просто нужно доставить в систему: dpkg -i /opt/linux-headers-legacy-rockchip-rk356x_1.x.x_arm64.deb 2. После установки у нас появятся в каталоге /usr/src хедеры ядра ls /usr/src |
Так же из документации orangepi есть пример как собирать костюмный модуль ядра:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
## Офф топ для общего развития. #0. Создаем код модуля ядра cat > hello.c << "EOF" #include <linux/init.h> #include <linux/module.h> static int hello_init(void) { printk("Hello Orange Pi -- init\n"); return 0; } static void hello_exit(void) { printk("Hello Orange Pi -- exit\n"); return; } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("GPL"); EOF #1. Создаем Makefaile для сборки модуля cat > Makefile << "EOF" ifneq ($(KERNELRELEASE),) obj-m:=hello.o else KDIR :=/lib/modules/$(shell uname -r)/build PWD :=$(shell pwd) all: make -C $(KDIR) M=$(PWD) modules clean: rm -f *.ko *.o *.mod.o *.mod *.symvers *.cmd *.mod.c *.order endif EOF #2. Собираем make V=1 #3. Проверяем что собралось ls *.ko #4. Загружаем модуль ядра (вообще лучше такое делать через modprobe вместо ismod) insmod hello.ko #5. Проверяем что наш модуль загрузился dmesg | grep "Hello" #6. Выгружаем модуль ядра rmmod hello |
Сборка peraso
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# Для потомков # root@peraso1:/opt/13.3.328/src/drivers/net/wireless/prs# uname -a # Linux peraso1 5.10.160-rockchip-rk356x #1.0.6 SMP Mon May 27 17:03:18 CST 2024 aarch64 GNU/Linux # root@peraso1:/opt/13.3.328/src/drivers/net/wireless/prs# lsusb # Bus 006 Device 002: ID 2932:0720 Peraso Technologies Inc. Peraso PRS460 0. Переходим в каталог с Makefile cd /opt/13.3.328/src/drivers/net/wireless/prs 1. Собираем модуль make -C /lib/modules/5.10.160-rockchip-rk356x/build M=$PWD CONFIG_PRS_FALCON=m modules V=1 #make -C /lib/modules/$(uname -r)/build M=$PWD CONFIG_PRS_FALCON=m modules V=1 2. Пробуем подгрузить собравшийся модуль: insmod prs_falcon.ko 3. Проверяем lsmod | grep prs_falcon dmesg | grep prs_falcon 4. Если все ок и ошибок в третьем пункте нет, продолжаем: 4.1 Копируем модуля ядра в каталок к модулям текущего ядра: cp prs_falcon.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ 4.2 Обновляем зависимости depmod -a 4.3 Пробуем загрузить: modprobe prs_falcon 5. Проверяем сделанное: lsmod | grep prs dmesg | tail -20 |
Запуск точки доступа и клиента:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
Клиент Client: wpa_supplicant -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf -B wpa_supplicant -Dnl80211 -iwlan0 -c wpa.conf wpa_supplicant -Dwext -iwlx20cec40343d9 -c wpa_suplicant.conf Точка доступа AP: hostapd -B /etc/hostapd.conf hostapd -dddd -g /var/run/hostapd/global hostapd.conf Пример конфига hostapd: cat > hostapd.conf << EOF driver=nl80211 interface=wlx20cec40343d9 ssid=clear-link channel=2 hw_mode=ad country_code=US ctrl_interface=/var/run/hostapd ctrl_interface_group=0 EOF Пример конфига wpa_supplicant: cat > wpa_suplicant.conf << "EOF" ctrl_interface=/var/run/wpa_supplicant network={ ssid="clear-link" frequency=60480 scan_ssid=1 key_mgmt=NONE } EOF Тест: wpa_supplicant -Dnl80211 -iwlx20cec40343da -c wpa_suplicant.conf hostapd -dddd -g /var/run/hostapd/global hostapd.conf |
Install peraso driver for debian 11 X86
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
#debian 11 #root@peraso4:/# uname -a #Linux peraso4 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64 GNU/Linux apt update apt install git make gcc linux-libc-dev linux-headers-amd64 pkg-config libncurses-dev flex bison libssl-dev libelf-dev dwarves rsync bc fakeroot build-essential apt install pkg-config bc fakeroot xz-utils libncurses5-dev build-essential apt install linux-headers-amd64 apt install tmux iperf3 tcpdump mc apt install hostapd apt install libudev-dev cd /opt/ tar -xvf src_peraso_13.3.328.tgz mv src peraso_13.3.328 cd /opt/peraso_13.3.328/drivers/net/wireless/prs/ make -C /lib/modules//$(uname -r)/build M=$PWD CONFIG_PRS_FALCON=m modules V=1 #mkdir -p /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ cp prs_falcon.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ depmod -a #script INTERFACE="" HOSTNAME_INTERGER="" INTERFACE=$(ip a | grep wlx | awk '{print $2}' | tr -d ':') HOSTNAME_INTERGER=$(hostname | tr -d peraso) set_face=${INTERFACE} set_ip="10.0.0.${HOSTNAME_INTERGER}/24" cat > supl.txt << EOF #!/bin/bash ip a flush dev ${set_face} ip a a ${set_ip} dev ${set_face} wpa_supplicant -Dnl80211 -i${set_face} -c wpa_suplicant.conf #hostapd -dddd -g /var/run/hostapd/global hostapd.conf EOF cat > hostapd.conf << EOF driver=nl80211 interface=${set_face} ssid=clear-link channel=3 hw_mode=ad country_code=US beacon_int=100 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 EOF cat > wpa_suplicant.conf << "EOF" ctrl_interface=/var/run/wpa_supplicant network={ ssid="clear-link" frequency=60480 scan_ssid=1 key_mgmt=NONE } EOF |
uapi/linux
|
1 2 3 4 5 6 7 8 |
# Создаем директорию uapi/linux если нужно mkdir -p /usr/include/uapi/linux # Создаем симлинк на существующий stddef.h ln -sf /usr/include/linux/stddef.h /usr/include/uapi/linux/stddef.h # Проверим что создалось ls -la /usr/include/uapi/linux/stddef.h |
peraso module config
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
cat > /etc/modprobe.d/prs_falcon.conf << "EOF" options prs_falcon PRS_AMSDU_TYPE=1 PRS_BRIDGE_MODE_ENABLE=0 PRS_FW_LOG=1 PRS_TX_BIND_CPU=2 PRS_RX_BIND_CPU=3 EOF Перезапуск модуля: sudo modprobe -r prs_falcon sudo depmod -a sudo modprobe prs_falcon cat /sys/module/prs_falcon/parameters/PRS_FW_LOG Log: prsfwlog prs_log.elf tail -f /var/log/kern.log | ./prsfwlog -f ./prs_log.elf | tee test.log tail -f /var/log/kern.log | ./prsfwlog -f ./prs_log.elf | tee test.log tail -f /var/log/kern.log | tee test_raw.log |
Пример модулей ядра для минимальной работы:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
Device Drivers → [*] Network device support → [*] USB Network Adapters → <*> Realtek RTL8152/RTL8153 based USB Ethernet adapters <*> ASIX AX88179/178A based USB 2.0/3.0 Ethernet Devices Networking support → Networking options → [*] 802.1d Ethernet Bridging Device Drivers → USB support → <*> USB Modem (CDC ACM) support Device Drivers → USB support → USB Gadget Support → [*] USB Gadget Drivers → <*> Gadget Serial Driver (port for userspace) [*] Generic serial bulk in/out [*] Abstract Control Model (CDC ACM) Device Drivers → [*] USB support → <*> Support for Host-side USB [*] USB device filesystem <*> xHCI HCD (USB 3.0) support <*> EHCI HCD (USB 2.0) support <*> OHCI HCD (USB 1.1) support Device Drivers → [*] HID support → <*> HID bus support [*] Battery level reporting for HID devices USB HID support → <*> USB HID transport layer [*] PID device support [*] /dev/hiddev raw HID device support Device Drivers → [*] USB support → USB Input Devices → <*> USB Keyboard support <*> USB Mouse support Device Drivers → [*] SCSI device support → <*> SCSI device support [*] legacy /proc/scsi/ support <*> SCSI disk support Device Drivers → [*] USB support → <*> USB Mass Storage support File systems → DOS/FAT/NT Filesystems → <*> MSDOS fs support <*> VFAT (Windows-95) fs support (437) Default codepage for FAT (iso8859-1) Default iocharset for FAT <*> Native language support → <*> Codepage 437 (United States, Canada) <*> NLS ISO 8859-1 (Latin 1; Western European Languages) <*> NLS UTF-8 <*> The Extended 4 (ext4) filesystem |
Пример falcon bridge:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
cat > /etc/modprobe.d/prs_falcon.conf << "EOF" #options prs_falcon PRS_BRIDGE_MODE_ENABLE=1 PRS_FW_LOG=1 #options prs_falcon PRS_AMSDU_TYPE=1 PRS_BRIDGE_MODE_ENABLE=1 #options prs_falcon options prs_falcon PRS_BRIDGE_MODE_ENABLE=1 EOF #AP cat > supl.txt << "EOF" #!/bin/bash ip a flush dev wlx20cec40343da #ip a a 10.0.0.78/24 dev wlx20cec40343da ip a flush dev enxc84d442309ca ip l set up dev enxc84d442309ca brctl delbr br0 brctl addbr br0 brctl addif br0 prs0 brctl addif br0 enxc84d442309ac ip l set up dev br0 ip a a 10.0.0.72/24 dev br0 iwconfig wlx20cec40343da power off wpa_supplicant -Dnl80211 -iwlx20cec40343da -c wpa_suplicant.conf #hostapd -dddd -g /var/run/hostapd/global hostapd.conf "EOF" #HAP cat > supl.txt << "EOF" #!/bin/bash ip a flush dev wlx20cec40343d9 #ip a a 10.0.0.1/24 dev wlx20cec40343d9 #wpa_supplicant -Dnl80211 -iwlx20cec40343d9 -c wpa_suplicant.conf brctl delbr br0 brctl addbr br0 brctl addif br0 prs0 ip l set up dev br0 ip a a 10.0.0.1/24 dev br0 iwconfig wlx20cec40343d9 power off hostapd -dddd -g /var/run/hostapd/global hostapd.conf EOF bash supl.txt |