From d34fb38d70495188f3894c12954782e7d5d5d0ce Mon Sep 17 00:00:00 2001 From: xonmello Date: Sat, 8 Jul 2023 20:10:08 -0500 Subject: [PATCH 1/2] Update dockerfile to build Can be run with the commands: docker build -t liberty . docker run -v $(pwd):/mnt -ti liberty Signed-off-by: Nicholas Mello --- Dockerfile | 30 +++++++++++++++--------------- rust-toolchain.toml | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index a358693..694e49e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,22 @@ -# podman build -t los:latest -f Dockerfile . +FROM rust:1.55-alpine as builder -#FROM rust:1.57-alpine -FROM rust:alpine +run apk add --no-cache musl-dev bash -RUN apk add --no-cache musl-dev +RUN adduser --disabled-password --gecos "" liberty +USER liberty +WORKDIR /home/liberty +COPY . . RUN rustup target add x86_64-unknown-linux-gnu -RUN rustup default nightly -RUN rustup component add \ - rust-src \ - llvm-tools-preview +RUN rustup component add rust-src +RUN rustup component add llvm-tools-preview RUN cargo install bootimage +RUN rustup default nightly +RUN rustup update nightly -# bring in the code from your git clone -COPY . . -# put the image in a known location -RUN cargo install --debug --root /usr/local --path . +RUN cargo build + +RUN touch copy.sh +RUN echo -e "#!/bin/sh\ncp -r ./target/* /mnt/target" > copy.sh -# A container must be created before extracting the kernel. -# los=$(podman create --name mylos los:latest) -# podman cp $los:/usr/local/bin/libertyos_kernel . +CMD ["/bin/sh", "/home/liberty/copy.sh"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fd541b4..23aeb78 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2022-01-07" +channel = "nightly-2023-01-07" components = [ "rust-src", "clippy", "rustfmt", "rustc", "rust-std", "llvm-tools-preview" ] targets = [ "x86_64-unknown-linux-gnu" ] From 6f5bb3751b9a58535991ccbec28a033f84b4f052 Mon Sep 17 00:00:00 2001 From: xonmello Date: Sun, 9 Jul 2023 14:02:01 -0500 Subject: [PATCH 2/2] Fix warnings and optimize Fixed the warnings about features being sable Moved the copy of files lower down in the script so less is needed on rerun Signed-off-by: Nicholas Mello --- Cargo.lock | 2 +- Dockerfile | 3 ++- src/lib.rs | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 480d3f0..82b03c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "libertyos_kernel" -version = "0.16.0" +version = "0.17.0" dependencies = [ "acpi", "aml", diff --git a/Dockerfile b/Dockerfile index 694e49e..df024c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ run apk add --no-cache musl-dev bash RUN adduser --disabled-password --gecos "" liberty USER liberty WORKDIR /home/liberty -COPY . . +COPY rust-toolchain.toml . RUN rustup target add x86_64-unknown-linux-gnu RUN rustup component add rust-src @@ -14,6 +14,7 @@ RUN cargo install bootimage RUN rustup default nightly RUN rustup update nightly +COPY . . RUN cargo build RUN touch copy.sh diff --git a/src/lib.rs b/src/lib.rs index 2ac86e2..086d887 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,8 +6,6 @@ #![allow(unused_variables)] #![feature(abi_x86_interrupt)] #![feature(alloc_error_handler)] -#![feature(asm_sym)] -#![feature(const_fn_fn_ptr_basics)] #![feature(const_mut_refs)] #![feature(core_intrinsics)] #![feature(custom_test_frameworks)]