SAMA5D3 Xplained Board

一、烧录

1)先在官网 http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage 

下载  linux4sam-poky-sama5d3_xplained-5.7.zip 和 SAM-BA 3.x release 

2)将Demo镜像解压到sam-ba工具的example/sama5d3目录

3)windows终端cmd进入sam-ba_3.2.1\examples\sama5d3\linux4sam-poky-sama5d3_xplained-5.7目录运行sam-ba就启动烧录了。

设备管理器里可能会缺少gadget serial v2.4驱动

下载USB-CDC driver: https://www.kernel.org/doc/Documentation/usb/linux-cdc-acm.inf

放在sam-ba_3.2.1\driver目录,安装即可烧录

C:\Users\15019\Desktop\sam-ba_3.2.1\examples\sama5d3\linux4sam-poky-sama5d3_xplained-5.7>

取下JP5,复位板子,运行如下指令

..\..\..\sam-ba -x demo_linux_nandflash_usb.qml

 

二、编译

1、How to build Buildroot for AT91

http://www.at91.com/linux4sam/bin/view/Linux4SAM/BuildRootBuild

 

1)自定义交叉工具链 toolchain

  │ │                                                                  Toolchain type (External toolchain)  --->                                                                                                     │ │  
  │ │                                                                  *** Toolchain External Options ***                                                                                                               │ │  
  │ │                                                                  Toolchain (Custom toolchain)  --->                                                                                                             │ │  
  │ │                                                                  Toolchain origin (Pre-installed toolchain)  --->                                                                                            │ │  
  │ │                                                                  (/usr/local/gcc-linaro-arm-linux-gnueabihf) Toolchain path                                                                         │ │  
  │ │                                                                  ($(ARCH)-linux-gnueabihf) Toolchain prefix                                                                                               │ │  
  │ │                                                                  External toolchain gcc version (4.7.x)  --->                                                                                                 │ │  
  │ │                                                                  External toolchain kernel headers series (3.2.x)  --->                                                                                 │ │  
  │ │                                                                  External toolchain C library (glibc/eglibc)  --->

 

2)自定义内核版本 Kernel

Linux Kernel YES
Kernel version Custom Git tree
URL of custom Git repository https://github.com/raspberrypi/linux
Custom Git version rpi-3.6.y
Kernel configuration Using a defconfig
Defconfig name bcmrpi
Kernel binary format zImage

3)添加NFS支持(Target packages -> FileSystem and flash utilities -> nfs-utils)

 

3)单独编译内核

下载源码

https://github.com/linux4sam/linux-at91/tree/linux-4.9-at91

编译文档

http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage#Configure_and_Build_the_Linux_ke

添加编译器路径 /usr/local/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf-

先要安装个uboot的小工具

sudo apt-get install uboot-mkimage

更改Makefile

#ARCH        ?= $(SUBARCH)
#CROSS_COMPILE    ?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH        = arm
CROSS_COMPILE    = arm-linux-gnueabihf-

然后如下三条指令编译

make ARCH=arm sama5_defconfig

make ARCH=arm

make ARCH=arm uImage LOADADDR=0x20008000

make ARCH=arm dtbs

 

4) 挂载SD卡

(1)确保sd卡加载成功
fdisk -l

(2)挂载SD卡

mount /dev/mmcblk0p1 /mnt/mmc

或者

mount -t vfat  /dev/mmcblk0p1 /mnt/mmc

(3)卸载SD卡

umount /mnt/mmc

注意,当前目录不能是/mnt,否则会出现“umount can't umount /mnt device or resource busy”的错误提示信息。

(4)Linux 如何上电挂载SD卡

编辑/etc/init.d/目录下的rcS文件:vi /etc/init.d/rcS
在里面加入一行:mount -t vfat /dev/mmcblk0p1 /mnt/mmc
这样上电后开发板就会自动挂载SD卡到主目录的mmc文件夹

 

5) 挂载U盘也类似

# mount /dev/sda1 /media                                                        
FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Ple.
# cd /media/                                                                    
# ls                                                                            
Image                      uImage                                               
at91-sama5d3_xplained.dtb  zImage                                               
#

二、其他

1)资料收集

http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage

http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=ATSAMA5D3-XPLD

http://www.eewiki.net/display/linuxonarm/SAMA5D3

