?
开发板:? ? tq2440
?
工具:? ? ? Win7 + VMware + Debian6
?
U-boot版本: u-boot-2015.01
?
Linux版本:? 天嵌自带的 linux-2.6.30.4
?
GCC版本:? ? gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176)
?
之前由于移植过u-boot-2014.04到tq2440上,现在移植u-boot-2015.01的时候就不说那么详细了,因为之前已经说的很详细了,现在简略移植一下。
?
?
?
下面是解压后得到的文件:
?

?
可以看到目录内容跟u-boot-2014.04不同了,下面是u-boot-2014.04的顶层目录内容:
?

?
其中最不同的就是我们所熟悉的在u-boot-2014.04中的boards.cfg和mkconfig没有了,而同时又在u-boot-2015.01的顶层目录下多出了一个configs目录,还有一个Kconfig文件(这不是Linux内核所特有的吗?),可以看到u-boot一直在学习Linux内核的配置和编译方法。
?
在configs目录下有很多默认的配置文件:
?

?
在Linux的arch/arm/configs下面也有很多默认的配置文件,Linux内核在配置的时候可以使用 make xxx_defconfig 来配置,
?
看样子,u-boot也可以使用make xxx_defconfig,Linux内核还可以使用make menuconfig来配置,u-boot也可以使用make menuconfig来配置,下面我们用smdk2410为例实验一下:
?
在u-boot-2015.01的configs目录下有一个叫做smd2410_defconfig的配置文件,那么执行 make smd2410_defconfig
?

?
然后我们再执行make menuconfig试试:
?

?
果然如此。
?
我们选择的是smdk2410的配置文件,在这里体现出来:
?

?
然后就可以编译了, 直接执行 make 即可,刚开始会报错:
?

?
原因是我们没有指定交叉编译工具链的名字,修改顶层的Makefile即可:
?

?
然后再执行make就可以编译成功。
?
在以前的u-boot配置是总是有什么ARCH、CPU、BOARD和SOC之类的变量,同时编译完成后会在include下生成一个叫做config.mk的文件,其中对这几个变量赋值了,如:
?

?
但是在u-boot-2015.01编译完成后,在include下面却没有config.mk了,只有autoconf.mk了,那它是怎么做的呢?
?
在u-boot-2015.01中执行完make smdk2410_defconfig后,会在顶层目录中生成一个.config文件,我们大致看一下其中的内容:
?

?
可以看到,在.config中还是有ARCH、CPU、SOC以及BOARD之类的配置项,在顶层目录下的config.mk中会使用.config中的配置:
?

?
在arch/Kconfig中对这几个配置进行了说明:
?
config SYS_ARCH
? ? string
? ? help
? ? ? This option should contain the architecture name to build the
? ? ? appropriate arch/ directory.
? ? ? All the architectures should specify this option correctly.
?
config SYS_CPU
? ? string
? ? help
? ? ? This option should contain the CPU name to build the correct
? ? ? arch//cpu/ directory.
?
? ? ? This is optional.? For those targets without the CPU directory,
? ? ? leave this option empty.
?
config SYS_SOC
? ? string
? ? help
? ? ? This option should contain the SoC name to build the directory
? ? ? arch//cpu//.
?
? ? ? This is optional.? For those targets without the SoC directory,
? ? ? leave this option empty.
?
config SYS_VENDOR
? ? string
? ? help
? ? ? This option should contain the vendor name of the target board.
? ? ? If it is set and
? ? ? board//common/Makefile exists, the vendor common
? ? ? directory is compiled.
? ? ? If CONFIG_SYS_BOARD is also set, the sources under
? ? ? board// directory are compiled.
?
? ? ? This is optional.? For those targets without the vendor directory,
? ? ? leave this option empty.
?
config SYS_BOARD
? ? string
? ? help
? ? ? This option should contain the name of the target board.
? ? ? If it is set, either board//
? ? ? or board/ directory is compiled depending on
? ? ? whether CONFIG_SYS_VENDOR is set or not.
?
? ? ? This is optional.? For those targets without the board directory,
? ? ? leave this option empty.
?
config SYS_CONFIG_NAME
? ? string
? ? help
? ? ? This option should contain the base name of board header file.
? ? ? The header file include/configs/.h
? ? ? should be included from include/config.h.
?
同时在arch/Kconfig中又会加载其他目录下的Kconfig,如 source “arch/arm/Kconfig”,在arch/arm/Kconfig中又会加载board目录下的Kconfig,如 source “board/samsung/smdk2410/Kconfig”,下面我们看一下board/samsung/smdk2410/Kconfig中的内容:
?

?
不错,就是在这里对.config中的那几个配置赋了值,可以看到,第一个行用TARGET_SMDK2410进行了判断,这个在arch/arm/Kconfig中:
?

?
意思是: 如果选择的是smd2410,TARGET_SMDK2410会被选择,然后board/samsung/smdk2410/Kconfig会对CONFIG_SYS_CPU、CONFIG_SYS_SOC、CONFIG_SYS_VENDOR、CONFIG_SYS_BOARD、CONFIG_SYS_CONFIG_NAME赋值:
?
先说到这里吧。