编译AT91SAM9G25的linux步骤及出现的问题

内核下载地址:http://www.kernel.org/先不要在这里面下载,这里只是用来做对比的。

下载地址为ATMEL官网中查找到该款芯片后,找相信的路径去下载。

编译内核

第一步:要把确定解压完整的内核添加到你所创建的家目录的文件夹下,我这里是创建在了家目录下的AT95文件夹下;

第二步:安装交叉编译工具链,如果没有安装,按照如下方法安装:

sudo apt-get install gcc-arm-linux-gnueabi

export CROSS_COMPILE=arm-linux-gnueabi-

第三步:配置板子的内核:

      make ARCH=arm sama5_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
#

出现的问题,这里由于我在uboot解压的所以丢失了kconfig文件,最好是在Windows下解压然后移动到刚才创建好的文件夹下面去。

 

第四步:配置内核,因为我们是初学者,所以这里最好先不要去动去,

命令如下

make ARCH=arm menuconfig

 

 

 

 

第五步:编译zImage

  命令为:make ARCH=arm

这里出现的问题主要是找不到头文件,查找发现这里缺少了软链接,在arch/arm/boot/dts/include文件夹里没发现dt-bindings这个链接文件的链接,最后通过命令

ln –s arch/arm/boot/dts/include/dt-bindings  include/dt-bingings

添加这个命令后再执行

命令为:make ARCH=arm

出现的结果为:

[..]
 
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready

第六步:编译uImage

当在编译uImage时出现这种错误是

multiple (or no) load addresses:

This is incompatible with uImages

Specify LOADADDR on the commandline tobuild an uImage

make[1]: *** [arch/arm/boot/uImage] Error 1

make: *** [uImage] Error 2

原因是没有指定加载地址。

解决方法:ARCH=armCROSS_COMPILE=arm-linux-gnueabi- LOADADDR=0x20008000 make uImage

正确:

CHK    include/config/kernel.release

 CHK    include/generated/uapi/linux/version.h

 CHK    include/generated/utsrelease.h

make[1]: `include/generated/mach-types.h'is up to date.

 CHK     include/generated/bounds.h

 CHK    include/generated/asm-offsets.h

 CALL    scripts/checksyscalls.sh

 CHK    include/generated/compile.h

 Kernel: arch/arm/boot/Image is ready

 Kernel: arch/arm/boot/zImage is ready

 UIMAGE  arch/arm/boot/uImage

Image Name:   Linux-4.1.0-linux4sam_5.0

Created:      Wed Jul 27 21:01:55 2016

Image Type:   ARM Linux Kernel Image (uncompressed)

Data Size:    3525960 Bytes = 3443.32 kB = 3.36 MB

Load Address: 0x20008000

Entry Point:  0x20008000

 

第七步:编译设备树文件

执行命令为:

make ARCH=arm dtbs

出现的结果为:

 

ATMEL官网中出现的这部分内容在编译zImage时就出现了

DTC     arch/arm/boot/dts/at91-kizbox2.dtb
  DTC     arch/arm/boot/dts/at91-sama5d2_xplained.dtb
  DTC     arch/arm/boot/dts/at91-sama5d2_xplained_pda4.dtb
  DTC     arch/arm/boot/dts/at91-sama5d3_xplained.dtb
  DTC     arch/arm/boot/dts/at91-sama5d3_xplained_pda4.dtb
  DTC     arch/arm/boot/dts/at91-sama5d3_xplained_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d31ek.dtb
  DTC     arch/arm/boot/dts/sama5d31ek_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d31ek_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d31ek_revc_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d31ek_revc_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d31ek_revc.dtb
  DTC     arch/arm/boot/dts/sama5d33ek.dtb
  DTC     arch/arm/boot/dts/sama5d33ek_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d33ek_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d33ek_revc.dtb
  DTC     arch/arm/boot/dts/sama5d33ek_revc_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d33ek_revc_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d34ek.dtb
  DTC     arch/arm/boot/dts/sama5d34ek_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d34ek_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d34ek_revc.dtb
  DTC     arch/arm/boot/dts/sama5d34ek_revc_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d34ek_revc_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d35ek.dtb
  DTC     arch/arm/boot/dts/sama5d35ek_revc.dtb
  DTC     arch/arm/boot/dts/sama5d36ek_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d36ek.dtb
  DTC     arch/arm/boot/dts/sama5d36ek_pda7.dtb
  DTC     arch/arm/boot/dts/sama5d36ek_revc.dtb
  DTC     arch/arm/boot/dts/sama5d36ek_revc_pda4.dtb
  DTC     arch/arm/boot/dts/sama5d36ek_revc_pda7.dtb
  DTC     arch/arm/boot/dts/at91-sama5d4_xplained.dtb
  DTC     arch/arm/boot/dts/at91-sama5d4_xplained_pda4.dtb
  DTC     arch/arm/boot/dts/at91-sama5d4_xplained_hdmi.dtb
  DTC     arch/arm/boot/dts/at91-sama5d4_xplained_pda7.dtb
  DTC     arch/arm/boot/dts/at91-sama5d4ek.dtb

这是我编译内核的步骤及遇到的问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值