Skip to content

Commit

Permalink
milestone: 0529-with-gnu-host
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiger3018 committed May 30, 2023
1 parent 918551d commit b60406b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/docker-existing-dockerfile
{
"name": "oskernel Dev Image",
"image": "tiger3018/oskernel-dev:0529-with-gnu-host",

// Sets the run context to one level up instead of the .devcontainer folder.
// "context": "..",

// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
// "dockerFile": "../Dockerfile"

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "containerUser": "vscode",
// "postStartCommand": "useradd -s /usr/bin/zsh vscode",
"extensions": [
"rust-lang.rust-analyzer"
]
}
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN mkdir /root/bpkg-ws && cd /root/bpkg-ws \
FROM debian:bullseye-slim
RUN echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install curl ca-certificates make patch perl file gdb-multiarch binutils binutils-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-system-misc zsh git --no-install-recommends -y \
&& apt-get install curl ca-certificates make patch perl file gdb-multiarch binutils binutils-riscv64-linux-gnu g++ g++-riscv64-linux-gnu qemu-system-misc zsh git --no-install-recommends -y \
&& apt-get install qemu-system-misc/bullseye-backports --no-install-recommends -y \
&& apt-get autoremove -y \
&& apt-get clean \
Expand All @@ -40,9 +40,14 @@ RUN mkdir /root/.build2 \
&& echo "#!config.import.build2 = /root/.local/share/doc/build2/" >> /root/.build2/b.options \
&& echo "#!config.c = gcc-10" >> /root/.build2/b.options \
&& echo "#!config.cxx = g++-10" >> /root/.build2/b.options \
&& echo "#!config.cxx.id = gcc" >> /root/.build2/b.options
&& echo "#!config.cxx.id = gcc" >> /root/.build2/b.options \
&& sed -i "s#clang++-13#g++#" /root/bpkg-ws/build/config.build \
&& sed -i "s#clang++-13#g++#" /root/bpkg-ws/*/build/config.build
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \
&& echo -e "zstyle ':omz:update' mode disabled\nsetopt autocd\nsetopt correct\nsetopt interactivecomments\nsetopt magicequalsubst\nsetopt numericglobsort\nsetopt promptsubst" && cat /root/.zshrc | tee /root/.zshrc \
&& sed -i "s#plugins=(git)#plugins=(git git-escape-magic command-not-found history history-substring-search isodate scd shell-proxy z)#" /root/.zshrc

ENV RUSTUP_UPDATE_ROOT=https://mirrors.nju.edu.cn/rustup
ENV RUSTUP_UPDATE_ROOT=https://mirrors.nju.edu.cn/rustup
# RUN useradd -s /usr/bin/zsh -d /root user \
# && chmod ugo+rw -R /root
# USER user
10 changes: 5 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# See <https://seisman.github.io/how-to-write-makefile/introduction.html>
# See <https://github.com/rust-lang/rfcs/pull/940>
BINARY_CRATE_NAME = $(shell grep exe buildfile | awk -F'[{}]' '{print $$2}')
BINARY_NAME = kernel-qemu
BINARY_NAME := kernel-qemu
#BUILD2_PATH = /root/.local/bin/
#BUILD2_NAME = b
OSCOMP_SD_CARD_IMG = sdcard.img
OSCOMP_SD_CARD_IMG := sdcard.img
RUST_CRATE_MAIN = $(shell grep exe buildfile | awk -F'[{}]' '{print $$(NF -1)}').rs
RUSTC_EDITION = $(shell grep edition buildfile | awk -F' ' '{print $$(NF +0)}')
RUSTC_DEF = RUSTC_BOOTSTRAP=1
Expand All @@ -27,7 +27,7 @@ hyphen-move:

qemu:
qemu-system-riscv64 -nographic -machine virt \
-kernel $(BINARY_NAME) -m 128M -smp 2 \
-drive file=$(OSCOMP_SD_CARD_IMG),if=none,format=raw,id=x0 \
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
-kernel $(BINARY_NAME) -m 128M -smp 2
# -drive file=$(OSCOMP_SD_CARD_IMG),if=none,format=raw,id=x0 \
# -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
# -kernel $(BINARY_NAME) -append "root=/dev/vda ro console=ttyS0"
7 changes: 7 additions & 0 deletions rust-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"crates": [{
"root_module": "hello.rs",
"edition": "2021",
"deps": []
}]
}

0 comments on commit b60406b

Please sign in to comment.