Skip to content

Commit

Permalink
Merge branch 'update_gateware' of https://github.com/apertus-open-sou…
Browse files Browse the repository at this point in the history
…rce-cinema/axiom-firmware into update_gateware
  • Loading branch information
se6astian-pi committed Apr 11, 2024
2 parents 941ae9a + 043edf3 commit 3d576f6
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 17 deletions.
13 changes: 8 additions & 5 deletions makefiles/in_chroot/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ sed -i 's/#IgnorePkg =/IgnorePkg = linux linux-*/' /etc/pacman.conf
echo 'Server = http://de3.mirror.archlinuxarm.org/$arch/$repo' > /etc/pacman.d/mirrorlist
pacman-key --init
pacman-key --populate archlinuxarm
pacman --noprogressbar --noconfirm --needed -Syu
pacman --noprogressbar --noconfirm --needed --overwrite '*' -Syu
pacman --noprogressbar --noconfirm -R linux-zedboard || true

# install dependencies
pacman --noprogressbar --noconfirm --needed -S $(grep -vE "^\s*#" makefiles/in_chroot/requirements_pacman.txt | tr "\n" " ")
pacman --noprogressbar --noconfirm --needed --overwrite '*' -S $(grep -vE "^\s*#" makefiles/in_chroot/requirements_pacman.txt | tr "\n" " ")
pip install --break-system-packages wheel
pip install --break-system-packages --progress-bar off -r makefiles/in_chroot/requirements_pip.txt

Expand All @@ -39,6 +39,9 @@ if ! [ -d /home/$USERNAME ]; then
rm -f /home/$USERNAME/.bashrc
fi

# also set the same password for root
echo "root:$PASS" | chpasswd

