Skip to content

Commit

Permalink
refactor: separate apps from userlib.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajh123 committed Apr 10, 2024
1 parent 5d7bbba commit c19aaf6
Show file tree
Hide file tree
Showing 26 changed files with 20 additions and 19 deletions.
11 changes: 6 additions & 5 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ In addition to executing commands, you can only do the following things.

** Userland Application

The userland comes with a user library called ulib that is similar to Rust’s
std, so you can use it to develop your favorite commands. If you create a bin
crate named ~_command~ in src/user, the build.rs and mkfs.rs will place a file
named ~command~ in the file system and make it available for use.
The userland comes with a user library called ulib (located at src/user/lib)
that is similar to Rust’s std, so you can use it to develop your favorite
commands. If you create a bin crate named ~_command~ in src/user/bin, the
build.rs and mkfs.rs will place a file named ~command~ in the file system
and make it available for use.

- In src/user/Cargo.toml, define a bin crate with the name of the command you
want to create with a ~_~ prefix
#+begin_src toml
[[bin]]
name = "_rm"
path = "rm.rs"
path = "bin/rm.rs"
#+end_src
- userland is also no_std, so don’t forget to add ~#[no_std]~. Use ulib to
develop any command you like. Here is an example of the rm command.
Expand Down
28 changes: 14 additions & 14 deletions src/user/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,59 @@ forced-target = "riscv64gc-unknown-none-elf"

[lib]
name = "ulib"
path = "lib.rs"
path = "lib/lib.rs"

[[bin]]
name = "_cat"
path = "cat.rs"
path = "bin/cat.rs"

[[bin]]
name = "_echo"
path = "echo.rs"
path = "bin/echo.rs"

[[bin]]
name = "_grep"
path = "grep.rs"
path = "bin/grep.rs"

[[bin]]
name = "_init"
path = "init.rs"
path = "bin/init.rs"

[[bin]]
name = "_initcode"
path = "initcode.rs"
path = "bin/initcode.rs"

[[bin]]
name = "_kill"
path = "kill.rs"
path = "bin/kill.rs"

[[bin]]
name = "_ln"
path = "ln.rs"
path = "bin/ln.rs"

[[bin]]
name = "_ls"
path = "ls.rs"
path = "bin/ls.rs"

[[bin]]
name = "_mkdir"
path = "mkdir.rs"
path = "bin/mkdir.rs"

[[bin]]
name = "_rm"
path = "rm.rs"
path = "bin/rm.rs"

[[bin]]
name = "_sh"
path = "sh.rs"
path = "bin/sh.rs"

[[bin]]
name = "_wc"
path = "wc.rs"
path = "bin/wc.rs"

[[bin]]
name = "_head"
path = "head.rs"
path = "bin/head.rs"

[dependencies]
libkernel = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c19aaf6

Please sign in to comment.