buildroot构建项目(二)--- u-boot 2017.11 建立 2440 开发板
一、准备工作
在建立之前,先需要将下载的u-boot 拷贝一份出来解压,在此工程下进行更改和创建。同时根据前面搜索到的 mini2440开发板所在的版本,下载一份u-boot 拷贝出 mini2440 的工程文件。
选择2013.10版本的 u-boot。下载,并解压。
1.1 board 目录修改
u-boot-2013.10/board/samsung/smdk2410 复制进 u-boot-2017.11/board/samsung/ 目录
文件名修改:


Makefile 修改为:

创建 Kconfig 文件并修改:

1.2 头文件修改
u-boot-2013.10/include/configs/smdk2410.h 拷贝进 u-boot-2017.11//include/configs/mini2440.h

在头文件中添加对 S3C2440芯片的支持:

在2013.10版本中,执行命令:grep -R -l "smdk2410.h"
查找是否还有包含 smdk2410.h 文件
1.3 修改arch/arm下文件
1.3.1 修改Kconfig文件
当前新版的u-boot与linux源码一样,都执行make menuconfig 进行配置,所以在configs目录下要有mini2440的配置


1.3.2 修改arch/arm/include/asm/mach-types.h
mach-types.h 已经有了相关配置:




1.3.3 加入S3C24X0文件夹
u-boot-2013.10/arch/arm/cpu/arm920t/s3c24x0 复制进 u-boot-2017.11/arch/arm/cpu/arm920t/目录
1.4 修改 u-boot-2017.11/configs 下的defconfig文件
在新版本的 u-boot 中,并没有我们适用和仿照的配置文件。既然没有,那么我们执行 make menuconfig 在其中配置一份最小配置。
- Architecture select:架构,选择 ARM architecture
- ARM architecture:
- Target select:选择我们配置的开发板 mini2440
- 其余全不选中
- General setup:通用配置
- 选中 Configure standard U-boot features 即可,其余全不选。
- boot images 启动镜像,暂且默认
- API:默认不选中即可
- Boot timing:暂时默认
- Boot media:选中支持 NAND flash
- delay in seconds before automatically booting :启动延迟的时间,设置为5
- Enable boot arguments:使能启动命令参数,暂时不做修改,为空
- Console:默认
- Default fdt file:默认不填
- add U-Boot environment variable vers:默认不写
- Display information about the CPU during start up:选上
- Display information about the board during start up:选上
- Start-up hooks:里面是特殊板子的启动选项,默认不选
- Security support:编译的选项,暂时默认
- SPL / TPL:默认
- Command line interface:命令行接口,
- Support U-Boot commands:支持U-boot命令,选中
- Use hush shell:不选
- Shell prompt:命令行的类型,默认就好
- Autoboot options:自动启动选项,默认即可
- Info commands:命令信息,默认即可
- Boot commands:启动命令,暂时默认,后面可能裁剪一下
- Environment commands:环境变量命令,默认
- Memory commands :内存命令
- Compression commands:压缩命令
- Device access commands:设备到达命令,去掉 fpga,我们是ARM,加入nand命令,其他保持默认
- Shell scripting commands:SHELL脚本命令,默认
- Network commands:网络命令,暂且默认
- Misc commands:杂项命令,都去掉
- Power commands:电源命令,无
- Security commands:加密命令,不选
- Firmware commands:防火墙命令
- Filesystem commands:文件系统命令,默认不选
- Debug commands:调试命令,默认不选
- Enable UBI - Unsorted block images commands:镜像分块命令,默认不选
- Partition Types:磁盘类型,暂时默认
- Device Tree Control:设备树控制,默认都不选中即可
- Path to dtc binary for use within mkimage:dtc二进制文件路径,默认即可
- Environment:环境变量,默认即可
- Networking support:网络设备支持,默认即可
- Device Drivers:设备驱动,暂且默认
- File systems:文件系统支持,选择YAFFS2 filesystem support
- Library routines:库选择,默认即可
- Unit tests:单元测试,不选中
配置完后,保存编译一遍。
1.5 编译报错解决
1.5.1 config_cmd_default.h: No such file or directory
没有 config_cmd_default.h 文件,此文件中装载的是 U-BOOT中的一些命令。
注释掉头文件
1.5.2 lib/asm-offsets.c:1:0: error: bad value (armv4t) for -march= switch
一般是由于交叉编译工具链没有指定,在顶层的 Makefile 下加入交叉编译工具链。
1.5.3 重复定义的选项:
include/configs/mini2440.h:84:0: warning: "CONFIG_CMD_ELF" redefined
include/configs/mini2440.h:85:0: warning: "CONFIG_CMD_NAND" redefined
include/configs/mini2440.h:113:0: warning: "CONFIG_SYS_PROMPT" redefined
include/configs/mini2440.h:121:0: warning: "CONFIG_DISPLAY_CPUINFO" redefined
include/configs/mini2440.h:195:0: warning: "CONFIG_YAFFS2" redefined
这些选项在 config文件或者是 其他文件中都已经定义,先注释掉
1.5.4 scripts/Makefile.build:280: recipe for target 'cmd/reginfo.o' failed
cmd/reginfo.c:10:21: fatal error: asm/ppc.h: No such file or directory
#include <asm/ppc.h>
缺少文件。
追踪 reginfo.c 的源码

