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

来源:互联网 发布:网络对人们的好处 编辑:程序博客网 时间:2024/05/18 05:09

我在根目录下下建了个文件夹/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’
出现如下界面表示交叉编译器安装成功
[root@localhost 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 -lDisk /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 -lDisk /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

0 0
原创粉丝点击