【学习Sitara™ AM335x】-PhyCORE-AM335X Linux Quickstart(转)

2019-07-15 15:36发布

【学习Sitara™ AM335x】-PhyCORE-AM335X Linux Quickstart


1 About this QuickstartThis document describes how to install and work with the Linux Board Support Package (BSP) for the phyCORE-AM335X platform. This BSP provides a fundamental software platform for development, deployment and execution on the phyCORE-AM335X.The Quickstart contains instructions for:
  • Host Setup
  • Board Setup
  • Building a BSP (Platform, Kernel, Root Filesystem)
  • Flashing images to NAND (MLO, Barebox, Kernel, Root Filesystem)

2 Host SetupThe phyCORE-AM335X (PCM-051) has been developed and tested with Ubuntu 10.04 LTS Lucid Lynx.  Although it is possible to use a different OS, some setup information will contain OS-specific commands and paths for settings.Update repositories and upgrade installed packages.
  • sudo apt-get update
  • sudo apt-get upgrade

复制代码

2.1 Server-side SupportSupport for installing and setting up TFTP, NFS, and Samba server settings to enable communication between multiple systems and the target.2.1.1 TFTPTFTP allows files to be downloaded from one machine to another. With most embedded Linux devices, TFTP is an efficient way to boot the kernel during development so that the user does not have to flash a new kernel every time it is modified. It is also helpful when updating images in flash from barebox .First, start by installing the TFTP server.
  • sudo apt-get install tftpd-hpa

复制代码

Next, files can be accessed from another machine on the same network by simply using the IP address of the host. You must specify a folder where the files will reside on the host by replacing the folder path for TFTP_DIRECTORY with whatever folder you wish to use as your TFTP file storage location, or leave the folder as the default.
  • sudo gedit /etc/default/tftpd-hpa

  • # /etc/default/tftpd-hpa

  • TFTP_USERNAME="tftp"
  • TFTP_DIRECTORY="/var/lib/tftpboot"
  • TFTP_ADDRESS="0.0.0.0:69"
  • TFTP_OPTIONS="--secure"

复制代码

If you made any changes to the settings of the TFTP server, you need to restart it for them to take effect.
  • sudo restart tftpd-hpa

复制代码

Lastly, if you would like to grant every user on the system permission to place files in the TFTP directory, use the following command, replacing <TFTP_DIRECTORY> with your chosen location.
  • sudo chmod ugo+rwx

复制代码

2.1.2 NFSA network file-system (NFS) server gives other systems the ability to mount a file-system stored on the host and exported over the network. In embedded development, this is essential for quickly testing applications and evaluating different file-system setups.To begin the installation process use the following command:
  • sudo apt-get install nfs-kernel-server

复制代码

Exported filesystems are designated in the "/etc/exports" file and allow you to choose both the directory to be exported and many settings for accessing the exports. Below is an example for exporting a folder called "nfs_export-ex" located in a user's home directory.
  • sudo gedit /etc/exports

  • # /etc/exports

  • /home//nfs_export-ex  *(rw,sync,no_root_squash,no_subtree_check)

复制代码

The options (rw, sync, no_root_squash, no_subtree_check) for this folder are essential in setting up the NFS export correctly. For more information on additional options, refer to the man page for 'exports'.
  • rw enables

read and write access when the directory is mounted
  • sync

tells the file-system to handle local access calls before remote access
  • no_root_squash

allows root access when mounting the file-system
  • no_subtree_check

reduces the number of checks the server must make to ensure that an exported sub-directory is within an exported tree and also enables access to root files in conjunction with no_root_squashAfter modifying this file, in order to mount the directories as an NFS, you must force the NFS server to export all of the directories listed in "/etc/exports".
  • sudo /usr/sbin/exportfs -va

复制代码

2.1.3 SambaSamba servers are an excellent way to access a Linux file-system on a Windows machine via a network connection. Using a Samba server, it is quick and easy to transfer files between systems. To install a Samba server, use the following command:
  • sudo apt-get install samba

复制代码

Before the Samba share can be mounted on another machine it's necessary to modify the configuration file to allow write access and access to home directories. Start by editing the "/etc/samba/smb.conf" file.
  • sudo gedit /etc/samba/smb.conf

复制代码

Inside this file there are four specific things that need to be uncommented (remove the ';' at the beginning of the line) to enable the sharing of home folders and write access. Below is the section that must be modified:
  • #======================= Share Definitions =======================

  • # Un-comment the following (and tweak the other settings below to suit)
  • # to enable the default home directory shares. This will share each
  • # user's home directory as \serverusername
  • ;[homes]
  • ;   comment = Home Directories
  • ;   browseable = yes

  • # By default, the home directories are exported read-only. Change the
  • # next parameter to 'no' if you want to be able to write to them.
  • ;   read only = no

