概述
在zed的PS端运行spark(已成功):
(1)设置uboot为sd卡启动rootfs:
"sdboot=if mmcinfo; then "
"run uenvboot; "
"echo Copying Linux from SD to RAM... && "
"fatload mmc 0 0x3000000 ${kernel_image} && "
"fatload mmc 0 0x2A00000 ${devicetree_image} && "
"bootm 0x3000000 - 0x2A00000; "
"fi "
如果想从zImage启动,修改 include/configs/zynq_common.h 的sdboot 内容:
"sdboot=echo (modified) Copying Linux from SD to RAM... && "
"mmcinfo && "
"fatload mmc 0 0x8000 zImage && "
"fatload mmc 0 0x2A00000 ${devicetree_image} && "
"bootz 0x8000 - 0x2A00000 "
(2)devicetree.dts修改启动参数:
bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=0";
参考网站http://www.wiki.xilinx.com/Ubuntu+on+Zynq
(3)下载Uboot的rootfs镜像:
http://www.wiki.xilinx.com/file/view/zynq-ubuntu-core-12.10-core-armhf-rootfs.tar.xz/423293908/zynq-ubuntu-core-12.10-core-armhf-rootfs.tar.xz
(4)配置ip地址:
vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
设置网络地址生效:
/etc/init.d/networking restart
自动获取ip地址
dhclient eth0
(5)安装Java
/* wrong 1
apt-get install python-software-properties
遇到add-apt-repository: command not found的错误请参考以下链接。
(http://www.thelinuxguy.nl/how-tos/how-to-fix-sudo-add-apt-repository-command-not-found-linux/)
apt-get install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer
*/
/* wrong 2 此方法在后面sbt/sbt assembly会出错
apt-cache search jdk
apt-get install openjdk-7-jdk
vi ~/.bashrc
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-armhf/
JRE_HOME=${JAVA_HOME}/jre
export ANDROID_JAVA_HOME=$JAVA_HOME
export CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export JAVA_HOME;
export JRE_HOME;
export CLASSPATH;
HOME_BIN=~/bin/
export PATH=${PATH}:${JAVA_PATH}:${HOME_BIN};
*/
方法2:下载jdkforarm
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-arm-downloads-2187468.html
如果需要下载以前的版本:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
JAVA_HOME=/root/jdk1.7.0_60
export PATH=${JAVA_HOME}/bin:$PATH
(6)安装hadoop:
wget http://mirror.nus.edu.sg/apache/hadoop/common/hadoop-2.4.0/hadoop-2.4.0.tar.gz
tar zxvf hadoop-2.4.0.tar.gz
export PATH=/root/hadoop-2.4.0/bin:$PATH
(7)安装Scala
wget http://www.scala-lang.org/files/archive/scala-2.9.3.tgz
tar zxvf scala-2.10.4.tgz
mv scala-2.10.4 /usr/share/scala
ln -s /usr/share/scala/bin/scala /usr/bin/scala
ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
(8)安装Spark
wget http:
//d3kbcqa49mib13.cloudfront.net/spark-0.9.1-bin-hadoop2.tgz
tar zxvf spark-0.9.1-bin-hadoop2.tgz
cd spark-0.9.1-bin-hadoop2
sbt/sbt assembly
(注意这条命令后面不能有一杠,注意墙)
(这条命令如果失败似乎问题不大)
(9)测试
examples:http://spark.apache.org/examples.html
from random import random
def sample(p):
x, y = random(), random()
return 1 if x*x + y*y < 1 else 0
count = sc.parallelize(xrange(0, 1000)).map(sample)
.reduce(lambda a, b: a + b)
print "Pi is roughly %f" % (4.0 * count / 1000)
如果开发板处于广域网,而且没有配置localhost机器名, 则会遇到此错误
拔掉网线再测试:
配置机器名字:
成功启动界面:
成功测试界面:
转载于:https://www.cnblogs.com/shenerguang/p/3804905.html
最后
以上就是成就蜡烛为你收集整理的Learn ZYNQ (8)的全部内容,希望文章能够帮你解决Learn ZYNQ (8)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复