bmcd
18 months agoChanged firmware_update definition to usb_boot origin/feature/otg_msd
Sven Rademakers [Sun, 17 Dec 2023 13:51:05 +0000 (13:51 +0000)]
Changed firmware_update definition to usb_boot

This commit contains only definition and name changes. The aim is to
be more descriptive.

18 months agoSimply usb boot interface
Sven Rademakers [Fri, 15 Dec 2023 16:20:25 +0000 (16:20 +0000)]
Simply usb boot interface

In the current firmware_update module, there are a lot of assumptions
made to support use cases that probably never are going to be
implemented.

18 months agofwupdate: use `rockusb` driver for maskrom rk1 transfers
Ruslan Akbashev [Fri, 8 Dec 2023 19:29:40 +0000 (23:29 +0400)]
fwupdate: use `rockusb` driver for maskrom rk1 transfers

As a consequence, this enables functionality of `tpi advanced msd` for
rk1 nodes.

Closes turing-machines/BMC-Firmware#137

18 months agoget latest on dependencies
Sven Rademakers [Mon, 4 Dec 2023 14:22:17 +0000 (14:22 +0000)]
get latest on dependencies

18 months agostreaming_data_service: fix get error msg deadlock
Sven Rademakers [Mon, 4 Dec 2023 11:02:06 +0000 (11:02 +0000)]
streaming_data_service: fix get error msg deadlock

When an error occurs during a file transfer, method
`return_transfer_error` always falls back on the default error message
'transfer canceled'.

The issues is fixed by not holding the streaming_data_service state lock
when waiting for the error message to bubble up. This gives the
streaming_data_service the opportunity to update the error state.

18 months agodata_transfer: accept URL as transfer sources
Sven Rademakers [Thu, 30 Nov 2023 14:27:18 +0000 (14:27 +0000)]
data_transfer: accept URL as transfer sources

transfer data from an alternative source, HTTP, for firmware and flash
upgrades.

18 months agopatch async-compression: make sure to exhaust reader
Sven Rademakers [Fri, 1 Dec 2023 18:33:10 +0000 (18:33 +0000)]
patch async-compression: make sure to exhaust reader

This commit makes sure that underlaying readers are exhausted.
This fixes a bug that sha256 validation was not triggered as the stream
was still ready to accept new data even though the decompressor which
was on a higher layer already communicated that the stream is EOF.

Next to that, some logging improvements are present in this commit

18 months agoAPI: expose crc options
Sven Rademakers [Fri, 1 Dec 2023 10:46:20 +0000 (10:46 +0000)]
API: expose crc options

When initiating a file transfer (to flash a node or upgrade firmware) a
sha256 query parameter can now be passed that will be used to verify
integrity of the written image:

`/api/bmc?opt=set&type=flash&file=/my/file.img&node=1&sha256=74eea5165db`

A query option `skip_crc` can be passed to skip the crc validation step.
This step gets executed after writing the node. It reads back the whole
written area and compares this crc with the crc checksum of the written
data:

`/api/bmc?opt=set&type=flash&skip_crc`

18 months agostreaming_data_service: improvements
Sven Rademakers [Thu, 30 Nov 2023 17:08:43 +0000 (17:08 +0000)]
streaming_data_service: improvements

* The BMC will restore USB and power state of the given node even if a
  transfer was aborted prematurely.
* The multi-part HTTP handler cancels the node flash process if a partial
  byte-stream was received.

18 months agoxz decoding: calculate available memory
Sven Rademakers [Wed, 15 Nov 2023 14:05:04 +0000 (14:05 +0000)]
xz decoding: calculate available memory

determine the amount of allocate-able memory before initializing the
decoder. This lowers the chance of running out of memory.

18 months agoadded xz decoder
Sven Rademakers [Wed, 15 Nov 2023 10:24:25 +0000 (10:24 +0000)]
added xz decoder

xz decoding support is very unstable at the moment due to the high
demand of memory.

18 months agochange read interface to AsyncRead v2.0.6-unstable
Sven Rademakers [Wed, 15 Nov 2023 09:05:04 +0000 (09:05 +0000)]
change read interface to AsyncRead

This work prepares the code base for easy integration with decoding
codec streams. Using `AsyncRead` means we can get rid off an extra
buffering step when using decompression

