uboot2014.10移植(一)
最新有点时间,所以想折腾点东西,于是拿起了几年前的TQ2440玩玩,下载了uboot2014.10版本,准备移植到板子上去,没想到折腾环境都折腾了一下午。
1.工具链安装
我的工具链直接用命令安装的:
sudo apt-get install arm-linux-gnueabi
安装完之后测试下:
k@localhost ~/w/0/uboot2014.10> arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/5/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-armel-cross/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-armel-cross --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-armel-cross --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libgcj --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv5t --with-float=soft --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4)
2.修改顶层makefile:
ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif 修改成:
ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?= arm-linux-gnueabi-
endif
默认的configs文件在comfgs/目录下,于是直接运行以下命令:
k@localhost ~/w//uboot2014.> make smdk2410_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:::
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c::: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
jump->offset = strlen(r->s);
^
scripts/kconfig/menu.c::: note: ‘jump’ was declared here
struct jump_key *jump;
^
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
k@localhost ~/w//uboot2014.> make
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
cc1: error: bad value (armv4) for -march= switch
/home/k/work/-uboot/uboot2014./scripts/Makefile.autoconf:: recipe for target 'include/autoconf.mk' failed
make[]: *** [include/autoconf.mk] Error
/home/k/work/-uboot/uboot2014./Makefile:: recipe for target 'silentoldconfig' failed
make[]: *** [silentoldconfig] Error
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
k@localhost ~/w//uboot2014.>
猜测是ifeq那个判断不成立,所以导致工具链没有指定,所以我用下面命令执行:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
也可以修改Makefile如下:
ARCH = arm
CROSS_COMPILE ?= arm-linux-gnueabi- ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif
在那个判断语句上面制定ARCH和CROSS_COMPILE,保存退出然后直接make也可以的。
这次编译没问题,但又出现include/linux/compiler-gcc.h:106:30: fatal error: linux/compiler-gcc5.h:No such file or directory的错误,原因是ubuntu的版本太高了,网上下载不到这个文件,也有人提出了其它的处理方式,我是直接执行下面命令:
k@localhost ~/w//uboot2014.> cd include/linux/
k@localhost ~/w//u/i/linux> cp compiler-gcc4.h compiler-gcc5.h
再次执行make,运行又有地方报错:
arch/arm/lib/board.c::: error: ‘coloured_LED_init’ aliased to external symbol ‘__coloured_LED_init’
void coloured_LED_init(void)__attribute__((weak, alias("__coloured_LED_init")));
^
arch/arm/lib/board.c::: error: ‘blue_led_off’ aliased to external symbol ‘__blue_led_off’
void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
^
arch/arm/lib/board.c::: error: ‘blue_led_on’ aliased to external symbol ‘__blue_led_on’
void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
^
arch/arm/lib/board.c::: error: ‘yellow_led_off’ aliased to external symbol ‘__yellow_led_off’
void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
^
arch/arm/lib/board.c::: error: ‘yellow_led_on’ aliased to external symbol ‘__yellow_led_on’
void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
^
arch/arm/lib/board.c::: error: ‘green_led_off’ aliased to external symbol ‘__green_led_off’
void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
^
arch/arm/lib/board.c::: error: ‘green_led_on’ aliased to external symbol ‘__green_led_on’
void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
^
arch/arm/lib/board.c::: error: ‘red_led_off’ aliased to external symbol ‘__red_led_off’
void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
^
arch/arm/lib/board.c::: error: ‘red_led_on’ aliased to external symbol ‘__red_led_on’
void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
^
scripts/Makefile.build:: recipe for target 'arch/arm/lib/board.o' failed
make[]: *** [arch/arm/lib/board.o] Error
Makefile:: recipe for target 'arch/arm/lib' failed
make: *** [arch/arm/lib] Error
这是因为内联函数不能为weak属性,直接将这些函数注释掉算了:
inline void __coloured_LED_init(void) {}
//void coloured_LED_init(void)__attribute__((weak, alias("__coloured_LED_init")));
inline void __red_led_on(void) {}
//void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
inline void __red_led_off(void) {}
//void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
inline void __green_led_on(void) {}
//void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
inline void __green_led_off(void) {}
//void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
inline void __yellow_led_on(void) {}
//void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
inline void __yellow_led_off(void) {}
//void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
inline void __blue_led_on(void) {}
//void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
inline void __blue_led_off(void) {}
//void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
再次make
arch/arm/lib/built-in.o: In function `clbss_l':
/home/k/work/-uboot/uboot2014./arch/arm/lib/crt0.S:: undefined reference to `coloured_LED_init'
/home/k/work/-uboot/uboot2014./arch/arm/lib/crt0.S:: undefined reference to `red_led_on'
arm-linux-gnueabi-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.26. assertion fail ../../bfd/elf32-arm.c:
arm-linux-gnueabi-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.26. assertion fail ../../bfd/elf32-arm.c:
arm-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script
arm-linux-gnueabi-ld.bfd: final link failed: Invalid operation
Makefile:: recipe for target 'u-boot' failed
make: *** [u-boot] Error
刚才将函数注释掉了,现在当然报错了。
# bl coloured_LED_init
# bl red_led_on
直接注释掉了。
再次make,终于没问题了。
uboot2014.10移植(一)的更多相关文章
- AM335x(TQ335x)学习笔记——u-boot-2014.10移植
根据最近移植u-boot-2014.10至TQ335x,基于这样的假设am335x evm移植.不是很多地方需要改变. 因为TI的am335x evm开发了使用eeprom船上保存配置信息.它使用不同 ...
- u-boot-2012.10移植到AT91RM9200(包括NAND FLASH)
基于中嵌SRM9204 目 录 1 配置 1.1修改顶层Makefile(可选) 1.2配置 1.3下载.运行.测试 2 修改内存配置参数(根据芯片手册修改) 2.1 修改配置参数 2.2 编译 2 ...
- u-boot-2014.04移植FL2440(使用eclipse编辑uboot)
1.首先安装eclipse 安装指令 : apt-get install eclipse 使用上面的命令会安装好jdk 和eclipse,eclipse必须在Java环境执行,所以须要安装jdk环境. ...
- u-boot-2015.01在tq2440上的初步移植
作者: 彭东林 邮箱: pengdonglin137@163.com QQ: 405728433 开发板: tq2440 工具: Win7 + VMware + Debian6 ...
- tr069开源协议EasyCwmp移植
1.平台MT7628 2.交叉编译器及版本信息mipsel-linux + buildroot-gcc463_32bits.tar.bz2 3.创建工作目录lancer@ubuntu:~$ mkdir ...
- AM335x(TQ335x)学习笔记——挂载Ramdisk
上篇文章中我们已经能够通过u-boot启动内核了,但是没有能够启动成功,从内核的log中可以看出,内核启动失败的原因是没有挂载到root文件系统,本文将使用busybox制作根文件系统并打包成ramd ...
- Ubuntu16.04交叉工具链安装
前言: 开发环境是64位的ubuntu16.04,交叉工具链是通过sudo apt-get install ....安装的,移植uboot2014.10,但是很奇怪,按照网上的介绍在start.s里面 ...
- pscp使用详解 Windows与Linux文件互传工具
pscp使用详解 Windows与Linux文件互传工具 pscp使用方法详解:pscp是putty安装包所带的远程文件传输工具,是一款十分常见windows与linux系统之间文件互传的工具,使用方 ...
- u-boot ctr0.S详解 包含_main函数
/** ****************************************************************************** * @author Maox ...
随机推荐
- laravel中使一段文字,限制长度,并且超出部分使用指定内容代替
{{str_limit($post->content,100,'....')}} 文字内容超出100个字,就用省略号显示
- learning ddr mode reigsters
For application flexibility, various functions, features, and modes are programmable in four Mode Re ...
- Android Studio2.1版本后使用虚拟机碰见的问题总结以及其他问题
一.androidstudio的sdk配置问题 如果点击Start a new Android Studio project是没有反应的,并且在Configure下面的SDK Manager是灰色的, ...
- 在学习DRF之前
学习DRF之前~~~ 在学习DRF之前~我们要先复习一些知识点~~ FBV和CBV 学习Django的时候~我们已经学习过了CBV以及FBV~~我们来复习一下~~ 什么是FBV和CBV呢~~ FB ...
- Cracking The Coding Interview 5.5
#include <iostream> #include <vector> using namespace std; int getNum1(int N) { int num= ...
- Cracking The Coding Interview2.3
#include <iostream> #include <string> using namespace std; class linklist { private: cla ...
- Lookaside
频繁申请和回收内存,会导致在内存上产生大量的内存碎片,从而导致最终无法申请内存.DDK提供了Lookaside结构来解决这个问题.可以将Lookaside结构想象成一个内存容器.在初始的时候,它先向W ...
- CentOS7安装Nginx及配置
Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttpd具有占有内存少,稳定性高等优势.**它最常的用途是提供反向代理服务.** 安装 在Centos下,yum源不 ...
- socket 编程通信实例
socket 编程通信实例:TCPserver: , ServerThread, ; WSADATA wsaData; ,), ; } ; } } ; g ...
- redis 解析配置文件
在redis安装文件夹里面有redis.conf,查看配置. 一:基础配置介绍 1.units(单位) --这里可以看到 1k和1kb是不一样的, units 这里单位是不区分大小写的,are al ...