BeagleBone Black, Can't build image

I’m trying to use latest base image supplied by BeageBoard AM3358 Debian 10.3 2020-04-06 1GB SD console to create an updated image that hopefully fixes the scrip that allows the SD card to be transferred to the internal memory. Since I’ve been having issue with the the OS seizing up when the SD card IO is overloaded. As described in this thread beagleboneblack - BeagleBone Black freezes - Stack Overflow.

I’ve been following the image build guide GitHub - syncloud/image: Syncloud image build scripts and created a fork GitHub - Dan2077/image: Syncloud image build scripts to include the updated image.

After installing drone cli and syncing my fork, I get stuck at step step 7
PS C:\Users\DanXC\Documents\GitHub\image> drone exec --pipeline=beagleboneblack-all-buster --trusted
2022/09/06 23:45:01 cannot find pipeline

We actually use a pretty old image for beagle bone:

I can switch it to the latest one from your link, and give your a new syncloud image, but I would like to know what exactly are you running to copy SD contents to emmc and what error are you getting, could you post a command and the output please?

Since I’ve been having issue with the the OS seizing up when the SD card IO is overloaded.

That is interesting, but we always suggest to have an additional USB disk for files so OS stays on SD and all data files go to external disk (you can activate it in Settings). Of cause having OS on emmc is even better, but if you problems are comming from a lot of data files access (ex Nextcloud has thousands of files it needs to index or so) having an external disk is always preferred as a first step.

The Syncloud BBB image is a bit all over the place with two partitions and several uEnv.txt files in boot directories. The script I’m trying to trigger with the Syncloud BBB image is at the bottom of the uEnv.txt file cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh. I took out the # at the beginning of the line and that should have got the image to copy itself to internal memory but nothing happened. I didn’t take note of any logs. When using BBB’s image, that modified line in uEnv.txt got it to copy the image over automatically.

As you suggested, I went with en external SSD for my storage but I still had issues with the process mmcqd going hard before my SSH session dropped out.

you know what I forgot that we actually have this script:
/snap/platform/current/bin/copy_to_emmc.sh

Can you try it will simply copy aal from /dev/mmcblk0 to /dev/mmcblk1
then you can take out the card and reboot as I remember

I tried the script and I’m getting this:
root@syncloud:~# /snap/platform/current/bin/copy_to_emmc.sh
source device (/dev/mmcblk0) size: 4025483264 bytes
target device (/dev/mmcblk1) size: 3867148288 bytes
target device size is less then target device
use -f to copy only bytes to fit on target (dangerous)

I checked the partitioning on the SD card and I haven’t resized the partitions

As it says try with -f:

/snap/platform/current/bin/copy_to_emmc.sh -f

It will not copy the last 5% of your disk (as internal memory is a bit smaller) hopefully you do have anything there.

I ran the command with -f and here is the output:

root@syncloud:~# /snap/platform/current/bin/copy_to_emmc.sh -f
source device (/dev/mmcblk0) size: 4025483264 bytes
target device (/dev/mmcblk1) size: 3867148288 bytes
target device size is less then target device
3776512+0 records in
3776512+0 records out
3867148288 bytes (3.9 GB, 3.6 GiB) copied, 847.359 s, 4.6 MB/s

I then shutdown, removed SD card, powered on and no boot

Do you have any official 8mage that boots from internal emmc?
Do you need to flip some switch on the board to force it to boot from emmc?

Also I think you may want to run sync after this command to make sure it is not copying in the backgound still.

I tried with using the sync command and it still wouldn’t boot after the SD card was removed:

root@syncloud:~# /snap/platform/current/bin/copy_to_emmc.sh -f
source device (/dev/mmcblk0) size: 4025483264 bytes
target device (/dev/mmcblk1) size: 3867148288 bytes
target device size is less then target device
3776512+0 records in
3776512+0 records out
3867148288 bytes (3.9 GB, 3.6 GiB) copied, 838.388 s, 4.6 MB/s
root@syncloud:~# sync
root@syncloud:~#

