您尚未登录。

#1 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 22:48:31

是的  明天再研究研究  感谢晕哥 耽误了你不少时间 谢谢~

#2 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 22:35:37

确认过了。
1、上午用的官方脚本编译的LINUX内核,那个脚本交叉编译器用的是/home/orangepi/Android_5.1/Android/lichee/brandy/gcc-linaro/bin
2、我在内核目录中用ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make 不能通过
In file included from kernel/power/scenelock.c:14:0:
kernel/power/scenelock_data.h:22:34: 错误: ‘sizeof’不能用于不完全的类型‘struct scene_extended_standby_t[]’
kernel/power/scenelock.c: 在函数‘scenelocks_init’中:
kernel/power/scenelock.c:352:24: 错误: ‘sizeof’不能用于不完全的类型‘struct scene_extended_standby_t[]’
make[2]: *** [kernel/power/scenelock.o] 错误 1
make[1]: *** [kernel/power] 错误 2
make: *** [kernel] 错误 2
root@ubuntu:/home/orangepi/Android_5.1/Android/lichee/linux-3.10#

#3 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 19:34:45

心态崩了,换了编译器出现了不同的错误- -|||
topeet@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code$ sudo ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- M=${PWD}
make -C /home/orangepi/Android_5.1/Android/lichee/linux-3.10 modules
make:进入目录'/home/orangepi/Android_5.1/Android/lichee/linux-3.10'
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CC [M]  drivers/crypto/sunxi/sunxi_ss.o
drivers/crypto/sunxi/sunxi_ss.c: 在函数‘sunxi_ss_res_request’中:
drivers/crypto/sunxi/sunxi_ss.c:715:2: 错误: 隐式声明函数‘irq_of_parse_and_map’ [-Werror=implicit-function-declaration]
drivers/crypto/sunxi/sunxi_ss.c: 在函数‘sunxi_ss_hw_init’中:
drivers/crypto/sunxi/sunxi_ss.c:767:2: 错误: 隐式声明函数‘of_property_read_u32_array’ [-Werror=implicit-function-declaration]
drivers/crypto/sunxi/sunxi_ss.c: 在文件作用域:
drivers/crypto/sunxi/sunxi_ss.c:1041:21: 错误: ‘sunxi_ss_of_match’未声明(不在函数内)
drivers/crypto/sunxi/sunxi_ss.c:912:12: 警告: ‘sunxi_ss_dma_mask’定义后未使用 [-Wunused-variable]
cc1: some warnings being treated as errors
make[3]: *** [drivers/crypto/sunxi/sunxi_ss.o] 错误 1
make[2]: *** [drivers/crypto/sunxi] 错误 2
make[1]: *** [drivers/crypto] 错误 2
make: *** [drivers] 错误 2
make:离开目录“/home/orangepi/Android_5.1/Android/lichee/linux-3.10”

#4 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 18:11:29

还是不行。我看了一下官方给的源码文件里面,存在一个编译器。我编译的时候直接调用官方给的脚本 .build.sh config进行编译。
是不是我得装上它给的的编译器才能行?
root@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code# ls
Makefile  OrangePi_misc.c
root@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code# ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- M=${PWD} make -C /home/orangepi/Android_5.1/Android/lichee/linux-3.10 modules
make:进入目录'/home/orangepi/Android_5.1/Android/lichee/linux-3.10'
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CC [M]  security/fivm/fivm_crypto.o
/tmp/ccWnMY01.s: Assembler messages:
/tmp/ccWnMY01.s:234: Error: garbage following instruction -- `dmb ish'
/tmp/ccWnMY01.s:248: Error: garbage following instruction -- `dmb ish'
make[2]: *** [security/fivm/fivm_crypto.o] 错误 1
make[1]: *** [security/fivm] 错误 2
make: *** [security] 错误 2
make:离开目录“/home/orangepi/Android_5.1/Android/lichee/linux-3.10”

#5 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 17:49:26

root@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code# ARCH=arm CROSS_COMPILE=/usr/local/arm/4.4.1/bin/arm-none-linux-gnueabi- make modules
make: *** 没有规则可以创建目标“modules”。 停止。
root@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code# ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make modules
make: *** 没有规则可以创建目标“modules”。 停止。
root@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code# su topeet
topeet@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code$ ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make modules

#6 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 17:07:20

编译LINUX内核源码没问题,下面是给的提示。
sun50iw2p1 compile Kernel successful

INFO:build Kernel OK.
INFO:build rootfs ...
INFO:skip make rootfs for android
INFO:build rootfs OK.

-------------------------------------------
build sun50iw2p1 android lichee OK
--------------------------------------------

#7 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 16:48:53

emmmmmm  还是提示include/uapi/linux/types.h:4:23: fatal error: asm/types.h:没有那个文件或目录
#include <asm/types.h>

