Skip to content

Commit

Permalink
First Draft of Implementing PCFS (#20)
Browse files Browse the repository at this point in the history
* temporary checkin to handle rebase

while i was working on this i also managed to implement the parsing
of Mion FW files. this requires a rebase, and a temporary checkin.

* add in mion commands for fw investigations

part of validating PCFS will be validating it across many MION FW
versions (thanks to crediar i was able to get quite a few more versions
to test with from SDKs they happened to have lying around). this adds
in commands to decrypt those firmwares, so i can actually figure out
what's going on with them.

it also adds a subcommand to quickly dump the fw out of running memory
incase someone new gets a cat-dev i wanna have a quick way to get their
current fw out of memory, without telling them they need to CTRL-C
early.

also small nit, fixed the help page rendering for the MION subcommand
as before it wasn't actually interacting correctly.

* fix cli bridge targeting, legacy booting support

- this fixes arguments that _may_ not be a bridge not actually being
  handled in the correct order in `target_bridge`, it would always
  take the default over the positional argument.
- boot now can boot mion fw's that don't have access to `power_on_v2`.
- you can now get the targeted bridge mac easily without duplicate
  lookups when messing with `bridgectl`.
- `boot.rs` was becoming too long, so split it into it's own series
  of modules, can't say they'll always live this way, but they're
  better than what it was.
- fix status uri for getting mion status.
- build in route for ejecting discs on legacy MIONs
- build in route for getting MION FW versions

* PCFS implementation parts, Giant Error Rework

This commit moves us along further on the PCFS front, where SDIO,
and ATAPI are now probably properly being handled? At least for the
packet types that I know about. However, the big thing in this commit
is completely reworking the error structure for `cat-dev`.

This is due to the fact the error structures were being WAY TOOOO
MESSY. A couple problems with the existing strategy:

1. So many fields being turned into the same error type, means matching
   almost all APIs you would have to match way more error types than
   could ever be returned (matching errors becoming tedious!).
2. Most of the errors are stored 'far away' from the actual source code
   that generates those errors (small issue, but bugged me!).
3. 'Duplicate' Errors, e.g. there were many that were "invalid size",
   when we already had `FieldTooShort`/`FieldTooLong`. These errors were
   almost always worse than the FieldTooShort/FieldTooLong.
4. Many errors didn't implement `From`/`Into` for all the errors in the
   "upchain", so you usually had to manually wrap error types. Now
   almost all errors can be changed with just `Into`, `From`, and `?`.

All in all, error handling should be significantly cleaner all things
considered. There is a single case which is worse:

- Accepting a top level error type (e.g. `CatBridgeError`), but trying
  to parse out an inner error type (e.g. `mionps` & `mionparamspace`).
  Because error types are significantly more structured, this means more
  wrapping in that case, and thus uglier code.

Overall I'm not too worried about this, because most APIs do return the
smallest possible structured type they can. Most are not returning
`CatBridgeError`. Not to mention this specific error matching isn't used
very frequently at all (as evidenced by it only being in two specific
CLI's that have buggy behavior anyway). Given how much simpler the `?`,
`into`, and smaller error structures are.

* pcfs one step closer, mostly booting now

- actually read all the fields from `FSEmul.conf` and respect them
  when needed.
- allow ctrl-c'ing out of serial wait task when connecting to
  `DEBUG_OUT`.
- add cli arguments for anything that can be specified in an env
  var/file to ensure per process overrides exist.
- scope out a bit more of the `boot` command when using a "default"
  setup (e.g. with SATA enabled, FFIO/CSR setup).
- add a load bearing sleep call between sending SDIO packets, so we
  don't overload the MION processing our devices (this is required to
  even be able to send `fw.img` because the MION is actually really
  terrible at it's job).
- allow legacy bridges to actually detect PCFS being enabled.
  - i still need to figure out ways to override all the args, probably
    more web setup calls but we'll see.
- fix latest clippy warnings
- upgrade to latest rust, and latest rust package resolver
- allow dlfs to recognize addresses that appear mid-way through a file.
- host filesystem now resembles more of a filesystem.
- implement a lot more of the PCFS Sata server, enough to complete a
  full MLC bootup and scan (we are now blocked on SDIO message types
  again).

* new packet types to allow pcfs, and minor fixes

- implement write_file for pcfs
- implement change_owner for pcfs
- fix up documentation
- work around case-insensitivity problems for linux with title ids.
  - windows is case insensitive, as is macosx, ext4 common linux however
    is case sensitive. most of the time copying between the two will
    just work. EXCEPT for title ids (which are expected to be
    lowercase).

* fixup windows, and identify errors in mac

* slightly more info for debugging osx

* properly check for parent directory, canonicalize for mac

* fix formatting

* fix ppc_boot test for dlf on windows

* fix windows tests
  • Loading branch information
Mythra authored Jan 14, 2025
1 parent 533a149 commit fa1ebdc
Show file tree
Hide file tree
Showing 111 changed files with 17,341 additions and 2,912 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,19 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: sprig_unix_amd64.deb
path: installer-scripts/unix/sprig_0.0.6_amd64.deb
path: installer-scripts/unix/sprig_0.0.8_amd64.deb
- uses: actions/upload-artifact@v4
with:
name: sprig_unix_amd64.rpm
path: installer-scripts/unix/sprig-0.0.6-1.x86_64.rpm
path: installer-scripts/unix/sprig-0.0.8-1.x86_64.rpm
- uses: actions/upload-artifact@v4
with:
name: sprig_unix_amd64.apk
path: installer-scripts/unix/sprig_0.0.6_x86_64.apk
path: installer-scripts/unix/sprig_0.0.8_x86_64.apk
- uses: actions/upload-artifact@v4
with:
name: sprig_unix_amd64.pkg.tar.zst
path: installer-scripts/unix/sprig-0.0.6-1-x86_64.pkg.tar.zst
path: installer-scripts/unix/sprig-0.0.8-1-x86_64.pkg.tar.zst
- uses: actions/upload-artifact@v4
with:
name: sprig-target-directory-unix
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
run: rustup update stable
- name: Run Nextest
run: cargo nextest run
env:
RUST_BACKTRACE: full
doc-test:
name: Run doc tests
strategy:
Expand All @@ -82,4 +84,6 @@ jobs:
- name: Install Rust
run: rustup update stable
- name: Run Doc Tests
run: cargo test --doc
run: cargo test --doc
env:
RUST_BACKTRACE: full
Loading

0 comments on commit fa1ebdc

Please sign in to comment.