Rootfs update is one of the most common ways of updating the system. The example page on Github talks about rootfs updates in detail. There are three files in the example.

  • rootfs_update.sh - This script installs the rootfs (uploaded on the Bytebeam cloud) to the new partition and boots to the new rootfs.
  • updater - This is the wrapper script for rootfs_update.sh.
  • make_firmware_update.sh - It creates the update tar file, that needs to be uploaded to the Bytebeam cloud.

Step 1: Create tar of the rootfs

On the device, use the following command to take the backup of the rootfs.

#!/bin/bash

# To create tar of current rootfs
sudo find / -maxdepth 1 -mindepth 1 -not -type l -print0 | \
sudo tar -cvpzf /mnt/download/rootfs.tar.gz \
--exclude='/mnt/download/rootfs.tar.gz' \
--exclude='/proc/*' \
--exclude='/tmp/*' \
--exclude='/mnt/*' \
--exclude='/dev/*' \
--exclude='/sys/*' \
--exclude='/run/*' \
--exclude='/media/*' \
--exclude='/home/pi/*' / 

NOTE: For BeagleBone, use the following script to backup the rootfs. We do not take the backup of the boot partition(named uboot).

#!/bin/bash

# To create tar of current rootfs
sudo find / -maxdepth 1 -mindepth 1 -not -type l -print0 | \
sudo tar -cvpzf /mnt/download/rootfs.tar.gz \
--exclude='/mnt/download/rootfs.tar.gz' \
--exclude='/uboot/*' \
--exclude='/proc/*' \
--exclude='/tmp/*' \
--exclude='/mnt/*' \
--exclude='/dev/*' \
--exclude='/sys/*' \
--exclude='/run/*' \
--exclude='/media/*' \
--exclude='/home/debian/*' / 

Step 2: Create the update tar file

Run the make_firmware_update.sh script, which generates the update tar file named rootfs_update.tar.gz. Upload this file in the “Firmware Upload” section of the Bytebeam cloud. Once the update is complete, the device will be booted to the new rootfs.