Skip to content
Snippets Groups Projects
Verified Commit 245a2486 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

imgs/boot: fix prepare_turris_image script for Mox and improve

This makes this script support Mox as well as it reduces unnecessary
spam it creates in logs.
parent 3973446c
Branches
Tags
No related merge requests found
#!/bin/bash
set -e
set -eu
TFTP_ROOT="/var/tftpboot"
branch="${1:-hbk}"
board="$1"
branch="${2:-hbk}"
case "$board" in
omnia)
kernel="zImage"
dtb="dtb"
;;
mox)
kernel="Image"
dtb="armada-3720-turris-mox.dtb"
;;
*)
echo "Unsupported board: $board" >&2
exit 1
;;
esac
# Get appropriate medkit
wait4network
wget "https://repo.turris.cz/$branch/medkit/omnia-medkit-latest.tar.gz" -O medkit.tar.gz
url="https://repo.turris.cz/$branch/medkit/$board-medkit-latest.tar.gz"
echo "Getting medkit from:" "$url"
wget -q "$url" -O medkit.tar.gz
# Repack as CPIO
mkdir root
......@@ -16,9 +34,9 @@ ln -sf /sbin/init root/init
mkimage -A arm -O linux -T ramdisk -C none -d root.cpio root.uimage
# Prepare to TFTP
cp root/boot/zImage "$TFTP_ROOT/zImage"
cp -L root/boot/dtb "$TFTP_ROOT/dtb"
mv root.uimage "$TFTP_ROOT/root.uimage"
cp "root/boot/$kernel" "$TFTP_ROOT/"
cp -L "root/boot/$dtb" "$TFTP_ROOT/"
mv root.uimage "$TFTP_ROOT/"
# Clean after ourself
rm -rf root root.cpio medkit.tar.gz
......@@ -77,7 +77,7 @@ class Board(abc.ABC):
# Now load image from TFTP
with Container(lxd_client, "boot", self.config.device_map()) as cont:
ccli = cli.Shell(cont.pexpect())
ccli.run(f"prepare_turris_image '{os_branch}'", timeout=120)
ccli.run(f"prepare_turris_image '{self.config.board}' '{os_branch}'", timeout=120)
uboot.run("setenv ipaddr 192.168.1.142")
uboot.run("setenv serverip 192.168.1.1")
self._board_bootup(uboot)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment