Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • redox-os/redoxer
  • bruceadams/redoxer
  • freewilll/redoxer
  • ssd/redoxer
  • andypython/redoxer
  • mattmadeofpasta/redoxer
  • TornaxO7/redoxer
  • regaast/redoxer
  • plimkilde/redoxer
  • AgostonSzepessy/redoxer
  • jD91mZM2/redoxer
  • bool_purist/redoxer
  • coolreader18/redoxer
  • tcrawford/redoxer
  • enygmator/redoxer
  • 4lDO2/redoxer
  • andrey.turkin/redoxer
17 results
Show changes
Commits on Source (156)
[target.aarch64-unknown-redox]
linker = "aarch64-unknown-redox-gcc"
rustflags = []
[target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc"
rustflags = []
.dockerignore
.git
.gitignore
Dockerfile
daemon
example
target
use flake
build
#Added by cargo
#
#already existing elements are commented out
/target
**/*.rs.bk
target
.direnv/
\ No newline at end of file
This diff is collapsed.
[package]
name = "redoxer"
version = "0.1.0"
authors = ["Jeremy Soller <jeremy@system76.com>"]
version = "0.2.51"
description = "Method for quickly running programs inside of Redox from a KVM capable OS."
license = "MIT"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
repository = "https://gitlab.redox-os.org/redox-os/redoxer"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
redox_syscall = "0.1"
redox_termios = "0.1"
dirs = "5.0.1"
redox_installer = "0.2.29"
redox_syscall = "0.5"
redoxfs = "0.6.8"
tempfile = "3.13.0"
toml = "0.5"
proc-mounts = "0.3.0"
FROM ubuntu:22.04
# Install dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -qq && \
apt-get install -y -qq \
build-essential \
curl \
expect \
fuse \
libfuse-dev \
pkg-config \
qemu-system-x86 \
rsync \
nasm
# Install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- --default-toolchain nightly -y
# Set path
ENV PATH=/root/.cargo/bin:$PATH
# Install redoxer
COPY . /root/redoxer
RUN cargo install --path /root/redoxer
# Install redoxer toolchain
RUN TARGET=x86_64-unknown-redox redoxer toolchain && \
TARGET=i686-unknown-redox redoxer toolchain
# Ensure redoxer exec is working
RUN redoxer exec true
Copyright (c) 2016 Redox OS Developers
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# redoxer
The tool used to build/run Rust programs (and C/C++ programs with zero dependencies) inside of a Redox VM, the Redox GitLab CI use a Docker image with `redoxer` pre-installed.
A pre-built Docker image can be found on [Docker Hub](https://hub.docker.com/r/redoxos/redoxer)
## Commands
- Install the tool
```sh
cargo install redoxer
```
- Install the Redox toolchain
```sh
redoxer toolchain
```
- Build the Rust program or library with Redoxer
```sh
redoxer build
```
- Run the Rust program on Redox
```sh
redoxer run
```
- Test the Rust program or library with Redoxer
```sh
redoxer test
```
- Run arbitrary executable (`echo hello`) with Redoxer
```sh
redoxer exec echo hello
```
[target.aarch64-unknown-redox.dependencies.std]
features = ["panic_unwind"]
[target.x86_64-unknown-redox.dependencies.std]
features = ["panic_unwind"]
#features = ["panic_unwind", "backtrace"]
#[dependencies.test]
#stage = 1
# This is the default configuration file
# General settings
[general]
# Do not prompt if settings are not defined
prompt = false
# Package settings
[packages]
#acid = {}
#audiod = {}
#autoconf = {}
#automake = {}
#bash = {}
#binutils = {}
ca-certificates = {}
#cairo = {}
#cairodemo = {}
#cargo = {}
#cleye = {}
#cmatrix = {}
#contain = {}
coreutils = {}
#cpal = {}
#curl = {}
#dash = {}
#diffutils = {}
#dosbox = {}
drivers = {}
#drivers-041 = {}
#duktape = {}
#eduke32 = {}
#exampled = {}
#expat = {}
extrautils = {}
#fd = {}
#ffmpeg = {}
findutils = {}
#freeciv = {}
#freedoom = {}
#freeglut = {}
#freetype = {}
#friar = {} # mio patch
#game-2048 = {}
#games = {}
#gawk = {}
#gcc = {}
#gears = {}
#generaluser-gs = {}
#gettext = {}
#gigalomania = {}
#git = {}
#glib = {}
#glium = {}
#glutin = {}
#gnu-binutils = {}
#gnu-grep = {}
#gnu-make = {}
#gstreamer = {}
#harfbuzz = {}
#hematite = {}
#init = {}
#installer = {}
#ion = {}
ipcd = {}
#jansson = {}
kernel = {}
#keyboard-sfx = {}
#lci = {}
#libc-bench = {}
#libffi = {}
#libiconv = {}
#libjpeg = {}
#liborbital = {}
#libpng = {}
#libsodium = {}
#llvm = {}
logd = {}
#lua = {}
#mdp = {}
#mesa = {}
#mesa_glu = {}
#miniserve = {}
#nasm = {}
#ncdu = {}
#ncurses = {}
#ncursesw = {}
netdb = {}
netstack = {}
#netsurf = {}
netutils = {}
#newlib = {}
#newlibtest = {}
nulld = {}
#openjazz = {}
#openssl = {}
#openttd = {}
#openttd-opengfx = {}
#openttd-openmsx = {}
#openttd-opensfx = {}
#orbdata = {}
#orbital = {}
#orbterm = {}
#orbutils = {}
#osdemo = {}
#pastel = {}
#patch = {}
#pcre = {}
#periodictable = {}
#perl = {}
#pixelcannon = {}
#pixman = {}
#pkgutils = {}
#powerline = {}
#prboom = {}
ptyd = {}
#python = {}
#qemu = {}
randd = {}
#readline = {} # ncurses
#redoxfs = {}
#redox-ssh = {}
#relibc = {}
#ripgrep = {}
#rodioplay = {}
#rs-nes = {}
#rust = {}
#rust64 = {}
#rust-cairo = {}
#rust-cairo-demo = {}
#rustual-boy = {}
#schismtracker = {}
#scummvm = {}
#sdl = {}
#sdl2 = {}
#sdl_gfx = {}
#sdl_image = {}
#sdl_mixer = {}
#sdl_ttf = {}
#sdl-player = {}
#sed = {}
#servo = {}
#shellstorm = {}
#smith = {}
#sodium = {}
#sopwith = {}
#ssh = {}
#syobonaction = {}
#terminfo = {}
#termplay = {}
#timidity = {}
#ttf-hack = {}
#userutils = {}
uutils = {}
#vim = {}
#vttest = {}
#webrender = {}
#winit = {}
#xz = {}
zerod = {}
#zlib = {}
# User settings
[users.root]
password = "password"
uid = 0
gid = 0
name = "root"
home = "/root"
[users.user]
# Password is unset
password = ""
[[files]]
path = "/etc/init.d/00_base"
data = """
nulld
zerod
randd
ipcd
logd
ptyd
# pcid /etc/pcid/filesystem.toml
"""
[[files]]
path = "/etc/init.d/10_net"
data = """
# smolnetd
# dnsd
# dhcpd
"""
[[files]]
path = "/etc/init.d/20_redoxer"
data = """
redoxerd
"""
[[files]]
path = "/etc/net/dns"
data = """
208.67.222.222
"""
[[files]]
path = "/etc/net/ip"
data = """
10.0.2.15
"""
[[files]]
path = "/etc/net/ip_router"
data = """
10.0.2.2
"""
[[files]]
path = "/etc/net/ip_subnet"
data = """
255.255.255.0
"""
[[files]]
path = "/etc/net/mac"
data = """
54-52-00-ab-cd-ef
"""
[[files]]
path = "/etc/group"
data = """
root;0;root
"""
[[files]]
path = "/etc/hostname"
data = """
redox
"""
[[files]]
path = "/usr/bin"
data = "/bin"
symlink = true
[[files]]
path = "/usr/games"
data = "/games"
symlink = true
[[files]]
path = "/usr/include"
data = "/include"
symlink = true
[[files]]
path = "/usr/lib"
data = "/lib"
symlink = true
[[files]]
path = "/usr/share"
data = "/share"
symlink = true
[[files]]
path = "/tmp"
data = ""
directory= true
# 0o1777
mode = 1023
[general]
prompt = false
[packages]
bootloader = {}
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_termios"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
dependencies = [
"redox_syscall 0.2.16",
]
[[package]]
name = "redoxerd"
version = "0.1.0"
dependencies = [
"redox_syscall 0.3.5",
"redox_termios",
]
[package]
name = "redoxerd"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
edition = "2018"
[dependencies]
redox_syscall = "0.3"
redox_termios = "0.1"
......@@ -14,22 +14,35 @@ fn syscall_error(error: syscall::Error) -> io::Error {
io::Error::from_raw_os_error(error.errno)
}
pub fn handle(event_file: &mut File, master_fd: RawFd, process: &mut Child) -> io::Result<ExitStatus> {
pub fn handle(event_file: &mut File, master_fd: RawFd, timeout_fd: RawFd, process: &mut Child) -> io::Result<ExitStatus> {
let handle_event = |event_id: RawFd| -> io::Result<bool> {
if event_id == master_fd {
let mut packet = [0; 4096];
loop {
// Read data from PTY master
let count = match syscall::read(master_fd as usize, &mut packet) {
Ok(0) => return Ok(false),
Ok(count) => count,
Err(ref err) if err.errno == syscall::EAGAIN => return Ok(true),
Err(err) => return Err(syscall_error(err)),
};
// Write data to stdout
syscall::write(1, &packet[1..count]).map_err(syscall_error)?;
for i in 1..count {
// Write byte to QEMU debugcon (Bochs compatible)
Pio::<u8>::new(0xe9).write(packet[i]);
}
}
} else if event_id == timeout_fd {
let mut timespec = syscall::TimeSpec::default();
syscall::read(timeout_fd as usize, &mut timespec).map_err(syscall_error)?;
timespec.tv_sec += 1;
syscall::write(timeout_fd as usize, &mut timespec).map_err(syscall_error)?;
Ok(true)
} else {
Err(io::Error::new(
io::ErrorKind::InvalidData,
......@@ -38,14 +51,8 @@ pub fn handle(event_file: &mut File, master_fd: RawFd, process: &mut Child) -> i
}
};
if handle_event(master_fd)? {
if handle_event(master_fd)? && handle_event(timeout_fd)? {
'events: loop {
let mut sys_event = syscall::Event::default();
event_file.read(&mut sys_event)?;
if ! handle_event(sys_event.id as RawFd)? {
break 'events;
}
match process.try_wait() {
Ok(status_opt) => match status_opt {
Some(status) => return Ok(status),
......@@ -56,6 +63,12 @@ pub fn handle(event_file: &mut File, master_fd: RawFd, process: &mut Child) -> i
_ => return Err(err),
}
}
let mut sys_event = syscall::Event::default();
event_file.read(&mut sys_event)?;
if ! handle_event(sys_event.id as RawFd)? {
break 'events;
}
}
}
......@@ -89,6 +102,9 @@ fn inner() -> io::Result<()> {
let (columns, lines) = (DEFAULT_COLS, DEFAULT_LINES);
let (master_fd, pty) = getpty(columns, lines)?;
let timeout_fd = syscall::open("time:4", syscall::O_CLOEXEC | syscall::O_RDWR | syscall::O_NONBLOCK)
.map_err(syscall_error)? as RawFd;
let mut event_file = OpenOptions::new()
.read(true)
.write(true)
......@@ -100,6 +116,12 @@ fn inner() -> io::Result<()> {
data: 0
})?;
event_file.write(&syscall::Event {
id: timeout_fd as usize,
flags: syscall::flag::EVENT_READ,
data: 0
})?;
let slave_stdin = OpenOptions::new().read(true).open(&pty)?;
let slave_stdout = OpenOptions::new().write(true).open(&pty)?;
let slave_stderr = OpenOptions::new().write(true).open(&pty)?;
......@@ -121,7 +143,7 @@ fn inner() -> io::Result<()> {
}
let mut process = command.spawn()?;
let status = handle(&mut event_file, master_fd, &mut process)?;
let status = handle(&mut event_file, master_fd, timeout_fd, &mut process)?;
if status.success() {
Ok(())
} else {
......@@ -143,11 +165,12 @@ pub fn main() {
Ok(()) => {
// Exit with success using qemu device
Pio::<u16>::new(0x604).write(0x2000);
Pio::<u8>::new(0x501).write(51 / 2);
},
Err(err) => {
eprintln!("redoxerd: {}", err);
// Exit with error using qemu device
Pio::<u8>::new(0x501).write(1);
Pio::<u8>::new(0x501).write(53 / 2);
}
}
}
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "example"
version = "0.1.0"
[package]
name = "example"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
edition = "2018"
[dependencies]
#!/usr/bin/env bash
set -e
redoxer_manifest="$(realpath ../Cargo.toml)"
function redoxer {
cargo run --release --manifest-path "${redoxer_manifest}" -- "$@"
}
redoxer "$@"
fn main() {
println!("Hello, world!");
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1702312524,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"systems": "systems_2"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1702779466,
"narHash": "sha256-IZeGwmm5n6bn+f4aEwMdbzFsJaa219efYZass7pdNdg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d74fd31da8994c7e60850561a64379324c1c77dd",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
}
},
"root": "root",
"version": 7
}