Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何解决Raspberry Pi内核文件bounds.c中的此错误?_C_Linux Kernel_Raspberry Pi_Cross Compiling - Fatal编程技术网

如何解决Raspberry Pi内核文件bounds.c中的此错误?

如何解决Raspberry Pi内核文件bounds.c中的此错误?,c,linux-kernel,raspberry-pi,cross-compiling,C,Linux Kernel,Raspberry Pi,Cross Compiling,我是内核编译新手。我想为Raspberry Pi 1型号B创建闪烁LED驱动程序,但作为实现此目标的第一步,我正在尝试交叉编译未经修改的Raspberry Pi内核和以下内容 在第7步之前,一切都很顺利。在步骤7中,当我输入cross compile命令时,它显示如下: $ make ARCH=arm CROSS_COMPILE=${CCPREFIX} CHK include/config/kernel.release CHK include/generated/ua

我是内核编译新手。我想为Raspberry Pi 1型号B创建闪烁LED驱动程序,但作为实现此目标的第一步,我正在尝试交叉编译未经修改的Raspberry Pi内核和以下内容

在第7步之前,一切都很顺利。在步骤7中,当我输入cross compile命令时,它显示如下:

$ make ARCH=arm CROSS_COMPILE=${CCPREFIX}  
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
In file included from ./arch/arm/include/asm/bug.h:6:0,
                 from include/linux/bug.h:4,
                 from include/linux/page-flags.h:9,
                 from kernel/bounds.c:9:
./arch/arm/include/asm/opcodes.h:14:52: error: unknown type name 'u32'
./arch/arm/include/asm/opcodes.h:14:64: error: unknown type name 'u32'
In file included from ./arch/arm/include/asm/irqflags.h:6:0,
                 from include/linux/irqflags.h:15,
                 from ./arch/arm/include/asm/bitops.h:27,
                 from include/linux/bitops.h:36,
                 from include/linux/log2.h:16,
                 from kernel/bounds.c:12:
./arch/arm/include/asm/ptrace.h:125:1: error: unknown type name 'bool'
./arch/arm/include/asm/ptrace.h: In function 'regs_get_register':
./arch/arm/include/asm/ptrace.h:141:6: error: expected expression before 'struct'
In file included from include/linux/bitops.h:36:0,
                 from include/linux/log2.h:16,
                 from kernel/bounds.c:12:
./arch/arm/include/asm/bitops.h: In function '____atomic_set_bit':
./arch/arm/include/asm/bitops.h:38:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
./arch/arm/include/asm/bitops.h:38:23: note: each undeclared identifier is reported only once for each function it appears in
./arch/arm/include/asm/bitops.h: In function '____atomic_clear_bit':
./arch/arm/include/asm/bitops.h:50:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
./arch/arm/include/asm/bitops.h: In function '____atomic_change_bit':
./arch/arm/include/asm/bitops.h:62:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
./arch/arm/include/asm/bitops.h: In function '____atomic_test_and_set_bit':
./arch/arm/include/asm/bitops.h:76:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
./arch/arm/include/asm/bitops.h: In function '____atomic_test_and_clear_bit':
./arch/arm/include/asm/bitops.h:93:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
./arch/arm/include/asm/bitops.h: In function '____atomic_test_and_change_bit':
./arch/arm/include/asm/bitops.h:110:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
In file included from ./arch/arm/include/asm/bitops.h:122:0,
                 from include/linux/bitops.h:36,
                 from include/linux/log2.h:16,
                 from kernel/bounds.c:12:
include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
include/asm-generic/bitops/non-atomic.h:17:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function '__clear_bit':
include/asm-generic/bitops/non-atomic.h:25:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function '__change_bit':
include/asm-generic/bitops/non-atomic.h:42:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function '__test_and_set_bit':
include/asm-generic/bitops/non-atomic.h:59:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function '__test_and_clear_bit':
include/asm-generic/bitops/non-atomic.h:78:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function '__test_and_change_bit':
include/asm-generic/bitops/non-atomic.h:90:23: error: 'BITS_PER_LONG' undeclared (first use in this function)
include/asm-generic/bitops/non-atomic.h: In function 'test_bit':
include/asm-generic/bitops/non-atomic.h:105:21: error: 'BITS_PER_LONG' undeclared (first use in this function)
In file included from ./arch/arm/include/asm/bitops.h:312:0,
                 from include/linux/bitops.h:36,
                 from include/linux/log2.h:16,
                 from kernel/bounds.c:12:
