Linux 复制相同的 BeagleBone Black 设置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17834561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:21:18  来源:igfitidea点击:

Duplicating identical BeagleBone Black setups

linuxembedded-linuxbootbeagleboardbeagleboneblack

提问by Philipp

After having set-up and customized my "master" BeagleBone Black (BBB) with applications etc. on the on-board eMMC, I want to duplicate it on other BBB boards.

在板载 eMMC 上使用应用程序等设置和自定义我的“主”BeagleBone Black (BBB) 后,我想在其他 BBB 板上复制它。

What is the best way to duplicate the BBB?

复制 BBB 的最佳方法是什么?

My understanding of options:

我对选项的理解:

  1. SD-Card: Programming each board by inserting a prepared SD card containing an image and pressing the "boot" switch while powering up.
    • How should I prepare that .img file or the SD card from my master BBB?
    • The image should copy to the on-board eMMC, so that the SD-card can be removed afterwards.
  2. USB: Programming by connecting the board over USB to a (Win7) PC.
    • Is it possible to write the full on-board eMMC from the PC?
    • With which app to do the writing?
    • How to prepare the image which will be written, starting from the master BBB?
  3. Ethernet: Programming over LAN after boot-up with default angstrom distro.
    • Is it even possible over LAN?
    • How to do the writing?
    • How to prepare the image which will be written, starting from the master BBB?
  1. SD 卡:通过插入准备好的包含图像的 SD 卡并在通电时按下“启动”开关来对每个板进行编程。
    • 我应该如何从我的主 BBB 准备 .img 文件或 SD 卡?
    • 映像应复制到板载 eMMC,以便之后可以移除 SD 卡。
  2. USB:通过 USB 将开发板连接到 (Win7) PC 进行编程。
    • 是否可以从 PC 上编写完整的板载 eMMC?
    • 用哪个app写?
    • 如何准备将要写入的图像,从主 BBB 开始?
  3. 以太网:使用默认 angstrom 发行版启动后通过 LAN 编程。
    • 甚至可以通过局域网吗?
    • 怎么做文案?
    • 如何准备将要写入的图像,从主 BBB 开始?

Which is possible/best?

哪个是可能的/最好的?

Edit: My current solution is to flash with a standard image (from the BeagleBoe website) and then have a script do all modifications as expected. This includes disabling many services I don't need, installing applications and configuring stuff etc. If there is an easier way for making a SD card with a full image on it, I'm still interested.

编辑:我当前的解决方案是使用标准图像(来自 BeagleBoe 网站)进行闪存,然后让脚本按预期进行所有修改。这包括禁用许多我不需要的服务、安装应用程序和配置东西等。如果有更简单的方法来制作带有完整图像的 SD 卡,我仍然很感兴趣。

采纳答案by Paul Ryan

For anyone else that needs this, the best answer I've found to this is to do the following:

对于需要此功能的其他任何人,我找到的最佳答案是执行以下操作:

First setup your master Beaglebone Black the way you want it.

首先按照您想要的方式设置您的主 Beaglebone Black。

Backup the eMMC

备份 eMMC

  • FAT format a 4GB or larger SD card (must be a MBR/bootable formatted microSD card)
  • Download beagleboneblack-save-emmc.zipand extract the contents onto your SD card

    Note: this is an image from Jason Krinder at his github https://github.com/jadonk/buildrootusing the save-emmc-0.0.1 tag

  • Put the card into your powered off Beaglebone Black
  • Power on your Beaglebone Black while holding the S2 Button
  • The USR0 led will blink for about 10 minutes, when it's steady on you have an SD card with a copy of your eMMC in a .img file
  • FAT 格式 4GB 或更大的 SD 卡(必须是 MBR/可启动格式的 microSD 卡)
  • 下载beagleboneblack-save-emmc.zip并将内容解压缩到您的 SD 卡上

    注意:这是 Jason Krinder 在他的 github https://github.com/jadonk/buildroot使用 save-emmc-0.0.1 标签的图像

  • 将卡放入已关闭电源的 Beaglebone Black
  • 按住 S2 按钮打开 Beaglebone Black 电源
  • USR0 LED 将闪烁大约 10 分钟,当它稳定时,您有一张 SD 卡,其中包含 .img 文件中的 eMMC 副本

Use the eMMC to flash a new Beaglebone Black

使用 eMMC 刷入新的 Beaglebone Black

  • On the SD card edit autorun.sh

    #!/bin/sh
    echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger 
    dd if=/mnt/<image-file>.img of=/dev/mmcblk1 bs=10M
    sync
    echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger
    

    where <image-file>is the image file you got after copying backing up your eMMC

  • Insert the card into your powered off Beaglebone Black
  • Power on your Beaglebone Black while holding the S2 Button
  • The Beaglebone Black should go into rebuilding mode and within about 20 minutes you'll have a newly flashed Beaglebone Black (when all 4 USR LEDs are solid) with a copy of your original
  • 在 SD 卡上编辑 autorun.sh

    #!/bin/sh
    echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger 
    dd if=/mnt/<image-file>.img of=/dev/mmcblk1 bs=10M
    sync
    echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger
    

    <image-file>复制备份eMMC后得到的镜像文件在哪里

  • 将卡插入已关闭电源的 Beaglebone Black
  • 按住 S2 按钮打开 Beaglebone Black 电源
  • Beaglebone Black 应进入重建模式,大约 20 分钟内,您将拥有一个新闪烁的 Beaglebone Black(当所有 4 个 USR LED 均亮起时)以及您的原始副本

