Hyper Open Edge Cloud

How To Generate ORS Image During the Assembly

The process to generate ORS image for assembly
  • Last Update:2024-03-11
  • Version:002
  • Language:en

Install OS

Install Ubuntu 20.04 by downloading the "64-bit PC (AMD64) server install image" iso image here, and then copying it to an USB disk. You can use dd to copy the iso:

laptop:~# dd if=iso_image_path of=/dev/usb_device bs=1M status=progress && sync

During the installation, you should choose these options:

  • language: English
  • keyboard: chose depending on your keyboard
  • Use entire disk
  • No LVM
  • hostname : orsXXX # replace XXX with the number
  • username, password: slapos
  • Install OpenSSH server
  • No snap to install

Connect through SSH

Once the installation is complete and you have rebooted after removing the USB key, the next steps can be done through SSH. To find the IP of the ORS computer, you can use the following command:

laptop:~# sudo nmap -T4 -sP network_ip/prefix_length | grep -B2 Taiwan

Once you have the ip, you can connect to the ORS computer through SSH:

laptop:~# ssh slapos@ors_ip
Password: slapos

Setup SSH keys

You can add your SSH keys for automatic connection in /root/.ssh/authorized_keys file.

Configure network with ifupdown

root@orsXX:~# apt install -y ifupdown

Place the following script inside /etc/network/interfaces

root@orsXX:~# auto lo
root@orsXX:~# iface lo inet loopback

auto enp0s31f6
iface enp0s31f6 inet dhcp
        post-up echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
        post-up iptables -t nat -A POSTROUTING -o enp0s31f6 -j MASQUERADE


auto enp2s0
iface enp2s0 inet dhcp
        post-up echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
        post-up iptables -t nat -A POSTROUTING -o enp2s0 -j MASQUERADE

 

If you need to add another re6st IPv6 on lo:

auto lo lo:0
iface lo inet loopback
iface lo:0 inet6 static
        address <re6st-ip>
        netmask <re6st-netmask>

 

root@orsXX:~# apt remove -y --purge netplan.io networkd-dispatcher

Upgrade And fix Ubuntu 

root@orsXX:~# apt update
root@orsXX:~# eatmydata apt dist-upgrade -y
root@orsXX:~# apt autoremove --purge -y
root@orsXX:~# apt remove -y snapd irqbalance
root@orsXX:~# apt install -y net-tools

Install software to flash Xilinx FPGA 

This step is only needed if you need to flash the FPGA. By default, the FPGA is already flashed with correct bitstream.

Install patched openocd to flash the FPGA