19 months agov2.0.5 v2.0.5
Sven Rademakers [Tue, 28 Nov 2023 12:47:28 +0000 (12:47 +0000)]
v2.0.5

19 months agopin_controller: fix clearing of boot pin
Sven Rademakers [Tue, 28 Nov 2023 12:44:49 +0000 (12:44 +0000)]
pin_controller: fix clearing of boot pin

When toggling USB mode from flashing to another mode, the RPI_BOOT pin
is not cleared. This means that a given node does not boot when
restarted until this pin is cleared via an alternative way.

19 months agov2.0.4 v2.0.4
Sven Rademakers [Thu, 23 Nov 2023 17:15:14 +0000 (17:15 +0000)]
v2.0.4

19 months agoUSB route added 'flash' option to API
Sven Rademakers [Thu, 23 Nov 2023 14:05:57 +0000 (14:05 +0000)]
USB route added 'flash' option to API

The boot pin state is added to the USB state, as its closely related to
the different roles a given node fulfills.

19 months agoKEY_1 long press improvement.
Sven Rademakers [Tue, 21 Nov 2023 12:22:35 +0000 (12:22 +0000)]
KEY_1 long press improvement.

Long pressing KEY_1 will execute the inverse power action of on normal press.
Prior, long pressing would always force all nodes on.
See the state table:

 | state             | long_press | All nodes |
 | :---------------- | :--------: | :-------: |
 | 0b0000            |  False     | On        |
 | 0b0111            |  False     | Off       |
 | 0b1111            |  False     | Off       |
 | 0b0000            |  True      | On        |
 | 0b0111            |  True      | On        |
 | 0b1111            |  True      | Off       |

19 months agobump patch version to v2.0.3 v2.0.3
Sven Rademakers [Wed, 15 Nov 2023 17:59:24 +0000 (17:59 +0000)]
bump patch version to v2.0.3

19 months agoupdate clap dependency
Sven Rademakers [Wed, 15 Nov 2023 17:48:02 +0000 (17:48 +0000)]
update clap dependency

19 months agostreaming_data_service: wait for error state
Sven Rademakers [Wed, 15 Nov 2023 17:44:02 +0000 (17:44 +0000)]
streaming_data_service: wait for error state

wait up to a maximum of 5 seconds for the worker attached to the
streaming service to shutdown and return its error message.

19 months agoimprove Gzip implementation
Sven Rademakers [Wed, 15 Nov 2023 10:23:39 +0000 (10:23 +0000)]
improve Gzip implementation

makes use of the gzip encoder inside async_compression crate.
Return archive as streaming body.

19 months agocreated v2.0.2 v2.0.2
Sven Rademakers [Sun, 12 Nov 2023 19:44:46 +0000 (19:44 +0000)]
created v2.0.2

19 months agoadd bmcd reload endpoint
Sven Rademakers [Sun, 12 Nov 2023 11:44:16 +0000 (11:44 +0000)]
add bmcd reload endpoint

19 months agoadded backup endpoint
Sven Rademakers [Sun, 12 Nov 2023 11:09:14 +0000 (11:09 +0000)]
added backup endpoint

Compresses filesystem overlay into a `tar.gz` and returns it as response.
Uses zlib for compression.

19 months agoupgrade_worker: fix clippy
Sven Rademakers [Sun, 12 Nov 2023 00:22:41 +0000 (00:22 +0000)]
upgrade_worker: fix clippy

19 months agoos upgrade: dont block runtime
Sven Rademakers [Sat, 11 Nov 2023 22:41:58 +0000 (22:41 +0000)]
os upgrade: dont block runtime

schedule blocking `osupgrade` process call on designated thread.

19 months agostreaming_data_service: cleanup
Sven Rademakers [Sat, 11 Nov 2023 19:44:22 +0000 (19:44 +0000)]
streaming_data_service: cleanup

* updated implementation from `AsyncRead` to `AsyncBufRead`.
* moved CRC checker from reader half to writer half. see `WriteWatcher`
* split data_transfer into its own file.

19 months agoformat NodeId's with Display trait
Sven Rademakers [Fri, 10 Nov 2023 16:12:18 +0000 (16:12 +0000)]
format NodeId's with Display trait

In order for smooth API handling, align response json with UI text