追踪到 asm/ppc.h 文件
需要宏控制,查找一下此宏在哪里定义的

注释掉:

1.5.5 cmd/ubi.c:79:44: error: ‘CONFIG_MTD_UBI_WL_THRESHOLD’ undeclared (first use in this function)

文件系统全部干掉,menuconfig中可配
1.5.6 drivers/rtc/s3c24x0_rtc.c:17:34: fatal error: asm/arch/s3c24x0_cpu.h: No such file or directory
#include <asm/arch/s3c24x0_cpu.h>
头文件未包含。
将文件同步过来即可
保存一下 .config 文件备份,然后 make distclean。再重新编译一遍。
1.5.7 common/built-in.o:(.rodata.init_sequence_f+0x20): undefined reference to `board_early_init_f'
common/built-in.o:(.rodata.init_sequence_f+0x4c): undefined reference to `dram_init'
common/built-in.o:(.data.init_sequence_r+0x24): undefined reference to `board_init'
查找函数,可以知道 这些函数在 board/samsung/mini2440/mini2440.c 文件中,查看编译的过程
mini2440.c文件并没有编译
修改里面的 board/samsung/mini2440/Makefile 文件为:

- obj-y = xxx.o:是最基本的赋值,make会将整个makefile展开后,再决定变量的值。也就是说,变量的值将会是整个makefile中最后被指定的值。
- obj-y := xxx.o:是覆盖之前的值,表示变量的值决定于它在makefile中的位置,而不是整个makefile展开后的最终值。
- obj-y ?= xxx.o:是如果没有被赋值过就赋予等号后面的值
- obj-y += xxx.o:是添加等号后面的值
在生成built-in.o的时候,如果使用:使 obj 的值为 lowlevel_init.o,覆盖了mini2440.c。
重新编译:board/samsung/mini2440/mini2440.c: In function ‘board_init’:
board/samsung/mini2440/mini2440.c:100:27: error: ‘MACH_TYPE_SMDK2410’ undeclared (first use in this function)
gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;

再重新编译,依然报错,找到原因是因为我们的 machine_arch_type 没有定义
再 arch/arm/include/asm/mach-types.h 中进行定义,加入如下配置:

文件头上加上:

在board/samsung/mini2440/mini2440.c中加入头文件:

编译,错误终结。
1.5.8 drivers/serial/built-in.o: In function `get_current': 和 drivers/serial/built-in.o: In function `serial_initialize':
/u-boot-2017.11/drivers/serial/serial.c:379: undefined reference to `default_serial_console'
/u-boot-2017.11/drivers/serial/serial.c:242: undefined reference to `default_serial_console'
查找当前版本和以前的版本进行对比:
当前版本:

以前的版本:

少一个文件: serial_s3c24x0.c,拷贝一份进去
cp ../../uboot/u-boot-2016.01/drivers/serial/serial_s3c24x0.c drivers/serial/serial_s3c24x0.c
修改 Makefile:

执行编译,错误消除。
1.5.9 env/built-in.o: In function `env_flash_save':
/u-boot-2017.11/env/flash.c:268: undefined reference to `flash_sect_protect'
/u-boot-2017.11/env/flash.c:303: undefined reference to `flash_sect_protect'
/env/flash.c:276: undefined reference to `flash_sect_erase'
/flash.c:280: undefined reference to `flash_write'
/env/flash.c:298: undefined reference to `flash_perror'
flash_sect_protect ,flash_sect_erase依赖于宏 CONFIG_MTD_NOR_FLASH 生效


menuconfig 中修改:
device drivers > mtd support:选中 norflash support
编译执行,错误消失
1.5.9 Error: You must add new CONFIG options using Kconfig
The following new ad-hoc CONFIG options were detected:
CONFIG_ARM920T
CONFIG_MINI2440
CONFIG_NAND_S3C2440
CONFIG_RTC_S3C24X0
CONFIG_S3C2440
CONFIG_S3C24X0
CONFIG_S3C24X0_SERIAL
CONFIG_SYS_HUSH_PARSER
CONFIG_SYS_S3C2440_NAND_HWECC
CONFIG_ZERO_BOOTDELAY_CHECK
Please add these via Kconfig instead. Find a suitable Kconfig
file and add a 'config' or 'menuconfig' option.
注释掉顶层 Makefile 中下面几句:

clean 之后编译。
编译完成,生成了 u-boot.bin.

