u-boot transplantation (1)---Preparation work

Publisher:清新时光Latest update time:2023-07-03 Source: elecfansKeywords:u-boot Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Production of tool chain

1.1 Tools

  Software tool: crosstool-ng

  Download address: git clone https://github.com/crosstool-ng/crosstool-ng

  The crosstool-ng environment requires libncurse5-dev 

  sudo apt-get install libncurse5-dev

  Install autoconf: sudo apt-get install autoconf

  Enter the crosstool-ng directory, execute ./bootstrap, and generate the configure execution file

  Check the installation environment. If any errors are reported, install the software: ./configure --prefix=`pwd`/crosstool 

  The required software is:

  sudo apt-get install gperf bison flex texinfo help2man gawk

  Execute the command make to execute the command:

  make install

  export PATH="${PATH}:`pwd`/crosstool/bin"

1.2 Start production

1.2.1 Create target folder

  Create three folders in the root directory:

  mkdir src x-tools crosstool

  

1.2.2 Environment

  Enter the crosstool directory: cd ~/.crosstool

  Execution: ct-ng list-samples

  

  Select arm-unknown-linux-gnueabi as the template for the cross-compilation tool chain

  Execute the command: ct-ng show-arm-unknown-linux-gnueabi to view the configuration required to compile the cross-compilation tool chain

  

  Download gcc 6.3.0: wget http://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.gz

  

  Execute command: ct-ng arm-unknown-linux-gnueabi

  

  Execute command: ct-ng menuconfig

  

  

  Select Target options

             *** Target optimisations ***
           (armv4t) Architecture level: instruction set architecture, exynos4412 is armv7-a architecture, -march=name
           (arm920t) Emit assembly for CPU: CPU core type, -mcpu=name
           () Tune for CPU : Optimization of CPU, please check the chip manual for details, -mtune=name

  

  The latest version of crosstool-ng only needs to select the first and second projects.

  Select toolchain options:

  

  u-boot 2016.01 does not support GCC6, so the GCC version needs to be changed to between GCC5.0 and GCC6.0.

  Save and exit.

1.2.3 Compilation

  Execute command: ct-ng build

  

  Compiled successfully:

  

  Create environment variables:

  vim .bashrc, add the following line

  PATH=~/x-tools/arm-s3c2440a-linux-gnueabihf/bin:$PATH/

  Execute source .bashrc

   Execute arm-s3c2440a-linux-gnueabi-gcc -v

  

  u-boot 2016.01 does not support GCC6, so the GCC version needs to be changed to between GCC5.0 and GCC6.0.

2. Establish u-boot working directory

  Download u-boot_2016.01 version and unzip u-boot.

  

2.1 Board directory modification

2.1.1 Create jz2440 board

  View the files in the ../board/samsung/ directory:

  

  In this version, 2440 has been deprecated. Therefore, smdk2410 is selected as the template to create 2440 u-boot.

  

2.1.2 jz2440 file name modification

  Modify file name:

  

2.1.3 Kconfig modification

  Modify the Kconfig and Makefile files and change smdk2410 inside to jz2440, as follows:

  Kconfig file:

  

 

2.1.4 Makefile modification

  

2.2 Modify header file

  

  Add content to the header file:

  

  Add support for S3C2440

  Find the file containing the header file smdk2410.h:

  

  Nothing needs to be modified

2.3 Modify configuration file 

  The current new version of u-boot is the same as the Linux source code. Make menuconfig is executed for configuration, so there must be jz2440 configuration in the configs directory.

  Configuration in the config directory:

  

  

2.5 Modify the configuration file under arch/arm

  arch/arm/Kconfig, which adds support for jz2440

  

  

2.6 Modify rch/arm/include/asm/mach-types.h

  

  

3. Configure .config and compile u-boot

3.1 configuration.config

  Execute command: make jz2440_defconfig

  

  Execute command: make menuconfig

  

  Select the target_select item in ARM architecture, and then select jz2440:

  

  Configure the command line prompt of u-boot:

  

  

  Save and exit configuration.

3.2 Compilation

  

  Compiled successfully:

  

4. Compilation errors

4.1 Not enough room for program headers

  arm-2440-linux-gnueabi-ld.bfd: u-boot: Not enough room for program headers, try linking with -N
  arm-2440-linux-gnueabi-ld.bfd: final link failed: Bad value
  make: *** [Makefile:1193: u-boot] Error 1

   Solution: https://www.mail-archive.com/u-boot@lists.denx.de/msg235861.html

  Add the following lines to the Makefile in the root directory:

  


Keywords:u-boot Reference address:u-boot transplantation (1)---Preparation work

Previous article:u-boot transplantation (2)---Work before modification: code flow analysis 1
Next article:13. S3C2440 bare metal—initialization code and MMU

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号