19 months agotokio: remove patch, `take` fix landed in 1.34
Sven Rademakers [Fri, 10 Nov 2023 11:50:23 +0000 (11:50 +0000)]
tokio: remove patch, `take` fix landed in 1.34

19 months agorename firmware_runner to upgrade_worker
Sven Rademakers [Fri, 10 Nov 2023 10:31:41 +0000 (10:31 +0000)]
rename firmware_runner to upgrade_worker

19 months agoflash node: improve flashing performance
Sven Rademakers [Fri, 10 Nov 2023 07:23:27 +0000 (07:23 +0000)]
flash node: improve flashing performance

Decreased the flashing time from 16m to 6m40s.

Conducted a dd test locally on the BMC to determine the correct block
size for writing to a raspberry CM4.
Times measured using a 206Mb file:

512B     1m50.22s
512K     43.0s
1M       43.03s
4M       42.96s
8M       43.19s
16M      43.00s
32M      45.95s

Concluded 4M is the optimal blocksize.

Ran some tests writing `2023-05-03-raspios-bullseye-armhf-lite.img`
* using dd 4M                   => 6m23.86s
* using tpi with -l flag        => 6m22s
* using tpi over local network  => 6m40s

19 months agoredirect_service: forward to correct port
Sven Rademakers [Thu, 9 Nov 2023 11:13:46 +0000 (11:13 +0000)]
redirect_service: forward to correct port

The redirect service was not taking into account an explicitly configured
HTTP port. Resulting i a redirect that was not resolvable.
By parsing the configured port in the destination location, browsers now
can forward correctly requests to port 80.

19 months agoexpose additional endpoint
Sven Rademakers [Wed, 8 Nov 2023 16:51:15 +0000 (16:51 +0000)]
expose additional endpoint

Exposes 2 additional endpoints in the API. Intended to serve the BMC-UI.
It sorts version related strings in a 'about' call and info about your
specific board into 'info'

19 months agov2.0.1 include fixes during RC1 testing v2.0.1
Sven Rademakers [Mon, 6 Nov 2023 13:09:30 +0000 (13:09 +0000)]
v2.0.1 include fixes during RC1 testing

19 months agoSimplify power state
Sven Rademakers [Mon, 6 Nov 2023 12:50:06 +0000 (12:50 +0000)]
Simplify power state

Previously, an attempt was made to make a power controller with a on
and off state. The "on" state had a sub-state where nodes could be
activated, they were participating in the on/off state
toggling. Power commands to nodes that were 'deactivated` were omitted.

After some trial and error, its concluded that for the end user its
confusing as:
* there is no real way to detect if a module is inserted at a slot and
  therefore can be labeled as active. As a fallback it was up to the
  user to flag a given node as active.
* there was no easy way to see if a node was/is active and to what state
  it will go when an global on or off command was given

The global power state is removed and the interface is simplified.
* on restart the previous power-state prior reboot is restored
* pressing KEY_1 will toggle all nodes on if 3 or less nodes are powered
  on
* pressing KEY_1 when all nodes are off will turn all nodes on
* pressing KEY_1 when all nodes are on will turn all nodes off
* long press KEY_1 will force every node to on
* the API does not cache a global state, command `on --node 1` will turn
  node 1 on etc

19 months agopersistency: improve logging, decrease write timeout
Sven Rademakers [Mon, 6 Nov 2023 12:46:45 +0000 (12:46 +0000)]
persistency: improve logging, decrease write timeout

decrease write timeout. Actual caching is handled by linux filesystem.

19 months agoban_patrol: simplify ban deadline
Sven Rademakers [Mon, 6 Nov 2023 10:15:43 +0000 (10:15 +0000)]
ban_patrol: simplify ban deadline

Improvements to simplify deadline logic. The time the user is banned
from authenticating in case of exceeding the authentication threshold

19 months agoUpdate default_config.yaml
Sven Rademakers [Mon, 6 Nov 2023 00:10:25 +0000 (00:10 +0000)]
Update default_config.yaml

Add trailing backslash to www path

19 months agoserial: replace custom ring buffer impl with a crate
Ruslan Akbashev [Sat, 4 Nov 2023 00:47:14 +0000 (04:47 +0400)]
serial: replace custom ring buffer impl with a crate

Fixes turing-machines/BMC-Firmware#135

