Skip to content

Commit

Permalink
Merge pull request #13 from peterbarker/pr/test-fixes
Browse files Browse the repository at this point in the history
CI fixes
  • Loading branch information
lthall authored Jul 9, 2024
2 parents 94d6238 + f1054b0 commit 98903de
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test_scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ jobs:
CI_BUILD_TARGET: ${{matrix.config}}
shell: bash
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
Tools/scripts/build_ci.sh
1 change: 1 addition & 0 deletions .github/workflows/test_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
CI_BUILD_TARGET: ${{matrix.config}}
shell: bash
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
set -ex
# set up some variables based on what sort of build we're doing:
BOOTLOADER=0
Expand Down
7 changes: 6 additions & 1 deletion Tools/ardupilotwaf/chibios.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,13 @@ def sign_firmware(image, private_keyfile):
try:
import monocypher
except ImportError:
Logs.error("Please install monocypher with: python3 -m pip install pymonocypher")
Logs.error("Please install monocypher with: python3 -m pip install pymonocypher==3.1.3.2")
return None

if monocypher.__version__ != "3.1.3.2":
Logs.error("must use monocypher 3.1.3.2, please run: python3 -m pip install pymonocypher==3.1.3.2")
return None

try:
key = open(private_keyfile, 'r').read()
except Exception as ex:
Expand Down
6 changes: 3 additions & 3 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4364,7 +4364,7 @@ def fly_guided_move_local(self, x, y, z_up, timeout=100):
MAV_POS_TARGET_TYPE_MASK.POS_ONLY | MAV_POS_TARGET_TYPE_MASK.LAST_BYTE, # mask specifying use-only-x-y-z
x, # x
y, # y
-z_up,# z
-z_up, # z
0, # vx
0, # vy
0, # vz
Expand Down Expand Up @@ -8144,7 +8144,7 @@ def ShipOps_WeirdOrigin(self):

perch_alt = self.get_parameter('SHIP_PCH_ALT')

abs_alt = self.get_altitude(relative=False)
# abs_alt = self.get_altitude(relative=False)

self.progress("trigger launch")
self.set_rc(3, 2000)
Expand Down Expand Up @@ -8589,7 +8589,7 @@ def FlyEachFrame(self):
# to carry the path to the JSON.
actual_model = model.split(":")[0]
defaults = self.model_defaults_filepath(actual_model)
if type(defaults) != list:
if not isinstance(defaults, list):
defaults = [defaults]
self.customise_SITL_commandline(
["--defaults", ','.join(defaults), ],
Expand Down
3 changes: 2 additions & 1 deletion Tools/environment_install/install-prereqs-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ echo "Checking CLI Tools installed..."
ERROR=$(xcode-select --install 2>&1 > /dev/null)
} ||
{
if [[ $ERROR != *"command line tools are already installed"* ]]; then
if [[ $ERROR != *"ommand line tools are already installed"* ]]; then
echo "$ERROR" 1>&2
exit 1
fi
Expand All @@ -78,6 +78,7 @@ function install_arm_none_eabi_toolchain() {
)
fi
echo "Registering STM32 Toolchain for ccache"
sudo mkdir -p /usr/local/opt/ccache/libexec
sudo ln -s -f $CCACHE_PATH /usr/local/opt/ccache/libexec/arm-none-eabi-g++
sudo ln -s -f $CCACHE_PATH /usr/local/opt/ccache/libexec/arm-none-eabi-gcc
echo "Done!"
Expand Down
2 changes: 1 addition & 1 deletion Tools/scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ for t in $CI_BUILD_TARGET; do
echo "Building signed firmwares"
sudo apt-get update
sudo apt-get install -y python3-dev
python3 -m pip install pymonocypher
python3 -m pip install pymonocypher==3.1.3.2
./Tools/scripts/signing/generate_keys.py testkey
$waf configure --board CubeOrange-ODID --signed-fw --private-key testkey_private_key.dat
$waf copter
Expand Down
10 changes: 8 additions & 2 deletions Tools/scripts/signing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ firmware doesn't match any of the public keys in the bootloader.
To generate a public/private key pair, run the following command:

```
python3 -m pip install pymonocypher
python3 -m pip install pymonocypher==3.1.3.2
Tools/scripts/signing/generate_keys.py NAME
```

Expand Down Expand Up @@ -131,7 +131,13 @@ This opens a secure command session using your private_key.dat file to allow the
securecommand getpublickeys will return the number of public keys...you will need this next
securecommand removepublickeys 0 X where X is the number of public keys...this removes them
```
Re-run the 'getpublickeys' command again to verify that all keys have been removed.

For example, if you have a standard firmware with the 3 ArduPilot
public keys and one of your own public keys then X will be 4 in the
above command.

Re-run the 'getpublickeys' command again to verify that all keys have
been removed.

Now exit MAVProxy and build a firmware using the normal bootloader but still using the --signed-fw option:

Expand Down
5 changes: 4 additions & 1 deletion Tools/scripts/signing/generate_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
try:
import monocypher
except ImportError:
print("Please install monocypher with: python3 -m pip install pymonocypher")
print("Please install monocypher with: python3 -m pip install pymonocypher==3.1.3.2")
sys.exit(1)

if monocypher.__version__ != "3.1.3.2":
Logs.error("must use monocypher 3.1.3.2, please run: python3 -m pip install pymonocypher==3.1.3.2")
sys.exit(1)

if len(sys.argv) != 2:
print("Usage: generate_keys.py BASENAME")
Expand Down
6 changes: 0 additions & 6 deletions Tools/scripts/signing/make_secure_bl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
import os
import base64

try:
import monocypher
except ImportError:
print("Please install monocypher with: python3 -m pip install pymonocypher")
sys.exit(1)

# get command line arguments
from argparse import ArgumentParser
parser = ArgumentParser(description='make_secure_bl')
Expand Down
6 changes: 5 additions & 1 deletion Tools/scripts/signing/make_secure_fw.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
try:
import monocypher
except ImportError:
print("Please install monocypher with: python3 -m pip install pymonocypher")
print("Please install monocypher with: python3 -m pip install pymonocypher==3.1.3.2")
sys.exit(1)

if monocypher.__version__ != "3.1.3.2":
Logs.error("must use monocypher 3.1.3.2, please run: python3 -m pip install pymonocypher==3.1.3.2")
return None

key_len = 32
sig_len = 64
sig_version = 30437
Expand Down

0 comments on commit 98903de

Please sign in to comment.