Duplicating identical BeagleBone Black setups - linux

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.
What is the best way to duplicate the BBB?
My understanding of options:
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.
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?
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?
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.

As noted at the bottom of the eLinux article, there is a much easier way if you are running the Debian distribution:
Boot master BBB with no SD card in
Insert SD card
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.
When the LEDs stop and the script terminates, remove the SD card.
Insert SD card into new BBB then power on.
eMMC will be flashed; LEDs on new BBB will flash in sequence until complete.

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.
Backup the eMMC
FAT format a 4GB or larger SD card (must be a MBR/bootable formatted microSD card)
Download beagleboneblack-save-emmc.zip and extract the contents onto your SD card
Note: this is an image from Jason Krinder at his github https://github.com/jadonk/buildroot using 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
Use the eMMC to flash a new 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
eLinux reference used for this article - http://elinux.org/BeagleBone_Black_Extracting_eMMC_contents

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.
After setting up your BBB with the applications you want, the basic steps are:
On the desktop, run this command in a terminal:
nc -l 19000|bzip2 -d|dd bs=16M of=BBB.img
On the BeagleBone Black, run this command in a terminal (you can SSH into it, or do it directly from the BBB):
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.
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.

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
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.
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.

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 not to hold the boot button down when powering up.

Related

Banana Pi not booting (red LED on)

I got some brand new banana Pi's,
these are the "Banana Pi-M2" and the "Banana Pi-M3"
I was trying to install Debian on both of them, but I couldn't get it to work.
I was exactly following this tutorial here (Windows):
http://wiki.lemaker.org/BananaPro/Pi:SD_card_installation
to save Debian on the SD Card.
The Problem is always the same. When pressing the power Button on the "M3", or plugging in the "M2", only the red LED goes on and nothing happens.
The LED for the LAN port stays off, so it comes close that the Pi is not booting up.
The power supply I am using produces 5V and 2100mA which should fit the conditions for the Banana Pi.
The distros I then tried to install were for example Bananian which I got from here:
https://www.bananian.org/download
And several distros like Debian from here:
http://www.banana-pi.org/m3-download.html
http://www.banana-pi.org/m2-download.html
I tested it using 2 different SD Cards, and also only using a USB Stick.
everything was producing the same error.
Is there something I missed?
Thanks in advance.
It sounds like an underpowering situation.
If you have a barrel jack instead of micro usb use the barrel jack.
The pre-production samples of this board had the usual 4.0/1.7mm barrel jack for DC-IN BPi M2/M2+ also use. This has been replaced by a Micro USB jack on the first production batch in Dec 2015 leading to the usual sorts of problems banana-pi.org forums are full of (see also next paragraph for some reasons). Starting in May 2016 Micro USB has been replaced by the 4.0/1.7mm barrel jack again so powering is possible more reliable now. The Micro USB receptacle on the longer board side is USB OTG, also connected to the board's PMIC and while looking like an alternative way to power the board that's not recommended unless you love underpowering situations, reboot loops and the like.
I had the same problems at one point, like #Hagen said, it could be under powered, make sure you have a 5V, 2A rated power supply. The other cause of the red led and no boot is the lack of a micro SD card. Try pushing it in a bit further though not with much force and hit reboot. if you get 3 leds, it works!
This Banana PI M3 device starts up and works normally when power supply connector (4mm/1,7mm) and a micro USB connect put to device of Banana same time from same 5V power supply. I think in the device may have something grounding problems.

what does "usb start" command do exactly?

