编译

使用这个方法编译的barebox会缺失一些环境变量,会导致如显示的设备树未开启,启动异常等问题,请参考如 meta-phytec barebox 环境配置 。因此请使用 在yocto中查找并修改软件源代码 / yocto how to find and modify the source for software packages 的方法。

barebox有编译的文档

https://www.barebox.org/doc/latest/user/barebox.html

barebox可以从以下链接得到:

https://git.phytec.de/barebox/

首先用git clone将代码下载到本地,然后checkout到对应的版本上

接下来就可以编译,在编译前,需要source sdk的environment(以imx6为例)

. (path to sdk)/environment-setup-cortexa9hf-neon-phytec-linux-gnueabi

然后需要export一个变量,这样告诉后边各种操作是针对arm平台的。

export ARCH=arm

然后

make help

接下来查找defconfig

你可以在yocto目录的 sources/meta-phytec/conf/machine/include 中查找

Bootloaderconfig
phyCORE i.MX6 bareboximx_v7_defconfig
phyCORE i.MX6ul bareboximx_v7_defconfig
phyCORE AM335x bareboxam335x_defconfig
phyCORE AM335x MLOam335x_mlo_defconfig
phyCORE RK3288 bareboxrk3288_defconfig
phyCORE RK3288 u-bootphycore-rk3288_defconfig
phyCORE i.MX8M u-bootpcl066_defconfig
phyCORE i.MX8MM u-boot

sd & mfgtools: phycore-imx8mm_defconfig

fspi: phycore-imx8mm_fspi_defconfig

请注意启动时需要两个bootloader的会有两个defconfig,分别编译,如AM335x的MLO。

以下为imx6为例

make imx_v7_defconfig

如果需要配置barebox的menuconfig,需要注意的是,这个不能在有sdk环境的shell中执行,否则会报ncurses lib的错误。下面这个指令执行前需要export ARCH=arm。

make menuconfig

然后需要修改一下LDFLAG,将"Wl,"去掉。否则后边会报错 WL flag不支持。

export LDFLAGS="-O1 --hash-style=gnu --as-needed"

然后

make

然后就会生成对应不同核心板的image在images/ 目录中。
文件名可以在meta-phytec这个layer中的conf/machine中查询:

首先在

BSP版本、设备树、config文件对照表 / BSP version, device tree, config file cross reference table

中确定你用的BSP版本对应的meta-phytec的tag,然后在https://git.phytec.de/meta-phytec/中切换到对应的tag,然后查看conf/machine/中对应的machine名称。

如 https://git.phytec.de/meta-phytec/tree/conf/machine/phyboard-segin-imx6ul-2.conf?h=2.2.2-phy5 这里的文件名就是 barebox-phytec-phycore-imx6ul-512mb.img。

增加debug信息

barebox默认的loglevel为7, 如果要增加更多的调试信息, 可以loglevel设置为8.

这个loglevel的修改是在barebox的menuconfig中的Debugging--> (7) default loglevel 中配置的.

选项解释与推荐设置
(8) compile loglevel设为8
(8) default loglevel设为8
[ ] enable debug symbols不需要开
[*] low level debug messages推荐开
(0) OMAP Debug UART Port SelectionAM335x平台适用,设为0
[*] Trace initcalls 推荐开


  • No labels