Here is a list of images for the BBB Latest Software Images - BeagleBoard
AM3358 Debian 10.3 2020-04-06 4GB SD IoT Can be written to the emmc when holding down a button on the board during boot described here Getting Started - BeagleBoard | How do I start using my board?
To have the image write itself to the emmc automatically during boot without having to hold any button down, you can use this image AM3358 Debian 10.3 2020-04-06 4GB eMMC IoT Flasher
according to this page Beagleboard:BeagleBoneBlack Debian - eLinux.org the difference between manual and auto flashing is having a # at the beginning of a line in a file in /boot/uEnv.txt

What do you make of this?

Ultimately I am hopping to have syncloud running on the emmc for “max perforance” and the insert a large sd card to use for storage since using a usb drive on the BBB can cause it to crash AM335X: USB babble interrupt - Processors forum - Processors - TI E2E support forums

Right now we just do a copy (dd), do you know what else needs to be done to make it boot from emmc?

Maybe you read what flasher does and do it manually to test.

It’s been long time since I touched BBB.

I had a look at /opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh and it does a lot more than dd. I can’t make any sense of it sorry.

Is it hard to set up syncloud from scratch from a debian image?

I tried using 7zip to copy the files in bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img to your BBB syncloud image file but couldn’t figure it out.

In the syncloud BBB image, it has the #cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
in the \boot\uEnv.txt file which can be used to trigger the copy from the SD card to the EMMC by removing the # at the beginning of the line. I can’t find the init-eMMC-flasher-v3.sh file in the syncloud image so maybe include these files in the image?

Could you make an image using the Debian console image? It’s a small file with just the bare essentials AM3358 Debian 10.3 2020-04-06 1GB SD console

Ok we can include this file, but can you check if it works by copying it and running?

I can’t copy the files in windows because it messes up the file structure and windows can’t read the SD card. I tried mounting the ISO on a bootable linux but I couldn’t extract the ISO. This might seem trivial but I can’t do it lol

Ok, let include it, I will give a new image soon.

Can you try this one: https://github.com/syncloud/image/releases/download/latest/syncloud-beagleboneblack-latest.img.xz

script should be in /original/ …

current image is base on:
bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb

if you want I can switch to (which should be better):
bone-debian-10.3-console-armhf-2020-04-06-1gb

Let me know I will publish a new update.

That script was quite eventful but it was unable to boot on it’s own. If you could switch to the other image, that would be great.

Logs from runnig \original\opt\scripts\tools\eMMC\init-eMMC-flasher-v3.sh
================================================================================
Starting eMMC Flasher from microSD media
Version: [1.20161216: more fixes...]
================================================================================

================================================================================
Prepare environment for flashing
Starting at Fri 26 May 2023 08:41:54 AM UTC
----------------------------------------
==> Giving system time to stablize...
5 4 3 2 1
==> Preparing /tmp
==> Preparing sysctl
==> sysctl: vm.min_free_kbytes=[2667]
==> sysctl: setting: [sysctl -w vm.min_free_kbytes=16384]
vm.min_free_kbytes = 16384
----------------------------------------
==> Determining root drive
==> console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 root                                                                             wait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
----------------------------------------
==> root_drive=[/dev/mmcblk0p2]
====> Root drive identified at [/dev/mmcblk0p2]
==> Boot Drive [/dev/mmcblk0p1]
==> Figuring out Source and Destination devices
====> Source identified: [/dev/mmcblk0]
====> Destination identified: [/dev/mmcblk1]
==> Figuring out machine
====> Machine is TI_AM335x_BeagleBone_Black
====> Machine is compatible with BeagleBone Black
====> The Boot and Root drives are identified to be different.
====> Giving system time to stablize...
5 4 3 2 1
====> Mounting /dev/mmcblk0p1 Read Only over /boot/uboot
================================================================================
5 4 3 2 1

========================================
Checking for Valid bbb-eeprom header
==> Valid bbb-eeprom header found [335]
========================================