include/asm-generic/bitops/fls64.h: At top level:
include/asm-generic/bitops/fls64.h:33:2: error: #error BITS_PER_LONG not 32 or 64
In file included from ./arch/arm/include/asm/bitops.h:314:0,
                 from include/linux/bitops.h:36,
                 from include/linux/log2.h:16,
                 from kernel/bounds.c:12:
include/asm-generic/bitops/sched.h: In function 'sched_find_first_bit':
include/asm-generic/bitops/sched.h:27:2: error: #error BITS_PER_LONG not defined
In file included from include/linux/log2.h:16:0,
                 from kernel/bounds.c:12:
include/linux/bitops.h: At top level:
include/linux/bitops.h:202:37: error: unknown type name 'u64'
include/linux/bitops.h:208:2: error: #error BITS_PER_LONG not 32 or 64
In file included from kernel/bounds.c:12:0:
include/linux/log2.h:32:17: error: unknown type name 'u32'
include/linux/log2.h:40:17: error: unknown type name 'u64'
include/linux/log2.h:52:1: error: unknown type name 'bool'
Kbuild:44: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1004: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
我没有对任何内核文件进行任何更改。我不知道为什么bounds.c有问题。另外,我下载了内核文件的压缩版本,因此我认为这不是签出/更新问题。我必须承认,我对这个错误的真正含义感到困惑。我错过什么了吗

提前谢谢

编辑: (1) 步骤6之前的
printenv

(2) 步骤6的输出


这些错误与bounds.c无关,但可能与您的环境设置、include path等有关。您可能希望检查输出文件,以了解工具链如何解析宏来设置CCPREFIX等。(1)在步骤6之前编辑您的帖子,以包含
printenv
命令的输出。(2) 显示步骤#6的输出。交叉编译内核的主机是32位吗?@LethalProgrammer主机是64位的,我安装了用于交叉编译的64位库machine@Peter你能再详细解释一下吗?我对这东西完全陌生。。
$ printenv
XDG_VTNR=7
XDG_SESSION_ID=c2
CLUTTER_IM_MODULE=xim
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/omkar
SESSION=ubuntu
GPG_AGENT_INFO=/home/omkar/.gnupg/S.gpg-agent:0:1
SHELL=/bin/bash
TERM=xterm-256color
VTE_VERSION=4205
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
WINDOWID=58720266
KERNEL_SRC=/home/bhargav/rpi/linux-rpi-3.2.27
OLDPWD=/home/omkar/rpi
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1623
GNOME_KEYRING_CONTROL=
GTK_MODULES=gail:atk-bridge:unity-gtk-module
USER=omkar
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
QT_ACCESSIBILITY=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
PATH=/home/omkar/bin:/home/omkar/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
DESKTOP_SESSION=ubuntu
QT_IM_MODULE=ibus
QT_QPA_PLATFORMTHEME=appmenu-qt5
XDG_SESSION_TYPE=x11
PWD=/home/omkar/rpi/linux-rpi-4.4.y
JOB=unity-settings-daemon
XMODIFIERS=@im=ibus
GNOME_KEYRING_PID=
LANG=en_US.UTF-8
GDM_LANG=en_US
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
IM_CONFIG_PHASE=1
COMPIZ_CONFIG_PROFILE=ubuntu
GDMSESSION=ubuntu
SESSIONTYPE=gnome-session
GTK2_MODULES=overlay-scrollbar
HOME=/home/omkar
XDG_SEAT=seat0
SHLVL=1
LANGUAGE=en_US
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
UPSTART_INSTANCE=
UPSTART_EVENTS=xsession started
XDG_SESSION_DESKTOP=ubuntu
LOGNAME=omkar
COMPIZ_BIN_PATH=/usr/bin/
QT4_IM_MODULE=xim
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-S9i5BrLSwB
CCPREFIX=/home/omkar/rpi/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
LESSOPEN=| /usr/bin/lesspipe %s
INSTANCE=
UPSTART_JOB=unity7
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
GTK_IM_MODULE=ibus
LESSCLOSE=/usr/bin/lesspipe %s %s
XAUTHORITY=/home/omkar/.Xauthority
_=/usr/bin/printenv
$ make ARCH=arm CROSS_COMPILE=${CCPREFIX} bcmrpi_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#