编译android内核时出错

编译android内核时出错

我尝试为三星 note 2 编译 android 内核源代码,我的主机是 ubuntu 13.04,我使用工具链 4.8,当我使用以下方式编译内核时,我从 arch/arm/configs 中选择了一个 defconfig

 make -j4 ARCH=arm CROSS_COMPILE=/home/naimk/lab/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-

我收到此错误:

linux-androideabi-
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      arch/arm/kernel/asm-offsets.s
In file included from arch/arm/kernel/asm-offsets.c:16:0:
/home/naimk/lab/note2/kernel/arch/arm/include/asm/cacheflush.h:19:22: fatal error: mach/smc.h: No such file or directory
 #include <mach/smc.h>
                      ^
compilation terminated.
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

以及其他内核源,如三星 ace GT-S5830i

我收到此错误:

 HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/arm/Kconfig
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.c
  CC      scripts/mod/empty.o
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/mod/modpost.o
  SHIPPED scripts/genksyms/parse.h
  SHIPPED scripts/genksyms/keywords.c
  SHIPPED scripts/genksyms/parse.c
  HOSTCC  scripts/genksyms/lex.o
  HOSTCC  scripts/conmakehash
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  HOSTCC  scripts/mod/sumversion.o
  HOSTCC  scripts/genksyms/parse.o
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTLD  scripts/genksyms/genksyms
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/compile.h
  CC      init/do_mounts.o
  CC      init/main.o
  UPD     include/generated/compile.h
  CC      init/do_mounts_rd.o
  HOSTCC  usr/gen_init_cpio
In file included from include/linux/nfs_fs.h:41:0,
                 from init/do_mounts.c:20:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
In file included from include/linux/blkdev.h:12:0,
                 from init/do_mounts.h:2,
                 from init/do_mounts_rd.c:12:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
In file included from include/linux/mempolicy.h:70:0,
                 from init/main.c:51:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
  GEN     usr/initramfs_data.cpio
  AS      usr/initramfs_data.o
  LD      usr/built-in.o
  CC      init/do_mounts_initrd.o
  CC      arch/arm/kernel/compat.o
  CC      init/do_mounts_md.o
In file included from include/linux/blkdev.h:12:0,
                 from init/do_mounts.h:2,
                 from init/do_mounts_initrd.c:11:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
  CC      init/initramfs.o
In file included from include/linux/blkdev.h:12:0,
                 from init/do_mounts.h:2,
                 from init/do_mounts_md.c:5:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
  CC      init/calibrate.o
  CC      arch/arm/kernel/elf.o
  AS      arch/arm/kernel/entry-armv.o
  AS      arch/arm/kernel/entry-common.o
  CC      arch/arm/kernel/irq.o
  CC      arch/arm/mm/dma-mapping.o
  CC      arch/arm/mm/extable.o
  CC      arch/arm/kernel/process.o
  CC      arch/arm/kernel/ptrace.o
arch/arm/mm/dma-mapping.c: In function '__dma_alloc':
arch/arm/mm/dma-mapping.c:215:25: warning: array subscript is above array bounds [-Warray-bounds]
     pte = consistent_pte[++idx];
                         ^
  CC      init/version.o
arch/arm/mm/dma-mapping.c: In function 'dma_free_coherent':
arch/arm/mm/dma-mapping.c:259:25: warning: array subscript is above array bounds [-Warray-bounds]
    ptep = consistent_pte[++idx];
                         ^
  LD      init/mounts.o
  LD      init/built-in.o
  CC      arch/arm/mm/fault.o
  CC      arch/arm/kernel/return_address.o
  CC      arch/arm/mm/init.o
  CC      arch/arm/kernel/setup.o
  CC      arch/arm/kernel/signal.o
  CC      arch/arm/common/vic.o
arch/arm/kernel/signal.c: In function 'restore_sigframe':
arch/arm/kernel/signal.c:278:30: warning: variable 'aux' set but not used [-Wunused-but-set-variable]
  struct aux_sigframe __user *aux;
                              ^
  CC      arch/arm/common/icst.o
  CC      arch/arm/common/clkdev.o
  CC      arch/arm/mm/iomap.o
  CC      arch/arm/mm/fault-armv.o
  LD      arch/arm/common/built-in.o
  CC      arch/arm/kernel/sys_arm.o
  CC      arch/arm/mach-versatile/core.o
In file included from arch/arm/mm/fault-armv.c:18:0:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
  CC      arch/arm/kernel/stacktrace.o
  CC      arch/arm/mm/flush.o
In file included from arch/arm/mm/flush.c:12:0:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:415:16: warning: variable 'c' set but not used [-Wunused-but-set-variable]
  volatile char c;
                ^
  CC      arch/arm/mm/ioremap.o
  CC      arch/arm/kernel/time.o
  CC      arch/arm/mm/mmap.o
  CC      arch/arm/kernel/traps.o
  CC      arch/arm/mach-versatile/versatile_pb.o
  CC      arch/arm/mm/pgd.o
  CC      arch/arm/mm/mmu.o
  CC      arch/arm/plat-versatile/clock.o
  CC      arch/arm/mach-versatile/pci.o
  CC      arch/arm/plat-versatile/timer-sp.o
/home/naimk/lab/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld: internal error in relocate_special_relocatable, at /s/ndk-toolchain/src/build/../binutils/binutils-2.23/gold/arm.cc:9901
make[1]: *** [arch/arm/kernel/traps.o] Error 1
make: *** [arch/arm/kernel] Error 2
make: *** Waiting for unfinished jobs....
  CC      arch/arm/plat-versatile/sched-clock.o
  CC      arch/arm/mm/vmregion.o
  LD      arch/arm/plat-versatile/built-in.o
  CC      arch/arm/mm/proc-syms.o
  LD      arch/arm/mach-versatile/built-in.o
  CC      arch/arm/mm/alignment.o
  AS      arch/arm/mm/abort-ev5tj.o
  AS      arch/arm/mm/pabort-legacy.o
  CC      arch/arm/mm/copypage-v4wb.o
  AS      arch/arm/mm/tlb-v4wbi.o
  AS      arch/arm/mm/proc-arm926.o
arch/arm/mm/alignment.c: In function 'do_alignment':
arch/arm/mm/alignment.c:298:15: warning: 'offset.un' may be used uninitialized in this function [-Wmaybe-uninitialized]
   offset.un = -offset.un;
               ^
arch/arm/mm/alignment.c:720:21: note: 'offset.un' was declared here
  union offset_union offset;
                     ^
  LD      arch/arm/mm/built-in.o
/home/naimk/lab/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld: internal error in relocate_special_relocatable, at /s/ndk-toolchain/src/build/../binutils/binutils-2.23/gold/arm.cc:9901
make[1]: *** [arch/arm/mm/built-in.o] Error 1
make: *** [arch/arm/mm] Error 2

如果你能帮助我

答案1

跑步:

make clean && make mrproper

然后重试。

相关内容