天天看點

**Tiny4412(Cortex_A9) Uboot核心移植(一)*

我在根目錄下下建了個檔案夾/disk/A9,與開發闆相關的工具、資料都放在這裡邊。

uboot移植步驟

1.配置交叉編譯器

1>

ls /disk/A9/arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz

tar -xvf arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz

解壓後的檔案夾為opt

2> cp opt/* /opt/ -r

3> 配置使用者環境變量

vim ~/.bash_profile

在.bash_profile檔案中添加以下内容:

PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin/

添加後.bash_profile 檔案内容如下

# .bash_profile

# Get the aliases and functions
  if [ -f ~/.bashrc ]; then
      . ~/.bashrc
  fi

  # User specific environment and startup programs

  PATH=$PATH:$HOME/bin
  PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin/

  export PATH
           

4>生效環境變量

source ~/.bash_profile

5>測試

在新的終端在輸入 arm- ‘tab’+’tab’

出現如下界面表示交叉編譯器安裝成功

[[email protected] 2017-02-13]# arm-

arm-linux-addr2line arm-none-linux-gnueabi-addr 2line

arm-linux-ar arm-none-linux-gnueabi-ar

arm-linux-as arm-none-linux-gnueabi-as

arm-linux-c++ arm-none-linux-gnueabi-c++

arm-linux-cc arm-none-linux-gnueabi-cc

arm-linux-c++filt arm-none-linux-gnueabi-c++f ilt

arm-linux-cpp arm-none-linux-gnueabi-cpp

arm-linux-g++ arm-none-linux-gnueabi-g++

arm-linux-gcc arm-none-linux-gnueabi-gcc

2.編譯uboot

1>ls /disk/A9/uboot_tiny4412-master.zip

2>unzip uboot_tiny4412-master.zip

解壓後檔案為uboot_tiny4412-master

3>cd uboot_tiny4412-master

4>make tiny4412_config

5>make

編譯完成後顯示如下内容,表明編譯成功

arm-linux-ld: warning: creating a DT_TEXTREL in object.

arm-linux-objcopy -O srec u-boot u-boot.srec

arm-linux-objcopy –gap-fill=0xff -O binary u-boot u-boot.bin

如果 編譯出錯,一般都是未安裝32位庫 lib

安裝32位庫,我的庫檔案位lib.tar

解壓: tar -xvf lib.tar

解壓後檔案夾 test

cd test

ls

有以下三個檔案夾 lib usrlib usrlocallib

将這三個三個檔案夾添加到根目錄底下,不要覆寫根目錄下的原始檔案(即在拷貝時提示是否覆寫源檔案,直接回車即可)。

cp lib/* /lib/ -r

cp usrlib/* /usr/lib/ -r

cp usrlocallib/* /usr/local/lib/ -r

加載庫後重新編譯。

3.準備SD卡

1》df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda7 207G 44G 153G 23% /

tmpfs 3.8G 224K 3.8G 1% /dev/shm

/dev/sda5 2.0G 64M 1.8G 4% /boot

/dev/sdb1 1023M 6.2M 1017M 1% /media/5D13-6E09

/dev/sdb3 2.0G 87M 1.8G 5%

/media/38fa7b25-a79c-4f22-bfdd-37eef00bb5eb

2》  umount /media/*
3》 fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
           

255 heads, 63 sectors/track, 60801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00045184

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13055 104858624 7 HPFS/NTFS

/dev/sda2 13055 26109 104858624 7 HPFS/NTFS

/dev/sda3 26109 32636 52429824 7 HPFS/NTFS

/dev/sda4 32636 60802 226238488 5 Extended

/dev/sda5 32637 32892 2048000 83 Linux

/dev/sda6 32892 33414 4194304 82 Linux swap /

/dev/sda7 33414 60802 219993088 83 Linux

Disk /dev/sdb: 15.5 GB, 15523119104 bytes

64 heads, 32 sectors/track, 14804 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x7d37efd0

Device Boot Start End Blocks Id System

/dev/sdb1 20 1044 1049600 c W95 FAT32 (LBA)

/dev/sdb2 1045 2069 1049600 83 Linux

/dev/sdb3 2070 4118 2098176 83 Linux

4》 D格SD卡 ,這裡D格大小為 bs * count = 1MB
    dd  if=/dev/zero   of=/dev/sdb  bs=1024  count=1024
           

count=1024

1024+0 records in

1024+0 records out

1048576 bytes (1.0 MB) copied, 0.260175 s, 4.0 MB/s

5》 fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
           

255 heads, 63 sectors/track, 60801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00045184

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13055 104858624 7 HPFS/NTFS

/dev/sda2 13055 26109 104858624 7 HPFS/NTFS

/dev/sda3 26109 32636 52429824 7 HPFS/NTFS

/dev/sda4 32636 60802 226238488 5 Extended

/dev/sda5 32637 32892 2048000 83 Linux

/dev/sda6 32892 33414 4194304 82 Linux swap / Solaris

/dev/sda7 33414 60802 219993088 83 Linux

Disk /dev/sdb: 15.5 GB, 15523119104 bytes

64 heads, 32 sectors/track, 14804 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

4**燒寫Uboot**

1>cd    /disk/A9/uboot_tiny4412-master
    2>cd sd_fuse/   
    3> ls
           

Makefile sd_fdisk.c tiny4412 V310-EVT1-mkbl2.c

4> make

gcc -o mkbl2 V310-EVT1-mkbl2.c

gcc -o sd_fdisk sd_fdisk.c

5>cd tiny4412/

6>./sd_fusing.sh /dev/sdb(我的SD卡)

出現如下畫面說明燒寫成功

/dev/sdb reader is identified.

BL1 fusing

16+0 records in

16+0 records out

8192 bytes (8.2 kB) copied, 0.218726 s, 37.5 kB/s

BL2 fusing

28+0 records in

28+0 records out

14336 bytes (14 kB) copied, 0.38555 s, 37.2 kB/s

u-boot fusing

540+1 records in

540+1 records out

276932 bytes (277 kB) copied, 2.04629 s, 135 kB/s

TrustZone S/W fusing

184+0 records in

184+0 records out

94208 bytes (94 kB) copied, 0.741492 s, 127 kB/s

U-boot image is fused successfully.

Eject SD card and insert it again.

5>将SD卡插入闆子上

6> 确定闆子與PC通信OK

ls /dev/tty*

發現有ttyUSB0 說明闆子序列槽與PC間裝置通信正常(闆子序列槽與PC usb口之間通過序列槽轉接線或序列槽子產品通信)

7>安裝并設定序列槽通信工具minicom

1>yum -y install minicom

2>minicom -s

出現如下畫面:

+—–[configuration]——+

| Filenames and paths |

| File transfer protocols |

| Serial port setup |

| Modem and dialing |

| Screen and keyboard |

| Save setup as dfl |

| Save setup as.. |

| Exit |

| Exit from Minicom |

+————————–+

3> 選擇Serial port setup 并按如下設定

Serial Device : /dev/ttyUSB0

Bps/Par/Bits : 115200 8N1

Hardware Flow Control : No

Software Flow Control : No

儲存設定

4> 選擇 Save setup as dfl

5> 選擇Exit

将會進入如下界面:

Welcome to minicom 2.3

OPTIONS: I18n

Compiled on Aug 19 2010, 05:50:19.

Port /dev/ttyUSB0

Press CTRL-A Z for help on special keys              
           

��������������������������������������������������������������������������������������������������������K

U-Boot 2010.12 (Feb 13 2017 - 17:23:07) for TINY4412

CPU: S5PC220 [Samsung SOC on SMP Platform Base on ARM CortexA9]

APLL = 1400MHz, MPLL = 800MHz

Board: TINY4412

DRAM: 1023 MiB

vdd_arm: 1.2

vdd_int: 1.0

vdd_mif: 1.1

BL1 version: N/A (TrustZone Enabled BSP)

Checking Boot Mode … SDMMC

REVISION: 1.1

MMC Device 0: 14804 MB

MMC Device 1: 3728 MB

MMC Device 2: N/A

* Warning - using default environment

Net: No ethernet found.

Hit any key to stop autoboot: 0

設定完成。

minicom 退出方法 CTRL + A + q

繼續閱讀