Skip to content

Commit

Permalink
Hide fake storage behind env var
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Jan 17, 2024
1 parent a38231e commit b0be672
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ SHELL = /bin/bash
ifeq ("${DEBUG}","1")
BUILD_TAGS := ${BUILD_TAGS},debug
endif
ifeq ("${FAKE_STORAGE}", "1")
BUILD_TAGS := ${BUILD_TAGS},fake_storage
endif

APP := ""
TEXT_START = 0x80010000 # ramStart (defined in mem.go under relevant tamago/soc package) + 0x10000
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ the `imx_boot` tool, or similar.
Note that since this OS image is not being loaded via the bootloader, it does not need
to be added to the FT log.

#### Optional development environment variables

The following environment variables may be set when compiling the Trusted OS image in order
to add extra debugging support to the resulting image:

| Variable | Description
|------------------|------------
| `DEBUG` | When set to `1`, enables output of logging, stdout, etc. See #debugging section below for more details
| `FAKE_STORAGE` | When set to `1`, provides a storage card implementation which passes-through to SDCard on native hardware, but uses RAM to emulate an SDCard otherwise.

### Encrypted RAM support

Only on i.MX6UL P/Ns, the `BEE` environment variable must be set to match
Expand Down Expand Up @@ -182,6 +192,13 @@ The Trusted OS image can be executed under emulation as follows:
make qemu
```

Note that emulated MMC storage is not currently supported, so the Trusted OS should
be built with the `FAKE_STORAGE` environment variable set to `1`:

```bash
make DEBUG=1 FAKE_STORAGE=1 trusted_os
```

The emulation run network connectivity should be configured as follows (Linux
example with tap0):

Expand Down
4 changes: 2 additions & 2 deletions trusted_os/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !debug
// +build !debug
//go:build !fake_storage
// +build !fake_storage

package main

Expand Down
4 changes: 2 additions & 2 deletions trusted_os/storage_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build debug
// +build debug
//go:build fake_storage
// +build fake_storage

package main

Expand Down

0 comments on commit b0be672

Please sign in to comment.