Changes between Initial Version and Version 1 of UsingMutekH/LuaMicroShell


Ignore:
Timestamp:
Dec 22, 2009, 4:22:21 PM (15 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UsingMutekH/LuaMicroShell

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