WhyCan Forum

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132, 微信: whycan_cn (哇酷网/挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2019-11-21 22:36:12

Gbear
会员
注册时间: 2019-11-15
累计积分: 13

学习笔记F1C100S之u-boot编译过程记录

本人纯属软件文盲,linux更文盲,本身做硬件设计的,对软件一窍不通 :) 自从掉到咱们论坛这个大坑后,翻贴无数,在此做一下记录,尽量多配截图,以方便后面的新手少走弯路,快速体验编译成功的小成就~ 高手勿喷高手勿喷高手勿喷~~~

由于是学习,所以采用了虚拟机安装ubuntu的方式,比较耐折腾,安装好后复制出来备份,需要重新安装系统的时候替换出来就可以了~
1、具体虚拟机安装ubuntu的过程在此不详细记录了,百度一堆一堆的。建议安装的时候断网,免得安装过程中下载插件。
2、安装好系统后,第一步先更新一下apt-get,具体命令是:

sudo apt-get update

备注:快速打开命令行的快捷键是Ctrl+Alt+t
更新apt-get
3、紧着接安装git工具,具体命令是:

sudo apt-get install git

安装git工具
4、获取编译工具,具体命令是:

mkdir f1c100s
cd f1c100s

以上是先建立了一个f1c100s的目录,然后进入f1c100s。也可以省去此步骤、没有影响。

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

获取编译工具
5、此时技巧来了,再次按Ctrl+Alt+t新建一个命令行窗口,拽取u-boot源码,具体命令是:

mkdir uboot
cd uboot

当然上面两行诗创建uboot目录和进入uboot目录的命令,可以省去,没有影响。

git clone https://github.com/Lichee-Pi/u-boot.git

拽取u-boot源码1
这时等待拽取源码或者获取编译工具结束,静静的等待 ·-· 。。。
6、其实我们还可以做点别的
根据坛友们的经验,尤其是晕哥的全志开发资料精华汇总, 持续更新 (******请大家继续补充********)LinjieGuo的尝试从零构建F1C100s开发环境

需要补充安装下面这些包,具体命令如下:

sudo apt-get install libncurses5-dev
sudo apt-get install device-tree-compiler
sudo apt-get install libncurses5-dev libncursesw5-dev
sudo apt-get install swig python-dev python3-dev

libncurses5-dev
device-tree-compiler
libncurses5-dev libncursesw5-dev
swig python-dev python3-dev

7、待获取编译环境的命令行窗口获取完毕后,安装vim编辑器,不装用vi也可以,具体命令是:

sudo apt install vim

我也搞不清楚什么时候用apt install什么时候用apt-get install,好像喵过一眼是说这是两个组合命令,get是获取,apt是安装,不作数,我这里糊涂着呢~
另外,不管你开了多少个命令行,貌似只能有一个apt-get运行,如果有运行中的apt-get再运行会报错。
vim
有关vim编辑器的使用自行百度补脑,不细说了~百度有很多。
8、解压编译环境,命令是:

tar -vxJf gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz

tar
9、拷贝编译环境到/opt/目录,也就是平常说的安装,命令是:

sudo cp -r ./gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi /opt/

cp
10、配置编译环境,添加path环境变量,具体方法是用vim打开/etc/目录下面的bash.bashrc,在末尾添加
PATH="$PATH:/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin",这一行,具体操作是运行sudo vim /etc/bash.bashrc命令
然后按光标向下按键移动显示内容到最后面一行,再按光标向右键,移动到行尾,这时按“i”键,转化为插入模式。输入PATH="$PATH:/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin"输入完后按ESC键,甭管显示什么,输入:wq保存退出即可。还是如前面提到的,具体怎么使用请百度。

sudo vim /etc/bash.bashrc

这里少截了一个图,借用后面更新source /etc/bash.bashrc命令的图吧~
bash
添加的内容是:

PATH="$PATH:/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin"

path
wq
最后运行更新命令,命令如下:

source /etc/bash.bashrc

bash
小试一下gcc是否正常,使用gcc显示版本号的方式测试安装是否正常,出来一堆,反正我看不懂~~~
命令是:

