iTop4412 3.0.15内核移植到linux4.4.34(一)

打算借linux移植学习内核启动过程,及4412各外设驱动原理

移植时,先修改一些config,然后解决编译出现的问题

System Type-->Multiple platform selection
[*]ARMv7 based platforms(Cortex-A,PJ4,Scorpion, Krait)

System Type--->Samsung EXYNOS
[*]SAMSUNG EXYNOS4
[*]SAMSUNG EXYNOS4412

File systems--->Network File Systems--->
<>NFS client support for NFS version 2
<*>NFS client support for NFS version 3
[]NFS server support for NFS version 3
[]NFS server support for NFS version 4

编译出现错误:
scripts/sign-file.c:23:30: fatal error: openssl/opensslv.h: No such file or directory
解决:apt-get install libssl-dev

/tmp/ccKduzSd.s: Assembler messages:
/tmp/ccKduzSd.s:869: Error: garbage following instruction -- `dmb ishst'
/tmp/ccKduzSd.s:888: Error: garbage following instruction -- `dmb ishst'
/tmp/ccKduzSd.s:919: Error: garbage following instruction -- `dmb ish'
/tmp/ccKduzSd.s:931: Error: garbage following instruction -- `dsb ishst'

解决:
System Type->ARM system type (ARM Ltd. Vesatile family)

配置改为
 [*] MMU-based Paged Memory Management Support
 ARM system type (Allow multiple platforms to be selected) 
 [*] Samsung EXYNOS  ---> SAMSUNG EXYNOS4
     SAMSUNG EXYNOS4412
问题:
  CC      arch/arm/kernel/suspend.o
/tmp/ccgcmPjb.s: Assembler messages:
/tmp/ccgcmPjb.s:243: Error: garbage following instruction -- `dsb nshst'
/tmp/ccgcmPjb.s:251: Error: garbage following instruction -- `dsb nsh'

解决:
Power management options  --->
[] Suspend to RAM and standby 

问题:
  CC      arch/arm/mm/fault.o
/tmp/ccEM41mf.s: Assembler messages:
/tmp/ccEM41mf.s:632: Error: garbage following instruction -- `dsb ishst'
make[1]: *** [arch/arm/mm/fault.o] Error 1

解决:
替换函数
static inline void flush_pmd_entry(pmd_t *pmd)
{
const unsigned int __tlb_flag = __cpu_tlb_flags;


if (tlb_flag(TLB_DCLEAN))
asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
: : "r" (pmd) : "cc");


if (tlb_flag(TLB_L2CLEAN_FR))
asm("mcr p15, 1, %0, c15, c9, 1  @ L2 flush_pmd"
: : "r" (pmd) : "cc");


if (tlb_flag(TLB_WB))
dsb();
}
出错:
CC      arch/arm/mm/flush.o
/tmp/ccobT12L.s: Assembler messages:
/tmp/ccobT12L.s:99: Error: garbage following instruction -- `dsb nshst'
/tmp/ccobT12L.s:107: Error: garbage following instruction -- `dsb nsh'
/tmp/ccobT12L.s:223: Error: garbage following instruction -- `dsb ishst'
/tmp/ccobT12L.s:308: Error: garbage following instruction -- `dsb nshst'
/tmp/ccobT12L.s:314: Error: garbage following instruction -- `dsb nsh'
/tmp/ccobT12L.s:386: Error: garbage following instruction -- `dsb nshst'
/tmp/ccobT12L.s:392: Error: garbage following instruction -- `dsb nsh'
/tmp/ccobT12L.s:427: Error: garbage following instruction -- `dsb ishst'
/tmp/ccobT12L.s:461: Error: garbage following instruction -- `dsb ishst'
/tmp/ccobT12L.s:516: Error: garbage following instruction -- `dsb ishst'
/tmp/ccobT12L.s:569: Error: garbage following instruction -- `dsb ishst'
make[1]: *** [arch/arm/mm/flush.o] Error 1
解决:
barrier.h
#if __LINUX_ARM_ARCH__ >= 7

#ifdef CONFIG_ARCH_EXYNOS
#define isb(option) __asm__ __volatile__ ("isb" : : : "memory")
#define dsb(option) __asm__ __volatile__ ("dsb" : : : "memory")
#define dmb(option) __asm__ __volatile__ ("dmb" : : : "memory")
#else
#define isb(option) __asm__ __volatile__ ("isb " #option : : : "memory")aa
#define dsb(option) __asm__ __volatile__ ("dsb " #option : : : "memory")
#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
#endif
问题:
arch/arm/mm/tlb-v7.S: Assembler messages:
arch/arm/mm/tlb-v7.S:38: Error: garbage following instruction -- `dsb ish'
arch/arm/mm/tlb-v7.S:59: Error: garbage following instruction -- `dsb ish'
arch/arm/mm/tlb-v7.S:72: Error: garbage following instruction -- `dsb ish'
arch/arm/mm/tlb-v7.S:87: Error: garbage following instruction -- `dsb ish'
make[1]: *** [arch/arm/mm/tlb-v7.o] Error 1

proc-v7.S与cache-v7.S也有相同问题

解决:
在对应文件中找到dsb ishst
替换为dsb

编译出错:
arch/arm/lib/testchangebit.S: Assembler messages:
arch/arm/lib/testchangebit.S:15: Error: garbage following instruction -- `dmb ish'
arch/arm/lib/testchangebit.S:15: Error: garbage following instruction -- `dmb ish'
make[1]: *** [arch/arm/lib/testchangebit.o] Error 1

修改arch\arm\include\asm\assembler.h
去掉ish

查看代码发现有个angel模式,不明白什么是这个模式,搜了下发现这个模式即ARM's standard semihosting interface ,用于外部调试,
是一种旧办法,现在基本不使用了。(参考:http://stackoverflow.com/questions/38550715/linux-booting-angel-booting)

至此编译通过

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值