Skip to content

Commit 00ed5d2

Browse files
authored
Merge pull request #39 from jonasblixt/v2.0.0-cleanup1
V2.0.0
2 parents e38c689 + a0c0b11 commit 00ed5d2

File tree

195 files changed

+6848
-5015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+6848
-5015
lines changed

.github/workflows/punchboot-tools.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Build punchboot-tools
2-
# push
3-
on: [pull_request]
2+
on: [pull_request, push, workflow_dispatch]
43

54
# REMEMBER: If the libusb versions for macos are updated the 'macos deps',
65
# setup.py and pyproject.toml must also be updated since they have hard coded
@@ -50,7 +49,7 @@ jobs:
5049
install_name_tool -id @rpath/libusb-1.0.0.dylib libusb_arm64/1.0.26/lib/libusb-1.0.0.dylib
5150
5251
- name: Build wheels
53-
uses: pypa/[email protected].2
52+
uses: pypa/[email protected].5
5453
with:
5554
package-dir: .
5655
output-dir: wheelhouse

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ tags
4040
download
4141
*.egg-info
4242
*.so
43+
build
44+
dist

.pre-commit-config.yaml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 23.12.1
4-
hooks:
5-
- id: black
6-
language_version: python3
7-
- repo: https://github.com/pre-commit/mirrors-mypy
8-
rev: v1.8.0
9-
hooks:
10-
- id: mypy
11-
additional_dependencies:
12-
- "semver>=3,<4"
13-
- "click>=8,<9"
14-
pass_filenames: false # This and the args, argument are needed to make mypy read pyproject.toml
15-
args: ["."]
16-
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.1.14
18-
hooks:
19-
- id: ruff
20-
- repo: https://github.com/pre-commit/mirrors-clang-format
21-
rev: v17.0.6
22-
hooks:
23-
- id: clang-format
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-json
8+
- id: check-merge-conflict
9+
- id: check-shebang-scripts-are-executable
10+
- id: check-yaml
11+
- id: end-of-file-fixer
12+
- id: forbid-submodules
13+
- id: requirements-txt-fixer
14+
- id: trailing-whitespace
15+
16+
- repo: https://github.com/pre-commit/mirrors-mypy
17+
rev: v1.8.0
18+
hooks:
19+
- id: mypy
20+
additional_dependencies:
21+
- "semver>=3,<4"
22+
- "click>=8,<9"
23+
- "setuptools>=69,<70"
24+
pass_filenames: false # This and the args, argument are needed to make mypy read pyproject.toml
25+
args: ["."]
26+
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.2.1
29+
hooks:
30+
- id: ruff
31+
args: [ --fix ]
32+
33+
- repo: https://github.com/pre-commit/mirrors-clang-format
34+
rev: v17.0.6
35+
hooks:
36+
- id: clang-format

LICENSE

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
Punch BOOT
2-
2+
33
SPDX-License-Identifier: BSD-3-Clause
4-
4+
55
Copyright 2018, Jonas Blixt <[email protected]>
66

7-
Redistribution and use in source and binary forms, with or without modification,
7+
Redistribution and use in source and binary forms, with or without modification,
88
are permitted provided that the following conditions are met:
99

10-
1. Redistributions of source code must retain the above copyright notice,
10+
1. Redistributions of source code must retain the above copyright notice,
1111
this list of conditions and the following disclaimer.
1212

13-
2. Redistributions in binary form must reproduce the above copyright notice,
14-
this list of conditions and the following disclaimer in the documentation
13+
2. Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
1515
and/or other materials provided with the distribution.
1616

17-
3. Neither the name of the copyright holder nor the names of its contributors
18-
may be used to endorse or promote products derived from this software
17+
3. Neither the name of the copyright holder nor the names of its contributors
18+
may be used to endorse or promote products derived from this software
1919
without specific prior written permission.
2020

21-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27-
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29-
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
3131
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32-

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Punchboot is a secure and fast bootloader for embedded systems. It is designed t
1919
- Minimize software download time in production
2020
- Be useful for day-to-day development
2121

22-
Punchboot is designed for embedded systems and therefore it has a minimalistic
23-
apporach. There is no run-time configuration, everything is configured in
22+
Punchboot is designed for embedded systems and therefore it has a minimalistic
23+
apporach. There is no run-time configuration, everything is configured in
2424
the board files.
2525

