最新有点时间,所以想折腾点东西,于是拿起了几年前的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. [Leetcode 739]*还有几天会升温 Daily Temperatures

    [题目] Given a list of daily temperatures T, return a list such that, for each day in the input, tells ...

  2. 手打struts知识点

    Struts2概论 1.MVC原理 MVC(Model-View-Controller),程序设计理念 视图不用多说,html.jsp等 控制器,中转站,分配各个组件应当做什么,接受参数并跳转其他处理 ...

  3. 使用 DirectX 创建 3D 图形

    官方链接   https://msdn.microsoft.com/zh-cn/library/windows/desktop/hh465137.aspx 使用 Windows 运行时初始化 Dire ...

  4. ansible暂停模块

    pause 在playbook执行的过程中暂停一定时间或者提示用户进行某些操作 常用参数: minutes:暂停多少分钟 seconds:暂停多少秒 prompt:打印一串信息提示用户操作 示例: - ...

  5. ubantu安装python3虚拟环境

    Ubuntu安装python3虚拟环境 安装虚拟环境 步骤: 打开Linux终端(快捷键Ctrl+Alt+T),输入命令: sudo apt install python-virtualenv sud ...

  6. YUM仓库配置

    YUM的前身是YUP(Yellow dog Updater,Yellow dog Linux的软件更新器),最初由TSS公司(Terra Soft Solutions,INC.)使用Python语言开 ...

  7. SpringBoot 添加fastjson

    1.先在项目中添加fastjson依赖: <dependency> <groupId>com.alibaba</groupId> <artifactId> ...

  8. 【Python】socket编程-2

    #练习3:TCP协议+while循环 服务端: import socket #socket模块 import sys reload(sys) sys.setdefaultencoding(" ...

  9. Failed to decode response: zlib_decode(): data error

    /********************************************************************** * Failed to decode response: ...

  10. RNN 通过字符语言模型 理解BPTT

    链接:https://github.com/karpathy/char-rnn http://karpathy.github.io/2015/05/21/rnn-effectiveness/ http ...