Linux-Kernel

使用 Raspberry Pi 網站上提供的指南編譯核心時出錯

  • October 23, 2015

我在嘗試從原始碼編譯核心時遇到錯誤。我環顧四周,但沒有找到任何處理我所看到的錯誤的東西。

我正在使用Raspberry Pi網站上的指南來完成該過程,並且只是按照說明進行操作。我在執行 Raspbian Jessie 的 Raspberry Pi 2 板上將其編譯為 Raspberry Pi 模型 B(第一代)的核心。無論核心是用於原始核心還是 Raspberry Pi 2,都會發生這些錯誤。這是我正在做的和看到的:

pi@rpi4 ~ $ git clone --depth=1 https://github.com/raspberrypi/linux
Cloning into 'linux'...
remote: Counting objects: 52876, done.
remote: Compressing objects: 100% (50355/50355), done.
remote: Total 52876 (delta 4013), reused 17588 (delta 1852), pack-reused 0
Receiving objects: 100% (52876/52876), 142.61 MiB | 3.87 MiB/s, done.
Resolving deltas: 100% (4013/4013), done.
Checking connectivity... done.
Checking out files: 100% (49946/49946), done.
pi@rpi4 ~ $ cd linux
pi@rpi4 ~/linux $ KERNEL=kernel
pi@rpi4 ~/linux $ make 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
#
pi@rpi4 ~/linux $ time make -j5 zImage modules dtbs
scripts/kconfig/conf  --silentoldconfig Kconfig
 CHK     include/config/kernel.release
 WRAP    arch/arm/include/generated/asm/bitsperlong.h
 WRAP    arch/arm/include/generated/asm/cputime.h
....................
 CC      mm/frontswap.o
In file included from include/linux/sched.h:27:0,
                from kernel/rcu/tree.c:37:
include/linux/mm_types.h:209:8: internal compiler error: Segmentation fault
struct page_frag {
       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
 CC [M]  fs/9p/v9fs.o
 CC [M]  crypto/ctr.o
 CC [M]  fs/9p/fid.o
 CC      mm/dmapool.o
 CC [M]  crypto/gcm.o
 CC [M]  fs/9p/xattr.o
 CC [M]  fs/9p/xattr_user.o
 CC      mm/slub.o
 CC [M]  fs/9p/xattr_trusted.o
 CC [M]  fs/9p/acl.o
 CC [M]  crypto/ccm.o
 LD [M]  fs/9p/9p.o
 CC      fs/autofs4/init.o
The bug is not reproducible, so it is likely a hardware or OS problem.
scripts/Makefile.build:258: recipe for target 'kernel/rcu/tree.o' failed
make[2]: *** [kernel/rcu/tree.o] Error 1
scripts/Makefile.build:403: recipe for target 'kernel/rcu' failed
make[1]: *** [kernel/rcu] Error 2
Makefile:947: recipe for target 'kernel' failed
make: *** [kernel] Error 2
make: *** Waiting for unfinished jobs....
 LD      fs/btrfs/built-in.o
 CC [M]  fs/btrfs/super.o
 CC      fs/autofs4/inode.o
....................
 CC      fs/fscache/netfs.o
 CC      fs/f2fs/segment.o
 CC [M]  fs/fuse/dir.o
In file included from include/linux/mm.h:921:0,
                from include/linux/pagemap.h:7,
                from include/linux/fscache.h:23,
                from include/linux/fscache-cache.h:21,
                from fs/fscache/internal.h:31,
                from fs/fscache/netfs.c:15:
include/linux/vmstat.h: In function ‘count_vm_event’:
include/linux/vmstat.h:41:2: internal compiler error: Segmentation fault
 this_cpu_inc(vm_event_states.event[item]);
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
 CC [M]  fs/btrfs/raid56.o
The bug is not reproducible, so it is likely a hardware or OS problem.
scripts/Makefile.build:258: recipe for target 'fs/fscache/netfs.o' failed
make[2]: *** [fs/fscache/netfs.o] Error 1
scripts/Makefile.build:403: recipe for target 'fs/fscache' failed
make[1]: *** [fs/fscache] Error 2
make[1]: *** Waiting for unfinished jobs....
 CC [M]  fs/btrfs/uuid-tree.o
 CC [M]  fs/fuse/file.o
 CC [M]  fs/fuse/inode.o
 CC      fs/ext4/extents.o
 CC [M]  fs/btrfs/props.o
 CC      fs/f2fs/recovery.o
 CC [M]  fs/fuse/control.o
cc1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
 CC      fs/f2fs/debug.o
 CC [M]  fs/btrfs/hash.o
 CC [M]  fs/btrfs/acl.o
 CC [M]  fs/fuse/cuse.o
The bug is not reproducible, so it is likely a hardware or OS problem.
scripts/Makefile.build:258: recipe for target 'fs/f2fs/recovery.o' failed
make[2]: *** [fs/f2fs/recovery.o] Error 1
make[2]: *** Waiting for unfinished jobs....
 LD [M]  fs/fuse/fuse.o
 CC      fs/ext4/ext4_jbd2.o
scripts/Makefile.build:403: recipe for target 'fs/f2fs' failed
make[1]: *** [fs/f2fs] Error 2
 CC      fs/ext4/migrate.o
....................
 LD      fs/ext4/built-in.o
Makefile:947: recipe for target 'fs' failed
make: *** [fs] Error 2

real    11m41.081s
user    43m2.340s
sys 2m1.510s
pi@rpi4 ~/linux $ ccache -s
cache directory                     /home/pi/.ccache
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
files in cache                         0
cache size                             0 Kbytes
max cache size                       1.0 Gbytes

如您所見,編譯過程在建構文件系統組件和模組時失敗。Ccache 似乎也沒有拾取任何文件。我看到它說可能是由於硬體問題導致的內部編譯器錯誤,但我不確定這是什麼。

問題是,我也一直在我的筆記型電腦上編譯核心和模組,這是一台執行 Ubuntu 並安裝了交叉編譯工具鏈的 x86-64 機器。筆記型電腦在編譯核心時似乎有更高的成功率。我會用它來完成這項工作,但我正在研究一個在 Raspberry Pi 本身上編譯時更有意義的項目。我一直在尋找解決方案,但似乎找不到,而且它阻礙了一個相當重要的(對我而言)項目。

不幸的是,這似乎是一個更系統範圍的問題。重新安裝作業系統解決了這個問題,我使用 NOOBS 代替或直接對作業系統進行映像。不是最優雅的解決方案,但你有它。

引用自:https://unix.stackexchange.com/questions/235475