root@orsXX:~# apt install -y git libtool automake pkg-config libusb-dev libftdi-dev libusb-1.0-0-dev build-essential
root@orsXX:~# git clone https://github.com/openocd-org/openocd openocd
root@orsXX:~# cd openocd
root@orsXX:~/openocd# git checkout v0.11.0
root@orsXX:~/openocd# patch -p1
diff --git a/src/flash/nor/spi.c b/src/flash/nor/spi.c
index 937c194e6..7f459606c 100644
--- a/src/flash/nor/spi.c
+++ b/src/flash/nor/spi.c
@@ -61,7 +61,7 @@ const struct flash_device flash_devices[] = {
FLASH_ID("sp s25fl512s", 0x13, 0x00, 0x12, 0xdc, 0xc7, 0x00200201, 0x200, 0x40000, 0x4000000),
FLASH_ID("cyp s25fl064l", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x00176001, 0x100, 0x10000, 0x800000),
FLASH_ID("cyp s25fl128l", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x00186001, 0x100, 0x10000, 0x1000000),
- FLASH_ID("cyp s25fl256l", 0x13, 0x00, 0x12, 0xdc, 0xc7, 0x00196001, 0x100, 0x10000, 0x2000000),
+ FLASH_ID("cyp s25fl256l", 0x13, 0x00, 0x12, 0xd8, 0xc7, 0x00196001, 0x100, 0x10000, 0x2000000),
FLASH_ID("atmel 25f512", 0x03, 0x00, 0x02, 0x52, 0xc7, 0x0065001f, 0x80, 0x8000, 0x10000),
FLASH_ID("atmel 25f1024", 0x03, 0x00, 0x02, 0x52, 0x62, 0x0060001f, 0x100, 0x8000, 0x20000),
FLASH_ID("atmel 25f2048", 0x03, 0x00, 0x02, 0x52, 0x62, 0x0063001f, 0x100, 0x10000, 0x40000),
^D^D
root@orsXX:~/openocd# ./bootstrap
root@orsXX:~/openocd# ./configure --enable-ftdi
root@orsXX:~/openocd# make -j 4

 

Download the FPGA firmware (private)

The FPGA firmware can be found here (old version) or in https://lab.nexedi.com/nexedi/ors-utils-private (newer versions). The firmware is private and you should ask RapidSpace team for access to it.

Install Amarisoft stack

Remove all previous software if any:

root@orsXX:~# rm -rf lteenb* trx_sdr* mme ots mbms enb

root@orsXX:~# tar -xzvf amarisoft.2021-12-17.tar.gz
root@orsXX:~# cd 2021-12-17/
root@orsXX:~/2021-12-17/# ./install.sh --default

Wait (very long, no output)
Hard reboot

Put the Amarisoft licences:

root@orsXX:~# mkdir ~/.amarisoft

copy lteenb.key and ltemme.key in ~/.amarisoft

Prepare ORS for SlapOS Software Release

The ors-amarisoft SR expects the amarisoft stack to be in /opt/amarisoft/lte

root@orsXX:~# git clone https://lab.nexedi.com/jhuge/amarisoft-private.git
root@orsXX:~# mkdir -p /opt/amarisoft
root@orsXX:~# mv amarisoft-private/v2021-09-18 /opt/amarisoft/
root@orsXX:~# patchelf --set-rpath /opt/amarisoft/v2021-09-18/enb lteenb
root@orsXX:~# setcap cap_sys_nice=+pe lteenb
root@orsXX:~# patchelf --set-rpath /opt/amarisoft/v2021-09-18/enb lteenb-avx2
setcap cap_sys_nice=+pe lteenb-avx2
root@orsXX:~# sudo apt install ansible
root@orsXX:~# git clone https://lab.nexedi.com/nexedi/slapos.package

Install speedtest on ORS

root@orsXX:~# cd /var/www/html/
root@orsXX:/var/ww/html# git clone https://github.com/adolfintel/speedtest
root@orsXX:/var/ww/html# cd speedtest/
root@orsXX:/var/ww/html/speedtest# cp examples/example-singleServer-gauges.html index.html
root@orsXX:/var/ww/html/speedtest# service apache2 restart

Soft reboot so that lte service starts

Scripts from ors-util

root@orsXX:~# git clone https://lab.nexedi.com/nexedi/ors-utils.git
root@orsXX:~# ln -s ors-utils/scripts scripts

Shrink image

IMG is file containing whole SSD image


fdisk -l IMG

losetup -f -o $((START<<9)) [--sizelimit $((SECTORS<<9))] IMG

mount /dev/loopN MOUNPOINT
rm MOUNTPOINT/var/swapfile
rm MOUNTPOINT/tmp/*
rm MOUNTPOINT/opt/slapos/log/*
#rm -r MOUNTPOINT/var/log/journal/HASH
rm MOUNTPOINT/var/log/re6stnet/*
rm MOUNTPOINT/root/.bash_history MOUNTPOINT/root/.gitconfig MOUNTPOINT/root/.lesshst
cd MOUNTPOINT/etc
# squash all commits from etckeeper
git rebase -i --root
git reflog expire --expire=now --all
git gc --aggressive --prune=all
umount MOUNTPOINT

resize2fs -pM /dev/loopN

dumpe2fs -h /dev/loopN | grep Block
tune2fs -l /dev/loopN | grep Block

losetup -d /dev/loopN  

parted IMG resizepart 2 $((START_SECTOR + (BLOCK_COUNT<<3) - 1))s

truncate -s $(((END_SECTOR + 34) * 512)) IMG
sgdisk -s IMG
> w
# https://superuser.com/questions/1081623/shrink-total-disk-image-uefi-gpt-flashdrive-freespace-at-end