f1c200s

您所在的位置:网站首页 linux移植到f1c200s f1c200s

f1c200s

2024-07-06 03:45| 来源: 网络整理| 查看: 265

目录 前言安装必要工具安装交叉编译链工具 下载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

由于官方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 ..

在这里插入图片描述

配置Uboot 修改Makefile vim Makefile

输入/CROSS_COMPILE定位到修改的位置,如果用别的编辑器修改,大概在246行,修改为如下内容:

ARCH?=arm CROSS_COMPILE?=arm-linux-gnueabi-

修改前: 在这里插入图片描述 修改后:在这里插入图片描述

配置文件 make licheepi_nano_spiflash_defconfig make menuconfig

需要在menuconfig里面配置成如图这样就可以,当然如果你是高手也可以自己配置

在这里插入图片描述 boot arguments参数:

console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw

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相对应的目录 在这里插入图片描述 执行下列命令后进行python测试:

cp /usr/bin/python3 /usr/bin/python

在这里插入图片描述 重新编译:

make -j8 出现multiple definition of `yylloc’错误

错误具体详细如下:

/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-parser.tab.c的定义后如下图: 在这里插入图片描述 重新编译:

make -j8 出现FATAL ERROR: Unable to parse input tree错误

具体错误详情如下:

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

在这里插入图片描述 删除斜杠后: 在这里插入图片描述 重新编译:

make -j8 出现/usr/bin/env: ‘python2’: No such file or directory错误

具体出错信息:

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输出: ![在这里插入图片描述](https://img-blog.csdnimg.cn/e8e38bb908bd414983c902f9c4283450.png

快速搭建 修改后的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