19 months agobring back info logging of `bmcd` module
Sven Rademakers [Fri, 3 Nov 2023 16:26:47 +0000 (16:26 +0000)]
bring back info logging of `bmcd` module

19 months agofix typo in reboot API query
Sven Rademakers [Fri, 3 Nov 2023 16:23:01 +0000 (16:23 +0000)]
fix typo in reboot API query

19 months agomove the default www directory to /srv/bmcd/www
Sven Rademakers [Fri, 3 Nov 2023 15:40:20 +0000 (15:40 +0000)]
move the default www directory to /srv/bmcd/www

According FHS:
'/srv – this directory should contain data that is served by the system'

19 months agoExpose more daemon configuration to config file
Sven Rademakers [Fri, 3 Nov 2023 15:19:39 +0000 (15:19 +0000)]
Expose more daemon configuration to config file

in particular:
* port
* www dir
* enable/disable http redirect

19 months agoauthentication: auto reload users
Sven Rademakers [Fri, 3 Nov 2023 13:30:34 +0000 (13:30 +0000)]
authentication: auto reload users

Reload the internal cache when an users are added or removed. This
prevents granting stale users access the API + UI.

Implementation is based on `inotify` subsystem.

19 months agofix unit-test ban_patrol
Sven Rademakers [Fri, 3 Nov 2023 08:11:13 +0000 (08:11 +0000)]
fix unit-test ban_patrol

19 months agoauth: ban consecutive failed requests
Sven Rademakers [Wed, 25 Oct 2023 16:28:41 +0000 (17:28 +0100)]
auth: ban consecutive failed requests

Consecutive unauthenticated requests that exceed a given threshold will
be banned for a given period before they are allowed to make any new
request. Every consecutive failed attempt exponentially increases the
cool down period in which the peer is blocked from authenticate itself
up to a upper limit.

19 months agoconfig: added authentication group
Sven Rademakers [Wed, 25 Oct 2023 10:57:02 +0000 (11:57 +0100)]
config: added authentication group

default_config is updated with the exposed values and a description is
added.

19 months agohumantime: convert durations into human readable
Sven Rademakers [Wed, 25 Oct 2023 10:33:52 +0000 (11:33 +0100)]
humantime: convert durations into human readable

19 months agofix power init
Sven Rademakers [Fri, 3 Nov 2023 08:42:41 +0000 (08:42 +0000)]
fix power init

19 months agobmc_application: restore power and usb settings
Sven Rademakers [Fri, 3 Nov 2023 07:57:10 +0000 (07:57 +0000)]
bmc_application: restore power and usb settings

This commit contains 2 improvements:
* Internal operations are not triggering persistency updates anymore.
  Minimizing flash wear.
* After a flash command the power and USB settings are restored to their
  previous values

19 months agoexpose reboot over API
Sven Rademakers [Fri, 3 Nov 2023 07:49:03 +0000 (07:49 +0000)]
expose reboot over API

19 months agov2.0.0 v2.0.0
Sven Rademakers [Wed, 1 Nov 2023 15:02:01 +0000 (15:02 +0000)]
v2.0.0

19 months agostub: adjust `get_device_path` signature to original
Ruslan Akbashev [Tue, 31 Oct 2023 12:15:58 +0000 (16:15 +0400)]
stub: adjust `get_device_path` signature to original

19 months agousbboot: move searching from `/dev/disk/by-id` to `/sys/block`
Ruslan Akbashev [Tue, 31 Oct 2023 12:05:04 +0000 (16:05 +0400)]
usbboot: move searching from `/dev/disk/by-id` to `/sys/block`

After turing-machines/BMC-Firmware@1193ce32 [1] mdev replaced eudev, and
with it directory of symlinks /dev/disk/by-id stopped being generated.
Work around this by searching in /sys/block instead.

[1]: https://github.com/turing-machines/BMC-Firmware/commit/1193ce329f952297ab9604238097523839a2c287

19 months agostreaming_data_service: improve error message
Sven Rademakers [Tue, 31 Oct 2023 13:15:00 +0000 (13:15 +0000)]
streaming_data_service: improve error message

When the channel closes which the sender uses to transport the file
data. Ask the `StreamingDataService` what the current error state is
rather then just responding to the client with a generic answer.

19 months agodo not run clippy on all features
Sven Rademakers [Tue, 31 Oct 2023 07:31:59 +0000 (07:31 +0000)]
do not run clippy on all features

