配置u-boot 參數,構造NFS啓動Beaglebone Black板的操作系統

来源:互联网 发布:java基础面试题 编辑:程序博客网 时间:2024/06/05 01:17

Board Setup

Getting Familiar with the Board

Take some time to read about the board features and connectors on http://www.elinux.org/Beagleboard:BeagleBoneBlack. Ensure you know how to properly power off and on the board without damaging it. Do not abruptly cut off power to your BeagleBone.
Beagleboardblackdiagram.png

Important things to note are the serial header, the miniUSB port (USB Client), the Ethernet port, the microSD card slot, the reset button, and the power button.

Other Useful Technical Documentation

  • Board System Reference Manual
  • TI AM335x SoC Datasheet
  • TI AM3359 SoC Technical Reference Manual

Setup Communication with the Board

  1. The BeagleBone serial connector is exported on the 6 pins close to one of the 48 pins headers. Using your USB to Serial adapter (female ends), connect the ground wire (blue) to the pin closest to the power supply connector, and the TX (red) and RX (green) wires to the pins board RX and board TX. The setup is shown below.
    Beaglebone serial setup.png
    NOTE

    You should always make sure that you connect the TX pin of the cable to the RX pin of the board, and vice versa.
  2. Once the USB to Serial connector is plugged in, a new serial port should appear: /dev/ttyUSB0. You can also see this device appear by looking at the output of dmesg.
  3. Ensure that your microSD card is inserted into the microSD card slot on the board. Power up your board by plugging your board into the Linux machine with the miniUSB cable.
  4. Finally, use your Ethernet cables to connect the Ethernet port of your board to your router and your router to your Linux machine, as shown in the diagram.
    AM335x Development Environment.png



Board Communication Setup

Setup NFS

  1. Use sudo to edit the file called exports in /etc. Add the following line to the bottom. This will allow NFS to locate the directory you wish to export via NFS, where you wish to export the directory (the * means all IP addresses. You can replace it with the IP address of your board if you wish), and the permissions you wish to use while exporting.
    <SDK path>/trainingNFS *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
  2. Stop and restart the NFS server, which was installed when you ran the setup package script. Either enter the lines one at a time, or add a sleep 1 in between the 2 lines.
    sudo /etc/init.d/nfs-kernel-server stop
    sudo /etc/init.d/nfs-kernel-server start

Setup Minicom

  1. Minicom is the serial communication program that was installed when you ran the setup-package.sh script earlier in the lab. You will use this program for interfacing with the board over the USB to serial cable. You will need to configure minicom the first time you run it. Start minicom into its configuration menu with the command:
    sudo minicom -s
    Minicom serialportsetup.png
  2. Scroll to and select the Serial port setup option. Press a to edit the Serial Device field to /dev/ttyUSB0, then pressEnter. Presse to edit the Bps/Par/Bits field to 115200 8N1, then pressEnter. Ensure both the Hardware and Software Flow Control fields are set to No. Your settings should now look like the ones in the image below.
    Minicom settingsview.png
  3. Press Enter to return to the main configuration menu and select Save setup as dfl. A confirmation message should appear.
  4. Select Exit from Minicom.

Boot the Board

  1. Run the command ifconfig to find the ip address of your host machine. An example is shown below.
    Minicom ipconfig.png
  2. Open the serial communication program Minicom by calling:
    minicom
    NOTE

    You can exit minicom at any time by hitting the keys Ctrl and A simultaneously, and then hitting X.
  3. Reboot your board by pressing the reboot button and when the line Hit any key to stop autoboot shows up, press any button on your keyboard to stop the U-boot countdown. You should now see the U-Boot prompt U-Boot# as shown below. If you miss the prompt, you can always hit the reboot button again.
    Minicom rebootview.png
  4. You can now use the command setenv <target variable> <value> to change your U-Boot environment variables to tell U-Boot to use NFS to mount your kernel and file system before booting. You will need to set the following variables:
    setenv serverip <your host ip>
    setenv rootpath <SDK path>/trainingNFS
    setenv bootfile zImage
    setenv ip_method dhcp
    setenv nfs_bootfile 'nfs ${loadaddr} ${serverip}:${rootpath}${bootdir}/${bootfile}'
    setenv nfs_fdtfile 'nfs ${fdtaddr} ${serverip}:${rootpath}${bootdir}/${fdtfile}'
    setenv bootcmd 'setenv autoload no; dhcp; run nfs_bootfile; run findfdt; run nfs_fdtfile; run netargs; bootz ${loadaddr} - ${fdtaddr}'

    NOTE

    You can enable line wrapping in minicom by pressing Ctrl-A Z and then W each time the window is opened.

    bootcmd in more detail:
    setenv autoload no - prevents U-Boot from trying to autoload an image over TFTP when you use the dhcp command
    dhcp - discovers the ip address of your board
    run nfs_bootfile - runs the command nfs ${loadaddr} ${serverip}:${rootpath}${bootdir}/${bootfile} stored in the nfs_bootfile variable, which created in an earlier line. This command mounts your zImage file over NFS from your host IP and specified file path to the address in loadaddr
    run findfdt - scans your board for the name of the necessary .dtb file to use
    run nfs_fdtfile - runs the command nfs ${fdtaddr} ${serverip}:${rootpath}${bootdir}/${fdtfile} stored in the nfs_fdtfile variable, which created in an earlier line. This command mounts the necessary .dtb file over NFS from your host IP and specified file path to the address in fdtaddr
    run netargs - sets bootagrs, a boot variable to be automatically passed to the kernel
    bootz ${loadaddr} - ${fdtaddr} - boots the board from the zImage and .dtb file in the loadaddr and fdtaddr memory locations respectively
    NOTE

    The printenv and help commands are useful for understanding these variables in more depth. If you wish to view the current value of a specific environemtn variable, you can call echo $<target>. editenv <target> is another helpful command to know that can be used to edit an environment variable without the need to completely overwrite it.
  5. Save the changes to your uboot environment variables with the command saveenv. You should see a message like the one below.
    Minicom ubootsaveenv.png
    If you do not see this message, your board may be using the pre-installed version of U-Boot saved on the internal eMMC rather than the version you copied to your microSD card. You can follow the instructionshere to wipe the eMMC so your board will boot from the microSD card.
  6. Once your environment variables are saved, reboot your board again.
    NOTE

    If your ip address changes, you will need to reset the serverip U-Boot variable or your board will not boot.
  7. If your board boots correctly, you should see a series of ###, as seen in the image below.
    Minicom successfulboot.png

    If your board boots incorrectly, you will see a series of TTT, as seen below.
    Minicom failedboot.png

    If you see this screen, you will need to go back and re-read the lab steps to find and correct your error. Common errors include a misspelling in your /etc/exports file, an incorrect ip address in the U-Boot environment variable serverip, or some other misspelled U-Boot environment variable.
  8. When the board is done booting, you will be prompted for a login. You should enter the login root, as seen below.
    Minicom aragologin.png
    NOTE

    If you connect to the board over minicom when the board is already booted, you many need to hit Enter a few time to see the login prompt.

轉自:

http://processors.wiki.ti.com/index.php/Processor_SDK_Linux_Training:_Introduction_to_Device_Driver_Development#Setup_NFS

0 0
原创粉丝点击