Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
编译
使用这个方法编译的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到对应的版本上
- BSP版本、设备树、config文件对照表 / BSP version, device tree, config file cross reference table
- 在yocto中怎样查看内核、barebox等软件的版本 / yocto how to check kernel and barebox version
接下来就可以编译,在编译前,需要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 中查找 sd & mfgtools: phycore-imx8mm_defconfig fspi: phycore-imx8mm_fspi_defconfig 请注意启动时需要两个bootloader的会有两个defconfig,分别编译,如AM335x的MLO。Bootloader config phyCORE i.MX6 barebox imx_v7_defconfig phyCORE i.MX6ul barebox imx_v7_defconfig phyCORE AM335x barebox am335x_defconfig phyCORE AM335x MLO am335x_mlo_defconfig phyCORE RK3288 barebox rk3288_defconfig phyCORE RK3288 u-boot phycore-rk3288_defconfig phyCORE i.MX8M u-boot pcl066_defconfig phyCORE i.MX8MM u-boot
以下为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 Selection | AM335x平台适用,设为0 |
[*] Trace initcalls | 推荐开 |