Feature "stubbed" is meant for development purposes.

19 months agoUpdate README.md
Sven Rademakers [Mon, 30 Oct 2023 15:35:45 +0000 (15:35 +0000)]
Update README.md

19 months agoadded stubs
Sven Rademakers [Mon, 30 Oct 2023 11:51:39 +0000 (11:51 +0000)]
added stubs

Stubs can be enabled with compiling feature flag 'stubbed'
* gpio controllers dont do anything
* serial returns static content
* firmware_update writes to /tmp/stubbed_device
* usb filtering is omitted

19 months agocleanup module directories of hal
Sven Rademakers [Mon, 30 Oct 2023 09:25:48 +0000 (09:25 +0000)]
cleanup module directories of hal

20 months agosanitize module layout files
Sven Rademakers [Sat, 28 Oct 2023 09:31:35 +0000 (10:31 +0100)]
sanitize module layout files

added a clippy lint to only allow self named modules files

20 months agoupdate dependencies and remove pinned rockusb commit
Sven Rademakers [Thu, 26 Oct 2023 19:53:54 +0000 (20:53 +0100)]
update dependencies and remove pinned rockusb commit

20 months agoauth: default to Basic WWW-Authenticate header
Sven Rademakers [Thu, 26 Oct 2023 02:25:22 +0000 (03:25 +0100)]
auth: default to Basic WWW-Authenticate header

20 months agoauthentication_context: fix failing unit-tests
Sven Rademakers [Wed, 25 Oct 2023 09:39:47 +0000 (10:39 +0100)]
authentication_context: fix failing unit-tests

20 months agoauth: format authorization denied based on scheme
Sven Rademakers [Wed, 25 Oct 2023 09:27:51 +0000 (10:27 +0100)]
auth: format authorization denied based on scheme

When responding with an unauthorized response, make sure that the
correct header is returned based on the scheme used.

Only a "realm" attribute is used when the scheme is unknown or not
parse-able.

20 months agoauth: fix clippy and fmt
Ruslan Akbashev [Wed, 25 Oct 2023 07:07:50 +0000 (11:07 +0400)]
auth: fix clippy and fmt

20 months agoauth: ask for `Basic` authentication scheme
Ruslan Akbashev [Tue, 24 Oct 2023 12:37:14 +0000 (16:37 +0400)]
auth: ask for `Basic` authentication scheme

This causes browsers to ask and use authentication credentials

20 months agotoggle `RPI_BOOT` signal instead of keeping it high v2.2.0
Sven Rademakers [Thu, 19 Oct 2023 10:49:37 +0000 (11:49 +0100)]
toggle `RPI_BOOT` signal instead of keeping it high

This way we can support a wider range of compute modules for image upgrade.
In particular, on an Orange-Pi(RK3566), the RPI_BOOT pin is connected to short
the MMC clock. This forces the device to go into Maskrom mode. Keeping the
RPI_BOOT pin logically means that its impossible for this device to
write anything to MMC.

20 months agofirmware_update: cleanup error and logging
Sven Rademakers [Wed, 18 Oct 2023 12:11:32 +0000 (13:11 +0100)]
firmware_update: cleanup error and logging

* Cleaned up the async logging/state component. Error information should
  flow back via `FwUdateError`.
* Flattened the `SUPPORTED_DEVICES` and `SUPPORTED_MSD_DEVICES`. All
  official supported devices need to be able to run as MSD. If
  there are any technical reasons why this is not feasible an appropriate
  error response is sufficient to differentiate between supported and
  not supported MSD devices.

20 months agostreaming_data_service:
Sven Rademakers [Mon, 16 Oct 2023 14:55:22 +0000 (15:55 +0100)]
streaming_data_service:

* Includes patch for tokio::io::Take which caused overflows when
  steaming files over 4GB
* Decreased lock contention of the streaming_data_service state by
  exposing the "Sender" of the data. (`take_sender()`)
* Upgraded from peer validation to handle validation. Only data that is
  send to the correct handle endpoint is allowed.
* various fixes and improvements

20 months agoshow buildroot info in `other` API endpoint
Sven Rademakers [Fri, 13 Oct 2023 16:23:35 +0000 (17:23 +0100)]
show buildroot info in `other` API endpoint

