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

本文档为BeagleBone Black用户提供详细的设置教程,包括熟悉主板特性、配置串口通信、设置NFS、配置Minicom及启动板载等关键步骤。通过本文,读者将学会如何正确地初始化和配置开发板。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
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 instructions here 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

<think>我们正在寻找支持U-Boot shell控制台的常用免费嵌入式开发平台。U-Boot是一个开源的引导加载程序,常用于嵌入式系统。我们需要平台支持常见的U-Boot命令,如关机、重启、读内存等,并且提供网址。 根据引用[3]中提到的刷机和启动过程,我们可以推断出一些嵌入式平台可能使用U-Boot。常见的免费嵌入式开发平台包括树莓派(Raspberry Pi)、BeagleBone等。这些平台通常支持U-Boot,并且有活跃的社区支持。 1. 树莓派(Raspberry Pi):虽然树莓派默认使用自己的引导程序,但可以替换为U-Boot。树莓派基金会提供了详细的文档和下载。 2. BeagleBoneBeagleBone系列开发默认使用U-Boot作为引导加载程序,因此原生支持U-Boot shell。 3. QEMU:这是一个模拟器,可以模拟多种硬件平台,包括使用U-Boot的环境。虽然不是硬件平台,但对于学习和测试U-Boot命令非常有用。 下面我们分别列出这些平台: 1. **树莓派 (Raspberry Pi)** - 描述:树莓派是一款流行的单计算机,虽然默认使用专有的引导程序,但可以安装U-Boot。用户可以通过U-Boot进行低级硬件操作。 - 支持U-Boot命令:关机(poweroff)、重启(reset)、读内存(md)等。 - 网址:[https://www.raspberrypi.org/](https://www.raspberrypi.org/) - 注意:树莓派上使用U-Boot需要自行编译和安装,官方文档中有相关指导。 2. **BeagleBone** - 描述:BeagleBone系列开发(如BeagleBone Black)默认使用U-Boot作为引导加载程序,因此开机即可进入U-Boot shell。 - 支持U-Boot命令:包括关机、重启、读内存等所有标准命令。 - 网址:[https://beagleboard.org/](https://beagleboard.org/) - 注意:BeagleBone的U-Boot是开箱即用的,无需额外安装。 3. **QEMU(模拟器)** - 描述:QEMU是一个开源的机器模拟器和虚拟器,可以模拟ARM等平台,并运行U-Boot。这对于学习和测试U-Boot命令非常方便,无需硬件即可体验。 - 支持U-Boot命令:支持标准的U-Boot命令。 - 网址:[https://www.qemu.org/](https://www.qemu.org/) - 注意:QEMU可以模拟多种开发,如versatilepb等,用户可以在模拟环境中运行U-Boot。 另外,还有一些其他的嵌入式平台也支持U-Boot,但上述三个是最常用且免费的。其中,BeagleBone是原生支持U-Boot的硬件平台,而树莓派需要额外步骤,QEMU则是模拟环境。 关于U-Boot的常用命令,这里简要列举: - 关机:`poweroff` - 重启:`reset` - 读内存:`md[.b, .w, .l] address`(例如:`md.l 0x100000` 读取从0x100000开始的长字内存) 以上平台都支持这些命令。 因此,我们推荐: 1. BeagleBone(硬件平台,原生支持) 2. 树莓派(硬件平台,需安装U-Boot) 3. QEMU(模拟器,方便学习和测试) 用户可以根据自己的需求选择硬件平台或模拟器。</think>### 推荐支持U-Boot shell的嵌入式开发平台 以下是常用且免费的嵌入式开发平台,均原生支持U-Boot shell控制台,提供关机、重启、内存读写等关键操作: --- #### 1. **BeagleBone系列** - **描述**:德州仪器推出的开源硬件平台,默认搭载U-Boot,提供完整的硬件调试接口。 - **支持命令**: ```bash # 关机 poweroff # 重启 reset # 读内存(示例:读取0x80000000开始的4字节) md.l 0x80000000 1 ``` - **网址**:[beagleboard.org](https://beagleboard.org/) - **特点**:开源硬件设计,社区活跃,支持Device Tree配置[^1]。 --- #### 2. **Raspberry Pi(需手动刷入U-Boot)** - **描述**:树莓派默认使用专有Bootloader,但可通过SD卡刷入U-Boot替代。 - **支持命令**: ```bash # 关机(需扩展命令) ums 0 mmc 0 # 重启 reset # 读内存(示例:读取0x3f000000) md.b 0x3f000000 10 ``` - **网址**:[raspberrypi.org](https://www.raspberrypi.org/) - **教程**:U-Boot移植指南见[官方Wiki](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#uboot)[^2]。 --- #### 3. **QEMU模拟器** - **描述**:虚拟化ARM开发(如`vexpress-a9`),完美支持U-Boot调试。 - **支持命令**: ```bash # 关机(模拟断电) qemu: quit # 重启 reset # 读内存(示例:读取0x40000000) md.w 0x40000000 4 ``` - **网址**:[qemu.org](https://www.qemu.org/) - **特点**:零硬件成本,支持GDB调试,适合学习U-Boot原理[^3]。 --- #### 4. **FriendlyARM NanoPi系列** - **描述**:全志芯片平台,默认集成U-Boot,提供GPIO扩展。 - **支持命令**: ```bash # 关机 poweroff # 重启 reset # 读内存(支持MMIO访问) mmc read 0x80000000 0x1000 1 ``` - **网址**:[friendlyarm.com](https://www.friendlyarm.com/) - **优势**:低价(约$20),兼容Arduino扩展--- ### 关键功能对比 | 平台 | 原生U-Boot | 关机命令 | 内存读写 | 硬件成本 | |---------------|-----------|---------|---------|---------| | BeagleBone | ✓ | ✓ | ✓ | $50+ | | Raspberry Pi | ✗(需刷机) | ✓ | ✓ | $35+ | | QEMU | ✓ | ✓ | ✓ | $0 | | NanoPi | ✓ | ✓ | ✓ | $20+ | > **提示**:实际命令可能因U-Boot版本差异略有不同,建议参考各平台文档[^1][^2][^3]。 --- ### 相关问题 1. U-Boot中如何通过`mmc write`命令烧录固件到eMMC? 2. 在QEMU模拟环境中如何调试U-Boot启动流程? 3. BeagleBone的U-Boot如何配置网络引导(TFTP/NFS)?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值