-
Notifications
You must be signed in to change notification settings - Fork 5
Home
The following packages on debian(-based) systems:
- podman
To create an unified build environment run build_in_podman.sh
. After the script finishes it enters the build environment and mounts the repo to /repo
.
This repository contains the script create-medkit.sh
in omnia/
directory, which can create an image called omnia-medkit-<date>.tar.gz
.
This tar.gz is the OS image for Turris Omnia reflash utility. The utility resides in the Turris Omnia rescue system in SPI flash, next to U-Boot. The main system is placed on eMMC drive, which is independent from the SPI flash.
You can enter the rescue system and run re-flash utility by long-pressing of reset button.
When the reset button is pushed and hold the LEDs form a counter (= number of LEDs on) that increases each 2 seconds. The counter indicate the boot mode:
- 1=normal
- 2=snapshot rollback
- 3=factory reset
- 4=re-flash
- 5=rescue shell
LEDs slowly change color from green to red to indicate time to next LED. The resulting boot mode depends on number of LEDs lit at the moment of releasing the reset button.
It is straight-forward:
- Obtain USB flash drive.
- Create a
msdos
disklabel on the disk. - Create the first partition on the disk.
- Format the partition with ext2/3/4.
- Write the resulting
omnia-medkit-<date>.tar.gz
to the partition. Unmount. - Plug the USB flash to Turris Omnia.
- Press reset button and wait until 4 LEDs are lit. Then release.
- Connect serial console and wait for Debian image to boot. It will take 1-2 minutes.
In Debian Bookworm the file capabilities are used for ping
utility to open needed privileged sockets. The Omnia install procedure, however, strips the caps from the ping
binary. Therefore the following step is necessary to fix the capabilities:
setcap cap_net_raw+ep /usr/bin/ping
Procedure:
- Connect to the router.
- Create new subvolume @debian on eMMC BtrFS filesystem.
- Unpack the resulting omnia-medkit.tar.gz .
- Connect a serial console to the router.
- Stop boot in U-Boot.
- Create the following debboot and debbootargs environment variables.
- You can now boot to Debian by stopping boot in U-Boot and issuing a command
run debboot
.
The U-Boot commands for creating the debboot and debootargs:
setenv debboot 'setenv bootargs $debbootargs; btrload mmc 0 0x01000000 boot/zImage @debian; btrload mmc 0 0x02000000 boot/dtb @debian; bootz 0x01000000 - 0x02000000'
setenv debbootargs "earlyprintk console=ttyS0,115200 rootfstype=btrfs rootdelay=2 root=b301 rootflags=subvol=@debian,commit=5 rw"
- latest u-boot
- mSATA SSD which will be put into slot "CN7" after preparation
- omnia-medkit-date.tar.gz which contains the debian os
side note: the following procedure has been tested with the omnia-medkit-20210609.tar on a turris omnia (black edition) side note: It should work universally though. (Tested with bullseye images.)
list all disks and find the correct SSD device, in this case we use sda
fdisk -l
format sda to dos table (additionally you can use the option bootable) - Attention! All data on the selected device will be erased!
cfdisk /dev/sda
check the partitions -> the sda device now has the partition sda1
lsblk
format the created partition to btrfs
mkfs.btrfs -f /dev/sda1
create a directory and mount the SSD
mkdir /mnt/ssd
mount /dev/sda1 /mnt/ssd
create the "@" subvol
btrfs subvol create /mnt/ssd/@
extract the debian files onto the SSD (change your file destination accordingly) and generate a symlink for the boot.scr
cd /mnt/ssd/@
tar -xzf /home/omnia-medkit-*.tar.gz
ln -s \@/boot/boot.scr /mnt/ssd/boot.scr
chroot to the new root on the SSD and re-generate the boot.scr
:
This step is not possible with certain version of Turris recscue where busybox does not have chroot util. In that case boot to MMC system and chroot from that system.
chroot /mnt/ssd/\@/
/etc/kernel/postinst.d/z99-genbootscr -r /dev/sda1
Expected output:
Root device: /dev/sda1
Kernel Image: /boot/vmlinuz-5.10.0-9-armmp
InitRD: /boot/initrd.img-5.10.0-9-armmp
Image Name: boot
Created: Sat Feb 19 00:54:36 2022
Image Type: PowerPC Linux Script (uncompressed)
Data Size: 1367 Bytes = 1.33 KiB = 0.00 MiB
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 1359 Bytes = 1.33 KiB = 0.00 MiB
Replace root block device in /etc/fstab
and leave the chroot:
sed -i 's%/dev/mmcblk0p1%/dev/sda1%' /etc/fstab
exit
Check the resulting boot.csr
file and then unmount the SSD
cat /mnt/ssd/boot.scr
Expect:
'V{�ƶb?�W��?DbootOsetenv bootargs "earlyprintk console=$console pcie_aspm=off root=/dev/sda1 rootdelay=2 rootflags=subvol=@,commit=5 rw"
setenv omnia_boot_prep 'scsi scan;'
setenv omnia_boot_lk 'load scsi 0 ${kernel_addr_r} /@/boot/vmlinuz-5.10.0-9-armmp'
setenv omnia_boot_ldt_phy 'load scsi 0 ${fdt_addr_r} /@/boot/armada-385-turris-omnia-phy.dtb'
setenv omnia_boot_ldt_sfp 'load scsi 0 ${fdt_addr_r} /@/boot/armada-385-turris-omnia-sfp.dtb'
setenv omnia_fixup_mac0 'setexpr fmac0 gsub : " " $ethaddr; fdt resize; fdt set /soc/internal-regs/ethernet@70000 local-mac-address "[${fmac0}]"'
setenv omnia_fixup_mac1 'setexpr fmac1 gsub : " " $eth1addr; fdt resize; fdt set /soc/internal-regs/ethernet@30000 local-mac-address "[${fmac1}]"'
setenv omnia_fixup_mac2 'setexpr fmac2 gsub : " " $eth2addr; fdt resize; fdt set /soc/internal-regs/ethernet@34000 local-mac-address "[${fmac2}]"'
setenv omnia_boot_lrd 'load scsi 0 ${ramdisk_addr_r} /@/boot/initrd.img-5.10.0-9-armmp'
setenv omnia_boot_brd 'bootz ${kernel_addr_r} ${ramdisk_addr_r}:0x${filesize} ${fdt_addr_r};'
setenv omnia_boot 'run omnia_boot_prep; run omnia_boot_lk; if gpio input gpio@71_4; then echo SFP; run omnia_boot_ldt_sfp; else echo PHY; run omnia_boot_ldt_phy; fi; fdt addr ${fdt_addr_r}; run omnia_fixup_mac0; run omnia_fixup_mac1; run omnia_fixup_mac2; run omnia_boot_lrd; run omnia_boot_brd'
And finally:
umount /mnt/ssd
Boot the Turris Omnia with a connected serial console and prevent it from autobooting (press any key to stop autoboot). Following commands are needed to set the correct boot-order/ directory.
saveenv boot_targets "scsi0 mmc0 usb0 pxe dhcp"
boot
Or use userspace utility before reboot:
fw_setenv boot_targets "scsi0 mmc0 usb0 pxe dhcp"
(With this the entire switchover to SSD can be done without serial console, however it is recommended to have a serial cable handy when attempting this procedure.)
- log in with default credentials: root - turris
- use the
mount
command and search for the line "/dev/sda1 on / type btrfs"
If you can find the mentioned line, the installation was succesfull.