最新有点时间,所以想折腾点东西,于是拿起了几年前的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移植(一)的更多相关文章

  1. AM335x(TQ335x)学习笔记——u-boot-2014.10移植

    根据最近移植u-boot-2014.10至TQ335x,基于这样的假设am335x evm移植.不是很多地方需要改变. 因为TI的am335x evm开发了使用eeprom船上保存配置信息.它使用不同 ...

  2. u-boot-2012.10移植到AT91RM9200(包括NAND FLASH)

    基于中嵌SRM9204 目  录 1 配置 1.1修改顶层Makefile(可选) 1.2配置 1.3下载.运行.测试 2 修改内存配置参数(根据芯片手册修改) 2.1 修改配置参数 2.2 编译 2 ...

  3. u-boot-2014.04移植FL2440(使用eclipse编辑uboot)

    1.首先安装eclipse 安装指令 : apt-get install eclipse 使用上面的命令会安装好jdk 和eclipse,eclipse必须在Java环境执行,所以须要安装jdk环境. ...

  4. u-boot-2015.01在tq2440上的初步移植

    作者: 彭东林 邮箱: pengdonglin137@163.com QQ:   405728433 开发板:     tq2440 工具:       Win7 + VMware + Debian6 ...

  5. tr069开源协议EasyCwmp移植

    1.平台MT7628 2.交叉编译器及版本信息mipsel-linux + buildroot-gcc463_32bits.tar.bz2 3.创建工作目录lancer@ubuntu:~$ mkdir ...

  6. AM335x(TQ335x)学习笔记——挂载Ramdisk

    上篇文章中我们已经能够通过u-boot启动内核了,但是没有能够启动成功,从内核的log中可以看出,内核启动失败的原因是没有挂载到root文件系统,本文将使用busybox制作根文件系统并打包成ramd ...

  7. Ubuntu16.04交叉工具链安装

    前言: 开发环境是64位的ubuntu16.04,交叉工具链是通过sudo apt-get install ....安装的,移植uboot2014.10,但是很奇怪,按照网上的介绍在start.s里面 ...

  8. pscp使用详解 Windows与Linux文件互传工具

    pscp使用详解 Windows与Linux文件互传工具 pscp使用方法详解:pscp是putty安装包所带的远程文件传输工具,是一款十分常见windows与linux系统之间文件互传的工具,使用方 ...

  9. u-boot ctr0.S详解 包含_main函数

    /** ****************************************************************************** * @author    Maox ...

随机推荐

  1. laravel注册行为的方法和逻辑

    public function register() { //验证: $this->validate(\request(), [ 'name' => 'required|min:3|uni ...

  2. ckeditor富文本编辑器的基本配置设置:

    原文地址:http://blog.csdn.net/wei365456yin/article/details/54618970?locationNum=5&fps=1 1.首先下载ckedit ...

  3. Jdbc连接数据库基本步骤

    Jdbc连接数据库的基本步骤: package demo.jdbc; import java.sql.Connection; import java.sql.DriverManager; import ...

  4. input获取焦点无效

    js控制input获得焦点: $("input").focus(); 无效,写在延时函数中问题解决: setTimeout(function(){ $("input&qu ...

  5. c# 中foreach 循环

    使用foreach循环可以迭代数组或一个集合对象, 1.通过foreach 循环输出整型数组中的数组: 2.通过for循环输出整型数组中的元素: 3.foreach 循环设置数组元素的计算器: cla ...

  6. php优秀框架codeigniter学习系列——hooks

    这篇文章学习CI框架的钩子特性. hooks是CI框架提供的一种机制,允许你在程序框架运行流程的某个阶段执行你自己的一些代码.比如系统运行前,CI_Controller调用前,系统运行结束后等特定的时 ...

  7. Kaggle(2):验证和过分拟合

    目前看来,随机森林是比较常用且有效的分类算法.以下先简要介绍python中随机森林的使用方法,然后谈谈分类结果的准确度验证和过拟合等两个重要问题. 1.随机森林的参数 在Scikit learn中使用 ...

  8. Python 内置函数2

    print(list("胡辣汤")) lst = ["河南话", "四川话", "东北", "山东" ...

  9. smali语法详解

    smali文件格式 每个smali文件都由若干条语句组成,所有的语句都遵循着一套语法规则.在smali 文件的头3 行描述了当前类的一些信息,格式如下: .class < 访问权限> [  ...

  10. MAC机下用Terminal操作MySql

    在MAC机上安装好MySql后,在Terminal内运行mysql时会提示mysql command not found命令.这是因为没有把运行时的路径添加到$PATH变量中.检查$PATH变量中是否 ...