amlogic-s9xxx-armbian
amlogic-s9xxx-armbian copied to clipboard
sw799编译GobiNet驱动 (用于挂载yuga 4G模块 虚拟出网卡) 失败
Device Information | 设备信息
- SOC: (RK3399)
- Model sw799
Armbian Version | 系统版本
- Kernel Version: 6.1.93-ophub ,随后通过 armbian-update -u dev 升级到 6.1.95-ophub,两个环境下都试过
- Release: Armbian_24.8.0_rockchip_sw799_noble_6.1.93_server_2024.06.15.img.gz
Describe the bug | 问题描述
- 想在sw799上编译GobiNet驱动,用于挂载yuga 4G模块 虚拟出网卡
- 根据yuga的教程已经把ttyUSBx都挂好了,AT指令也测试过没问题,暂时挂了张销号卡测试。
- 看yuga教程说想要虚拟一个网卡出来,要编译高通的gobinet驱动:
- 驱动编译参考 yuge-gobinet
- yuga_gobinet_1808311742
tinnu@armbian:~/yuga/yuga$ make
make -C /lib/modules/6.1.95-ophub/build/linux-headers-6.1.95-ophub/ M=/home/tinnu/yuga/yuga modules EXTRA_CFLAGS="-fno-stack-protector"
make[1]: Entering directory '/usr/src/linux-headers-6.1.95-ophub'
awk: cannot open "include/generated/asm-offsets.h" (No such file or directory)
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-none-elf-gcc (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.1 20231009
You are using: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
CC [M] /home/tinnu/yuga/yuga/GobiUSBNet.o
gcc: error: missing argument to ‘-mstack-protector-guard-offset=’
make[2]: *** [scripts/Makefile.build:250: /home/tinnu/yuga/yuga/GobiUSBNet.o] Error 1
make[1]: *** [Makefile:2010: /home/tinnu/yuga/yuga] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.95-ophub'
make: *** [Makefile:16: all] Error 2
** 参考以前的issue尝试
- https://github.com/ophub/amlogic-s9xxx-armbian/issues/1043
- 我从 https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads 下载了符合的编译链:
- arm-gnu-toolchain-13.2.rel1-aarch64-aarch64-none-elf.tar.xz
- 修改makefile指定了编译链:
obj-m := GobiNet.o
GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o MPQMUX.o
# KDIR := /lib/modules/$(shell uname -r)/build/
KDIR := /lib/modules/6.1.95-ophub/build/linux-headers-6.1.95-ophub/
PWD := $(shell pwd)
OUTPUTDIR=/lib/modules/`uname -r`/kernel/drivers/net/usb/
PI_KDIR := /lib/modules/6.8.0-1006-raspi/build
FILE = ${KDIR}/drivers/net/usb/usbnet.h
RK_CCPREFIX=/home/tinnu/toolchain/gcc-arm-11.2-2022.02-aarch64-aarch64-none-elf/bin/aarch64-none-elf-
all:
ifeq ($(FILE), $(wildcard $(FILE)))
cp ${KDIR}/drivers/net/usb/usbnet.h ./
endif
$(MAKE) -C $(KDIR) M=$(PWD) modules
pi:
$(MAKE) ARCH=arm64 CROSS_COMPILE=${RK_CCPREFIX} -C $(PI_KDIR) M=$(PWD) modules
rk:
$(MAKE) ARCH=arm64 CROSS_COMPILE=${RK_CCPREFIX} -C $(KDIR) M=$(PWD) modules
install: all
mkdir -p $(OUTPUTDIR)
cp -f GobiNet.ko $(OUTPUTDIR)
depmod
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order
tinnu@armbian:~/yuga/yuga$ make rk
make ARCH=arm64 CROSS_COMPILE=/home/tinnu/toolchain/arm-gnu-toolchain-13.2.Rel1-aarch64-aarch64-none-elf/bin/aarch64-none-elf- -C /lib/modules/6.1.95-ophub/build/linux-headers-6.1.95-ophub/ M=/home/tinnu/yuga/yuga modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.95-ophub'
awk: cannot open "include/generated/asm-offsets.h" (No such file or directory)
CC [M] /home/tinnu/yuga/yuga/GobiUSBNet.o
aarch64-none-elf-gcc: error: missing argument to '-mstack-protector-guard-offset='
make[2]: *** [scripts/Makefile.build:250: /home/tinnu/yuga/yuga/GobiUSBNet.o] Error 1
make[1]: *** [Makefile:2010: /home/tinnu/yuga/yuga] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.95-ophub'
make: *** [Makefile:22: rk] Error 2
** 探索
-
我感觉应该是编译链相关的问题,内核目前用的是:arm-gnu-toolchain-13.2.Rel1-aarch64-aarch64-none-elf;我也试过 gcc-arm-11.2-2022.02-aarch64-aarch64-none-elf.tar.xz ;都是一样的问题。
-
尝试在编译命令上加堆栈保护相关设置,都没有效果:
- EXTRA_CFLAGS="-fno-stack-protector"
- EXTRA_CFLAGS="-mstack-protector-guard-offset=offset"
-
在PC上直接编译,用的GCC 9.4.0 是可以编译通过的
-
后来试过拉寒芒那个镜像, 23.1 的,不过他的镜像下面没有 /lib/modules/$(shell uname -r)/build ,apt随便拉了个 linux-header 可以编译通过,GCC 版本好像也是 8 9 这样子。
** 猜测
- 是不是要像这个issue一样重新用比较旧的GCC编译内核?
- https://kkgithub.com/ophub/amlogic-s9xxx-armbian/issues/1043
- 另外,我使用armbian-kernal命令时,报错:
tinnu@armbian:~/yuga/yuga$ sudo armbian-kernel -u
[ STEPS ] Start updating the compile kernel scripts...
[ INFO ] Start installing update dependencies...
[ INFO ] Start syncing latest scripts...
[ INFO ] Start installing compilation dependencies...
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
注意,选中 'libncurses-dev' 而非 'libncurses5-dev'
注意,选中 'libncurses-dev' 而非 'libncursesw5-dev'
没有可用的软件包 python3-distutils,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
E: 无法定位软件包 libncurses5
E: 软件包 python3-distutils 没有可安装候选