為 Android 裝置編譯核心時出錯

為 Android 裝置編譯核心時出錯

我希望你有個美好的一天,

我對此很陌生,只是搜索並蒐索了我的情況,但沒有答案,這裡和這裡大約有 40 個線程,沒有人幫助我,所以我很害羞地問你這個問題,但我必須這樣做,

我正在嘗試為我的 Android 設備編譯內核,我編譯了我的鏈工具並修改了我的內核,但是當我編譯它時,它顯示了 112 個錯誤,如下所示:

CC      arch/arm/mm/alignment.o
CC      fs/open.o
CC      kernel/fork.o
CC      fs/read_write.o
In file included from include/linux/printk.h:6:0,
             from include/linux/kernel.h:13,
             from arch/arm/mm/rodata.c:15:
  arch/arm/mm/rodata.c: In function 'set_page_attributes':
include/linux/kern_levels.h:4:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'pmd_t {aka unsigned int}' [-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
              ^
include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
              ^
include/linux/printk.h:216:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
     ^
arch/arm/mm/rodata.c:91:4: note: in expansion of macro 'pr_err'
pr_err("%s: pmd %p=%08lx for %08lx not page table\n",
^
CC      mm/filemap.o
CC      mm/mempool.o
CC      mm/oom_kill.o
AS      arch/arm/mm/abort-ev7.o
AS      arch/arm/mm/pabort-v7.o
In file included from arch/arm/mm/dma-mapping.c:20:0:
include/linux/dma-contiguous.h: In function 'dev_get_cma_area':
include/linux/dma-contiguous.h:72:16: error: 'struct device' has no member named 'cma_area'
if (dev && dev->cma_area)
            ^
include/linux/dma-contiguous.h:73:13: error: 'struct device' has no member named 'cma_area'
return dev->cma_area;
         ^
include/linux/dma-contiguous.h: In function 'dev_set_cma_area':
include/linux/dma-contiguous.h:80:6: error: 'struct device' has no member named 'cma_area'
dev->cma_area = cma;
  ^
AS      arch/arm/mm/cache-v7.o
CC      arch/arm/mm/copypage-v6.o
CC      kernel/exec_domain.o
CC      arch/arm/mm/context.o
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from include/asm-generic/emergency-restart.h:4,
             from arch/arm/include/generated/asm/emergency-restart.h:1,
             from include/linux/reboot.h:56,
             from arch/arm/kernel/process.c:21:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
CC      security/apparmor/apparmorfs.o
CC      ipc/util.o
CC      crypto/api.o
arch/arm/mm/dma-mapping.c: At top level:
include/linux/dma-contiguous.h:66:28: error: 'CONFIG_CMA_AREAS' undeclared here (not in a function)
#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
                        ^
arch/arm/mm/dma-mapping.c:396:54: note: in expansion of macro 'MAX_CMA_AREAS'
static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
                                                  ^
AS      arch/arm/mm/tlb-v7.o
CC      fs/file_table.o
AS      arch/arm/mm/proc-v7.o
arch/arm/mm/dma-mapping.c:396:40: warning: 'dma_mmu_remap' defined but not used [-Wunused-variable]
static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
                                    ^
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from include/asm-generic/emergency-restart.h:4,
             from arch/arm/include/generated/asm/emergency-restart.h:1,
             from include/linux/reboot.h:56,
             from arch/arm/kernel/machine_kexec.c:8:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
CC      fs/super.o
CC      mm/fadvise.o
scripts/Makefile.build:308: recipe for target 'arch/arm/mm/dma-mapping.o' failed
make[1]: *** [arch/arm/mm/dma-mapping.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CC      fs/char_dev.o
CC      ipc/msgutil.o
CC      mm/maccess.o
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from arch/arm/kernel/traps.c:39:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
In file included from arch/arm/kernel/process.c:44:0:
/home/tareq/Kernel/arch/arm/include/asm/sec/sec_log.h:24:20: warning: function declaration isn't a prototype [-Wstrict-prototypes]
static inline void sec_debug_panic_message(en) { }
                ^
/home/tareq/Kernel/arch/arm/include/asm/sec/sec_log.h: In function 'sec_debug_panic_message':
/home/tareq/Kernel/arch/arm/include/asm/sec/sec_log.h:24:20: warning: type of 'en' defaults to 'int' [-Wimplicit-int]
CC      ipc/msg.o
In file included from arch/arm/mm/init.c:23:0:
include/linux/dma-contiguous.h: In function 'dev_get_cma_area':
include/linux/dma-contiguous.h:72:16: error: 'struct device' has no member named 'cma_area'
if (dev && dev->cma_area)
            ^
include/linux/dma-contiguous.h:73:13: error: 'struct device' has no member named 'cma_area'
return dev->cma_area;
         ^
include/linux/dma-contiguous.h: In function 'dev_set_cma_area':
include/linux/dma-contiguous.h:80:6: error: 'struct device' has no member named 'cma_area'
dev->cma_area = cma;
  ^
CC      kernel/panic.o
CC      ipc/sem.o
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from arch/arm/mm/fault.c:34:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
CC      kernel/printk.o
CC      ipc/shm.o
arch/arm/kernel/traps.c: In function 'cp_abort':
arch/arm/kernel/traps.c:829:8: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'void *' [-Wformat=]
panic("CP Crash : %s", debug_info);
    ^
scripts/Makefile.build:308: recipe for target 'arch/arm/kern /machine_kexec.o' failed
make[1]: *** [arch/arm/kernel/machine_kexec.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CC      kernel/cpu.o
scripts/Makefile.build:308: recipe for target 'arch/arm/kernel/process.o' failed
make[1]: *** [arch/arm/kernel/process.o] Error 1
CC      ipc/ipcns_notifier.o
scripts/Makefile.build:308: recipe for target 'arch/arm/mm/fault.o' failed
make[1]: *** [arch/arm/mm/fault.o] Error 1
CC      kernel/exit.o
scripts/Makefile.build:308: recipe for target 'arch/arm/kernel/traps.o' failed
make[1]: *** [arch/arm/kernel/traps.o] Error 1
CC      security/apparmor/audit.o
GEN     security/apparmor/capability_names.h
CC      security/apparmor/context.o
CC      kernel/itimer.o
LD      arch/arm/common/built-in.o
HZFILE  kernel/hz.bc
scripts/Makefile.build:308: recipe for target 'arch/arm/mm/init.o' failed
make[1]: *** [arch/arm/mm/init.o] Error 1
CC      kernel/softirq.o
CC      ipc/syscall.o
CC      kernel/resource.o 

並在編譯結束時:

CC [M]  fs/ocfs2/dlm/dlmdomain.o
CC [M]  fs/ocfs2/cluster/tcp.o
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from include/asm-generic/emergency-restart.h:4,
             from arch/arm/include/generated/asm/emergency-restart.h:1,
             from include/linux/reboot.h:56,
             from fs/ocfs2/cluster/quorum.c:48:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
scripts/Makefile.build:308: recipe for target 'fs/ocfs2/cluster/quorum.o' failed
make[3]: *** [fs/ocfs2/cluster/quorum.o] Error 1
make[3]: *** Waiting for unfinished jobs....
CC [M]  fs/xfs/xfs_ialloc_btree.o
CC [M]  fs/ocfs2/dlm/dlmdebug.o
CC [M]  fs/xfs/xfs_inode.o
CC [M]  fs/ocfs2/dlm/dlmthread.o
CC [M]  fs/xfs/xfs_log_recover.o
In file included from /home/tareq/Kernel/arch/arm/include/asm/sec/sec_debug.h:21:0,
             from include/asm-generic/emergency-restart.h:4,
             from arch/arm/include/generated/asm/emergency-restart.h:1,
             from include/linux/reboot.h:56,
             from fs/ocfs2/stack_user.c:25:
include/soc/sprd/hardware.h:40:2: error: #error "Unknown architecture specification"
#error "Unknown architecture specification"
^
scripts/Makefile.build:308: recipe for target 'fs/ocfs2/stack_user.o' failed
make[2]: *** [fs/ocfs2/stack_user.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CC [M]  fs/xfs/xfs_mount.o
CC [M]  fs/xfs/xfs_symlink.o
CC [M]  fs/ocfs2/dlm/dlmrecovery.o
CC [M]  fs/ocfs2/dlm/dlmmaster.o
CC [M]  fs/xfs/xfs_trans.o
CC [M]  fs/ocfs2/dlm/dlmast.o
CC [M]  fs/xfs/xfs_log.o
CC [M]  fs/xfs/xfs_log_cil.o
CC [M]  fs/xfs/xfs_buf_item.o
CC [M]  fs/xfs/xfs_extfree_item.o
CC [M]  fs/xfs/xfs_inode_item.o
CC [M]  fs/xfs/xfs_trans_ail.o
CC [M]  fs/ocfs2/dlm/dlmconvert.o
CC [M]  fs/xfs/xfs_trans_buf.o
CC [M]  fs/ocfs2/dlm/dlmlock.o
CC [M]  fs/xfs/xfs_trans_extfree.o
CC [M]  fs/ocfs2/dlm/dlmunlock.o
CC [M]  fs/xfs/xfs_trans_inode.o
CC [M]  fs/xfs/xfs_dquot.o
CC [M]  fs/xfs/xfs_dquot_item.o
CC [M]  fs/xfs/xfs_trans_dquot.o
CC [M]  fs/ocfs2/dlm/dlmver.o
CC [M]  fs/xfs/xfs_qm_syscalls.o
CC [M]  fs/xfs/xfs_qm_bhv.o
CC [M]  fs/xfs/xfs_qm.o
CC [M]  fs/xfs/xfs_quotaops.o
LD [M]  fs/nfs/blocklayout/blocklayoutdriver.o
CC [M]  fs/xfs/xfs_rtalloc.o
CC [M]  fs/xfs/xfs_acl.o
CC [M]  fs/xfs/xfs_stats.o
CC [M]  fs/xfs/xfs_sysctl.o
LD [M]  fs/nfs/objlayout/objlayoutdriver.o
LD [M]  fs/cifs/cifs.o
LD      fs/ext4/ext4.o
LD      fs/ext4/built-in.o
scripts/Makefile.build:455: recipe for target 'fs/ocfs2/cluster' failed
make[2]: *** [fs/ocfs2/cluster] Error 2
LD [M]  fs/nfs/nfs_layout_nfsv41_files.o
LD [M]  fs/nfs/nfsv4.o
LD [M]  fs/nfs/nfsv2.o
LD [M]  fs/nfs/nfsv3.o
LD [M]  fs/nfs/nfs.o
LD [M]  fs/xfs/xfs.o
LD [M]  fs/ocfs2/dlm/ocfs2_dlm.o
scripts/Makefile.build:455: recipe for target 'fs/ocfs2' failed
make[1]: *** [fs/ocfs2] Error 2
Makefile:798: recipe for target 'fs' failed
make: *** [fs] Error 2
ERROR: An error occured. Kernel was not compiled. 

這是不可能的,

很難相信所有這些錯誤都集中在一個核心中。

那麼,如果有人可以幫我解釋為什麼我會出現這些錯誤呢?我該怎麼做才能使其正常工作?

答案1

抱歉大家,我確實找出了問題所在,這是 defconfig 檔案的名稱,我所做的例如:我一開始有這個:anyname_defconfig,我將其重新命名為:bravo_defconfig。而錯誤消失了。但仍然存在一個問題[這些錯誤愛我哈哈:(]這就是我所擁有的:

include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */

include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */

include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */

scripts/Makefile.build:441: recipe for target 'drivers/misc/mdbg/mdbgdrv.o' failed
make[3]: *** [drivers/misc/mdbg/mdbgdrv.o] Error 1
scripts/Makefile.build:455: recipe for target 'drivers/misc/mdbg'failed
make[2]: *** [drivers/misc/mdbg] Error 2
make[2]: *** Waiting for unfinished jobs....

drivers/media/sprd_scale/common/img_scale.c: In function 'scale_k_read':
drivers/media/sprd_scale/common/img_scale.c:110:10: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
printk("scale_k_read error: wrong size of u_data: %ld \n", cnt);

scripts/Makefile.build:455: recipe for target 'drivers/misc' failed
make[1]: *** [drivers/misc] Error 2
make[1]: *** Waiting for unfinished jobs....

scripts/Makefile.build:387: recipe for target 'kernel/trace/built-in.o' failed
make[2]: *** [kernel/trace/built-in.o] Error 1
scripts/Makefile.build:455: recipe for target 'kernel/trace' failed
make[1]: *** [kernel/trace] Error 2
Makefile:798: recipe for target 'kernel' failed
make: *** [kernel] Error 2

drivers/input/keyboard/tc350k.c: In function 'tc300k_power':
drivers/input/keyboard/tc350k.c:367:27: warning: format '%s' expects a matching 'char *' argument [-Wformat=]
dev_err(&client->dev, "%s regulator_get error \n");

Makefile:798: recipe for target 'drivers' failed
make: *** [drivers] Error 2

scripts/Makefile.build:387: recipe for target 'fs/built-in.o' failed
make[1]: *** [fs/built-in.o] Error 1
Makefile:798: recipe for target 'fs' failed
make: *** [fs] Error 2
ERROR: An error occured. Kernel was not compiled.

如果有人可以幫我解決這個錯誤,我懇求你。

如何修復這個錯誤?

相關內容