复制代码

The outcomes after the changes are made follow:
  • #======================= Share Definitions =======================

  • # Un-comment the following (and tweak the other settings below to suit)
  • # to enable the default home directory shares. This will share each
  • # user's home directory as \serverusername
  • [homes]
  •    comment = Home Directories
  •    browseable = yes

  • # By default, the home directories are exported read-only. Change the
  • # next parameter to 'no' if you want to be able to write to them.
  •    read only = no

复制代码

NOTE: It might also be necessary to change the "workgroup = " line to match the workgroup for your machine.To apply the changes, the next step is to restart all Samba-related processes.
  • sudo restart smbd
  • sudo restart nmbd

复制代码

Lastly, each user needs to have a password enabled to be able to use the Samba server. There are no rules for this password. The simplest method for choosing this password is to make it the same as the UNIX user's password, but it is not a requirement. After typing in the command below, you will be prompted to enter the password for the specified user.
  • sudo smbpasswd -a

复制代码

As mentioned in the configuration file, the samba share can be connected by accessing "\<host machine ip>\<user>" by either mounting a network share or using Windows explorer to navigate to it.2.2 PTXdist2.2.1 General InformationPTXdist is a set of tools created by Pengutronix to help manage all of the BSP sources, from x-loader to the filesystem and its applications. It makes it easier for a user to manage everything for specific platforms and toolchains without manually repeating relatively complex commands every time it is necessary to build a new image.2.2.2 Extracting SourcesNOTE: Visit the AM335X's BSP page [phyCORE-AM335X Linux BSP-PD12.1.0] for the correct BSP tools and images.Note: If your BSP contains a different version of ptxdist (see BSP page), replace ptxdist-2010.11.1.tgz with the correct version as necessary in the instructions belowTo install PTXdist you need to extract the archive with the PTXdist software "ptxdist-2010.11.1.tgz."The PTXdist packet has to be extracted in order to be built before the installation. In this example, we assume that the "ptxdist-2010.11.1.tgz" file has been placed in the ~ (/home/<user>) directory.
  • ~$ tar -zxvf ptxdist-2010.11.1.tgz
  • ~$ cd ptxdist-2010.11.1

复制代码

Now that the source has been extracted, the next step is to configure it for building.2.2.3 Pre-RequisitesPTXdist checks for specific packages that must be installed before it can be successfully built. The following command begins a script that uses GNU autotools to help set up the environment for building the distribution.
  • ~/ptxdist-2010.11.1$ ./configure

复制代码

This command will automatically stop if it is missing a package, and tell you why and what package to install to continue with the initial setup. After successfully running the configure script, PTXdist is ready to be built and installed.
  • ~/ptxdist-2010.11.1$ make
  • ~/ptxdist-2010.11.1$ sudo make install

复制代码

The install location is "/usr/local" by default, which is why the "make install" command must be run with root privileges. If another directory is preferred for the install, use the --prefix option when installing, but be sure to add the "bin/" directory of the installed tools in this new folder to your $PATH by modifying and sourcing ~/.bashrc.
  • source ~/.bashrc

复制代码

Now that the install is complete, the PTXdist folder in the ~ (/home/<user>) directory can be removed, as well as the original archive, but this is not necessary.Optional:
  • ~/ptxdist-2010.11.1$ cd ..
  • ~$ rm  -rf ptxdist-2010.11.1*

复制代码

2.2.4 SetupThe first time PTXdist is used, there are some setup properties that have to be configured. To run PTXdist's setup, use the following command:
  • ~$ ptxdist setup

复制代码

Once in the ptxdist setup, the only settings that should be modified are the User->Name and User->eMail. This is mainly for general logging purposes. If you wish to modify any other settings, please refer to the Getting Helpsection for a link to PTXdist documentation.Since PTXdist works with sources only, it needs to grab source archives from the web using wget as it advances through its setup if they do not exist already.2.3 ToolchainsIn order to build images or applications for an embedded device, it is necessary to have a cross toolchain that will perform the necessary operations to compile code for a specified processor and system setup.Each toolchain will have a modified GNU Compiler Collection (gcc) designed for the desired setup.For example, the following are all toolchains contained in the OSELAS Toolchain-1.99.3.7 distribution:
  • arm-cortexa8-linux-gnueabi-gcc
  • arm-1136jfs-linux-gnueabi-gcc
  • arm-v5te-linux-gnueabi-gcc
  • powerpc-603e-linux-gnu-gcc


0条回答

一周热门 更多>