Skip to content

Commit

Permalink
SALT to Prod (#2)
Browse files Browse the repository at this point in the history
* Beta SALT (#33)
* Fix the default model number
* Bump storage version to 4.
* Bump firmware version to v4.0.2
* Bump bootloader to v1.0.4
  • Loading branch information
bgok authored Dec 22, 2017
1 parent 6f5c34f commit f3642d0
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
.metadata/

# component libraries
build/
build
bin

# Misc
tags
Expand Down
3 changes: 3 additions & 0 deletions b
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def proc_args():
parser.add_argument('-bf', '--bump-feature', help = 'Bump feature release version.', action = 'store_true')
parser.add_argument('-bb', '--bump-bug-fix', help = 'Bump bug fix version.', action = 'store_true')
parser.add_argument('-bt', '--bump-test', help = 'Bump test version.', action = 'store_true')
parser.add_argument('-salt', '--salt-logo', help = 'Build with the salt logo', action = 'store_true')
parser.add_argument('-d', '--debug', help = 'Build debug variant.', action = 'store_true')
parser.add_argument('-v', '--verbose', help = 'Build with verbose output.', action = 'store_true')
args = parser.parse_args()
Expand Down Expand Up @@ -93,6 +94,8 @@ def main():
buildargs += ' debug=1'
if args.verbose:
buildargs += ' verbose=1'
if args.salt_logo:
buildargs += ' salt-logo=1'

target ='arm-none-gnu-eabi'
local('scons ' + 'target='+target + buildargs)
Expand Down
6 changes: 4 additions & 2 deletions docker_build.sh → docker_build_keepkey_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ docker build -t $IMAGETAG .
docker run -t -v $(pwd):/root/keepkey-firmware --rm $IMAGETAG /bin/sh -c "\
cd /root/keepkey-firmware/libopencm3 && \
make clean && \
make && \
make && \
cd /root/keepkey-firmware && \
./b -d"
./b -d && \
mkdir -p bin/debug/keepkey && \
mv build/arm-none-gnu-eabi/debug/bin/*.bin bin/debug/keepkey/"
13 changes: 7 additions & 6 deletions docker_build_release.sh → docker_build_keepkey_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ docker build -t $IMAGETAG .
docker run -t -v $(pwd):/root/keepkey-firmware --rm $IMAGETAG /bin/sh -c "\
cd /root/keepkey-firmware/libopencm3 && \
make clean && \
make && \
make && \
cd /root/keepkey-firmware && \
./b -mp && \
echo '*********************************************************************' && \
echo '* KeepKey Application Fingerprint *' && \
echo '*********************************************************************' && \
cat build/arm-none-gnu-eabi/release/bin/keepkey_main.bin | sha256sum"

mkdir -p bin/release/keepkey && \
mv build/arm-none-gnu-eabi/release/bin/*.bin bin/release/keepkey/ && \
echo '*********************************************************************' && \
echo '* KeepKey Application Fingerprint *' && \
echo '*********************************************************************' && \
cat bin/release/keepkey/keepkey_main.bin | sha256sum"
fi
14 changes: 14 additions & 0 deletions docker_build_salt_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

IMAGETAG=keepkey/firmware

docker build -t $IMAGETAG .

docker run -t -v $(pwd):/root/keepkey-firmware --rm $IMAGETAG /bin/sh -c "\
cd /root/keepkey-firmware/libopencm3 && \
make clean && \
make && \
cd /root/keepkey-firmware && \
./b -d -salt && \
mkdir -p bin/debug/salt && \
mv build/arm-none-gnu-eabi/debug/bin/*.bin bin/debug/salt/"
29 changes: 29 additions & 0 deletions docker_build_salt_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

echo "*********************************************************************"
echo "* You are about to build a release version of KeepKey firmware. The *"
echo "* resulting bootloader image will memory protect the flash on your *"
echo "* device, so please use it with extreme care. *"
echo "*********************************************************************"
read -p "Are you sure you want to continue? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then

IMAGETAG=keepkey/firmware

docker build -t $IMAGETAG .

docker run -t -v $(pwd):/root/keepkey-firmware --rm $IMAGETAG /bin/sh -c "\
cd /root/keepkey-firmware/libopencm3 && \
make clean && \
make && \
cd /root/keepkey-firmware && \
./b -mp -salt && \
mkdir -p bin/release/salt && \
mv build/arm-none-gnu-eabi/release/bin/*.bin bin/release/salt/ && \
echo '*********************************************************************' && \
echo '* KeepKey Application Fingerprint (SALT) *' && \
echo '*********************************************************************' && \
cat bin/release/salt/keepkey_main.bin | sha256sum"
fi
1 change: 1 addition & 0 deletions interface/public/messages.options
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Features.coins max_count:9
Features.revision max_size:20
Features.bootloader_hash max_size:32
Features.policies max_count:1
Features.model max_size:32

ApplySettings.language max_size:17
ApplySettings.label max_size:33
Expand Down
3 changes: 3 additions & 0 deletions keepkey/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ else:
if(ARGUMENTS.get('project') == 'keepkey'):
env = add_flags(env, ['-DKEEPKEY_PRJ'])

if(ARGUMENTS.get('salt-logo')):
env = add_flags(env, ['-DSALT_WHITELABEL'])

init_project(env, deps=deps, libs=['opencm3_stm32f2'])

119 changes: 119 additions & 0 deletions keepkey/local/baremetal/app_resources.c

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions keepkey/local/baremetal/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ void fsm_msgGetFeatures(GetFeatures *msg)
resp->has_device_id = true;
strlcpy(resp->device_id, storage_get_uuid_str(), sizeof(resp->device_id));


resp->has_model = true;
#ifdef SALT_WHITELABEL
strlcpy(resp->model, "K1-14WL-S", sizeof(resp->model));
#else
strlcpy(resp->model, "K1-14AM", sizeof(resp->model));
#endif

/* Security settings */
resp->has_pin_protection = true; resp->pin_protection = storage_has_pin();
resp->has_passphrase_protection = true;
Expand Down
3 changes: 3 additions & 0 deletions keepkey_board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ else:
if(ARGUMENTS.get('project') == 'keepkey'):
env = add_flags(env, ['-DKEEPKEY_PRJ'])

if(ARGUMENTS.get('salt-logo')):
env = add_flags(env, ['-DSALT_WHITELABEL'])

init_project(env, deps=deps, libs=["opencm3_stm32f2"])
5 changes: 5 additions & 0 deletions keepkey_board/local/baremetal/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ static void layout_home_helper(bool reversed)
layout_clear();

static AnimationImageDrawableParams logo;

#ifdef SALT_WHITELABEL
logo.base.x = 60;
#else
logo.base.x = 100;
#endif
logo.base.y = 10;

if(reversed)
Expand Down
165 changes: 165 additions & 0 deletions keepkey_board/local/baremetal/resources.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"BOOTLOADER_PATCH_VERSION": 3, "MAJOR_VERSION": 4, "MINOR_VERSION": 0, "PATCH_VERSION": 0, "BOOTLOADER_MAJOR_VERSION": 1, "BOOTLOADER_MINOR_VERSION": 0}
{"BOOTLOADER_PATCH_VERSION": 4, "MAJOR_VERSION": 4, "MINOR_VERSION": 0, "PATCH_VERSION": 2, "BOOTLOADER_MAJOR_VERSION": 1, "BOOTLOADER_MINOR_VERSION": 0}

0 comments on commit f3642d0

Please sign in to comment.