I am facing a problem when i try to read from usb device at u-boot.
When i do
fatls usb 0:1
it says bad device. But as soon as i do
usb start
fatls usb 0:1
then it shows me correcly the fat partition in USB.
I was looking to add both commands in the common/main.c so that whenever the board boots it looks for the fat partition of USB.
It is tough but i need to do it.
Anybody has a clue??
As has been said in the comments, "usb start" is what initializes the USB subsystem and scans attached devices for things U-Boot can deal with (USB sticks, ethernet, etc). Unlike some buses such as MMC that we will do an initial scan on prior to starting the shell, for USB you must run the start command first if you expect to use devices that are attached.
Now, you don't add things to common/main.c, you add things to the bootcmd environment variable (and this can be changed in the boards config.h file so that the default environment is changed, if you are working on a board where you cannot do 'saveenv' to save your changes in a persistent way). So what you would want to do is:
=> setenv bootcmd 'usb start;fatls usb 0:1'
or whatever commands you wish to do with the files present on the USB stick.

UART doesn't work on BeagleBoneBlack running Ubuntu 14.04

I have been working for a few days trying to get the UART1 port to work on a bbb. I flashed the prebuilt kernel from the elinux wiki (http://www.elinux.org/BeagleBoardUbuntu#Flasher), and the UART1 appears in the /dev folder (as /dev/ttyO1, with a capital "o" not a zero), but when I write to it, nothing comes out of the pins. I can use UART0 (on a separate little serial header, but not the one I need) without any trouble.
I see a lot of tutorials for enabling UART1 that deal with a folder called /sys/devices/bone_capemgr.* but I don't have one. I think it is because I have a newer kernel, and nearly all of those tutorials are exclusively for older kernels (<=3.8).
I read that the current 3.13 images from Robert C Nelson don't have a cape-manager (https://groups.google.com/forum/m/#!topic/beagleboard/ND3_w7_dn8Q), and you can use the "really simple cape manager" (https://github.com/RobertCNelson/rscm), but the build.sh script doesn't work on my 3.14 kernel. I tried to change a path in the script to fix it and now that bbb won't boot.
I also tried the beaglebone-universal-io script (
https://github.com/cdsteinkuehler/beaglebone-universal-io) but when I query the relevant pin:
sudo ./config-pin -q P8_26
I get the error:
P8_26 pinmux file not found!
Please verify your device tree file
Am I missing something really simple here?

installing Angstrom on Beaglebone black

I am a newbie in Beaglebone Black, I install Ubuntu on my Beaglebone Black which works fine, Now I am trying to install Angstrom on Beaglebone Black, for this I first of all download image of Angstrom "Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.08.21.img" , then extract it using "7Zip" , after that I use "Win32 Disk Imager" to copy it into a 16 GB SD card.Now insert my SD card in Beaglebone Black. Then I press boot button and after that I provide power supply using 5v and 1 Amp adapter. After making sure that all four LED's are glowing , I release boot button.
Now the problem is the installation should be completed in around 45 minute and all four LED's should become stable , but in my case LED's keeps blinking. I check it more than four times for around more than one and a half hour and after that I take out the power supply and check Beaglebone Board on my desktop monitor, surprisingly Ubuntu is Still there.So, please tell where is the problem.
Use this file "BBB-eMMC-flasher-2013.09.04" under BeagleBone Black (eMMC flasher) for flashing to eMMC
I had also installed Angstrom on BeagleBoard Black.
You should follow derek molloy tutorial. Here is the link to tutorial
It should boot up in 10 seconds. It will not take 45 minute to boot up if properly installed.

How identify the primary video card on Linux programmatically?

The primary video card usually can be set in the BIOS (option Primary VGA card), and it will be the first card used by the system.
My question is how can I programmatically identify (using a shell script and utilities is preferable) which of my two video cards is the primary card?
Edit: I was hoping that I wouldn't have to elaborate why I need this, because it is a bit complex, but I will explain the problem below.
I have a configuration wizard which allows the dynamic configuration of a multiseat system in a LiveCD, with two independent displays, keyboards and mice, my wizard works in this way:
Start one Xorg server per video card (after generating xorg.conf with the correct PCI bus ID).
Start a ui in each of Xorgs with messages for configuration (press key and press mouse). One seat can be configured each time.
After the first seat is configured, the wizard closes the first Xorg and start the definitive Xorg in this seat with the desktop environment (already with the correct keyboard and mouse set).
The second seat now is able to be configured (press key and mouse), after this pass 3 is repeated for seat two.
The problem is: If I start the first Xorg in the primary video card, everything works, but if I start the first Xorg in the secondary card this is what happens:
The passes 1, 2, and 3 works, but at the end of pass 3, when the Xorg of the first seat is closed, the Xorg of the second seat blinks and doesn't come back, just show a blank screen with a _ cursor at top, the desktop of the first seat loads, but I don't see the wizard screen in the second seat, the first Xorg just comes back if I execute a kill -HUP , and I need to start the ui from it again.
So, it is why I need to identify the primary video card before I can start Xorg (sorry I didn't mention this before). I tested this system in different computers, with different video cards and the behavior is the same. I also tested with the lasted packages of the kernel and Xorg in Ubuntu 12.04 (packages of the raring release).
Assuming X11 is running, you could suppose that primary card is the one used by Xorg... then you might try
ls -l /proc/$(pidof X)/fd |grep /dev/dri
on my system Debian/Sid/x86-64 with Linux 3.12 kernel (which has an Nvidia card on a Intel3770K which also has its VGA) I'm getting /dev/dri/card0 etc...
But you should explain really why you are asking and what problem do you want to solve.... Why does that matter to you?
I am not at all sure that Linux has a notion of primary graphic card like the BIOS knows it.
And probably hwinfo is telling you everything about your graphical cards.
There are several command line tools in Linux that give you human readable information from the BIOS. Maybe you can find your Video boards in there and see which one is made primary. From what I see in my output, it does not look like something says "this is the primary video", but I do see quite a lot of information. You could output that information to a file when video card A is primary, again when B is primary, then compare those two files and see whether there is a difference.
The command I used, which gives me a lot of information, is dmidecode:
sudo dmidecode | less
If you look at the manual page:
man dmidecode
You will notice that the programmers offer a few other similar tools such as biosdecode and vpddecode.
From those you learn that the BIOS information is available from the /dev/mem device. Although you need to be root to read it, if you know the address (I don't) then you could go in there and peek and poke as required to find out where that one information of which video card is defined as the primary video card.
Running dmidecode, there are some details about my motherboard:
Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
Manufacturer: Supermicro
Product Name: X9SCI/X9SCA
Version: 1.01
Serial Number: ZM25U44192
Asset Tag: To be filled by O.E.M.
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: To be filled by O.E.M.
Chassis Handle: 0x0003
Type: Motherboard
Contained Object Handles: 0
Here I have one video entry:
Handle 0x000E, DMI type 10, 6 bytes
On Board Device Information
Type: Video
Status: Enabled
Description: To Be Filled By O.E.M.
Then the other entry looks like this:
Handle 0x0036, DMI type 41, 11 bytes
Onboard Device
Reference Designation: Onboard IGD
Type: Video
Status: Enabled
Type Instance: 1
Bus Address: 0000:00:02.0
It could also be something you need to read from the Flash memory your BIOS uses. This is done with flashrom (that you may need to install):
sudo flashrom --programmer internal --read my-flash.bin
In my case the ROM on my computer is 2Gb of data. So quite large. However, you can be sure that the information you are looking for exists within that data block since that is the only mean for the BIOS to save data that will stay around when the computer gets turned off.
I have found a way how to check the primary GPU when they are from different vendors or at least have different names.
In KDE go to Info Center, then open Graphics -> OpenGL. In Direct Rendering (GLX) and Direct Rendering (EGL) you can see a Driver block. You can see the Vendor and Device there. It will name the GPU which is primary.
At this screenshot you can see that AMD gpu is primary:
Also, you can get that Vendor value programmatically by running
glxinfo | grep "OpenGL vendor string" | cut -f2 -d":" | xargs.
I guess this method will stop working when kde will switch to vulkan for rendering (in kde 6). But for now I do not know another method of determining primary gpu.

Resources