arm-linux-gnueabi-gcc -v

gcc
自此整个编译环境获取、配置完毕。嗷嗷嗷,忘记说了,觉得有必要提醒一下,
从步骤7开始,都是在最开始打开的那个窗口或者说是步骤4哪里的那个窗口才可以完成的。
也许在其他窗口执行会有问题。

11、关闭所有的命令行窗口,按Ctrl+Alt+t重新打开一个窗口(因为之前分开三个窗口操作,为了节省时间),
命令行窗口之间操作的内容比如安装了XX,是不会过度到操作窗口以外的,除非是后面新打开的命令行窗口,不严谨的描述~高手勿喷!
正题:进入uboot目录,在进入u-boot目录,反正最终你找的u-boot目录,进去就OK了,运行git branch -a查看分支。具体命令是:

cd uboot
cd u-boot
git branch -a

gitbranch
选择nano-v2018.01分支,命令是:

git checkout nano-v2018.01

nano2018

12、开始编译咯,运行命令make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_spiflash_defconfig指定配置信息

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_spiflash_defconfig

makearch1.jpg
可视化配置,具体怎么配置坛内或者百度搜吧,我也不造~

make ARCH=arm menuconfig

menuconfig

正式开始编译,运行命令如下:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j1

make_ok
顺利编译
makels
其中末尾的J1是因为我电脑配置低,只分配给了虚拟机一个处理器,只有一个核心,可根据具体实际情况更改,核心数量越多编译越快。四核就是J4,J8都是土豪~~~~~

离线

#2 2019-11-21 23:14:29

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,491

Re: 学习笔记F1C100S之u-boot编译过程记录

太好了, 感谢有你这么认真的朋友!

离线

#3 2019-11-21 23:25:09

Gbear
会员
注册时间: 2019-11-15
累计积分: 13

Re: 学习笔记F1C100S之u-boot编译过程记录

晕哥 说:

太好了, 感谢有你这么认真的朋友!

坛友们都做了好多贡献,我吸取了论坛的资源,怎么好不做点贡献 yikes

离线

#4 2019-11-21 23:28:24

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,491

Re: 学习笔记F1C100S之u-boot编译过程记录

Gbear 说:

坛友们都做了好多贡献,我吸取了论坛的资源,怎么好不做点贡献 yikes

互相学习,共同进步.

离线

#5 2019-11-22 08:28:41

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,491

Re: 学习笔记F1C100S之u-boot编译过程记录

离线

#6 2019-11-24 01:27:36

达克罗德
会员
注册时间: 2018-04-10
累计积分: 645

Re: 学习笔记F1C100S之u-boot编译过程记录

