A8板卡AM3352移植环境搭建记录
README
- 该记录为A8板卡移植过程中的简要环境搭建步骤, 同时也是记录老ubuntu的更新源留作以后使用, 文档省略了对交叉编译工具中的 u-boot 和 kernel 源码的修改部分,该部分需要根据实际项目需求,硬件布线,来修改启动和针对模块的驱动部分.
一.文件说明
(1)ubuntu-12.04.4-desktop-amd64.iso ubuntu镜像,用来搭建开发环境
(2)ti-sdk-am335x-evm-06.00.00.00-Linux-x86-Install.bin TI开发环境SDK的安装文件
(3)u-boot-2013.01.01-psp06.00.00.00.tar.gz u-boot 源码(根据A8板卡修改过)
(4)linux-3.2.0-psp04.06.00.11.tar.gz linux kernel 源码(根据A8板卡修改过)
(5)am3352.pdf 和 am3352_english.pdf A8板卡上芯片AM3352的datasheet
(6)sitara-linuxsdk-sdg-06.00.00.00.pdf TI开发环境SDK搭建的参考文档
二.开发环境搭建
1.虚拟机vmware中安装ubuntu12.04系统
2.ubuntu12.04系统安装后需要预先做的事情
2.1更换更新源
ubuntu@ubuntu:~$ lsb_release -c 查看系统代号,用来替换更新源(更新源黄色背景英文部分为系统代号名称)
ubuntu@ubuntu:~$ sudo mv /etc/apt/sources.list /etc/apt/sources.list_back 更新源文件备份
ubuntu@ubuntu:~$ sudo vi /etc/apt/sources.list 打开更新源文件并写入更新源如下
#更新源使用老系统的源路径
deb http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
保存并退出
2.2更新
ubuntu@ubuntu:~$ sudo apt update
ubuntu@ubuntu:~$ sudo apt install vim
ubuntu@ubuntu:~$ sudo apt install build-essential
ubuntu@ubuntu:~$ sudo apt install libc6:i386 libstdc++6:i386
ubuntu@ubuntu:~$ sudo apt install libncurses5-dev lib32z1
也可参考如下
ubuntu@ubuntu:~$ sudo apt-get install build-essential autoconf automake bison flex libssl-dev bc u-boot-tools python diffstat texinfo gawk chrpath dos2unix wget unzip socat doxygen libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 g++-multilib
2.3卸载ubuntu无用的软件
ubuntu@ubuntu:~$ sudo apt-get remove libreoffice-common
ubuntu@ubuntu:~$ sudo apt-get remove thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku landscape-client-ui-install
ubuntu@ubuntu:~$ sudo apt-get remove onboard deja-dup
2.4配置终端vim
ubuntu@ubuntu:~$ sudo vim /etc/vim/vimrc 打开配置文件,文件末尾追加如下
set number 表示打开文件自动显示行号
#set nonumber 表示关闭行号
set tabstop=4 表示一个tab键显示出来多少个空格的长度,默认是8,这里设置为4
set softtabstop=4 表示在编辑模式下按退格键时候退回缩进的长度,设置为4
set shiftwidth=4 表示每一级缩进的长度,一般设置成softtabstop长度一样
set noexpandtab 当设置成expantab时表示缩进用空格来表示,noexpandtab则用制表符表示一个缩进
set autoindent 表示自动缩进
3.搭建开发环境
进入到ubuntu12.04开发环境目录
执行 ./ti-sdk-am335x-evm-06.00.00.00-Linux-x86-Install.bin
逐步按照安装的提示进行安装即可
三.板卡上运行u-boot和kernel
SD卡上存放 MLO u-boot.img uImage uEnv.txt 文件
并且创建 image 文件夹,文件夹中存放 MLO u-boot.img uImage rootfs.tar.gz 文件用来写入板卡的nand。(该文件夹是用来升级板卡的u-boot,kernel,rootfs)
四.烧写SD卡
步骤操作如下:
ubuntu@ubuntu:~/workspace/ti-sdk-am335x-evm-06.00.00.00/bin$ sudo ./create-sdcard.sh
[sudo] password for ubuntu:
################################################################################
This script will create a bootable SD card from custom or pre-built binaries.
The script must be run with root permissions and from the bin directory of
the SDK
Example:
$ sudo ./create-sdcard.sh
Formatting can be skipped if the SD card is already formatted and
partitioned properly.
################################################################################
Availible Drives to write images to:
# major minor size name
1: 8 16 62367744 sdb
Enter Device Number or n to exit:
These are the Drives available to write images to:
# major minor size name
1: 8 16 62367744 sdb
Enter Device Number or n to exit: 1
sdb was selected
################################################################################
**********WARNING**********
Selected Device is greater then 16GB
Continuing past this point will erase data from device
Double check that this is the correct SD Card
################################################################################
Would you like to continue [y/n] : y
Unmounting the sdb drives
unmounted /dev/sdb1
unmounted /dev/sdb2
Current size of sdb1 72261 bytes
Current size of sdb2 62284005 bytes
################################################################################
Detected device has 2 partitions already
Re-partitioning will allow the choice of 2 or 3 partitions
################################################################################
Would you like to re-partition the drive anyways [y/n] : y
Now partitioning sdb ...
################################################################################
Select 2 partitions if only need boot and rootfs (most users)
Select 3 partitions if need SDK & CCS on SD card. This is usually used
by device manufacturers with access to partition tarballs.
****WARNING**** continuing will erase all data on sdb
################################################################################
Number of partitions needed [2/3] : 2
Now partitioning sdb with 2 partitions...
################################################################################
Now making 2 partitions
################################################################################
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 2.68303 s, 391 kB/s
Disk /dev/sdb doesn't contain a valid partition table
DISK SIZE - 63864569856 bytes
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 7764 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sdb1 * 0+ 8 9- 72261 c W95 FAT32 (LBA)
/dev/sdb2 10 7763 7754 62284005 83 Linux
/dev/sdb3 0 - 0 0 0 Empty
/dev/sdb4 0 - 0 0 0 Empty
Successfully wrote the new partition table
Re-reading the partition table ...
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
################################################################################
Partitioning Boot
################################################################################
mkfs.vfat 3.0.12 (29 Oct 2011)
################################################################################
Partitioning rootfs
################################################################################
mke2fs 1.42 (29-Nov-2011)
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3899392 inodes, 15571001 blocks
778550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
476 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
################################################################################
Partitioning is now done
Continue to install filesystem or select 'n' to safe exit
**Warning** Continuing will erase files any files in the partitions
################################################################################
Would you like to continue? [y/n] : y
Mount the partitions
Emptying partitions
Syncing....
################################################################################
Choose file path to install from
1 ) Install pre-built images from SDK
2 ) Enter in custom boot and rootfs file paths
################################################################################
Choose now [1/2] : 2
################################################################################
For Boot partition
If files are located in Tarball write complete path including the file name.
e.x. $: /home/user/MyCustomTars/boot.tar.gz
If files are located in a directory write the directory path
e.x. $: /ti-sdk/board-support/prebuilt-images/
and the beginning of the files should be labeled with MLO, u-boot, uImage
i.e. test_MLO_image must be labeled as MLO_test_image
NOTE: Not all platforms will have an MLO file and this file can
be ignored for platforms that do not support an MLO
################################################################################
Enter path for Boot Partition : /home/ubuntu/workspace/A8_SYS/my_2021_sys/boot/boot.tar.gz
File exists
################################################################################
For Rootfs partition
If files are located in Tarball write complete path including the file name.
e.x. $: /home/user/MyCustomTars/rootfs.tar.gz
If files are located in a directory write the directory path
e.x. $: /ti-sdk/targetNFS/
################################################################################
Enter path for Rootfs Partition : /home/ubuntu/workspace/A8_SYS/my_2021_sys/system/rootfs.tar.gz
File exists
################################################################################
Copying files now... will take minutes
################################################################################
Copying boot partition
Written 100%
Copying rootfs System partition
Written 100%
Syncing...
Un-mount the partitions
Remove created temp directories
Operation Finished
ubuntu@ubuntu:~/workspace/ti-sdk-am335x-evm-06.00.00.00/bin$
至此sd卡烧写完成,使用的是独自的 boot.tar.gz 和 rootfs.targz 文件
其中 boot.tar.gz 文件中包含 MLO u-boot.img uImage 三个文件, 可增加 uEnv.txt 文件进行系统启动时的配置