烧板子是一条充满荆棘的路,尤其是对于之前没有烧过的同学来说,更对于比较冷门的板子来说。去某高校的实验室跑了两趟,和官方技术支持挤牙膏挤了好久才挖点资料过来参考。换了两台电脑,在PC上交叉编译,最后终于烧…好了…一把辛酸泪…
参考
https://elinux.org/R-Car/Boards/Yocto-Gen3-ADAS
下载文件10G左右,整个编译的目录所需空间为100G左右,需保证硬盘的剩余空间至少150G
主要注意的是需加入local.conf里添加caffe和opencl支持
最后编译后的文件在$WORK/build/temp/deploy/images/salvator-x目录,文件列表如下:
bl2-salvator-x.bin
bl2-salvator-x.elf
bl2-salvator-x.srec
bl31-salvator-x.bin
bl31-salvator-x.elf
bl31-salvator-x.srec
bootparam_sa0.bin
bootparam_sa0.srec
cert_header_sa6.bin
cert_header_sa6.srec
core-image-weston-salvator-x.ext4
core-image-weston-salvator-x.manifest
core-image-weston-salvator-x.tar.bz2
core-image-weston-salvator-x.tar.gz
core-image-weston-salvator-x.testdata.json
core-image-weston-salvator-x-20181206022553.rootfs.ext4
core-image-weston-salvator-x-20181206022553.rootfs.manifest
core-image-weston-salvator-x-20181206022553.rootfs.tar.bz2
core-image-weston-salvator-x-20181206022553.rootfs.tar.gz
core-image-weston-salvator-x-20181206022553.testdata.json
core-image-weston-sdk-salvator-x.ext4
core-image-weston-sdk-salvator-x.manifest
core-image-weston-sdk-salvator-x.tar.bz2
core-image-weston-sdk-salvator-x.tar.gz
core-image-weston-sdk-salvator-x.testdata.json
core-image-weston-sdk-salvator-x-20181206052426.rootfs.ext4
core-image-weston-sdk-salvator-x-20181206052426.rootfs.manifest
core-image-weston-sdk-salvator-x-20181206052426.rootfs.tar.bz2
core-image-weston-sdk-salvator-x-20181206052426.rootfs.tar.gz
core-image-weston-sdk-salvator-x-20181206052426.testdata.json
Image
Image–4.14.35+git0+118adc53e8-r1-r8a7795-es1-salvator-x-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-es1-salvator-x-view-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-salvator-x-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-salvator-xs-2x2g-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-salvator-xs-4x2g-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-salvator-xs-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7795-salvator-x-view-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-r8a7796-salvator-x-view-20181206022553.dtb
Image–4.14.35+git0+118adc53e8-r1-salvator-x-20181206022553.bin
Image-r8a7795-es1-salvator-x.dtb
Image-r8a7795-es1-salvator-x-view.dtb
Image-r8a7795-salvator-x.dtb
Image-r8a7795-salvator-xs.dtb
Image-r8a7795-salvator-xs-2x2g.dtb
Image-r8a7795-salvator-xs-4x2g.dtb
Image-r8a7795-salvator-x-view.dtb
Image-r8a7796-salvator-x-view.dtb
Image-salvator-x.bin
modules–4.14.35+git0+118adc53e8-r1-salvator-x-20181206022553.tgz
modules-salvator-x.tgz
r8a7795-es1-salvator-x.dtb
r8a7795-es1-salvator-x-view.dtb
r8a7795-salvator-x.dtb
r8a7795-salvator-xs.dtb
r8a7795-salvator-xs-2x2g.dtb
r8a7795-salvator-xs-4x2g.dtb
r8a7795-salvator-x-view.dtb
r8a7796-salvator-x-view.dtb
tee-salvator-x.bin
tee-salvator-x.elf
tee-salvator-x.srec
u-boot.bin
u-boot-elf.srec
u-boot-elf-salvator-x.srec
u-boot-elf-salvator-x-v2015.04+gitAUTOINC+6a82c94590-r0.srec
u-boot-salvator-x.bin
u-boot-salvator-x-v2015.04+gitAUTOINC+6a82c94590-r0.bin
串口线连接,开发板的CN25口连接pc的usb口
网线连接,用附带的蓝色网线(交叉网线)连接开发板网线接口和pc网线接口
注意sw设置
参考HyperFlash_miniMonitor_update_procedure_rev1.00.txt和
SPIflash_miniMonitor_update_procedure_rev1.00.txt
pc端用teraterm烧录u-boot,需要在Windows环境下。
http://sourceforge.jp/projects/ttssh2
http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
Open Tera Term(teraterm-4.97\ttermpro.exe) and configure serial port:
Drag and drop SCIF MiniMonitor binary file(AArch64_Gen3_H3_M3_Scif_MiniMon_V5.01.mot) into Tera Term window and click “Send file” to start transfer:
After file transferred, MiniMonitor will print the information:
Use Macro in Tera Term to automatically flashing IPL/U-Boot and select loader-writer-with-salvator_390.ttl in the salvator-x folder:
否则会遇到以下报错
[ 0.000163] NOTICE: BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.21
[ 0.005737] NOTICE: BL2: PRR is R-Car H3 Ver.3.0
[ 0.010413] NOTICE: BL2: Board is Salvator-XS Rev.1.0
[ 0.015534] NOTICE: BL2: Boot device is HyperFlash(160MHz)
[ 0.021056] NOTICE: BL2: LCM state is CM
[ 0.025101] NOTICE: BL2: AVS setting succeeded. DVFS_SetVID=0x53
[ 0.031086] NOTICE: BL2: CH0: 0x400000000 - 0x440000000, 1 GiB
[ 0.036957] NOTICE: BL2: CH1: 0x500000000 - 0x540000000, 1 GiB
[ 0.042842] NOTICE: BL2: CH2: 0x600000000 - 0x640000000, 1 GiB
[ 0.048726] NOTICE: BL2: CH3: 0x700000000 - 0x740000000, 1 GiB
[ 0.054651] NOTICE: BL2: DDR3200(rev.0.33)NOTICE: [WARM_BOOT]ERROR:
Warm booting...
The potential of BKUP_TRG did not switch to Low.
If you expect the operation of cold boot,
check the board configuration (ex, Dip-SW) and/or the H/W failure.
[ 0.087919] NOTICE: [BOOT_STATUS_UPDATE_ERROR]NOTICE: ..1
[ 0.093459] NOTICE: BL2: Failed to DRAM initialize (-1).
[ 5.007798] ERROR:
[ 5.008591] ERROR: BL2: System WDT overflow, occured address is 0xe6312cb8
需要Linux Host PC
使用tftp将内核文件烧录进开发板的内存
sudo apt-get install tftp-hpa tftpd-hpa
mkdir /tftp
chmod 777 /tftp
其中:
(1)tftp是我的TFTP的根目录,根据情况修改为自己的根目录。
(2)chmod是去更改tftpboot这个TFTP根目录的访问属性,因为其他tftp用户需要使用put命令上传文件的话,那就需要write权限的,所以这里干脆省事,直接chmod 777,添加所有权限(读+写+执行)。
sudo gedit /etc/default/tftpd-hpa
sudo service tftpd-hpa restart
$tftp
tftp> 表示tftp生效
用picocom连接接开发板和PC
sudo picocom -b 115200 /dev/ttyUSB0
出现如下界面
meng@meng-G3-3579:~$ sudo picocom -b 115200 /dev/ttyUSB0
picocom v1.7
port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv
imap is :
omap is :
emap is : crcrlf,delbs,
Terminal ready
接着打开电源,power on,出现一下界面
Terminal ready
[ 0.000163] NOTICE: BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.21
[ 0.005737] NOTICE: BL2: PRR is R-Car H3 Ver.3.0
[ 0.010413] NOTICE: BL2: Board is Salvator-XS Rev.1.0
[ 0.015534] NOTICE: BL2: Boot device is HyperFlash(160MHz)
[ 0.021056] NOTICE: BL2: LCM state is CM
[ 0.025101] NOTICE: BL2: AVS setting succeeded. DVFS_SetVID=0x53
[ 0.031086] NOTICE: BL2: CH0: 0x400000000 - 0x440000000, 1 GiB
[ 0.036957] NOTICE: BL2: CH1: 0x500000000 - 0x540000000, 1 GiB
[ 0.042842] NOTICE: BL2: CH2: 0x600000000 - 0x640000000, 1 GiB
[ 0.048726] NOTICE: BL2: CH3: 0x700000000 - 0x740000000, 1 GiB
[ 0.054651] NOTICE: BL2: DDR3200(rev.0.33)NOTICE: [COLD_BOOT]NOTICE: ..0
[ 0.089401] NOTICE: BL2: DRAM Split is 4ch(DDR f)
[ 0.093896] NOTICE: BL2: QoS is default setting(rev.0.07)
[ 0.099347] NOTICE: BL2: DRAM refresh interval 1.95 usec
[ 0.104774] NOTICE: BL2: Lossy Decomp areas
[ 0.108953] NOTICE: Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
[ 0.116050] NOTICE: Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
[ 0.122973] NOTICE: Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
[ 0.129898] NOTICE: BL2: v1.4(release):15dba6b
[ 0.134396] NOTICE: BL2: Built : 00:59:09, Jul 25 2018
[ 0.139592] NOTICE: BL2: Normal boot
[ 0.143243] NOTICE: BL2: dst=0xe6322d00 src=0x8180000 len=512(0x200)
[ 0.149634] NOTICE: BL2: dst=0x43f00000 src=0x8180400 len=6144(0x1800)
[ 0.156243] NOTICE: BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
[ 0.163251] NOTICE: BL2: dst=0x44100000 src=0x8200000 len=1048576(0x100000)
[ 0.174228] NOTICE: BL2: dst=0x50000000 src=0x8640000 len=1048576(0x100000)
U-Boot 2015.04 (Jul 25 2018 - 11:54:15)
CPU: Renesas Electronics R8A7795 rev 3.0
Board: Salvator-X
I2C: ready
DRAM: 3.9 GiB
Bank #0: 0x048000000 - 0x07fffffff, 896 MiB
Bank #1: 0x500000000 - 0x53fffffff, 1 GiB
Bank #2: 0x600000000 - 0x63fffffff, 1 GiB
Bank #3: 0x700000000 - 0x73fffffff, 1 GiB
MMC: sh-sdhi: 0, sh-sdhi: 1, sh-sdhi: 2
In: serial
Out: serial
Err: serial
Net: ravb
Hit any key to stop autoboot: 0
表示进入u-boot
设置mac地址
mac地址可设置为开发板上网线接口处的贴纸上的mac地址
setenv ethaddr XX:XX:XX:XX:XX:XX
在u-boot设置为
setenv ethaddr 2E:09:0A:02:EF:5F
设置ip
pc设置ethernet的ip
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-myQrcO0H-1578653909015)(https://note.youdao.com/yws/res/204/WEBRESOURCEcf0653fae8ac6ba36614c9cf5e35e059)]
在u-boot设置pc的ip,和pc上设置的ethernet的ip保持一致
setenv serverip 192.168.1.76
在u-boot设置开发板的ip
setenv ipaddr 192.168.1.3
保存设置的变量
saveenv
ping PC的ip,保证网络连通
在u-boot中输入以下命令
ping 192.168.1.3
出现以下界面表示ping通
ping 192.168.1.76
ravb Waiting for PHY auto negotiation to complete... done
ravb: 1000Base/Full
Using ravb device
host 192.168.1.76 is alive
将Image 和 Image-r8a7795-salvator-xs.dtb 放进tftp根目录
cp $WORK/build/tmp/deploy/images/salvator-x/Image /tftp/
cp $WORK/build/tmp/deploy/images/salvator-x/Image-r8a7795-salvator-xs.dtb /tftp/
WORK为yocto编译文件存放的目录
查看tftp根目录的文件
cd /tftp
ls
Image Image-r8a7795-salvator-xs.dtb
烧录内核文件
tftpboot 0x48080000 Image
tftpboot 0x48000000 Image-r8a7795-salvator-xs.dtb
booti 0x48080000 - 0x48000000
setenv bootcmd 'tftp 0x48080000 Image;tftp 0x48000000 Image-r8a7795-salvator-xs.dtb;booti 0x48080000 - 0x48000000'
saveenv
用nfs
环境配置
sudo apt-get install nfs-kernel-server nfs-common
创建nfs跟目录和文件系统复制进nfs目录下
IMAGE=weston
MACHINE=salvator-x
NFS_ROOT=/nfs/${MACHINE}
sudo mkdir -p "${NFS_ROOT}"
sudo rm -rf "${NFS_ROOT}"/*
sudo tar -xjf "${WORK}/build/tmp/deploy/images/${MACHINE}/core-image-${IMAGE}-${MACHINE}-*.tar.bz2" -C "${NFS_ROOT}"
sync
或者
sudo mkdir /nfs/salvator-x
sudo tar -xjf "${WORK}/build/tmp/deploy/images/salvator/core-image-weston-salvator-x.tar.bz2" -C "/nfs/salvator-x"
Edit /etc/exports:
sudo gedit /etc/exports
add
/nfs/salvator-x *(rw,no_subtree_check,sync,no_root_squash,no_all_squash)
Save the file and exit.
Force NFS server to re-read /etc/exports
sudo exportfs -a
Verify that NFS is working.
[builduser@buildmachine ~]$ showmount -e localhost
Export list for localhost:
/nfs/salvator-x *
在开发板的u-boot中设置nfs
setenv bootargs 'rw root=/dev/nfs nfsroot=192.168.1.76:/nfs/salvator-x ip=192.168.1.3
其中192.168.1.76为linux host pc 的ip,/nfs/salvator-x 为pc上ethernet的ip, 192.168.1.3为开发板的ip
U-Boot 2015.04 (Jul 25 2018 - 11:54:15)
CPU: Renesas Electronics R8A7795 rev 3.0
Board: Salvator-X
I2C: ready
DRAM: 3.9 GiB
Bank #0: 0x048000000 - 0x07fffffff, 896 MiB
Bank #1: 0x500000000 - 0x53fffffff, 1 GiB
Bank #2: 0x600000000 - 0x63fffffff, 1 GiB
Bank #3: 0x700000000 - 0x73fffffff, 1 GiB
MMC: sh-sdhi: 0, sh-sdhi: 1, sh-sdhi: 2
In: serial
Out: serial
Err: serial
Net: ravb
Hit any key to stop autoboot: 0
=> tftpboot 0x48080000 Image
ravb Waiting for PHY auto negotiation to complete... done
ravb: 1000Base/Full
Using ravb device
TFTP from server 192.168.1.76; our IP address is 192.168.1.3
Filename 'Image'.
Load address: 0x48080000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#####################################
3 MiB/s
done
Bytes transferred = 18665984 (11cd200 hex)
=> tftpboot 0x48000000 Image-r8a7795-salvator-xs.dtb
ravb:0 is connected to ravb. Reconnecting to ravb
ravb Waiting for PHY auto negotiation to complete... done
ravb: 1000Base/Full
Using ravb device
TFTP from server 192.168.1.76; our IP address is 192.168.1.3
Filename 'Image-r8a7795-salvator-xs.dtb'.
Load address: 0x48000000
Loading: ######
14.6 KiB/s
done
Bytes transferred = 77196 (12d8c hex)
=> booti 0x48080000 - 0x48000000
## Flattened Device Tree blob at 48000000
Booting using the fdt blob at 0x48000000
Using Device Tree in place at 0000000048000000, end 0000000048015d8b
Starting kernel ...
....
....
....
....
启动成功后
salvator-x login:
登录名为root,没有密码,登录后进入开发板的linux命令行界面
salvator-x login: root
root@salvator-x:~#
下次启动时不按键,倒计时结束时系统自动进入载入程序