./tools/mkimage: Can't map u-boot.img: Invalid argument
Makefile:1021: recipe for target 'u-boot.img' failed
make: *** [u-boot.img] Error 1
make: *** Waiting for unfinished jobs....
  CC      spl/arch/arm/cpu/arm926ejs/cpu.o
  CC      spl/arch/arm/mach-sunxi/board.o
  CC      spl/arch/arm/cpu/arm926ejs/cache.o
  CC      spl/arch/arm/mach-sunxi/clock.o
  CC      spl/arch/arm/cpu/arm926ejs/sunxi/timer.o
  CC      spl/arch/arm/mach-sunxi/cpu_info.o
  AS      spl/arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.o
  AS      spl/arch/arm/cpu/arm926ejs/sunxi/fel_utils.o
  LD      spl/arch/arm/cpu/arm926ejs/sunxi/built-in.o
  CC      spl/arch/arm/mach-sunxi/dram_helpers.o
  AS      spl/arch/arm/cpu/arm926ejs/start.o
  LD      spl/arch/arm/cpu/arm926ejs/built-in.o
  LD      spl/arch/arm/cpu/built-in.o
  AS      spl/arch/arm/lib/vectors.o
  AS      spl/arch/arm/lib/crt0.o
  CC      spl/arch/arm/mach-sunxi/pinmux.o
  AS      spl/arch/arm/lib/setjmp.o
  CC      spl/arch/arm/lib/spl.o
  CC      spl/arch/arm/lib/zimage.o
  CC      spl/arch/arm/mach-sunxi/usb_phy.o
  CC      spl/arch/arm/lib/bootm-fdt.o
  CC      spl/arch/arm/mach-sunxi/clock_sun6i.o
  AS      spl/arch/arm/lib/memset.o
  AS      spl/arch/arm/lib/memcpy.o
  CC      spl/arch/arm/lib/sections.o
  CC      spl/arch/arm/lib/stack.o
  CC      spl/arch/arm/mach-sunxi/dram_suniv.o
  CC      spl/arch/arm/lib/interrupts.o
  LD      spl/arch/arm/mach-sunxi/built-in.o
  CC      spl/arch/arm/lib/reset.o
  CC      spl/arch/arm/lib/cache.o
  CC      spl/board/sunxi/board.o
  CC      spl/arch/arm/lib/cache-cp15.o
  CC      spl/arch/arm/lib/psci-dt.o
  LD      spl/board/sunxi/built-in.o
  CC      spl/common/spl/spl.o
  AS      spl/arch/arm/lib/ashldi3.o
  AS      spl/arch/arm/lib/ashrdi3.o
  CC      spl/arch/arm/lib/div0.o
  AS      spl/arch/arm/lib/div64.o
  AS      spl/arch/arm/lib/lib1funcs.o
  AS      spl/arch/arm/lib/lshrdi3.o
  AS      spl/arch/arm/lib/muldi3.o
  AS      spl/arch/arm/lib/uldivmod.o
  CC      spl/common/spl/spl_mmc.o
  CC      spl/arch/arm/lib/eabi_compat.o
  AS      spl/arch/arm/lib/crt0_arm_efi.o
  CC      spl/arch/arm/lib/reloc_arm_efi.o
  LD      spl/common/spl/built-in.o
  CC      spl/common/init/board_init.o
  LD      spl/arch/arm/lib/built-in.o
  AR      spl/arch/arm/lib/lib.a
  CC      spl/common/console.o
  LD      spl/common/init/built-in.o
  CC      spl/common/dlmalloc.o
  CC      spl/common/malloc_simple.o
  CC      spl/common/image.o
  CC      spl/cmd/nvedit.o
  LD      spl/cmd/built-in.o
  CC      spl/common/memsize.o
  CC      spl/env/common.o
  CC      spl/common/stdio.o
  CC      spl/env/env.o
  CC      spl/common/cli.o
  LD      spl/env/built-in.o
  CC      spl/common/command.o
  CC      spl/common/s_record.o
  CC      spl/common/xyzModem.o
  CC      spl/lib/hashtable.o
  LD      spl/common/built-in.o
  CC      spl/disk/part.o
  CC      spl/lib/errno.o
  CC      spl/lib/display_options.o
  CC      spl/disk/part_dos.o
  CC      spl/lib/crc32.o
  CC      spl/disk/part_iso.o
  CC      spl/lib/ctype.o
  CC      spl/lib/div64.o
  CC      spl/disk/part_efi.o
  CC      spl/lib/hang.o
  CC      spl/lib/linux_compat.o
  CC      spl/lib/linux_string.o
  LD      spl/disk/built-in.o
  CC      spl/lib/membuff.o
  CC      spl/lib/string.o
  CC      spl/lib/tables_csum.o
  CC      spl/drivers/block/blk_legacy.o
  CC      spl/lib/time.o
  LD      spl/drivers/block/built-in.o
  CC      spl/drivers/gpio/sunxi_gpio.o
  CC      spl/lib/uuid.o
  LD      spl/drivers/gpio/built-in.o
  CC      spl/drivers/mmc/mmc.o
  CC      spl/lib/rand.o
  CC      spl/lib/tiny-printf.o
  CC      spl/lib/panic.o
  CC      spl/drivers/mmc/mmc_legacy.o
  CC      spl/lib/strto.o
  CC      spl/drivers/mmc/sunxi_mmc.o
  LD      spl/lib/built-in.o
  LD      spl/dts/built-in.o
  CC      spl/fs/fs_internal.o
  LD      spl/drivers/mmc/built-in.o
  LD      spl/drivers/power/built-in.o
  LD      spl/fs/built-in.o
  LD      spl/drivers/power/pmic/built-in.o
  LDS     spl/u-boot-spl.lds
  LD      spl/drivers/power/regulator/built-in.o
  CC      spl/drivers/serial/serial.o
  CC      spl/drivers/serial/serial_ns16550.o
  CC      spl/drivers/serial/ns16550.o
  LD      spl/drivers/serial/built-in.o
  LD      spl/drivers/built-in.o
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  COPY    spl/u-boot-spl.bin
  MKSUNXI spl/sunxi-spl.bin