2626
Punchboot could be useful if you care about the following:
@@ -108,22 +108,22 @@ this way many different public keys can be stored in a flash memory and every
108108
time the device boots it will compute a sha256 checksum and compare it to the
109109
fused checksum.
110110

111-
Punchboot is designed to be a part of a secure boot chain. This means that
112-
the bootloader is cryptographically signed, the ROM code of the SoC must
113-
support a mechanism to validate this signature, otherwise there is no
111+
Punchboot is designed to be a part of a secure boot chain. This means that
112+
the bootloader is cryptographically signed, the ROM code of the SoC must
113+
support a mechanism to validate this signature, otherwise there is no
114114
root of trust.
115115

116116
When punchboot has been verified it, in turn, will load and verify the next
117117
software component in the boot chain. The bootloader _only_ supports signed
118118
binaries.
119119

120120
## Testing and integration tests
121-
Punchboot uses QEMU for all module and integration tests. The 'test' platform
122-
and board target relies on virtio serial ports and block devices. The punchboot
123-
cli can be built with a domain socket transport instead of USB for communicating
121+
Punchboot uses QEMU for all module and integration tests. The 'test' platform
122+
and board target relies on virtio serial ports and block devices. The punchboot
123+
cli can be built with a domain socket transport instead of USB for communicating
124124
with an QEMU environment.
125125

126-
The test platform code includes gcov code that calls the QEMU semihosting API
126+
The test platform code includes gcov code that calls the QEMU semihosting API
127127
for storing test coverage data on the host.
128128

129129
Building and running tests:
@@ -135,30 +135,30 @@ $ make check
135135

136136
## Device identity
137137

138-
Most modern SoC's provide some kind of unique identity, that is guaranteed to
139-
be unique for that particular type of SoC / Vendor etc but can not be guarateed
138+
Most modern SoC's provide some kind of unique identity, that is guaranteed to
139+
be unique for that particular type of SoC / Vendor etc but can not be guarateed
140140
to be globally unique.
141141

142-
Punchboot provides a UUID3 device identity based on a combination of the unique
142+
Punchboot provides a UUID3 device identity based on a combination of the unique
143143
data from the SoC and an allocated, random, namspace UUID per platform.
144144

145-
When booting a linux system this information is relayed to linux through
145+
When booting a linux system this information is relayed to linux through
146146
in-line patching of the device-tree.
147147
The device identity can be found in '/proc/device-tree/chosen/device-uuid'
148148

149149
## Command mode
150150

151-
Command mode is entered when the system can't boot or if the bootloader is
151+
Command mode is entered when the system can't boot or if the bootloader is
152152
forced by a configurable, external event to do so.
153153

154-
In the command mode it is possible to update the bootloader, write data to
155-
partitions and install default settings. From v0.3 and forward
156-
an 'authentication cookie' must be used to interact with the bootloader to
157-
prevent malicious activity. The only command that can be executed without
154+
In the command mode it is possible to update the bootloader, write data to
155+
partitions and install default settings. From v0.3 and forward
156+
an 'authentication cookie' must be used to interact with the bootloader to
157+
prevent malicious activity. The only command that can be executed without
158158
authentication is listing the device information (including the device UUID)
159159

160-
The authentication cookie consists of the device UUID encrypted with one of
161-
the active key pair's private key.
160+
The authentication cookie consists of the device UUID encrypted with one of
161+
the active key pair's private key.
162162

163163
## punchboot tool
164164
The punchboot CLI is used for interacting with the command mode. A summary of the features available:
@@ -223,7 +223,7 @@ Authenticating using key index 0 and './0B177094-6B62-3572-902E-C1DE339ECB01.tok
223223
Read 103 bytes
224224
Authentication successful
225225
```
226-
Now the command mode is fully unlocked. The token is of course only valid for
226+
Now the command mode is fully unlocked. The token is of course only valid for
227227
the individual unit with that perticular UUID.
228228

229229
## Metrics
@@ -279,4 +279,3 @@ The POR time is off due to some unidentified problem with the SCU firmware.
279279
3. Implement test case(s) to ensure that future changes do not break legacy
280280
4. Run checks: cp configs/test_defconfig .config && make check
281281
5. Create pull request
282-

0 commit comments

Comments
 (0)