| | 1 | There is a shell demo application that comes with MutekH. |
| | 2 | |
| | 3 | This applications uses two MutekH features as its core: |
| | 4 | * The in-kernel lua binding |
| | 5 | * The libtermui terminal interface with completion |
| | 6 | |
| | 7 | Moreover, this application has optional parts that can demonstrate other |
| | 8 | services of the kernel. Depending on your configuration, more commands may |
| | 9 | be available. We'll see the complete list of features that can be built below. |
| | 10 | |
| | 11 | |
| | 12 | |
| | 13 | = Features = |
| | 14 | |
| | 15 | == VFS access == |
| | 16 | |
| | 17 | When you use the `CONFIG_VFS` token, you'll have access to all file-related functions. |
| | 18 | |
| | 19 | They are the usual shell commands (`ls`, `cat`, `cd`, `pwd`, `mkdir`, `rm`, `mv`, `ln`, `hexdump`), |
| | 20 | except they use a lua-ish syntax (with arguments like a function call). |
| | 21 | |
| | 22 | Example: |
| | 23 | {{{ |
| | 24 | [lua:] mkdir("foo") |
| | 25 | [lua:] cd("foo") |
| | 26 | [lua:foo] ls() |
| | 27 | [lua:foo] append("file.txt", "abcd") |
| | 28 | [lua:foo] ls() |
| | 29 | file.txt [reg] 4 |
| | 30 | [lua:foo] cat("file.txt") |
| | 31 | abcd[lua:foo] rm("file.txt") |
| | 32 | [lua:foo] ls() |
| | 33 | [lua:foo] |
| | 34 | }}} |
| | 35 | |
| | 36 | Il you compile other filesystem drivers ([api:macro:CONFIG_DRIVER_FS_FAT16], [api:macro:CONFIG_DRIVER_FS_ISO9660], [api:macro:CONFIG_DRIVER_FS_DEVFS]), you may even use `mount()`. |
| | 37 | |
| | 38 | {{{ |
| | 39 | [lua:] mkdir("dev") |
| | 40 | [lua:] mount("devfs", "dev") |
| | 41 | [lua:] cd("dev/child0") |
| | 42 | [lua:child0] ls() |
| | 43 | cpus-Ppc,405@0 [dir] 0 |
| | 44 | cpus-Ppc,405@1 [dir] 0 |
| | 45 | cpus-Ppc,405@2 [dir] 0 |
| | 46 | cpus-Ppc,405@3 [dir] 0 |
| | 47 | tty@0 [dir] 0 |
| | 48 | block@0 [dir] 0 |
| | 49 | xicu@0-out@0 [dir] 0 |
| | 50 | xicu@0-out@1 [dir] 0 |
| | 51 | xicu@0-out@2 [dir] 0 |
| | 52 | xicu@0-out@3 [dir] 0 |
| | 53 | xicu@0 [dir] 0 |
| | 54 | memory@0 [dir] 0 |
| | 55 | [lua:child0] cd("tty@0") |
| | 56 | [lua:tty@0] ls() |
| | 57 | handle [reg] 0 |
| | 58 | [lua:tty@0] append("handle", "message on tty") |
| | 59 | message on tty[lua:tty@0] |
| | 60 | }}} |
| | 61 | |
| | 62 | You may watch the internal state of the VFS with |
| | 63 | {{{ |
| | 64 | [lua:] vfs_dump() |
| | 65 | ... |
| | 66 | [lua:] |
| | 67 | }}} |
| | 68 | |
| | 69 | == Cryptographic functions == |
| | 70 | |
| | 71 | MutekH contains a cryptographic API. It is enabled with the [api:macro:CONFIG_LIBCRYPTO] |
| | 72 | |
| | 73 | |
| | 74 | The shell can be used to apply some |
| | 75 | cryptographic operations on files. The first command to test is a hash |
| | 76 | of a file. This example requires [api:macro:CONFIG_LIBCRYPTO_MD5]: |
| | 77 | |
| | 78 | {{{ |
| | 79 | [lua:] md5("test.txt") |
| | 80 | 58a8785971212ef137f04b05df26ea15 |
| | 81 | }}} |
| | 82 | |
| | 83 | == Timer functions == |
| | 84 | |
| | 85 | MutekH has a built-in timer. If you enabled support for |
| | 86 | the timer (with the [api:macro:CONFIG_MUTEK_TIMERMS] token), |
| | 87 | and if you have a proper timer device setup, you may use the following |
| | 88 | commands: |
| | 89 | |
| | 90 | {{{ |
| | 91 | [lua:] printlater(12000, "silly delayed message") |
| | 92 | [lua:] cat("test.txt") |
| | 93 | silly delayed message |
| | 94 | test contents line 1 |
| | 95 | contents line test 2 |
| | 96 | [lua:] |
| | 97 | }}} |