Commit graph

442 commits

Author SHA1 Message Date
bunnie
e9d8ec8f1d add better debug output from the image generator
this helps to see when address ranges are truncated or missing
2025-11-25 19:05:32 +08:00
Yuval Adam
f297c3b2a5 Remove python cache and build artifacts, update .gitignore
Signed-off-by: Yuval Adam <_@yuv.al>
2025-10-17 22:04:14 +02:00
bunnie
0efcd0af90 clean up a debug print 2025-10-16 23:26:30 +08:00
bunnie
ea8927fc55
Fixup sign_image to generate records with the new auth_data format 2025-10-06 23:34:30 +08:00
bunnie
54ee8ffd83 update sign_image to work with the new public key records 2025-10-06 15:19:52 +08:00
bunnie
3c68eea714
Merge branch 'main' into signing 2025-10-06 13:45:29 +08:00
bunnie
dbb0a75118 bump versions
have to absorb a version change due to xous-semver change

might as well also update the utra/svd generator dependencies
since that's been held off for a long time now.
2025-10-06 13:23:18 +08:00
bunnie
6d4f8004d3 fix breakage associated with changes to xous-semver 2025-10-06 13:17:21 +08:00
bunnie
4413b95162 place the public key in the correct location 2025-10-06 03:50:09 +08:00
bunnie
12e6292325 extend the image building tools to handle detached apps 2025-10-05 17:11:30 +08:00
bunnie
afd64aa2b2 add a helper program to create "detached apps"
detached apps are ROM-loaded apps that are detached from the
main xous.img.
2025-10-05 17:05:49 +08:00
bunnie
d21e99a3f3 implement swap header length reference 2025-10-04 18:52:50 +08:00
bunnie
2175ea60f1 improve the tools for creating images
- use more structural templating to place data, instead of
just hand-coded writes to a buffer

- add private key signature generation to the swap image
2025-10-04 00:49:56 +08:00
bunnie
f8c92c4c23 fix loader function code mapping 2025-10-01 14:55:19 +08:00
bunnie
f04a856037 allow .bin as uf2 conversion target 2025-10-01 02:56:53 +08:00
bunnie
76f6f1fda5 pack offsets into a u16-sized pointer
the data section is generally pretty small, a few k, and there
are cases where we need more initialization entries. This keeps
the structure from growing beyond 256 bytes.
2025-09-30 21:50:17 +08:00
bunnie
d9347e46fb update tools to generate a uf2 image 2025-09-29 16:17:45 +08:00
bunnie
a9112a743a add mapping for loader in image signing (synonymous with baremetal) 2025-09-29 13:51:58 +08:00
bunnie
d502aed5af refactor image creation to be cleaner
use struct-based API and bytemuck instead of manual byte serialization.
this is for the bao1x target, precursor still uses the legacy code.
2025-09-26 22:55:39 +08:00
bunnie
198e584369 add adjustable signature sector sizes
can be smaller than 4k now because on baochip the erase sector
size is just 32 bytes.
2025-09-24 23:50:13 +08:00
bunnie
024c8131bc extend image builder to handle baking in statics 2025-09-21 21:50:31 +08:00
bunnie
1255bf12d9 FLAG DAY: fix all names to harmonize around 'bao1x'
The code base had evolved through several code names, interim
names, company names and chip names that alternatively did or did
not exist.

Baochip is the definitive name of the company, and the Baochip1x
(full part number BAO1X2S4F-WA) is the definitivey part number of
the SoC. For convenience, the part number is shortened to 'bao1x'
in most feature flags and variable references.

