码迷,mamicode.com
首页 > 其他好文 > 详细

uboot图形化配置浅析

时间:2019-11-27 00:44:01      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:选中   depends   ons   name   conf   uboot   other   running   and   

1.1:menuconfig 重点会用到两个文件:.config 和 Kconfig,.config 文件前面已经说了,这个文件保存着 uboot 的配置项,使用 menuconfig 配置完 uboot 以后肯定要更新.config 文件。Kconfig文件是图形界面的描述文件,也就是描述界面应该有什么内容,很多目录下都会有 Kconfig 文件

 

1.2:打开图形界面,设置好要设置的项目后,make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8再编译uboot,注意不能用用mx6ull_alientek_emmc.sh ,因为在编译之前会清理工程,会删除掉.config 文件

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_alientek_emmc_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

 

1.3:过程分析:当输入 make menuconfig 以后会匹配到顶层 Makefile 的如下代码

 %config: scripts_basic outputmakefile FORCE
 $(Q)$(MAKE) $(build)=scripts/kconfig $@

    展开即为

@ make -f ./scripts/Makefile.build obj=scripts/kconfig menuconfig

  Makefile.build 会读取 scripts/kconfig/Makefile 中的内容,在 scripts/kconfig/Makefile 中可以找到如下代码

 menuconfig: $(obj)/mconf
 $< $(silent) $(Kconfig)

 展开即为

menuconfig: scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig

  以上目标 menuconfig 依赖 scripts/kconfig/mconf,因此 scripts/kconfig/mconf.c 这个文件会被编译,生成 mconf 这个可执行文件。目标 menuconfig 对应的规则为 scripts/kconfig/mconf Kconfig,也就是说 mconf 会调用 uboot 根目录下的 Kconfig 文件开始构建图形配置界面

 

1.4:Kconfig语法(通过根目录Kconfig分析)

1.4.1:mainmenu就是主菜单

mainmenu "U-Boot $UBOOTVERSION Configuration"

1.4.2:调用其他Kconfig

source "xxx/Kconfig" //xxx 为具体的目录名,相对路径

1.4.3:menu 用于生成菜单,endmenu 就是菜单结束标志,这两个一般是成对出现的。在顶层Kconfig 中有如下

menu "General setup"

config LOCALVERSION
	string "Local version - append to U-Boot release"
	help
	  Append an extra string to the end of your U-Boot version.
	  This will show up on your boot log, for example.
	  The string you set here will be appended after the contents of
	  any files with a filename matching localversion* in your
	  object and source tree, in that order.  Your total string can
	  be a maximum of 64 characters.

config LOCALVERSION_AUTO
	bool "Automatically append version information to the version string"
	default y
	help
	  This will try to automatically determine if the current tree is a
	  release tree by looking for git tags that belong to the current
	  top of tree revision.

	  A string of the format -gxxxxxxxx will be added to the localversion
	  if a git-based tree is found.  The string generated by this will be
	  appended after any matching localversion* files, and after the value
	  set in CONFIG_LOCALVERSION.

	  (The actual string used here is the first eight characters produced
	  by running the command:

	    $ git rev-parse --verify HEAD

	  which is done within the script "scripts/setlocalversion".)

config CC_OPTIMIZE_FOR_SIZE
	bool "Optimize for size"
	default y
	help
	  Enabling this option will pass "-Os" instead of "-O2" to gcc
	  resulting in a smaller U-Boot image.

	  This option is enabled by default for U-Boot.

config SYS_MALLOC_F
	bool "Enable malloc() pool before relocation"
	default y if DM
	help
	  Before relocation memory is very limited on many platforms. Still,
	  we can provide a small malloc() pool if needed. Driver model in
	  particular needs this to operate, so that it can allocate the
	  initial serial device and any others that are needed.

config SYS_MALLOC_F_LEN
	hex "Size of malloc() pool before relocation"
	depends on SYS_MALLOC_F
	default 0x400
	help
	  Before relocation memory is very limited on many platforms. Still,
	  we can provide a small malloc() pool if needed. Driver model in
	  particular needs this to operate, so that it can allocate the
	  initial serial device and any others that are needed.

menuconfig EXPERT
	bool "Configure standard U-Boot features (expert users)"
	default y
	help
	  This option allows certain base U-Boot options and settings
	  to be disabled or tweaked. This is for specialized
	  environments which can tolerate a "non-standard" U-Boot.
	  Only use this if you really know what you are doing.

if EXPERT
	config SYS_MALLOC_CLEAR_ON_INIT
	bool "Init with zeros the memory reserved for malloc (slow)"
	default y
	help
	  This setting is enabled by default. The reserved malloc
	  memory is initialized with zeros, so first malloc calls
	  will return the pointer to the zeroed memory. But this
	  slows the boot time.

	  It is recommended to disable it, when CONFIG_SYS_MALLOC_LEN
	  value, has more than few MiB, e.g. when uses bzip2 or bmp logo.
	  Then the boot time can be significantly reduced.
	  Warning:
	  When disabling this, please check if malloc calls, maybe
	  should be replaced by calloc - if expects zeroed memory.
endif
endmenu		# General setup

1.3.4:上面可以看到有很多config开头的项目,比如config LOCALVERSION,这个就是菜单 "General setup"的具体配置项,使能了此项功能之后,.config文件就会生成CONFIG_LOCALVERSION;config项目下面的就是此项的具体属性(类型、输入提示、依赖关系、帮助信息和默认值等)

1.3.5:

depends on:选中HAVE_GENERIC_BOARD后才能选SYS_GENERIC_BOARD;

select:选中ARC之后会选中后面select的几项

choice/endchoice: 代码段定义了一组可选择项,将多个类似的配置项组合在一起,供用户单选或者多选
config SYS_GENERIC_BOARD
	bool
	depends on HAVE_GENERIC_BOARD

choice
	prompt "Architecture select"
	default SANDBOX

config ARC
	bool "ARC architecture"
	select HAVE_PRIVATE_LIBGCC
	select HAVE_GENERIC_BOARD
	select SYS_GENERIC_BOARD
	select SUPPORT_OF_CONTROL
endchoice

1.3.6:menuconfig 和 menu 很类似,但是 menuconfig 是个带选项的菜单,只有选中MODULES后,if和endif之间的内容才可见

 menuconfig MODULES 
  bool "menu_name" 3 if MODULES
  ...
 endif # MODULES

1.3.7:comment 用 于 注 释

 

 

 

uboot图形化配置浅析

标签:选中   depends   ons   name   conf   uboot   other   running   and   

原文地址:https://www.cnblogs.com/lzd626/p/11939066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!