make: *** wait: No child processes.  Stop.

我编的TF卡版本的,mkimage报错,谁知道怎么回事

离线

#7 2019-11-24 20:46:50

sblpp
会员
注册时间: 2018-02-14
累计积分: 62

Re: 学习笔记F1C100S之u-boot编译过程记录

达克罗德 说:
./tools/mkimage: Can't map u-boot.img: Invalid argument
Makefile:1021: recipe for target 'u-boot.img' failed
make: *** [u-boot.img] Error 1
make: *** Waiting for unfinished jobs....
  CC      spl/arch/arm/cpu/arm926ejs/cpu.o
  CC      spl/arch/arm/mach-sunxi/board.o
  CC      spl/arch/arm/cpu/arm926ejs/cache.o
  CC      spl/arch/arm/mach-sunxi/clock.o
  CC      spl/arch/arm/cpu/arm926ejs/sunxi/timer.o
  CC      spl/arch/arm/mach-sunxi/cpu_info.o
  AS      spl/arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.o
  AS      spl/arch/arm/cpu/arm926ejs/sunxi/fel_utils.o
  LD      spl/arch/arm/cpu/arm926ejs/sunxi/built-in.o
  CC      spl/arch/arm/mach-sunxi/dram_helpers.o
  AS      spl/arch/arm/cpu/arm926ejs/start.o
  LD      spl/arch/arm/cpu/arm926ejs/built-in.o
  LD      spl/arch/arm/cpu/built-in.o
  AS      spl/arch/arm/lib/vectors.o
  AS      spl/arch/arm/lib/crt0.o
  CC      spl/arch/arm/mach-sunxi/pinmux.o
  AS      spl/arch/arm/lib/setjmp.o
  CC      spl/arch/arm/lib/spl.o
  CC      spl/arch/arm/lib/zimage.o
  CC      spl/arch/arm/mach-sunxi/usb_phy.o
  CC      spl/arch/arm/lib/bootm-fdt.o
  CC      spl/arch/arm/mach-sunxi/clock_sun6i.o
  AS      spl/arch/arm/lib/memset.o
  AS      spl/arch/arm/lib/memcpy.o
  CC      spl/arch/arm/lib/sections.o
  CC      spl/arch/arm/lib/stack.o
  CC      spl/arch/arm/mach-sunxi/dram_suniv.o
  CC      spl/arch/arm/lib/interrupts.o
  LD      spl/arch/arm/mach-sunxi/built-in.o
  CC      spl/arch/arm/lib/reset.o
  CC      spl/arch/arm/lib/cache.o
  CC      spl/board/sunxi/board.o
  CC      spl/arch/arm/lib/cache-cp15.o
  CC      spl/arch/arm/lib/psci-dt.o
  LD      spl/board/sunxi/built-in.o
  CC      spl/common/spl/spl.o
  AS      spl/arch/arm/lib/ashldi3.o
  AS      spl/arch/arm/lib/ashrdi3.o
  CC      spl/arch/arm/lib/div0.o
  AS      spl/arch/arm/lib/div64.o
  AS      spl/arch/arm/lib/lib1funcs.o
  AS      spl/arch/arm/lib/lshrdi3.o
  AS      spl/arch/arm/lib/muldi3.o
  AS      spl/arch/arm/lib/uldivmod.o
  CC      spl/common/spl/spl_mmc.o
  CC      spl/arch/arm/lib/eabi_compat.o
  AS      spl/arch/arm/lib/crt0_arm_efi.o
  CC      spl/arch/arm/lib/reloc_arm_efi.o
  LD      spl/common/spl/built-in.o
  CC      spl/common/init/board_init.o
  LD      spl/arch/arm/lib/built-in.o
  AR      spl/arch/arm/lib/lib.a
  CC      spl/common/console.o
  LD      spl/common/init/built-in.o
  CC      spl/common/dlmalloc.o
  CC      spl/common/malloc_simple.o
  CC      spl/common/image.o
  CC      spl/cmd/nvedit.o
  LD      spl/cmd/built-in.o
  CC      spl/common/memsize.o
  CC      spl/env/common.o
  CC      spl/common/stdio.o
  CC      spl/env/env.o
  CC      spl/common/cli.o
  LD      spl/env/built-in.o
  CC      spl/common/command.o
  CC      spl/common/s_record.o
  CC      spl/common/xyzModem.o
  CC      spl/lib/hashtable.o
  LD      spl/common/built-in.o
  CC      spl/disk/part.o
  CC      spl/lib/errno.o
  CC      spl/lib/display_options.o
  CC      spl/disk/part_dos.o
  CC      spl/lib/crc32.o
  CC      spl/disk/part_iso.o
  CC      spl/lib/ctype.o
  CC      spl/lib/div64.o
  CC      spl/disk/part_efi.o
  CC      spl/lib/hang.o
  CC      spl/lib/linux_compat.o
  CC      spl/lib/linux_string.o
  LD      spl/disk/built-in.o
  CC      spl/lib/membuff.o
  CC      spl/lib/string.o
  CC      spl/lib/tables_csum.o
  CC      spl/drivers/block/blk_legacy.o
  CC      spl/lib/time.o
  LD      spl/drivers/block/built-in.o
  CC      spl/drivers/gpio/sunxi_gpio.o
  CC      spl/lib/uuid.o
  LD      spl/drivers/gpio/built-in.o
  CC      spl/drivers/mmc/mmc.o
  CC      spl/lib/rand.o
  CC      spl/lib/tiny-printf.o
  CC      spl/lib/panic.o
  CC      spl/drivers/mmc/mmc_legacy.o
  CC      spl/lib/strto.o
  CC      spl/drivers/mmc/sunxi_mmc.o
  LD      spl/lib/built-in.o
  LD      spl/dts/built-in.o
  CC      spl/fs/fs_internal.o
  LD      spl/drivers/mmc/built-in.o
  LD      spl/drivers/power/built-in.o
  LD      spl/fs/built-in.o
  LD      spl/drivers/power/pmic/built-in.o
  LDS     spl/u-boot-spl.lds
  LD      spl/drivers/power/regulator/built-in.o
  CC      spl/drivers/serial/serial.o
  CC      spl/drivers/serial/serial_ns16550.o
  CC      spl/drivers/serial/ns16550.o
  LD      spl/drivers/serial/built-in.o
  LD      spl/drivers/built-in.o
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  COPY    spl/u-boot-spl.bin
  MKSUNXI spl/sunxi-spl.bin
make: *** wait: No child processes.  Stop.

我编的TF卡版本的,mkimage报错,谁知道怎么回事

TF卡版本编译是使用make licheepi_nano_defconfig吗?
我编译没问题,但是搞进去没任何反应...

离线

#8 2019-11-26 15:52:04

liopen88
会员
注册时间: 2019-11-19
累计积分: 2

Re: 学习笔记F1C100S之u-boot编译过程记录

你好,你这边跑起来了吗?nano

离线

#9 2019-11-26 16:43:56

达克罗德
会员
注册时间: 2018-04-10
累计积分: 645

Re: 学习笔记F1C100S之u-boot编译过程记录

sblpp 说:

TF卡版本编译是使用make licheepi_nano_defconfig吗?
我编译没问题,但是搞进去没任何反应...

要把所有分区都删除,然后再烧uboot

最近编辑记录 达克罗德 (2019-11-26 16:44:14)

离线

页脚