f1c200s |
您所在的位置:网站首页 › linux移植到f1c200s › f1c200s |
目录
前言安装必要工具安装交叉编译链工具
下载Uboot切换分支查看配置文件
配置Uboot修改Makefile配置文件
编译uboot出现/bin/sh: 1: python: not found错误出现multiple definition of `yylloc'错误出现FATAL ERROR: Unable to parse input tree错误出现/usr/bin/env: 'python2': No such file or directory错误出现ImportError: No module named _libfdt的错误出现scripts/dtc/pylibfdt/libfdt_wrap.c:154:11: fatal error: Python.h: No such file or directory错误
烧录快速搭建修改后的Uboot快速部署环境的Docker镜像
前言
本章所解决问题后的Uboot仓库、docker镜像可在文章末尾找到,如果不想一步步配置编译环境可到文章末尾下载docker镜像直接运行 安装必要工具 sudo apt update sudo apt upgrade sudo apt-get install git vim wget sudo apt-get install xz-utils nano unzip build-essential bc swig libncurses5-dev libpython3-dev libssl-dev pkg-config zlib1g-dev libusb-dev libusb-1.0-0-dev python3-pip gawk bison flex 安装交叉编译链工具下载交叉编译链: wget http://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabi/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz解压交叉编译链: mkdir /usr/local/arm tar -vxf gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz -C /usr/local/arm配置环境变量: vim ~/.bashrc打开后在文件最后一行添加以下变量: export PATH=$PATH:/usr/local/arm/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin生效环境变量: source ~/.bashrc查询版本确保安装无误: arm-linux-gnueabi-gcc -v由于官方Uboot并没有对f1c200s有支持,所以我们使用基于licheepi的Uboot进行编译和后续的开发工作 git clone https://github.com/Lichee-Pi/u-boot.git cd u-boot 切换分支 git checkout nano-v2018.01进入configs目录查看配置文件,可以看到有两个配置文件,一个是带spiflash的一个是不带的,根据自己需求选择 cd configs && find -name "*lichee*" && cd ..输入/CROSS_COMPILE定位到修改的位置,如果用别的编辑器修改,大概在246行,修改为如下内容: ARCH?=arm CROSS_COMPILE?=arm-linux-gnueabi-修改前: 需要在menuconfig里面配置成如图这样就可以,当然如果你是高手也可以自己配置
boot cmd参数: load mmc 0:1 0x80008000 zImage;load mmc 0:1 0x80c08000 suniv-f1c100s-licheepi-nano.dtb;bootz 0x80008000 - 0x80c08000;保存并退出写入到.config中 编译uboot make -j8 出现/bin/sh: 1: python: not found错误具体出错细节如下: /bin/sh: 1: python: not found make[3]: *** [scripts/dtc/pylibfdt/Makefile:26: scripts/dtc/pylibfdt/_libfdt.so] Error 127 HOSTCC scripts/dtc/checks.o make[2]: *** [scripts/Makefile.build:425: scripts/dtc/pylibfdt] Error 2 make[2]: *** Waiting for unfinished jobs.... HOSTCC scripts/dtc/util.o CHK include/config.h CFG u-boot.cfg CHK include/generated/version_autogenerated.h CC lib/asm-offsets.s CC arch/arm/lib/asm-offsets.s CHK include/generated/generic-asm-offsets.h CHK include/generated/asm-offsets.h make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2 make: *** [Makefile:493: scripts] Error 2经过测试我们只有python3,没有python,并且找到了python3相对应的目录
错误具体详细如下: /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here /workspace/u-boot/scripts/dtc/pylibfdt/setup.py:21: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup, Extension collect2: error: ld returned 1 exit status make[2]: *** [scripts/Makefile.host:108: scripts/dtc/dtc] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2 make: *** [Makefile:493: scripts] Error 2 make: *** Waiting for unfinished jobs....看起来是yylloc这个变量重复定义了,具体目录看起来应该是在scripts/dtc/文件夹下的dtc-lexer.lex.c下第一次定义了yylloc变量然后又在别的c文件定义了yylloc变量,输入以下命令进行查找 cd scripts/dtc/ && grep -nR yylloc果然,在dtc-parser.tab.c的1205行和dtc-lexer.lex.c的634行出现了多重定义,由于编译器提示dtc-lexer.lex.c是第一次定义,所以我们去注释dtc-parser.tab.c的定义 具体错误详情如下: DTC arch/arm/dts/suniv-f1c100s-licheepi-nano.dtb Error: arch/arm/dts/.suniv-f1c100s-licheepi-nano.dtb.pre.tmp:59.1-10 syntax error FATAL ERROR: Unable to parse input tree make[2]: *** [scripts/Makefile.lib:329: arch/arm/dts/suniv-f1c100s-licheepi-nano.dtb] Error 1 make[1]: *** [dts/Makefile:51: arch/arm/dts/suniv-f1c100s-licheepi-nano.dtb] Error 2 make: *** [Makefile:878: dts/dt.dtb] Error 2看起来是设备树的问题,这里也是困扰我最久的地方 进入scrpit文件夹,修改Makefile.lib的第321行,多了个斜杠,紫色选中为多的那个斜杠 cd scripts vim Makefile.lib
具体出错信息: BINMAN u-boot-sunxi-with-spl.bin /usr/bin/env: 'python2': No such file or directory make: *** [Makefile:1150: u-boot-sunxi-with-spl.bin] Error 127看起来没安装python2,安装一下 sudo apt-get install python2重新编译 make -j8 出现ImportError: No module named _libfdt的错误具体报错信息如下: Traceback (most recent call last): File "./tools/binman/binman", line 32, in import control File "/workspace/u-boot/tools/binman/control.py", line 16, in import fdt File "/workspace/u-boot/tools/binman/../dtoc/fdt.py", line 13, in import libfdt File "scripts/dtc/pylibfdt/libfdt.py", line 15, in import _libfdt ImportError: No module named _libfdt看起来我们之前无脑的把python3拷贝为python的方法是错误的,他的脚本用python2写的,与python3兼容性并不好,一些库已经不再支持,我们切换回python2 cp /usr/bin/python2 /usr/bin/python重新编译: make -j8 出现scripts/dtc/pylibfdt/libfdt_wrap.c:154:11: fatal error: Python.h: No such file or directory错误具体出错信息如下: CHK include/generated/asm-offsets.h scripts/dtc/pylibfdt/libfdt_wrap.c:154:11: fatal error: Python.h: No such file or directory 154 | # include | ^~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 make[3]: *** [scripts/dtc/pylibfdt/Makefile:26: scripts/dtc/pylibfdt/_libfdt.so] Error 1 make[2]: *** [scripts/Makefile.build:425: scripts/dtc/pylibfdt] Error 2 make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2 make: *** [Makefile:493: scripts] Error 2应该是python2的dev没有安装,安装试一下 sudo apt-get install python2-dev重新编译: make -j8编译成功,出现u-boot-sunxi-with-spl.bin文件 在芯片进入fel模式后,通过sunxi-tools进行烧录(单次,仅验证) 具体安装与使用参考:传送门 sudo sunxi-fel uboot u-boot-sunxi-with-spl.bin可以看到连接了芯片串口的设备有以下Uboot输出: Github: https://github.com/JiangLin998/licheepi-nano-u-boot Gitee:https://gitee.com/jianglin998/licheepi-nano-u-boot 快速部署环境的Docker镜像Docker镜像:https://github.com/JiangLin998/dockerImages |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |