DSGW-210-F-1 How to backup firmware image?

I have followed the steps in the quick start guide:

  1. bootm2recovery.sh to restart in recovery mode => no fails but I suspect It’s booting in normal way. In fact I can still login the system again by ssh (serial port doesnt exist, so no posibility to enter by this way…)
  2. Killall dsupdateimg => the process doesn’t exists
  3. mount /dev/mmcblk2p8 /f => device to mount doesn’t exists (mmcblk2p8). The nearest named device found in dev is mmcblk0p7…and it’s already mounted (at / )
  4. dd if=/dev/mmcblk2p7 of=/f/rootfs.img bs=10M => no mmcblk2p7 nor mmcblk2p8 so I haven’t tried this and next steps …

So no way to backup firmware image

Just so I understand. You want to backup the current file system as an .img file correct?

Yes, exactly, that is.

Yeah, I’m currently trying to do the same but so far no luck. I’ve managed to backup the file system as a whole, but then you have to use the sdk to create a new bootable image and that has to be performed on an ubuntu vm etc etc… So I have to read the documentation (if i can find it) and try it that way… Let me know if you have any luck

How did you manage to backup the filesystem? is bootm2recovery.sh restarting in recovery mode in your device? can you mount /dev/mmcblk2p8? Did you need to connect by seral port? Wich steps did you follow?

In the other hand I think the img you are backing up is just the rootfs, which, I suspect, could be flashed alone, as is, with RKDevTool (Download Image tab). I think SDK is only needed if you plan to make a complete image with rootfs, bootloader, recovery part…

So I did the following:
I had a spare SSD lying around with a usb 2.0 port on it and I connected that to the USB port on the gateway, I then had some help from chatgpt and it made me this script which I then ran:

#!/bin/sh

# Unmount any existing mount at /mnt
sudo umount /mnt

# Ensure the target directory on the USB HDD exists
sudo mkdir -p /mnt/usb

# Remove any existing image file on the USB HDD
sudo rm -f /mnt/usb/rootfs.img

# Copy the root filesystem to a tarball directly on the USB HDD
echo "Creating tarball of the root filesystem"
sudo tar --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/dev --exclude=/run --exclude=/f --exclude=/var/log --exclude=/var/tmp --exclude=/var/cache --exclude=ds --exclude=www -cpf /mnt/usb/rootfs.tar /bin /boot /etc /home /lib /media /opt /root /sbin /srv /usr /var /www

# Verify the tarball
if [ -f /mnt/usb/rootfs.tar ]; then
  echo "Filesystem copied successfully to tarball"
else
  echo "Error: Filesystem copy to tarball failed"
  exit 1
fi

# Create a sparse image file based on the tarball size
TAR_SIZE=$(du -sk /mnt/usb/rootfs.tar | awk '{print $1}')
IMG_SIZE=$((TAR_SIZE + (TAR_SIZE / 10))) # Add 10% to the tarball size for overhead
sudo dd if=/dev/zero of=/mnt/usb/rootfs.img bs=1k seek=$IMG_SIZE count=0

# Format the image file as ext4
sudo mkfs -t ext4 /mnt/usb/rootfs.img

# Mount the image file
sudo mount -o loop /mnt/usb/rootfs.img /mnt

# Extract the tarball into the mounted image
echo "Extracting tarball to image file"
sudo tar -xf /mnt/usb/rootfs.tar -C /mnt

# Create necessary directories
sudo mkdir /mnt/proc
sudo mkdir /mnt/run
sudo mkdir /mnt/sys
sudo mkdir /mnt/tmp
sudo chmod 777 /mnt/tmp

sudo mkdir /mnt/f
sudo mkdir /mnt/dev
sudo mkdir /mnt/dev/shm
sudo mkdir -p /mnt/sys/kernel/security
sudo mkdir -p /mnt/run/lock
sudo mkdir -p /mnt/dev/pts
sudo mkdir -p /mnt/sys/fs/cgroup/unified

# Unmount the image file
sudo umount /mnt

# Clean up
sudo rm /mnt/usb/rootfs.tar

echo "Backup completed successfully and stored on USB HDD."

So that netted me the full file system. However, I have not tested building an image I can flash to the gateway yet using the .img file I got so that remains to be seen.