http://www.at91.com/linux4sam/bin/view/Linux4SAM/

之前没用过这款IC,有个卖板子的也整理了些基本操作。

http://www.myir-tech.com/product/myd-sama5d3x.htm#loc

 

2)编译内核会报个错误

"mkimage" command not found - U-Boot images will not be built

http://blog.csdn.net/eibo51/article/details/51901480

 

3) Sama5d36ek_Device Tree

https://wenku.baidu.com/view/d4c3cf7fbed5b9f3f80f1c5d.html

http://blog.csdn.net/iefswang/article/details/27096393

 

4) gpio

http://www.myir-tech.com/bbs/forum.php?mod=viewthread&tid=7860

 

x) 刷机涉及到 openssl-1.1.0f.tar.gz 的安装

https://blog.csdn.net/xiatiancc/article/details/78913163

wget http://www.openssl.org/source/openssl-1.1.0f.tar.gz
tar -zxvf openssl-1.1.0f.tar.gz
cd openssl-1.1.0f
./config shared zlib
make

sudo make install

 

默认的安装路径

installing libcrypto.a
installing libssl.a
installing libcrypto.so.1.0.0
installing libssl.so.1.0.0
make[1]: Entering directory `/usr/local/ssl/lib64'
make[2]: Entering directory `/usr/local/ssl/lib64'
make[2]: Leaving directory `/usr/local/ssl/lib64'
make[2]: Entering directory `/usr/local/ssl/lib64'
make[2]: Leaving directory `/usr/local/ssl/lib64'
make[1]: Leaving directory `/usr/local/ssl/lib64'
OpenSSL shared libraries have been installed in:
  /usr/local/ssl

cp libcrypto.pc /usr/local/ssl/lib64/pkgconfig
chmod 644 /usr/local/ssl/lib64/pkgconfig/libcrypto.pc
cp libssl.pc /usr/local/ssl/lib64/pkgconfig
chmod 644 /usr/local/ssl/lib64/pkgconfig/libssl.pc
cp openssl.pc /usr/local/ssl/lib64/pkgconfig
chmod 644 /usr/local/ssl/lib64/pkgconfig/openssl.pc

 

#修改历史的OpenSSL文件设置备份
sudo mv /usr/bin/openssl /usr/bin/openssl.old
sudo mv /usr/include/openssl /usr/include/openssl.old

#设置软连接使其使用新的OpenSSL版本 刚刚安装的OpenSSL默认安装在/usr/local/ssl
sudo ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
sudo ln -s /usr/local/ssl/include/openssl /usr/include/openssl

#更新动态链接库数据
//echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
sudo sh -c "echo '/usr/local/ssl/lib' >> /etc/ld.so.conf"
sudo ldconfig -v
我们再来看看 OpenSSL 版本信息.

 

安装到指定路径--prefix=/usr/local/openssl

./config shared zlib  --prefix=/usr/local/openssl && make && make install

[root@localhost src]# tar -xzvf openssl-1.0.1s.tar.gz
[root@localhost src]# cd openssl-1.0.1s
[root@localhost openssl-1.0.1s]# ./config -fPIC --prefix=/usr/local/openssl enable-shared
[root@localhost openssl-1.0.1s]# ./config -t
[root@localhost openssl-1.0.1s]# make && make install

 

tar -xzvf openssl-1.0.0.tar.gz
cd openssl-1.0.0
./config -fPIC --prefix=$(pwd)/_install enable-shared
./config -t
make 
rm -f /usr/bin/pod2man
sudo make install

 

 

y) usb模拟网卡挂载nfs

//ubuntu主机
sudo nano /etc/exports
/home/dong/nfs *(rw,sync,no_root_squash,no_subtree_check)

sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/rpcbind restart

sudo ifconfig usb0 192.168.10.1

//设备端
modprobe g_multi file=/dev/mmcblk0p5,/dev/mmcblk0p6 ro=0,1 luns=2 stall=0 removable=1,1 iSerialNumber=3000111
ifconfig usb1 192.168.10.2
mount -t nfs -o nolock 192.168.10.1:/home/dong/nfs /home/tmp

 

posted @ 2018-03-06 15:07  dong1  阅读(689)  评论(0编辑  收藏  举报