20 months agostreaming_data_service: added write progress
Sven Rademakers [Fri, 13 Oct 2023 14:21:48 +0000 (15:21 +0100)]
streaming_data_service: added write progress

The status endpoint returns now the amount of bytes written to a given
node. e.g. `http://<HOST>/api/bmc?opt=get&type=flash`

20 months agostreaming_data_service: added support for local file writes
Sven Rademakers [Fri, 13 Oct 2023 11:21:51 +0000 (12:21 +0100)]
streaming_data_service: added support for local file writes

20 months agostreaming_data_service: improve logging of service
Sven Rademakers [Thu, 12 Oct 2023 12:51:43 +0000 (13:51 +0100)]
streaming_data_service: improve logging of service

20 months agofix cargo-cross
Sven Rademakers [Thu, 12 Oct 2023 09:39:07 +0000 (10:39 +0100)]
fix cargo-cross

fix the missing Openssl dependency that caused a build failure if cargo
cross was used. Updated the README to reflect the changes

20 months agoGH-52 implemented os_update
Sven Rademakers [Wed, 11 Oct 2023 09:37:38 +0000 (10:37 +0100)]
GH-52 implemented os_update

Added logic to execute a os_update

20 months agostreaming_data_service: removed receiverReader
Sven Rademakers [Wed, 11 Oct 2023 09:31:51 +0000 (10:31 +0100)]
streaming_data_service: removed receiverReader

* Removed our custom receiverReader and replaced it with a tokio variant
* moved transfer_context to its own file
* amount of bytes written is now returned in the status object of
  `TransferContext`
* other small improvements

20 months agofirmware_runner: resolve technical debt pt.3
Sven Rademakers [Mon, 9 Oct 2023 14:46:44 +0000 (15:46 +0100)]
firmware_runner: resolve technical debt pt.3

Prevent tokio::io::copy from stalling by making the reader exhaustive

20 months agoUpdate README.md
Sven Rademakers [Tue, 10 Oct 2023 12:23:16 +0000 (13:23 +0100)]
Update README.md

remove the package parameter. which is obsoleted now.

20 months agopersistency: during shutdown only write if changed
Sven Rademakers [Tue, 10 Oct 2023 11:22:37 +0000 (12:22 +0100)]
persistency: during shutdown only write if changed

Only write the binary persistency file if it was actually dirty

20 months agofirmware_runner: resolve technical debt pt.2
Sven Rademakers [Mon, 9 Oct 2023 14:46:44 +0000 (15:46 +0100)]
firmware_runner: resolve technical debt pt.2

* In this commit the custom copy function is replaced with a
plain `tokio::io::copy`. This function is more efficient as in that it
can copy with arbitrary read/write sizes and doesnt enforce
`.write_exact`.
* An `CrCReader` is introduced that hooks into the `AsyncRead` reads to
  calculate a crc checksum.
* This copy flow can still be aborted with an "cancel" signal

20 months agofirmware_runner: resolve technical debt
Sven Rademakers [Sat, 7 Oct 2023 10:04:01 +0000 (11:04 +0100)]
firmware_runner: resolve technical debt

Condensed writing/reading mechanism inside `firmware_runner` to one
function, `copy_with_crc`. Next iteration a better implementation is
desired for reporting process.

20 months agorestructure bmcd workspace
Sven Rademakers [Fri, 6 Oct 2023 15:38:24 +0000 (16:38 +0100)]
restructure bmcd workspace

* flattened the workspace by squasing `tpi_rs` into `bmcd`. `tpi_rs` was
  the remainders of a library that was statically compiled into the
  legacy bmc C application.
* moved around some files. Tried to group modules and files by feature.

20 months agoremove c_interface module
Sven Rademakers [Fri, 6 Oct 2023 14:48:09 +0000 (15:48 +0100)]
remove c_interface module

This module was an temporary glue layer in order to develop new code in
the legacy bmc binary. Since we have a new bmc daemon, this code can be
buried.

20 months ago flash_service: Generalize logic
Sven Rademakers [Fri, 6 Oct 2023 10:42:36 +0000 (11:42 +0100)]
 flash_service: Generalize logic

 This commit extracts flash related logic out of the flash_service
 until we are left with a generic service that can receive large
 binary data.

20 months agofix regression in test-suite
Sven Rademakers [Thu, 5 Oct 2023 09:54:31 +0000 (10:54 +0100)]
fix regression in test-suite