buildroot构建项目(二)--- u-boot 2017.11 建立 2440 开发板的更多相关文章
- buildroot构建项目(一)---buildroot介绍
1.1 什么是buildroot Buildroot是Linux平台上一个构建嵌入式Linux系统的框架.整个Buildroot是由Makefile脚本和Kconfig配置文件构成的.你可以和编译Li ...
- buildroot构建项目(三)--- u-boot 2017.11 适配开发板修改 1
当前虽然编译成功了,但是对于我们自己的目标板并不太适用.还得做一系列得修改. 一.lds 文件分析 u-boot 中最重要得链接文件即是,u-boot.lds.我们可以查看我们编译出来得 u-boot ...
- buildroot构建项目(五)--- u-boot 2017.11 适配开发板修改 3 ---- 系统启动初始化之二
一.cpu_init_crit 当执行完时钟初始化后,程序执行: bl cpu_init_crit 跳转到CPU初始化处进行,在其中主要是执行 caches 的关闭 和 MMU的关闭,之后跳转到 ...
- buildroot构建项目(六)--- u-boot 2017.11 适配开发板修改 4 ---- 系统启动初始化之三
一.内存控制器 在关闭了MMU和caches 之后 就进入lowlevel_init 函数,对内存控制器进行初始化.lowlevel_init.S (board\samsung\mini2440) 1 ...
- buildroot构建项目(八)--- u-boot 2017.11 适配开发板修改 5 ---- 系统启动初始化之五
执行完 board_init_f 后,跳回到 crt0.S中继续执行汇编语言 ldr r0, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp, ...
- buildroot构建项目(七)--- u-boot 2017.11 适配开发板修改 4 ---- 系统启动初始化之四
设置完寄存器控制器后,则跳出cpu_init_crit,进入_main 函数.即进入crt0.S (arch\arm\lib) 跟着代码流程慢慢走 一.crt0.S 1.1 第一步执行代码 /* 预 ...
- buildroot构建项目(四)--- u-boot 2017.11 适配开发板修改 2 ---- 系统启动初始化之一
一.代码分析 上一节已经分析了链接文件,知道了首先代码是从 _start 开始,之后设置了中断向量表,然后从 start.s 开始运行. _start:vectors.S (arch\arm\lib) ...
- 项目二:企业级java电商网站开发(服务端)
声明:项目源于网络,支持正版教程,学习使用,仅记录在此 项目介绍 企业级java电商网站开发(服务端),模块划分:用户管理,商品管理,商品品类管理,订单管理,订单详情管理,购物车管理,收货地址管理,支 ...
- 【OpenWRT】【RT5350】【二】烧写OpenWrt到RT5350开发板
烧写bin文件到开发板的方式有很多种,我采用的是通过web页面直接上传文件的方式 首先通过浏览器登陆路由器(192.168.1.1),作者的开发板已经烧好了OpenWrt并且可以通过Luci登陆,所以 ...
随机推荐
- mouseover与mouseenter,mouseout与mouseleave的区别
mouseover事件:不论鼠标指针穿过被选元素或其子元素,都会触发 mouseover 事件,对应mouseout事件: mouseenter事件:只有在鼠标指针穿过被选元素时,才会触发 mouse ...
- JavaScript 教程 之基础教程
1.js 错误 var objClass = { foo:1, bar:2 }; function printf() { var aaa:objClass; aaa.foo = 2; console. ...
- docker--Dockerfile--java
# AlpineLinux with a glibc-2.26-r0 and Oracle Java 7FROM alpine:3.6 MAINTAINER Anastas Dancha <an ...
- 覆盖的面积 HDU - 1255(扫描线求面积交)
题意: 就是扫描线求面积交 解析: 参考求面积并.... 就是把down的判断条件改了一下..由w > 0 改为 w > 1 同时要讨论一下 == 1 时 的情况, 所以就要用到一个临时 ...
- Sabotage UVA - 10480 (输出割边)
题意:....emm...就是一个最小割最大流,.,...用dinic跑一遍.. 然后让你输出割边,就是 u为能从起点到达的点, v为不能从起点到达的点 最后在残余路径中用dfs跑一遍 能到达的路 ...
- bzoj 2120 数颜色 (带修莫队)
题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=2120 题意:两种操作:Q 询问区间 l - r 内颜色的种类 ,R 单点修改 思路 ...
- 集成源码深度剖析:Fescar x Spring Cloud
Fescar 简介 常见的分布式事务方式有基于 2PC 的 XA (e.g. atomikos),从业务层入手的 TCC( e.g. byteTCC).事务消息 ( e.g. RocketMQ Hal ...
- 架构师成长之路7.1 CDN理论
点击返回架构师成长之路 架构师成长之路7.1 CDN理论 CDN,Content Distribute Network,内容分发网络:CDN解决的是如何将数据快速可靠从源站传递到用户的问题.用户获取数 ...
- [luogu3505][bzoj2088][POI2010]TEL-Teleportation【分层图】
题目大意 给出了一个图,然后让你加最多的边,让点\(1\)到\(2\)之间至少要经过5条边 解法 比较清楚,我们可以将这个图看作一个分层图,点\(1\)为第一层,再将\(2\)作为第五层,这样第一层和 ...
- hadoop文件配置
伪分布式配置: core-site.xml <configuration> <property> <name>fs.defaultFS</name> & ...

