diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..101d23b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,97 @@ +# https://docs.docker.com/reference/dockerfile/#overview +# https://docs.docker.com/build/building/best-practices/ + +FROM ubuntu:22.04 + +LABEL Name=oslab \ + Version=0.0.1 + +ENV HOSTNAME=docker-oslab + +RUN apt-get -y update && apt install -y \ + build-essential \ + bison \ + flex \ + libgmp3-dev \ + libmpc-dev \ + libmpfr-dev \ + texinfo \ + libisl-dev \ + wget \ + make \ + libncurses-dev \ + xorg-dev \ + glew-utils \ + unzip \ + x11-utils \ + x11-common \ + qemu-system-i386 \ + nasm \ + git \ + gdb \ + dos2unix \ + netcat-traditional \ + binutils \ + gcc + +# RUN wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.xz +# RUN wget https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz +# RUN wget https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip + +# RUN tar -xf binutils-2.43.tar.xz +# RUN tar -xf gcc-14.2.0.tar.xz + +# RUN mkdir build-binutils && \ +# cd build-binutils && \ +# ../binutils-2.43/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror &&\ +# make && \ +# make install + +# RUN mkdir build-gcc && \ +# cd build-gcc && \ +# ../gcc-14.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --disable-multilib && \ +# make all-gcc && \ +# make all-target-libgcc && \ +# make install-gcc && \ +# make install-target-libgcc + +RUN wget https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip && \ + unzip REL_2_8_FINAL.zip -d /tmp && \ + rm -rf REL_2_8_FINAL.zip + +# Comment these lines, cause unzip doesn't support reading from stdin. +# while busybox unzip does +# ## The single '-' in wget means write to stdout +# ## The single '-' in unzip means read from stdin +# ## /bin/sh doesn't support pipefail +# SHELL ["/bin/bash", "-c"] +# RUN set -o pipefail && \ +# wget --quiet -O - https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip | \ +# unzip - -d /tmp + +WORKDIR /tmp/Bochs-REL_2_8_FINAL/bochs + +RUN ./configure \ + --build=x86_64 \ + --host=x86_64 \ + --target=x86_64 \ + --enable-cpu-level=6 \ + --enable-pci \ + --enable-gdb-stub \ + --enable-logging \ + --enable-fpu \ + --enable-sb16=dummy \ + --enable-cdrom \ + --enable-x86-debugger \ + --enable-iodebug \ + --disable-docbook \ + --with-x11 + +RUN make && make install + +# if we don't change the workdir, we cannot remove /tmp/Bochs-REL_2_8_FINAL +WORKDIR / +RUN rm -rf /tmp/Bochs-REL_2_8_FINAL + +CMD ["/bin/bash", "-c"] +# CMD ["sh", "-c", "/usr/games/fortune -a | cowsay"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fc2478f..19d4b87 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,53 +1,58 @@ -// // For format details, see https://aka.ms/devcontainer.json. For config options, see the -// // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu -// { -// "name": "Ubuntu", -// // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile -// "image": "mcr.microsoft.com/devcontainers/base:jammy", -// "features": { -// "ghcr.io/devcontainers/features/git-lfs:1": {}, -// "ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {} -// } - -// // Features to add to the dev container. More info: https://containers.dev/features. -// // "features": {}, - -// // Use 'forwardPorts' to make a list of ports inside the container available locally. -// // "forwardPorts": [], - -// // Use 'postCreateCommand' to run commands after the container is created. -// // "postCreateCommand": "uname -a", - -// // Configure tool-specific properties. -// // "customizations": {}, - -// // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. -// // "remoteUser": "root" -// } - -{ - "name": "Local Dockerfile", - "build": { - "context": "..", - "dockerfile": "../Dockerfile" - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools", - "mateuszchudyk.hexinspector", - "DavidAnson.vscode-markdownlint", - "doinkythederp.nasm-language-support", - "jack89ita.open-file-from-path", - "mcu-debug.memory-view", - "NateAGeek.memory-viewer", - "mcu-debug.debug-tracker-vscode", - "ms-vscode.hexeditor", - "iliazeus.vscode-ansi", - // "cschlosser.doxdocgen", - "ms-vscode.makefile-tools" - ] - } - }, - "runArgs": ["--privileged", "-e", "DISPLAY=host.docker.internal:0.0"] -} +// // For format details, see https://aka.ms/devcontainer.json. For config options, see the +// // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +// { +// "name": "Ubuntu", +// // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile +// "image": "mcr.microsoft.com/devcontainers/base:jammy", +// "features": { +// "ghcr.io/devcontainers/features/git-lfs:1": {}, +// "ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {} +// } + +// // Features to add to the dev container. More info: https://containers.dev/features. +// // "features": {}, + +// // Use 'forwardPorts' to make a list of ports inside the container available locally. +// // "forwardPorts": [], + +// // Use 'postCreateCommand' to run commands after the container is created. +// // "postCreateCommand": "uname -a", + +// // Configure tool-specific properties. +// // "customizations": {}, + +// // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. +// // "remoteUser": "root" +// } + +{ + "name": "Local Dockerfile", + "build": { + "context": "..", + "dockerfile": "Dockerfile", + "args": { + "HTTP_PROXY": "http://host.docker.internal:3128", + "HTTPS_PROXY": "http://host.docker.internal:3128", + "NO_PROXY": "localhost,127.0.0.1" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "mateuszchudyk.hexinspector", + "DavidAnson.vscode-markdownlint", + "doinkythederp.nasm-language-support", + "jack89ita.open-file-from-path", + "mcu-debug.memory-view", + "NateAGeek.memory-viewer", + "mcu-debug.debug-tracker-vscode", + "ms-vscode.hexeditor", + "iliazeus.vscode-ansi", + // "cschlosser.doxdocgen", + "ms-vscode.makefile-tools" + ] + } + }, + "runArgs": ["--privileged", "-e", "DISPLAY=host.docker.internal:0.0"] +} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 27b83d3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -FROM docker/ubuntu:latest -LABEL Name=oslab Version=0.0.1 - - -RUN apt-get -y update && apt install -y build-essential bison flex libgmp3-dev \ - libmpc-dev libmpfr-dev texinfo libisl-dev wget make \ - libncurses-dev xorg-dev glew-utils unzip x11-utils x11-common \ - qemu-system-i386 nasm git gdb dos2unix netcat-traditional - -RUN wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.xz -RUN wget https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz -RUN wget https://github.com/bochs-emu/Bochs/archive/refs/tags/REL_2_8_FINAL.zip - -RUN tar -xf binutils-2.43.tar.xz -RUN tar -xf gcc-14.2.0.tar.xz - -RUN mkdir build-binutils && \ - cd build-binutils && \ - ../binutils-2.43/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror &&\ - make && \ - make install - -RUN mkdir build-gcc &&\ - cd build-gcc && \ - ../gcc-14.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers && \ - make all-gcc && \ - make all-target-libgcc && \ - make install-gcc && \ - make install-target-libgcc - -RUN unzip REL_2_8_FINAL.zip -WORKDIR /tmp/Bochs-REL_2_8_FINAL/bochs - -RUN ./configure \ - --build=x86_64 \ - --host=x86_64 \ - --target=x86_64 \ - --enable-cpu-level=6 \ - --enable-pci \ - --enable-gdb-stub \ - --enable-logging \ - --enable-fpu \ - --enable-sb16=dummy \ - --enable-cdrom \ - --enable-x86-debugger \ - --enable-iodebug \ - --disable-docbook \ - --with-x11 - -RUN make -RUN make install - -RUN rm -rf /tmp -# CMD ["sh", "-c", "/usr/games/fortune -a | cowsay"]