#8 Re: 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 15:45:40

是内核根目录的Makefile文件吗
ARCH        ?= arm
CROSS_COMPILE   ?=/usr/local/arm/4.4.1/bin/arm-none-linux-gnueabi-

#9 全志 SOC » [求助]linux设备驱动编译出错 » 2020-05-04 15:24:38

yugezaizheli
回复: 16

===================================================================
                                                                   驱动代码
===================================================================

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("YU");

static int hello_init(void)
{
	printk(KERN_EMERG "HELLO WORLD enter!\n");
	return 0;
}

static void hello_exit(void)
{
	printk(KERN_EMERG "HELLO WORLD exit!\n");
	
}

module_init(hello_init);
module_exit(hello_exit);

=====================================================================
                                                                 Makefile文件
=====================================================================

obj-m += module_test.o 

KDIR := /home/orangepi/Android_5.1/Android/lichee/linux-3.10

#当前目录变量
PWD ?= $(shell pwd)

all:
	make -C $(KDIR) M=$(PWD) modules
		
clean:
	rm -rf *.o

=============================== ====================================
                                                                   编译提示出错
====================================================================

topeet@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code$ ls
Makefile  OrangePi_misc.c
topeet@ubuntu:/home/orangepi/Android_5.1/orangepi_kernel_code$ make
make -C /home/orangepi/Android_5.1/Android/lichee/linux-3.10 M=/home/orangepi/Android_5.1/orangepi_kernel_code modules
make[1]: 正在进入目录 `/home/orangepi/Android_5.1/Android/lichee/linux-3.10'
  CC [M]  /home/orangepi/Android_5.1/orangepi_kernel_code/OrangePi_misc.o
In file included from include/linux/types.h:5,
                 from include/linux/init.h:5,
                 from /home/orangepi/Android_5.1/orangepi_kernel_code/OrangePi_misc.c:1:
include/uapi/linux/types.h:4: fatal error: asm/types.h: No such file or directory
compilation terminated.
make[2]: *** [/home/orangepi/Android_5.1/orangepi_kernel_code/OrangePi_misc.o] 错误 1
make[1]: *** [_module_/home/orangepi/Android_5.1/orangepi_kernel_code] 错误 2
make[1]:正在离开目录 `/home/orangepi/Android_5.1/Android/lichee/linux-3.10'
make: *** [all] 错误 2

#10 全志 SOC » 【求助】香橙派ZeroPlus2,全志H5,内核驱动编译出错 » 2020-05-03 19:48:51

yugezaizheli
回复: 1

编译官方给的Linux 源码没有问题,写完内核驱动(驱动没问题)并修改了Makefile和Kconfig,然后用make menuconfig加载驱动,最后调用官方给的编译脚本命令 ./build.sh,编译过程中出现错误。帮忙看看怎么解决,谢谢。
root@ubuntu:/home/orangepi/Android_5.1/Android/lichee# ./build.sh
INFO: ----------------------------------------
INFO: build lichee ...
INFO: chip: sun50iw2p1
INFO: platform: android
INFO: business:
INFO: kernel: linux-3.10
INFO: arch: arm64
INFO: board:
INFO: output: out/sun50iw2p1/android/
INFO: ----------------------------------------
INFO: build buildroot ...
external toolchain has been installed
external toolchain_32 has been installed
INFO: build buildroot OK.
INFO: build kernel ...
INFO: prepare toolchain ...
use last time build config
Building kernel
/home/orangepi/Android_5.1/Android/lichee/linux-3.10/output/lib/modules/3.10.65
Copy rootfs.cpio.gz for arm64
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/compile.h
  CC      arch/arm64/kernel/debug-monitors.o
arch/arm64/kernel/debug-monitors.c:323:5: error: redefinition of 'aarch32_break_handler'
int aarch32_break_handler(struct pt_regs *regs)
     ^
In file included from arch/arm64/kernel/debug-monitors.c:29:0:
/home/orangepi/Android_5.1/Android/lichee/linux-3.10/arch/arm64/include/asm/debug-monitors.h:149:12: note: previous definition of 'aarch32_break_handler' was here
static int aarch32_break_handler(struct pt_regs *regs)
            ^
/home/orangepi/Android_5.1/Android/lichee/linux-3.10/arch/arm64/include/asm/debug-monitors.h:149:12: warning: 'aarch32_break_handler' defined but not used [-Wunused-function]
make[1]: *** [arch/arm64/kernel/debug-monitors.o] 错误 1
make: *** [arch/arm64/kernel] 错误 2
make: *** 正在等待未完成的任务....
  GZIP    kernel/config_data.gz
  CHK     kernel/config_data.h
ERROR: build kernel Failed

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn