转帖 DM365 挂载NFS文件系统 【翻译】

Creating a Shared File System Between Host and Target

Although the EVM board's (i.e. target's) NAND flash contains a file system, during development it is more convenient to have the target board NFS mount a file system on a host Linux workstation. Once you have tested the application, you can store it on the board's flash for a standalone demonstration.

Before the EVM can mount a shared target file system, you must export that target file system on the host Linux workstation. The shared file system uses a NFS (Network File System) server. The exported file system will contain the target file system and your executables.

FY:虽然开发板的NAND FLASH有一个文件系统,但是在开发的时候还是通过加载linux主机上的NFS文件较方便。首先要在linux主机上建一个开发板平台的文件系统,包括文件系统和应用程序。这个文件系统通过NFS服务器被开发板平台加载。

Exporting a Shared File System for Target Access  FY:创建一个文件系统

To export the file system from your NFS server, perform the following steps. You only need to perform these steps once.

1) Log in with a user account on the host Linux workstation.

2) Perform the following commands to prepare a location for the MontaVista file system. For example:

host $ cd /home/useracct
host $ mkdir -p workdir/filesys
host $ cd workdir/filesys

3) Switch user to "root" on the host Linux workstation.

host $ su root

4) Perform the following commands to create a copy of the target file system with permissions set for writing to the shared area as useracct. Substitute your user name for useracct. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ cp -a /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/target/* .
host $ chown -R useracct opt
FY:首先在linux主机上建一个文件夹,然后把/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/target/
下的所有文件拷贝到filesys下,并修改普通用户对opt的权限,如果一直用root就没这个问题。

5) Still as root, edit the /etc/exports file on the host Linux workstation (not the exports file on the target filesystem) using a text editor like gedit, for example:

host $ gedit /etc/exports

Add the following line for exporting the filesys area, substituting your user name for useracct. Use the full path from root; ~ may not work for exports on all file systems. By editing the exports file you are effectively sharing the folder so that other devices (such as the EVM) can mount it.

/home/useracct/workdir/filesys *(rw,no_root_squash,no_all_squash,sync)

Note: Make sure you do not add a space between the * and the ( in the above command.

FY:修改/etc/exports,在里面加入/home/useracct/workdir/filesys *(rw,no_root_squash,no_all_squash,sync)设置文件系统目录;

6) Still as root, use the following commands to make the NFS server aware of the change to its configuration and to invoke an NFS restart.

host $/usr/sbin/exportfs -av
host $/sbin/service nfs restart

Note: Use exportfs -rav to re-export all directories. Use /etc/init.d/nfs status to verify that the NFS status is running.

FY:用exportfs设置/etc/exports中的目录可以被NFS客户机访问;

重启NFS服务;

7) Verify that the server firewall is turned off:

host $ /etc/init.d/iptables status

If the firewall is running, disable it:

host $ /etc/init.d/iptables stop
FY:关闭防火墙。

Testing the Shared File System FY:测试共享文件系统

To test your NFS setup, follow these steps:

1) Get the IP address of your host Linux workstations as follows. Look for the IP address associated with the eth0 Ethernet port.

host $ /sbin/ifconfig
FY:查看Linux主机IP

2) Open a terminal emulation window to connect to the EVM board via RS-232 using the instructionshere. If you have a Windows workstation, you can use HyperTerminal. If you have a Linux workstation, you might use Minicom. (You may need to turn on line wrap.)

3) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window (as shown here). This gets you into the U-Boot prompt where you can configure how U-Boot will boot the Linux kernel.

FY:给开发板上电,用超级终端查看UBOOT的信息,终止自动boot;

4) Set the following environment variables in the console window:

EVM # setenv nfshost  
EVM # setenv rootpath directory to mount 
EVM # setenv bootargs 'console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=76M video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4'

Note that the setenv bootargs command should be typed on a single line. Also note that you should avoid using the numeric keypad to enter numbers, as it can sometimes insert extra invisible characters. These environment variables must be typed in perfectly including capitals, if anything is typoed you will likely run into boot errors.

The directory to mount must match what you specified in Step 5 of Exporting a Shared File System for Target Access. For example, /home//workdir/filesys.

Hints: You may want to use the printenv command to print a list of your environment variables. You can also save these setenv commands in a .txt file from which you can paste them in the future.

5) Save the environment so that you don't have to retype these commands every time you cycle power on the EVM board:

EVM # saveenv

6) Boot the board using NFS:

EVM # boot

7) You can now log in as "root" with no password required.

See DM365 Alternate Boot Methods for information about booting with TFTP, NFS, or the board's NAND flash.

FY:设置UBOOT环境变量,

## Booting image at 80700000 ...
...
Starting kernel ...
...
VFS: Mounted root (nfs filesystem).
如果有这些信息就加载成功了,并可以访问刚才建的文件系统;

Notes on Using Evaluation/Production Codecs

As part of the DM365 DVSDK installation, you received a number of codecs:

  • Sequential JPEG Decoder
  • Sequential JPEG Encoder
  • MPEG4 Restricted Simple Profile Decoder
  • MPEG4 Simple Profile Encoder
  • H.264 High Profile Decoder
  • H.264 High Profile Encoder
  • G.711 Decoder (not a TI codec)
  • G.711 Encoder (not a TI codec)

These codecs are provided under a "for demonstration-only" license agreement. If you wish to use these codecs in a production development environment, you can go to thehttp://www.ti.com/digitalmediasoftware web site and click on "Software Inventory" to download the latest production versions and the appropriate license agreement.

Setting Up the Build/Development EnvironmentFY:设置编译环境

To set up the development and build environment, follow these steps:

1) Log in to your user account (and not as root) on the NFS host system.

2) Set your PATH so that the MontaVista tool chain host tools and cross compiler (arm_v5t_le-gcc) can be found. For example, in a default installation of the MontaVista LSP, you should add a definition like the following to your shell resource file (for example, home/user/.bashrc), typically this would be done using the export command. Note that there can be no spaces or carriage returns in the path definition. Note that this step is asking you to open .bashrc in a text editor such as vi or gedit and add the export command line to the file, for example run the command below:

host $ gedit /home/user/.bashrc

Than add the export command below to the .bashrc file:

export PATH="/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_5.0/montavista/pro/bin:/opt/mv_pro_5.0/montavista/common/bin:$PATH"

If you installed in a location other than /opt/mv_pro_5.0, use your own location in the PATH.

3) Remember to use the following command after modifying your .bashrc file, the source command will essentially execute the .bashrc script such that the path you just added to it is put into your environment variables:

host $ source /.bashrc

4) If you want to verify your new PATH variable you can run either of the commands below:

This will print just the PATH variable:

host $ echo $PATH

This will print all of the system's current environment variables:

host $ printenv
设置montavista环境变量。另外一种方法也可以,请见
hi.baidu.com/bluetoothman/blog/item/10935e3450e079bed1a2d320.html

Writing a Simple Program and Running it on the EVMFY:写一个简单程序,并让他在EVM上跑

Make sure you have performed the steps in Exporting a Shared File System for Target Access andSetting Up the Build/Development Environment.

Perform the following steps on the NFS host system as user (not as root):

1) Make a new directory for the simple program:

host $ mkdir /home/useracct/workdir/filesys/opt/hello

2) Move to the new directory:

host $ cd /home/useracct/workdir/filesys/opt/hello

3) Create a file named hello.c using a text editor (for example, gedit, kedit, xemacs, or vi),

host $ gedit hello.c

Now add the following contents to it:

#include 
int main()
{
printf("Buongiorno DaVinci!\n");
return 0;
}

4) Build the new c file:

host $ arm_v5t_le-gcc hello.c -o hello

Perform the following steps on the target board. You may use either the target's console window (Discussed here) or a telnet session.

1) Move to the new directory on the target:

target $ cd /opt/hello

2) Run the new executable:

./hello.

The output should be:

Buongiorno DaVinci!
FY:建一个hello程序,编译并通过NFS加载文件系统,并运行;

Building a New Linux KernelFY:编译一个Montavista linux kernel

If you modify the target's Linux kernel sources, you will need to rebuild it and then boot it up by either replacing the kernel that comes installed on the EVM board's flash (through a TFTP load, Serial load, JTAG load, etc) or by having the U-Boot utility use TFTP (Tiny File Transfer Protocol) to boot the kernel over a network connection.

 

Make sure you have completed Setting Up the Build/Development Environment and Writing a Simple Program and Running it on the EVM before attempting to build a new kernel.

FY:编译linux kernel,通过tftp加载测试;首先你一定要确保设置了环境变量;

To rebuild the Linux Kernel, follow these steps:

1) Log in to your user account (not as root).

2) Edit the Rules.make file in the dvsdk_#_#. directory:

host $ gedit /home/user/dvsdk_#_#_#_#/Rules.make

Modify PLATFORM to match your EVM board as follows:

PLATFORM=dm365
FY:修改PLATFORM=dm365

3) Use commands like the following to make a local working copy of the MontaVista Linux Support Package (LSP) in your home directory. This copy contains the embedded Linux 2.6.18 kernel plus the DaVinci drivers. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ cd /home/
host $ mkdir -p workdir/lsp
host $ cd workdir/lsp
host $ cp -R /opt/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci .
FY:把/opt/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci文件夹中内容拷贝到自己建的一个工作
文件夹,这样能保证安装文件夹下内容不被改变,相当时一个备份了,运行拷贝命令的时候那个红点一定不能少了;

4)Use the following commands to configure the kernel using the DaVinci defaults. Note that CROSS_COMPILE specifies a prefix for the executables that are used during compilation:

host $ cd ti-davinci/linux-2.6.18_pro500
host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- davinci_dm365_defconfig
FY:用上面的命令配置kernel为DaVinci默认配置

5) To modify the kernel options, you will need to use a configuration command such as "make menuconfig" or "make xconfig". To verify the MontaVista default kernel options, use the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- checksetconfig
FY:确认配置;

6) Compile the kernel using the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- uImage
FY:编译kernel;

7) If the kernel is configured with any loadable modules (that is, selecting for a module in menuconfig), use the following commands to rebuild and install these modules (with the default out of the box build you will not have any and can skip this step):

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- modules
host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- INSTALL_MOD_PATH=/home//workdir/filesys modules_install
FY:编译可加载的模块,并安装到NFS文件夹下,注意这里的红色中杠,TI WIKI上是没有的,我一开始没注意直接拷贝,老是编译不成功,后来发现这里少了,加上就没问题了;

8) Use the following command to copy uImage to a place where U-Boot can use TFTP to download it to the EVM. These commands assume you are using the default TFTP boot area, which is /tftpboot. If you use another TFTP root location, please change /tftpboot to your own TFTP root location. (Perform these commands as root or use a chown uImage command to get ownership of the file.)

host $ cp /home//workdir/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /tftpboot
host $ chmod a+r /tftpboot/uImage

For more information on setting up a TFTP server, see Setting Up a TFTP Server.

See a standard Linux kernel reference book or online source for more about Linux build configuration options.

FY:拷贝uImage文件到TFTP服务器根目录下;

Rebuilding the DVSDK Software for the TargetFY:编译DVSDK软件

To place demo files in the /opt/dvsdk directory, you need to rebuild the DVSDK software. To do this, follow these steps:

1) If you have not already done so, rebuild the Linux kernel as described in Building a New Linux Kernel.

FY:首先一定编译过Linux kernel

2) Change directory to dvsdk_#_#.

FY:来到dvsdk的安装目录

3) Edit the Rules.make file in the dvsdk_#_#. directory.

host $ gedit Rules.make
FY:找到Rules.make文件按照下面的说明修改;

If you installed components in the default locations, the directory definitions may already be correct, but you should verify them in any case.

Set PLATFORM to match your EVM board as follows:

PLATFORM=dm365
FY:修改平台为dm365

Set DVSDK_INSTALL_DIR to the top-level DVSDK installation directory as follows, note that by default ${HOME} refers to your /home/ directory:

DVSDK_INSTALL_DIR=/home//dvsdk_#_#
FY:设置dvsdk的安装目录

Modify the following variable as needed to match the location of XDCtools on your Linux host. We recommend that XDCtools be installed in the /home//dvsdk_#_# directory, but you may have installed it elsewhere.

XDC_INSTALL_DIR=/home//dvsdk_#_#/xdctools_#_#
FY:设置xdc_tool的安装目录

Make sure LINUXKERNEL_INSTALL_DIR is defined as follows so it points to where you copied the linux kernel tree in the Building a New Linux Kernel.

LINUXKERNEL_INSTALL_DIR=/home//workdir/lsp/ti-davinci/linux-2.6.18_pro500
FY:设置linuxkernel工作拷贝的目录,这也是一定要先编译linuxkernel的原因,这里要用到;

Make sure MVTOOL_DIR points to the MontaVista Linux tools directory as follows:

MVTOOL_DIR=/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le
FY:设置MVTOOL的安装目录

Make sure EXEC_DIR points to the opt directory on the NFS exported file system as follows:

EXEC_DIR=/home//workdir/filesys/opt/dvsdk/dm365
FY:设置编译后的可执行文件夹到NFS文件夹下,这样就可以在EVM平台上调用编译后的程序了;

4) While in the same directory that contains Rules.make, use the following commands to build the DVSDK demo applications and put the resulting binaries on the target file system specified by EXEC_DIR. Note that the first time you run 'make clean' there may not be much to clean yet, so the output from make will have a lot of 'no such file or directory' messages. The make commands should be run as the user account.

host $ make clean
host $ make
host $ make install
FY:

5) You can test the rebuilt DVEVM software by booting your NFS file system and running the demos from the command line as described in Running the Demos from the Command Line.

Booting the New Linux Kernel

After building the new kernel, in order to use it to boot the DaVinci board, you must transfer it to the board via TFTP. It is assumed you have completed the steps in Building a New Linux Kernel, and the boot file, uImage has been copied to /tftpboot (or some other site-specific TFTP accessible location).

1) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window (Discussed here).

2) Set the following environment variables. (This assumes you are starting from a default, clean U-Boot environment. See Default Boot Configuration for information on the U-Boot default environment.)

 

EVM # setenv bootcmd ’dhcp;bootm’
EVM # setenv serverip 
EVM # setenv bootfile uImage
EVM # setenv bootargs mem=76M console=ttyS0,115200n8 root=/dev/mtdblock3 rw rootfstype=yaffs2 ip=dhcp video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4
EVM # saveenv

Note that the 'setenv bootargs' command should be typed on a single line.

3) Boot the board:

EVM # boot

This configuration boots a new Linux kernel via TFTP with a NAND flash based file system. To boot using an NFS file system, see Booting via TFTP Using NFS File System.

FY:用TFTP加载linux kernel,并加载NFS文件系统。

For instructions on how to verify that your host workstation is running a TFTP server, and for instructions on what to do if it isn't, see Setting up a TFTP Server.

For more details on booting, see DM365 Alternate Boot Methods.

To continue the EVM setup process please continue in the Getting Started Guide.

Retrieved from " http://wiki.davincidsp.com/index.php/GSG:_DM365_DVEVM_Software_Setup"
Category:  DM365
Leave a Comment

你可能感兴趣的:(IPNC)