parent
0a9c294814
commit
84e1f148c2
@ -1 +0,0 @@
|
|||||||
PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[1;35m\]<$IMAGE_NAME>\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
|
|
@ -1,40 +0,0 @@
|
|||||||
FROM rustlang/rust:nightly
|
|
||||||
|
|
||||||
ENV IMAGE_NAME=blog_os-docker
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -q -y --no-install-recommends \
|
|
||||||
nasm \
|
|
||||||
binutils \
|
|
||||||
grub-common \
|
|
||||||
xorriso \
|
|
||||||
grub-pc-bin && \
|
|
||||||
apt-get autoremove -q -y && \
|
|
||||||
apt-get clean -q -y && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
|
||||||
cargo install xargo && \
|
|
||||||
rustup component add rust-src
|
|
||||||
|
|
||||||
ENV GOSU_VERSION 1.10
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
fetchDeps=' \
|
|
||||||
ca-certificates \
|
|
||||||
wget \
|
|
||||||
'; \
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
|
||||||
\
|
|
||||||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
|
|
||||||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
|
|
||||||
chmod +x /usr/local/bin/gosu; \
|
|
||||||
# verify that the binary works
|
|
||||||
gosu nobody true;
|
|
||||||
|
|
||||||
COPY entrypoint.sh /usr/local/bin/
|
|
||||||
COPY .bash_aliases /etc/skel/
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
||||||
CMD ["/bin/bash"]
|
|
@ -1,18 +0,0 @@
|
|||||||
# Building Blog OS using Docker
|
|
||||||
Inspired by [redox].
|
|
||||||
You just need `git`, `make`, and `docker`.
|
|
||||||
It is beter to use a non-privileged user to run the `docker` command, which is usually achieved by adding the user to the `docker` group.
|
|
||||||
|
|
||||||
## Run the container to build Blog OS
|
|
||||||
You can build the docker image using `make docker_build` and run it using `make docker_run`.
|
|
||||||
|
|
||||||
## Run the container interactively
|
|
||||||
You can use the `make` target `docker_interactive` to get a shell in the container.
|
|
||||||
|
|
||||||
## Clear the toolchain caches (Cargo & Rustup)
|
|
||||||
To clean the docker volumes used by the toolchain, you just need to run `make docker_clean`.
|
|
||||||
|
|
||||||
[redox]: https://github.com/redox-os/redox
|
|
||||||
|
|
||||||
## License
|
|
||||||
The source code is dual-licensed under MIT or the Apache License (Version 2.0). This excludes the `blog` directory.
|
|
@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
USER_NAME=blogos
|
|
||||||
USER_UID=${LOCAL_UID:-9001}
|
|
||||||
USER_GID=${LOCAL_GID:-9001}
|
|
||||||
|
|
||||||
groupadd --non-unique --gid $USER_GID $USER_NAME
|
|
||||||
useradd --non-unique --create-home --uid $USER_UID --gid $USER_GID $USER_NAME
|
|
||||||
|
|
||||||
export HOME=/home/$USER_NAME
|
|
||||||
|
|
||||||
TESTFILE=$RUSTUP_HOME/settings.toml
|
|
||||||
CACHED_UID=$(stat -c "%u" $TESTFILE)
|
|
||||||
CACHED_GID=$(stat -c "%g" $TESTFILE)
|
|
||||||
|
|
||||||
if [ $CACHED_UID != $USER_UID ] || [ $USER_GID != $CACHED_GID ]; then
|
|
||||||
chown $USER_UID:$USER_GID -R $CARGO_HOME $RUSTUP_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec gosu $USER_NAME "$@"
|
|
@ -1,16 +0,0 @@
|
|||||||
# MacOS environment
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
brew tap altkatz/homebrew-gcc_cross_compilers
|
|
||||||
brew install x64-elf-gcc
|
|
||||||
```
|
|
||||||
|
|
||||||
* x86_64_elf_*:
|
|
||||||
<https://github.com/altkatz/homebrew-gcc_cross_compilers>
|
|
||||||
|
|
||||||
* grub.rb:
|
|
||||||
<https://github.com/nativeos/homebrew-i386-elf-toolchain/blob/master/Formula/i386-elf-grub.rb>
|
|
||||||
|
|
||||||
* objconv.rb:
|
|
||||||
<https://github.com/hawkw/homebrew-grub/blob/master/Formula/objconv.rb>
|
|
||||||
Change SHA256
|
|
@ -1,31 +0,0 @@
|
|||||||
class Grub < Formula
|
|
||||||
desc "GNU GRUB 2 targetting i386-elf"
|
|
||||||
homepage "https://www.gnu.org/software/grub/"
|
|
||||||
url "https://ftp.gnu.org/gnu/grub/grub-2.02.tar.xz"
|
|
||||||
version "2.02"
|
|
||||||
sha256 "810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f"
|
|
||||||
|
|
||||||
depends_on "i386-elf-gcc"
|
|
||||||
|
|
||||||
def install
|
|
||||||
mkdir "grub-build" do
|
|
||||||
system "../configure",
|
|
||||||
"--disable-nls",
|
|
||||||
"--disable-werror",
|
|
||||||
"--disable-efiemu",
|
|
||||||
"--target=i386-elf",
|
|
||||||
"--prefix=#{prefix}",
|
|
||||||
"TARGET_CC=i386-elf-gcc",
|
|
||||||
"TARGET_NM=i386-elf-nm",
|
|
||||||
"TARGET_OBJCOPY=i386-elf-objcopy",
|
|
||||||
"TARGET_RANLIB=i386-elf-ranlib",
|
|
||||||
"TARGET_STRIP=i386-elf-strip"
|
|
||||||
|
|
||||||
system "make", "install"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test do
|
|
||||||
system "grub-shell", "--version"
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,23 +0,0 @@
|
|||||||
class Objconv < Formula
|
|
||||||
desc "Object file converter and disassembler"
|
|
||||||
homepage "http://www.agner.org/optimize/#objconv"
|
|
||||||
url "http://www.agner.org/optimize/objconv.zip"
|
|
||||||
version "2.44"
|
|
||||||
sha256 "f2c0c4cd6ff227e76ffed5796953cd9ae9eb228847ca9a14dba6392c573bb7a4"
|
|
||||||
def install
|
|
||||||
system "unzip", "source.zip",
|
|
||||||
"-dsrc"
|
|
||||||
# objconv doesn't have a Makefile, so we have to call
|
|
||||||
# the C++ compiler ourselves
|
|
||||||
system ENV.cxx, "-o", "objconv",
|
|
||||||
"-O2",
|
|
||||||
*Dir["src/*.cpp"],
|
|
||||||
"--prefix=#{prefix}"
|
|
||||||
bin.install "objconv"
|
|
||||||
end
|
|
||||||
|
|
||||||
test do
|
|
||||||
system "#{bin}/objconv", "-h"
|
|
||||||
# TODO: write better tests
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,38 +0,0 @@
|
|||||||
# Environment for RustOS-RISCV
|
|
||||||
|
|
||||||
# NOT ubuntu 18.04: libmpfr.so.4 error
|
|
||||||
FROM ubuntu:17.10
|
|
||||||
|
|
||||||
WORKDIR /rust
|
|
||||||
|
|
||||||
# Rust toolchain bins
|
|
||||||
# https://github.com/riscv-rust/rust/releases/download/riscv-rust-1.26.0-1-dev/rust-1.26.0-dev-x86_64-unknown-linux-gnu.tar.xz
|
|
||||||
ADD rust-1.26.0-dev-x86_64-unknown-linux-gnu.tar.xz .
|
|
||||||
|
|
||||||
# Rust src
|
|
||||||
# https://github.com/riscv-rust/rust/archive/riscv-rust-1.26.0-1-dev.zip
|
|
||||||
# with submodule: libcompiler_builtins, stdsimd
|
|
||||||
ADD rust-riscv-rust-1.26.0-1-dev.tar.gz .
|
|
||||||
|
|
||||||
# RISCV32 toolchain
|
|
||||||
# From tencent cloud for OS2018: ssh 2015011279@140.143.187.14
|
|
||||||
ADD rv32-toolchains-prebuild.tar.bz2 .
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
RUN apt-get update && apt-get install -q -y --no-install-recommends libssl1.0.0 libssh2-1 gcc make git libc6-dev \
|
|
||||||
autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
|
|
||||||
# Rust bins need this
|
|
||||||
RUN mkdir -p /gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/lib \
|
|
||||||
&& ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/lib/ld-linux-x86-64.so.2
|
|
||||||
# Install Rust toolchains
|
|
||||||
RUN ./rust-1.26.0-dev-x86_64-unknown-linux-gnu/install.sh && rm -rf ./rust-1.26.0-dev-x86_64-unknown-linux-gnu
|
|
||||||
# Install xargo
|
|
||||||
RUN apt-get install -q -y ca-certificates
|
|
||||||
RUN cargo install xargo
|
|
||||||
# Dependencies for qemu-system-riscv32
|
|
||||||
RUN apt-get install -q -y libglib2.0-0 libjpeg8 libpng16-16 libnuma1 libpixman-1-0 libaio1
|
|
||||||
# Env
|
|
||||||
ENV RISCV=/rust/install-rv32
|
|
||||||
ENV PATH=~/.cargo/bin:$RISCV/bin:$PATH
|
|
||||||
ENV XARGO_RUST_SRC=/rust/rust-riscv-rust-1.26.0-1-dev/src
|
|
||||||
RUN ln -s ~/.cargo/bin/xargo /usr/local/bin/xargo
|
|
Loading…
Reference in new issue