编译 Linux 会创建损坏的目标文件

编译 Linux 会创建损坏的目标文件

我正在尝试将当前系统更新到 Linux 5.4.85。我有两个支持编译此内核的工具链:gcc 4.6.3 和 gcc 10.2.1。这两个工具链的编译均失败。

我下载并解压了 tar 包,运行make menuconfig,保存配置,运行make并运行make CROSS_COMPILE=x86_64-linux-musl-。使用后者,我尝试调用较新的工具链,因为x86_64-linux-musl-gcc10.2.1 gcc 和其他工具都存在于 $PATH 中。

输出为

.
.
.


  VDSO2C  arch/x86/entry/vdso/vdso-image-64.c
  CC      arch/x86/entry/vdso/vdso-image-64.o
  LDS     arch/x86/entry/vdso/vdso32/vdso32.lds
  CC      arch/x86/entry/vdso/vdso32/vclock_gettime.o
  AS      arch/x86/entry/vdso/vdso32/note.o
  AS      arch/x86/entry/vdso/vdso32/system_call.o
  AS      arch/x86/entry/vdso/vdso32/sigreturn.o
  VDSO    arch/x86/entry/vdso/vdso32.so.dbg
  OBJCOPY arch/x86/entry/vdso/vdso32.so
  VDSO2C  arch/x86/entry/vdso/vdso-image-32.c
  CC      arch/x86/entry/vdso/vdso-image-32.o
  AR      arch/x86/entry/vdso/built-in.a
  CC      arch/x86/entry/vsyscall/vsyscall_64.o
objdump: arch/x86/entry/vsyscall/vsyscall_64.o: File format not recognized
  AS      arch/x86/entry/vsyscall/vsyscall_emu_64.o
  AR      arch/x86/entry/vsyscall/built-in.a
  AS      arch/x86/entry/entry_64.o
objdump: arch/x86/entry/entry_64.o: File format not recognized
  AS      arch/x86/entry/thunk_64.o
  CC      arch/x86/entry/syscall_64.o
objdump: arch/x86/entry/syscall_64.o: File format not recognized
  CC      arch/x86/entry/common.o
objdump: arch/x86/entry/common.o: File format not recognized
  AS      arch/x86/entry/entry_64_compat.o
  CC      arch/x86/entry/syscall_32.o
  AR      arch/x86/entry/built-in.a
  CC      arch/x86/events/amd/core.o
objdump: arch/x86/events/amd/core.o: File format not recognized
  CC      arch/x86/events/amd/uncore.o
objdump: arch/x86/events/amd/uncore.o: File format not recognized
  CC      arch/x86/events/amd/ibs.o
objdump: arch/x86/events/amd/ibs.o: File format not recognized
  CC      arch/x86/events/amd/iommu.o
objdump: arch/x86/events/amd/iommu.o: File format not recognized
  AR      arch/x86/events/amd/built-in.a
  CC      arch/x86/events/intel/core.o
objdump: arch/x86/events/int

或者使用较新的工具链

.
.
.


include/generated/compile.h
  CC      init/main.o
x86_64-linux-musl-objdump: warning: init/main.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: warning: init/main.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: init/main.o: file format not recognized
  CC      init/version.o
  CC      init/do_mounts.o
x86_64-linux-musl-objdump: warning: init/do_mounts.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: warning: init/do_mounts.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: init/do_mounts.o: file format not recognized
  CC      init/do_mounts_rd.o
x86_64-linux-musl-objdump: warning: init/do_mounts_rd.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: warning: init/do_mounts_rd.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: init/do_mounts_rd.o: file format not recognized
  CC      init/do_mounts_initrd.o
x86_64-linux-musl-objdump: warning: init/do_mounts_initrd.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: warning: init/do_mounts_initrd.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: init/do_mounts_initrd.o: file format not recognized
  CC      init/do_mounts_md.o
x86_64-linux-musl-objdump: warning: init/do_mounts_md.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: warning: init/do_mounts_md.o has a corrupt section with a size (7472747368732e00) larger than the file size
x86_64-linux-musl-objdump: init/do_mounts_md.o: file format not recognized
  CC      init/initramfs.o

如何在我的系统上编译现代 Linux 内核?

答案1

尝试更新您的 elfutils pkg。

相关内容