# add empty ~/.ssh/authorized_keys (see #80)
function add_authorized_keys_file() {
SSH_AUTHORIZED_KEYS=/home/$1/.ssh/authorized_keys
Expand All @@ -56,8 +59,8 @@ add_authorized_keys_file "root"
userdel -r -f alarm || true

# configure ssh
grep 'PermitRootLogin' /etc/ssh/sshd_config && sed -i 's/^.*PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
grep 'PermitRootLogin' /etc/ssh/sshd_config || echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
grep 'PermitRootLogin' /etc/ssh/sshd_config && sed -i 's/^.*PermitRootLogin.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
grep 'PermitRootLogin' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
grep -x 'X11Forwarding yes' /etc/ssh/sshd_config || echo "X11Forwarding yes" >> /etc/ssh/sshd_config

# build all the tools
Expand Down Expand Up @@ -194,6 +197,6 @@ rm -f $HASH_LOCATION/hashes.txt; rm -f $HASH_LOCATION/files.txt
find $VERIFY_DIRECTORIES -type f > $HASH_LOCATION/files.txt
# also hash file list
echo "$HASH_LOCATION/files.txt" >> $HASH_LOCATION/files.txt
hashdeep -c sha256 -f $HASH_LOCATION/files.txt > $HASH_LOCATION/hashes.txt
sudo rhash --sha256 --file-list $HASH_LOCATION/files.txt -o $HASH_LOCATION/hashes.txt

echo "axiom-update finished. Software version is now $(git describe --always --abbrev=8 --dirty)."
5 changes: 4 additions & 1 deletion makefiles/in_chroot/requirements_pacman.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ base-devel
git
figlet
wget
hashdeep
rhash
pacman-contrib
rsync

Expand All @@ -36,6 +36,9 @@ dtc
man
man-pages
libdisplay-info
bash-completion
# for growpart
cloud-guest-utils

# webserver
lighttpd
Expand Down
14 changes: 13 additions & 1 deletion software/configs/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,17 @@ alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# editor

# enable bash autocompletion
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

# you can use pvim/pnano/pcat to edit scripts in the $PATH
function pvim(){ sudo vim $(which "$1"); }
complete -F _command pvim
function pnano(){ sudo nano $(which "$1"); }
complete -F _command pnano
function pcat(){ cat $(which "$1"); }
complete -F _command pcat

alias vi='vim'
alias pvi='pvim'
2 changes: 1 addition & 1 deletion software/scripts/axiom_file_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
HASH_LOCATION="/opt/integrity_check"

echo "Checking Axiom system files... (this might take a while)"
output=$(hashdeep -c sha256 -x -f $HASH_LOCATION/files.txt -k $HASH_LOCATION/hashes.txt)
output=$(sudo rhash -c --skip-ok --brief $HASH_LOCATION/hashes.txt)

if [ -z "$output" ]; then
echo "No problems detected, all files are in factory state."
Expand Down
7 changes: 7 additions & 0 deletions software/scripts/axiom_grow_fs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# SPDX-FileCopyrightText: © 2024 Jaro Habiger <[email protected]>
# SPDX-License-Identifier: GPL-2.0-only

sudo growpart /dev/mmcblk0 2
sudo resize2fs /dev/mmcblk0p2
41 changes: 32 additions & 9 deletions software/scripts/axiom_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,34 @@
# it was previously known as kick.sh / kick-manual.sh

if [ "$EUID" -ne 0 ]
then echo "please run as root, 'sudo axiom_start.sh'"
exit
then echo "please run as root, e.g. 'sudo axiom_start.sh'"
exit 2
fi

# running axiom_start.sh twice will crash the camera, this should prevent that from happening
FILE=/tmp/axiom.started
if [[ -f "$FILE" ]]; then
echo "AXIOM service seems to be running already, if that is not the case please remove the /tmp/axiom.started file and try again."
exit
exit 1
fi


MODE=${1:-normal}
if [ "$MODE" = "normal" ]; then
echo "starting with FHD color HDMI output on top and bottom plugins";
echo
elif [ "$MODE" = "raw-uhd" ]; then
echo "starting camera with color HDMI output on top plugin and raw mode with alternating A/B frames on bottom plugin";
echo "the resolution of the raw output is 3840x2160 (no black colums present)";
echo
elif [ "$MODE" = "raw-full-width" ]; then
echo "starting camera with color HDMI output on top plugin and raw mode with alternating A/B frames on bottom plugin";
echo "the resolution of the raw output is 4096x2160 (with black columns on left and right sides)";
echo
else
echo
exit 2
fi

axiom_fclk_init.sh
axiom_zynq_info.sh
Expand Down Expand Up @@ -47,7 +62,7 @@ while sleep 1; do
axiom_fil_reg 15 0x08000800
axiom_fil_reg 15 0x0

[ "$MODE" == "raw" ] && axiom_fil_reg 11 0x00000031
[ "$MODE" =~ ^"raw" ] && axiom_fil_reg 11 0x00000031

axiom_cmv_init.sh
axiom_train && break
Expand All @@ -56,7 +71,7 @@ while sleep 1; do
axiom_gpio.py init
done

[ "$MODE" == "raw" ] && i2c0_bit_set 0x22 0x15 7
[ "$MODE" =~ ^"raw" ] && i2c0_bit_set 0x22 0x15 7

axiom_setup.sh $MODE
# ./hdmi_init.sh
Expand All @@ -65,9 +80,17 @@ axiom_setup.sh $MODE
axiom_fil_reg 15 0x01000100

# show overlay in normal mode - clear overlay in raw mode
[ "$MODE" == "normal" ] && axiom_mimg -a -O /opt/overlays/AXIOM-Beta-logo-overlay-white.raw
[ "$MODE" == "raw" ] && axiom_mimg -O -P0
if [ "$MODE" == "normal" ]; then
axiom_mimg -a -O /opt/overlays/AXIOM-Beta-logo-overlay-white.raw
else
axiom_mimg -O -P0
fi

if [ "$MODE" == "raw-full-width" ]; then
axiom_gen_init_hdmi.sh 2048x1080p50
axiom_data_init_hdmi.sh
axiom_snap -E -b -z # enable the black columns
fi

# initiate HDMI
axiom_hdmi_init3.sh
Expand All @@ -88,8 +111,8 @@ axiom_pic_jtag_pcie.py 0x92 0x92
axiom_set_gain.sh 1


# raw mode related commands
if [ "$MODE" == "raw" ]; then
# setup raw output
if [ "$MODE" =~ ^"raw" ]; then
axiom_scn_reg 28 0x7700
axiom_scn_reg 28 0x7000
axiom_scn_reg 31 0x0000 # top HDMI plugin module set normal color mode
Expand Down

0 comments on commit 3d576f6

Please sign in to comment.