ev3与java_创建一个可启动EV3的SD卡(以便使用Java/lejos)

本帖最后由 ntwuhui 于 2013-9-27 00:46 编辑

d6eb565c07c6485859926bf70b4b2efe.gif

QQ图片20130920080305.jpg (31.53 KB, 下载次数: 193)

2013-9-20 08:04 上传

These tools are designed to help you create a bootable SD card for the Lego EV3. This card can then be used to run Java/leJOS programs on the device. The SD card image is based on the standard Lego firmware but has been enhanced to provide the following:

这个工具用于帮助你创建一个可用于启动EV3的SD卡,通过此卡以便在EV3上使用Java/leJOS程序。这个卡中的镜像的设计是基于原有乐高固件而设计,不过能够增强EV3的功能。(个人翻译能力有限,请见谅)

1. The Lego device access Kernel modules are loaded without having the Lego VM running.

2. The WiFi stack is loaded to allow connection to the EV3 via a supported USB WiFi adaptor. This allows you to connect to the EV3 via Telnet, SSH and NFS and makes program development very simple.

3. Driver modules for Atheros ATH9K and Realtex 8192cu based devices are included and will be loaded automatically based on the detected WiFi chipset. The EV3 has been tested using the NetGear WNA1100 and EDIMAX EW-7811Un adaptors, but others may work if they use the same chipsets.

4. Installs the Oracle Java SE Embedded JVM, JNA and leJOS classes so you are ready to run Java programs on the EV3.

5. Includes shutdown scripts to power off the device when Linux is shutdown

So what do you need?

1. A micro SD card 2Gb or more in size.

2. A WiFi dongle that is supported by the EV3. At the moment the only devices used are the NetGear WNA1100 and EDIMAX EW-7811Un. But hopefully this list will be expanded.

3. A PC running Linux (the tools were created/tested on Ubuntu 12.10) to create the SD card and to use for program development. This can be a Windows system with Linux running under VirtualBox.

4. A WiFi Network and details of the SSID and PSK etc. needed to connect to it.

5. A download of the Oracle Java SE Embedded JVM.

6. A Telnet or ssh program to connect to the EV3

7. Optionally an NFS server to allow you to easily run programs developed on your PC.

为此,你应准备一下:

1.一个不低于2Gb的SD卡;

2.用于EV3的WIFI适配器。目前唯一能够使用的是NetGear WNA1100 和 EDIMAX EW-7811Un。不过希望这个支持清单能够得到扩展。

3. 一台运行Linux的PC机(这个工具在Ubuntu12.10下创建并测试通过)以便创建SD卡以及开发平台。也可以在运行windows的系统下(通过虚拟机软件VirtualBox运行Linux)实现。

4. 一个能了解到SSID以及PSD等详细信息的WIFI网络。(用于连接)

5. 下载Java SE Embedded JVM

6. 一个用于与EV3相连的Telnet或ssh程序

7. 一台NFS服务器用于更简便的运行开发平台(PS:个人觉得可以先忽略这一块)

Getting started.

1. Download the latest leJOS creation tools (file lejosimage.bz2) from:

让我们开始:

2.Linux终端下展开:tar xfj lejosimage.bz2,这一步可以得到一个名为lejosimage的文件夹(内含创建工具)

并将下载到的tar文件复制到lejosimage文件夹中

4.下面该让你的wifi网络起作用了。你需要修改文件wpa_supplicant.conf,示例如下:

ctrl_interface=/var/run/wpa_supplicant# Persnetwork={ssid="legolan"

key_mgmt=WPA-PSK

psk=8e9116c7665b56a95c03e3e23ec707f4cbe18fea82d620d9b85b2f79fe34cfee

pairwise=CCMP TKIP

group=CCMP TKIP

proto=RSN}

Which basically defines a network that has an SSID of “legolan” and uses WPA2 authentication. You can find more details of the various settings and configuration options here:

这里定义了网络SSID为“legolan”并使用wpa2验证,关于此配置文件更多例子见这里:

Ok now we are ready to create the image. First off we need to format the card. basically we are creating two partitions one DOS, the second Linux. To format the card hook up an SD card reader and use the command:

下面来创建镜像,第一步先格式化这张卡,将该卡分两个区:第一个用于DOS,第二个Linux。运行下面的命令进行格式化

./format_sdcard.sh

This will prompt you for sudo access as required. Take care when specifying the device to format, you could end up formatting your hard disk!

此步骤会提示需要sudo密码。。。

Once you have a formatted card we can create the image. First remove and re-insert the card. On most Linux systems the system will automatically mount the two partitions (called LMS2012 and LMS2012_EXT), if they are not mounted automatically you will need to mount them before continuing. Make a note of the location that that card has been mounted (on Ubuntu this will be /media//), then issue the command:

格式化后我们来创建镜像先移除sd卡再重新插入。linux系统会重新挂载这两个分区(名叫LMS2012以及LMS2012_EXT),如果没有自动挂载这两个分区,可以手工用mount命令挂载后再继续。将挂载点的名字记载下来(Ubuntu在/media/下可以看到),然后输入以下命令./update_sdcard.sh

Where is the location that the SD card is mounted and is name of the file you downloaded previously. On my system the command line would be:

这里是SD卡的挂载点名字。是先前下载的文件:

./update_sdcard.sh /media/andy ejre-7u21-fcs-b11-linux-arm-sflt-headless-04_apr_2013.tar.gz

The script will then go ahead and create the boot image.

此脚本将会创建一个可启动镜像。

Once complete eject the SD card using the eject option in the Linux file browser and remove it from the reader. Make sure the EV3 is powered off and then insert the card into the EV3 SD card slot. Press the enter button to boot the EV3. As the system boots it will turn on the Red LEDs when these turn off the EV3 will be ready to use. Shortly after the red light turns off the LCD screen will display the leJOS logo. Just below this you should see the IP address assigned to the EV3. If you do not see an IP address displayed then something has gone wrong with the WiFi setup, check that you have correctly configured the wpa_supplicant.conf and that you are using a supported WiFi device. If necessary re-run the update_sdcard.sh command to recreate the image.

当制作完成后正常退出SD卡,确认关闭EV3,再次插入SD卡,按Enter开启SD卡。当系统启动时红色LED会打开直到系统启动结束再自动关闭提示可以开始使用。

然后LCD屏幕上会显示leJOS logo.在此之后可以看到分配给EV3的IP地址。如果不显示这些,仔细检查配置文件wpa_supplicant.conf。必要时重新使用update_sdcard脚本重新创建SD卡镜像。

Once the EV3 has booted you should be able to connect to the displayed IP address using either ssh or telnet. Login as root with no password. Once connected you can now check that it is possible to run leJOS based Java programs. cd to the the /home/root/lejos/samples directory and type:

一切OK后,可以使用ssh或者telnet登陆EV3(telnet ip地址),登陆账户名root,密码为空。连上后就可以cd进入/home/root/lejos/samples并运行

jrun EV3HelloWorld

After a short while the program should play some sounds, light up the EV3 LEDs and display a message on the EV3 display.

。。。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值