add hello-world binary

This commit is contained in:
Ryan Heywood 2025-07-12 14:25:17 -04:00
parent b14e4260b2
commit 42d499e76a
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
14 changed files with 55 additions and 15 deletions

8
Cargo.lock generated
View File

@ -2,11 +2,15 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "hello"
version = "0.1.0"
[[package]]
name = "libc"
version = "0.2.172"
version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "nit"

View File

@ -1,12 +1,6 @@
[package]
name = "nit"
version = "0.1.0"
edition = "2024"
license = "MIT"
[features]
aws = []
default = ["aws"]
[dependencies]
libc = "0.2.172"
[workspace]
resolver = "2"
members = [
"crates/nit",
"crates/hello",
]

View File

@ -21,6 +21,7 @@ WORKDIR /src
RUN cargo build ${CARGOFLAGS}
WORKDIR /build_cpio
RUN cp /src/target/${TARGET}/release/nit init
RUN cp /src/target/${TARGET}/release/hello hello
ENV KBUILD_BUILD_TIMESTAMP=1
COPY <<-EOF initramfs.list
file /init init 0755 0 0
@ -33,6 +34,7 @@ COPY <<-EOF initramfs.list
dir /sys 0755 0 0
dir /usr 0755 0 0
dir /usr/bin 0755 0 0
file /usr/bin/hello hello 0755 0 0
dir /usr/sbin 0755 0 0
dir /dev 0755 0 0
dir /dev/shm 0755 0 0

6
crates/hello/Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2024"
[dependencies]

6
crates/hello/src/main.rs Normal file
View File

@ -0,0 +1,6 @@
fn main() {
println!("Hello, world!");
loop {
std::thread::sleep(std::time::Duration::from_secs(5));
}
}

16
crates/nit/Cargo.lock generated Normal file
View File

@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "libc"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "nit"
version = "0.1.0"
dependencies = [
"libc",
]

12
crates/nit/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "nit"
version = "0.1.0"
edition = "2024"
license = "MIT"
[features]
aws = []
default = ["aws"]
[dependencies]
libc = "0.2.172"

View File

@ -39,7 +39,7 @@ pub fn get_config() -> Result<Config> {
let platform = platform::get_current_platform(values.remove("platform").as_deref())?;
let target = values.remove("target").unwrap_or(String::from("/bin/sh"));
let target = values.remove("target").unwrap_or(String::from("/usr/bin/hello"));
Ok(Config { platform, mode, target })
}