20 months agopersistency: maturing component
Sven Rademakers [Mon, 2 Oct 2023 10:10:47 +0000 (11:10 +0100)]
persistency: maturing component

* Implemented a fallback mechanism when the database binary is
  corrupted. In this case the binary will be omitted and overwritten
  with an default store on successive write-backs of the store to disk
* Improved fatal error messages on erroneous `.get()` and `.set()`
  calls.
* Created a new config file item: `write_timeout`. Controls the write
  timeout of the persistency. More information inside
  `default_config.yaml`

20 months agoCI: add cargo-deny
Sven Rademakers [Mon, 2 Oct 2023 15:39:00 +0000 (16:39 +0100)]
CI: add cargo-deny

* Verify use of FOSS licenses.
* added copyright header to **/*.rs files

20 months agoMerge pull request #53 from turing-machines/feature/serial
Ruslan Akbashev [Wed, 4 Oct 2023 15:12:59 +0000 (19:12 +0400)]
Merge pull request #53 from turing-machines/feature/serial

tpi_rs: add serial handlers

20 months agoMerge branch 'master' into feature/serial
Ruslan Akbashev [Wed, 4 Oct 2023 15:04:43 +0000 (19:04 +0400)]
Merge branch 'master' into feature/serial

20 months ago Gh-10 rework pin controller
Sven Rademakers [Tue, 1 Aug 2023 10:05:01 +0000 (11:05 +0100)]
 Gh-10 rework pin controller

Rework to accommodate changes in the Linux subsystem by #49.

20 months agoserial: rework the ownership
Sven Rademakers [Fri, 29 Sep 2023 13:53:51 +0000 (14:53 +0100)]
serial: rework the ownership

The serial workers synchronize communication by:
* a channel for writes.
* shares the 'RingBuffer' implementation for reads.

21 months ago Implement token and basic authentication
Sven Rademakers [Tue, 19 Sep 2023 07:17:42 +0000 (08:17 +0100)]
 Implement token and basic authentication

NOTE: this Service is not resilient against brute-force attacks in such
it does not implement rate limiting on authentication nor authorization
requests.

* Uses Linux users to authorize requests.
* no authorization roles or scopes are implemented yet.
* token based authentication is implemented with the Redfish session
  login authentication in mind. That is, when we would implement Redfish
  it should be easy to append the current implementation
* token timeout gets reset on every use of the token.
* basic authentication: The authentication service expects a
  'Authorization' header containing the following format: 'Basic <base64
  encoded as <username:password>>'

21 months agorun `cargo fmt`
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
run `cargo fmt`

21 months agoserial: add `encoding` parameter
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
serial: add `encoding` parameter

21 months agoserial: move `RingBuffer` to its own module
Ruslan Akbashev [Mon, 25 Sep 2023 14:38:49 +0000 (18:38 +0400)]
serial: move `RingBuffer` to its own module

21 months agoflash_service: stability and improvements
Sven Rademakers [Wed, 20 Sep 2023 10:13:32 +0000 (11:13 +0100)]
flash_service: stability and improvements

* added a API call so a client can ask the current status of the
  `FlashService`
* fixes regarding cancelling of the node flash
* cleanup of code

21 months agoNode reset: implement simulated reset
Sven Rademakers [Thu, 21 Sep 2023 14:12:27 +0000 (15:12 +0100)]
Node reset: implement simulated reset

Node reset GPIO's are not connected on the board. Therefore remove
related logic and implement a simulated reset by toggling the power of
a given node.

21 months agolegacy API: support USB routes to BMC
Sven Rademakers [Wed, 20 Sep 2023 10:16:12 +0000 (11:16 +0100)]
legacy API: support USB routes to BMC

21 months agoadded "usb_boot" operation
Sven Rademakers [Fri, 15 Sep 2023 12:29:43 +0000 (13:29 +0100)]
added "usb_boot" operation

* split the usbboot pin functionality from the usb configuration and
  gave it its separate routine call.
* usb_boot pin is now exposed over the API via opt=set&type=usb_boot

21 months agotpi_rs: add serial handlers
Ruslan Akbashev [Wed, 13 Sep 2023 12:44:03 +0000 (16:44 +0400)]
tpi_rs: add serial handlers

Fixes #22