================================================================================
Checking running system
==> Copying: [/dev/mmcblk0] -> [/dev/mmcblk1]
==> lsblk:
----------------------------------------
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0          7:0    0 164.3M  1 loop /snap/platform/1862
mmcblk0      179:0    0   3.8G  0 disk
├─mmcblk0p1  179:1    0   200M  0 part /boot/uboot
└─mmcblk0p2  179:2    0     3G  0 part /
mmcblk1      179:8    0   3.6G  0 disk
└─mmcblk1p1  179:9    0   3.6G  0 part
mmcblk1boot0 179:16   0     2M  1 disk
mmcblk1boot1 179:24   0     2M  1 disk
----------------------------------------
==> df -h | grep rootfs:
----------------------------------------
==> Giving you time to check...
10 9 8 7 6 5 4 3 2 1
================================================================================

================================================================================
Preparing drives

----------------------------------------
==> Erasing: /dev/mmcblk1
----------------------------------------
108+0 records in
108+0 records out
113246208 bytes (113 MB, 108 MiB) copied, 10.219 s, 11.1 MB/s
----------------------------------------
108+0 records in
108+0 records out
113246208 bytes (113 MB, 108 MiB) copied, 3.33018 s, 34.0 MB/s
----------------------------------------
==> Erasing: /dev/mmcblk1 complete
----------------------------------------

----------------------------------------
==> Loading /boot/SOC.sh
************************************************************
#!/bin/sh
format=1.0

board=am335x_evm

bootloader_location=dd_spl_uboot_boot
bootrom_gpt=

dd_spl_uboot_count=1
dd_spl_uboot_seek=1
dd_spl_uboot_conf=notrunc
dd_spl_uboot_bs=128k
dd_spl_uboot_backup=/opt/backup/uboot/MLO

dd_uboot_count=2
dd_uboot_seek=1
dd_uboot_conf=notrunc
dd_uboot_bs=384k
dd_uboot_backup=/opt/backup/uboot/u-boot.img

boot_fstype=ext4
conf_boot_startmb=4
conf_boot_endmb=
sfdisk_fstype=L

boot_label=BOOT
rootfs_label=rootfs

#Kernel
dtb=
serial_tty=ttyO0
usbnet_mem=

************************************************************
==> Loaded

----------------------------------------

================================================================================
Writing bootloader to [/dev/mmcblk1]
----------------------------------------
==> Figuring out options for SPL U-Boot copy ...
===> Will use : count=1 seek=1 conv=notrunc bs=128k
==> Figuring out options for U-Boot copy ...
===> Will use : count=2 seek=1 conv=notrunc bs=384k
==> Copying SPL U-Boot with dd if=/opt/backup/uboot/MLO of=/dev/mmcblk1 count=1 seek=1 conv=notrunc bs=128k
------------------------------------------------------------
dd: failed to open '/opt/backup/uboot/MLO': No such file or directory
Traceback (last called is first):
     _dd_bootloader() in /original/opt/scripts/tools/eMMC/functions.sh:795
     prepare_drive() in /original/opt/scripts/tools/eMMC/functions.sh:1424
     main() in /original/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh:49
The command dd if=${dd_spl_uboot_backup} of=${destination} ${dd_spl_uboot} exited with exit code 1.
================================================================================
Tearing Down script environment
==> Unmounting /tmp
==> Unmounting /boot
umount: /boot: not mounted.
==> Stopping Cylon LEDs ...
==> Setting LEDs to
==> Force writeback of eMMC buffers by Syncing: /dev/mmcblk1
----------------------------------------
100000+0 records in
100000+0 records out
51200000 bytes (51 MB, 49 MiB) copied, 1.42661 s, 35.9 MB/s
----------------------------------------
===> Syncing: /dev/mmcblk1 complete
==> This script took 42 seconds to run
================================================================================
==> Setting LEDs to
root@syncloud:~#

Ok, this one is missing:

/opt/backup/uboot/MLO

Even if it was it would be under /original

Let me add it and use the latest image