This commit fixes all of the odd names and removes some unmaintained
early targets.
2025-09-18 21:25:51 +08:00
bunnie
74218bcded cleanup some cruft 2025-09-14 13:26:33 +08:00
bunnie
05a7a1fc06 fix naming of trng cases 2025-09-14 02:10:32 +08:00
bunnie
6908d9293e add a tool for recovering and analyzing trng traces from NTO 2025-09-13 23:28:42 +08:00
bunnie
c61a521c7d add size on disk reporting 2025-09-10 09:16:53 +08:00
bunnie
7d89deacb4 auto-generate code snippet for baremetal to bootstrap its .data region 2025-08-10 15:48:48 +08:00
bunnie
c58edf9598 use the loader version of copy object call for copying the loader
this handles the special case of not inserting RAM-based data segments into
the ROM.
2025-02-28 16:33:58 +08:00
bunnie
46b0e6b842 fix loader edge case with static data
include a check for assumption violations, and some explanation
on how this all comes about
2025-02-28 16:23:54 +08:00
bunnie
4f14a67504 formatting changes due to changes in nightly rust
needed to get a clean check on gh
2025-02-01 22:26:40 +08:00
bunnie
6e0bdb49f4 add an option to reset the backup flag
the backup flag can be left "hanging around" if a restore of PDDB
is aborted. This command allows a user to override that setting
in case this is necessary.
2024-12-29 01:28:12 +08:00
Jeanie
56e741207a just handle errors, no need for the unicode specific stuff.. 2024-12-02 23:30:57 +09:00
Jeanie
6f9e371754 add back cheeky comment 2024-12-02 23:18:55 +09:00
Jeanie
9995ba4852 get this script working again and handle all the decoding error issues 2024-12-02 23:17:38 +09:00
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
75954de8d6 commit the version bump 2024-09-23 01:46:25 +08:00
Chris Pick
b8feb4ec40 Improve USB no backend available message
Provide a more descriptive error message when pyusb can't find a backend
USB library.
2024-07-01 21:32:58 -04:00
bunnie
6516430536 add 0.9.16 to the releases for restores 2024-05-30 18:38:48 +08:00
bunnie
85a6f02c3f bump xous-semver rev
git tags now returns a 9-digit commit rev instead of 8 in some
versions of linux. This causes `u32` parsing of the rev to fail.
handle this.
2024-05-21 04:18:03 +08:00
bunnie
80dbf071be don't map errors so we can see what the underlying problem is 2024-05-21 04:03:45 +08:00
bunnie
63c316f32a fix image creation
1. nonce should be generated from the LSB of the commit hash.
security doesn't come from the nonce, and having the commit hash
in the nonce is helpful for version control of the swap image
(although it doesn't capture "dirty" builds, e.g. builds
made with uncommitted changes).

2. fix IniS regions to not require special alignment. Since the
data is copied (similar to IniE), we don't have to waste space
page-aligning things so that offsets map perfectly between
the image on disk and in RAM.

3. add checks that the loading position of data inside the
swap image matches our expectations. We should have 0x1000
bytes of unencrypted header, then 0x1000 bytes of XArgs + padding,
and then image data should start.

There is a "just so" coincidence in that the image data by
the MiniElf program always lines up at an address > 0x1000, making
space for the XArgs. I actually don't know why this padding is
there, but the "section" doesn't decode to anything we
can parse. Maybe it's some reserved space for OS-specific
loader shenanigans?
2024-05-06 18:49:18 +08:00
bunnie
9499a41739 fix padding computations in ELF file read-in
Not sure how this even worked in the first place....I think we
always just got lucky with the size of .gcc_except_table. However,
something changed in the last rustc update that causes this section
to align to a 256-byte boundary instead of a 4-byte boundary, which
exposes downstream alignment issues.

This patch now captures the actual offset alignment + padding,
which is somewhat complicated by the fact that we throw away
the first section (not sure why??? it doesn't seem to have
a valid name or header, but the first 0x114 bytes are non-existent)
so we have to factor this into all the downstream padding efforts.
2024-05-01 02:19:10 +08:00
bunnie
9ca720f188 add an assert to sanity-check that IniF sections are aligned
There is no hope for success if the alignment of an IniF is not
aligned, since we directly map the data into memory.
2024-05-01 02:18:29 +08:00
bunnie
9d2218488b add jump past signature block
Make the first word in the signature block a jump past the block
this is for the cramium target, where the best memory efficiency
happens if we align the data to the bottom of the memory. This
means that the signature block ends up "in the way" of the boot
process, because the reset vector can only be configured to something
on a 16k-page boundary (e.g., we'd waste 15k of memory without this).

This will require some reworking of the existing code base for
checking signatures down the line.
2024-04-26 18:13:06 +08:00
bunnie
4ace363abc this resolves comments from @xobs' code review 2024-04-09 18:23:09 +08:00
bunnie
400088fb42 add debug file generation for swap 2024-04-08 23:47:54 +08:00
bunnie
d489e14f3a fix nonce generation (offset should be bytes, not pages) 2024-04-07 22:37:22 +08:00
bunnie
3079da3a57 add debug provisions to encryption; limit AAD to 64 bytes 2024-04-07 00:38:34 +08:00
bunnie
7547d7c952 remove aead from dependencies (already part of aes-gcm-siv) 2024-04-06 22:56:03 +08:00
bunnie
d9b29c2d06 move the MAC (i.e. tag) above the variable length AAD field. 2024-04-06 22:55:39 +08:00