eLinux reference used for this article - http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents

本文使用的 eLinux 参考 - http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents

回答by stbtrax

Copying your emmc Image back to a SD card is a bit tricky, since it will need to be formated in a certain way to get it to mount. Here are some tips to get that working: http://dev.gentoo.org/~armin76/arm/beagleboneblack/install_emmc.xml#expand

将您的 emmc 映像复制回 SD 卡有点棘手,因为它需要以某种方式格式化才能安装。这里有一些技巧可以让它发挥作用:http: //dev.gentoo.org/~armin76/arm/beagleboneblack/install_emmc.xml#expand

What might be easier is using an USB thumb drive, or USB SD card reader. Note, currently there are some issues hot-plugging USB devices, so boot with it plugged in.

使用 USB 拇指驱动器或 USB SD 读卡器可能更容易。请注意,目前热插拔 USB 设备存在一些问题,因此请在插入时启动。

You can copy your entire FS to the USB drive, then compress it. Create a new bootable linux sd image, and put your compressed FS on there and use one of the scripts Ottavio linked to to copy over the compressed image. you can make a systemd service to launch the script on startup.

您可以将整个 FS 复制到 USB 驱动器,然后对其进行压缩。创建一个新的可启动 linux sd 映像,并将压缩的 FS 放在那里,并使用 Ottavio 链接到的脚本之一复制压缩映像。您可以创建一个 systemd 服务来在启动时启动脚本。

回答by SevakPrime

I have the same need and am using dd and nc (NetCat) to save directly on my desktop without having to use an intermediary SD Card. You can do this over the USB connection, or ethernet connection, by changing the IP address in the steps below.

我有同样的需求,正在使用 dd 和 nc (NetCat) 直接保存在我的桌面上,而无需使用中间 SD 卡。您可以通过 USB 连接或以太网连接执行此操作,方法是在以下步骤中更改 IP 地址。

After setting up your BBB with the applications you want, the basic steps are:

使用您想要的应用程序设置 BBB 后,基本步骤是:

  1. On the desktop, run this command in a terminal:
  1. 在桌面上,在终端中运行此命令:

nc -l 19000|bzip2 -d|dd bs=16M of=BBB.img

nc -l 19000|bzip2 -d|dd bs=16M of=BBB.img

  1. On the BeagleBone Black, run this command in a terminal (you can SSH into it, or do it directly from the BBB):
  1. 在 BeagleBone Black 上,在终端中运行此命令(您可以通过 SSH 进入,或直接从 BBB 执行):

dd bs=16M if=/dev/mmcblk0|bzip2 -c|nc 192.168.7.1 19000

dd bs=16M if=/dev/mmcblk0|bzip2 -c|nc 192.168.7.1 19000

The 192.168.7.1 address is for the USB connection. (BBB is 192.168.7.2) If you're doing this over an ethernet connection, you should use your desktop's IP address.

192.168.7.1 地址用于 USB 连接。(BBB 是 192.168.7.2)如果您通过以太网连接执行此操作,则应使用桌面的 IP 地址。

This is taken from instructions here.

这是取自此处的说明

Finally, follow any method to install onto the next BBB. Here's an example of how to flash the emmc.

最后,按照任何方法安装到下一个 BBB。 以下是如何刷写 emmc 的示例

回答by Julian Gold

We have noticed that on Beaglebones with the Jan 23rd 2015 release of Debian, the only way to successfully copy the image from SD is notto hold the boot button down when powering up.

我们注意到,在 2015 年 1 月 23 日发布的 Debian 的 Beaglebones 上,成功从 SD 复制映像的唯一方法是在开机时不要按住启动按钮。

回答by emorris

As noted at the bottom of the eLinux article, there is a much easier way if you are running the Debian distribution:

eLinux 文章底部所述,如果您运行的是 Debian 发行版,则有一种更简单的方法:

  1. Boot master BBB with no SD card in
  2. Insert SD card
  3. Log in (e.g. with serial terminal, SSH etc.) and run sudo /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh. LEDs will flash in sequence whilst SD card is being written.
  4. When the LEDs stop and the script terminates, remove the SD card.
  5. Insert SD card into new BBB then power on.
  6. eMMC will be flashed; LEDs on new BBB will flash in sequence until complete.
  1. 没有 SD 卡的引导主 BBB
  2. 插入 SD 卡
  3. 登录(例如使用串行终端、SSH 等)并运行sudo /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh. 正在写入 SD 卡时,LED 将依次闪烁。
  4. 当 LED 停止并且脚本终止时,取出 SD 卡。
  5. 将 SD 卡插入新 BBB 中,然后开机。
  6. eMMC 会刷出;新 BBB 上的 LED 将依次闪烁直至完成。