Module Integration Guides
...
Device Setup
Linux Generic
8 min
overview this guide shows how to setup a generic linux device to connect to bytebeam we assume you are using u boot for the bootloader if you are using a different bootloader please get in touch with us at support\@bytebeam io and we would be happy to guide you through the process partition schema create the following partitions on the device partition 1 boot partition of size around 100mb partition 2 root partition 1 (contains rootfs of linux distro) partition 3 root partition 2 (of size same as root partition 1) partition 4 download partition (to store application data) at any given point in time either "partition 2" or "partition 3" will be the active rootfs partition, and the other partition is referred to as the inactive partition data/download partition is where the persistent files are stored during kernel & rootfs updates, the contents of inactive partitions are replaced with the new rootfs to begin with setup your existing rootfs into root partition 1 and point u boot to boot into this partition once you have booted into partition 1 mount the boot partition at /uboot mount the root partition 2 at /mnt/next root mount the download partition 2 at /mnt/download customizing u boot for otas bytebeam uses uboot as the bootloader in order to support rollback feature, during rootfs updates u boot can be configured with the help of a boot script called boot scr root switch logic this section explains the workings of u boot for choosing the right partition to boot from understanding this section is required to be able to troubleshoot any issues you may face at a high level, we configure u boot to look for a specific file in the boot partition to know which partition to boot form for example, if file "two" is present, uboot boots from partition 2, and if file "three" is present, uboot boots from partition 3 the following flowchart explains the root switch logic in detail generate boot scr the above logic needs to be implemented in the boot scr file follow the below steps step 1 download the https //github com/u boot/u boot source code step 2 create the config file named boot cmd txt with the help of the "root switch" logic in this file, uboot can boot to the desired root partition note that this file depends on the type of the linux device example files(uenv txt, rpi boot cmd txt) are provied in the https //github com/bytebeamio/uplink/tree/main/scripts page step 3 from the config file, boot script file boot scr can be generated by shell cd /path/to/uboot u boot/tools/mkimage a arm64 o linux t script c none d boot cmd txt boot scr step 4 place the u boot binary and boot script in the boot partition of the device step 5 ensure that the fstab has the proper partition configuration setup uplink and ota scripts step 1 depending on the architecture of the device, the appropriate uplink binary can be downloaded from https //github com/bytebeamio/uplink/releases link place it in the download partition, rename the binary as uplink, and make it executable step 2 download the setup scripts \# get uplink service curl proto '=https' tlsv1 2 ssf o /mnt/download/systemd/uplink service https //raw\ githubusercontent com/bytebeamio/uplink/main/scripts/systemd/uplink service \# get check root partition service curl proto '=https' tlsv1 2 ssf o /mnt/download/systemd/check root partition service https //raw\ githubusercontent com/bytebeamio/uplink/main/scripts/systemd/check root partition service \# get config toml curl proto '=https' tlsv1 2 ssf o /usr/local/share/bytebeam/config toml https //raw\ githubusercontent com/bytebeamio/uplink/main/scripts/config toml \# get check root part sh curl proto '=https' tlsv1 2 ssf o /mnt/download/check root part sh https //raw\ githubusercontent com/bytebeamio/uplink/main/scripts/check root part sh chmod +x /mnt/download/check root part sh step 3 add services to systemd cp /mnt/download/systemd/uplink service /etc/systemd/system/ cp /mnt/download/systemd/check root partition service /etc/systemd/system/ systemctl daemon reload systemctl enable check root partition service systemctl start check root partition service step 4 depending on the root partition, create the file "two" or "three" in the boot partition and in the download partition as well boot=/uboot touch $boot/two touch /mnt/download/two step 5 install vim and netcat sudo apt update sudo apt install vim y sudo apt install netcat y boot the device ensure that the device has a good internet connection and that the system time is set properly
