From 92cbab57eaaf3736b27bdba8d2fbc6fa7dc5f7ba Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Fri, 25 Aug 2023 00:50:03 -0700 Subject: [PATCH 1/6] Revert --- Dockerfile | 2 +- manifests/site.pp | 2 +- modules/cs162/templates/shell/bashrc | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 99c065c..9747179 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:22.04 as src -RUN useradd --create-home --home-dir /vagrant --user-group vagrant +RUN useradd --create-home --home-dir /home/vagrant --user-group vagrant RUN echo vagrant:vagrant | chpasswd RUN echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN apt -y update && apt -y install puppet diff --git a/manifests/site.pp b/manifests/site.pp index 724df36..4eb7a2d 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -11,7 +11,7 @@ ] } - $home = "/vagrant" + $home = "/home/vagrant" # Configure apt diff --git a/modules/cs162/templates/shell/bashrc b/modules/cs162/templates/shell/bashrc index c1602b2..1742c92 100644 --- a/modules/cs162/templates/shell/bashrc +++ b/modules/cs162/templates/shell/bashrc @@ -142,4 +142,3 @@ fi . ~/.cs162.bashrc [ -f ~/.fzf.bash ] && source ~/.fzf.bash -cd ~ From fe5f6cdd056ca5f0af2574eea0ce117b237720ac Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Fri, 25 Aug 2023 00:53:12 -0700 Subject: [PATCH 2/6] Remove i386 --- manifests/site.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/site.pp b/manifests/site.pp index 4eb7a2d..973315a 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -126,7 +126,7 @@ } -> # Set up some project support stuff - class { ["cs162::bochs", "cs162::golang", "cs162::shell", "cs162::rustlang", "cs162::i386_gcc"]: + class { ["cs162::bochs", "cs162::golang", "cs162::shell", "cs162::rustlang"]: home_directory => $home, owner => vagrant, group => vagrant, From 6f2598bb866299a34f223c3104c2a458e62ce6c9 Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Fri, 25 Aug 2023 01:57:27 -0700 Subject: [PATCH 3/6] Add file --- manifests/site.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/site.pp b/manifests/site.pp index 973315a..558fb50 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -79,6 +79,7 @@ "fzf", "openssh-server", "man", + "file", ]: ensure => installed; [ From 095a3f35a4247fbf4dc6cc9c92014f72f122d2c5 Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Sat, 26 Aug 2023 00:06:33 -0700 Subject: [PATCH 4/6] Fix m1 issues --- Dockerfile.workspace | 2 ++ manifests/site.pp | 4 ++- modules/cs162/files/shell/bin/backtrace | 2 +- modules/cs162/files/shell/bin/i386-cgdb | 4 +++ modules/cs162/files/shell/bin/i386-exec | 3 ++ modules/cs162/files/shell/bin/i386-gcc | 3 ++ modules/cs162/files/shell/bin/i386-gdb | 4 +++ modules/cs162/files/shell/bin/i386-objdump | 3 ++ modules/cs162/manifests/i386_gcc.pp | 23 --------------- modules/cs162/templates/i386-gcc/install.sh | 32 --------------------- modules/cs162/templates/shell/bashrc | 1 - 11 files changed, 23 insertions(+), 58 deletions(-) create mode 100755 modules/cs162/files/shell/bin/i386-cgdb create mode 100755 modules/cs162/files/shell/bin/i386-exec create mode 100755 modules/cs162/files/shell/bin/i386-gcc create mode 100755 modules/cs162/files/shell/bin/i386-gdb create mode 100755 modules/cs162/files/shell/bin/i386-objdump delete mode 100644 modules/cs162/manifests/i386_gcc.pp delete mode 100755 modules/cs162/templates/i386-gcc/install.sh diff --git a/Dockerfile.workspace b/Dockerfile.workspace index 132ebd7..541cf85 100644 --- a/Dockerfile.workspace +++ b/Dockerfile.workspace @@ -21,6 +21,8 @@ RUN echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/hom FROM ubuntu:22.04 +RUN yes | unminimize + COPY --from=puppet . . RUN usermod -d /home/vagrant vagrant diff --git a/manifests/site.pp b/manifests/site.pp index 558fb50..a5c92ee 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -11,7 +11,7 @@ ] } - $home = "/home/vagrant" + $home = "/vagrant" # Configure apt @@ -80,6 +80,8 @@ "openssh-server", "man", "file", + "gcc-i686-linux-gnu", + "qemu-user", ]: ensure => installed; [ diff --git a/modules/cs162/files/shell/bin/backtrace b/modules/cs162/files/shell/bin/backtrace index 1151f30..4d61f5c 100755 --- a/modules/cs162/files/shell/bin/backtrace +++ b/modules/cs162/files/shell/bin/backtrace @@ -48,7 +48,7 @@ if (!@binaries) { } # Find addr2line. -my ($a2l) = search_path ("i386-elf-addr2line") || search_path ("addr2line"); +my ($a2l) = search_path ("i386-elf-addr2line") || search_path ("i686-linux-gnu-addr2line") || search_path ("addr2line"); if (!$a2l) { die "backtrace: neither `i386-elf-addr2line' nor `addr2line' in PATH\n"; } diff --git a/modules/cs162/files/shell/bin/i386-cgdb b/modules/cs162/files/shell/bin/i386-cgdb new file mode 100755 index 0000000..115833f --- /dev/null +++ b/modules/cs162/files/shell/bin/i386-cgdb @@ -0,0 +1,4 @@ +#!/usr/bin/bash + +i386-exec -g 16200 "$1" &\ +cgdb -d gdb-multiarch -ex "file $1" -ex "target remote localhost:16200" \ No newline at end of file diff --git a/modules/cs162/files/shell/bin/i386-exec b/modules/cs162/files/shell/bin/i386-exec new file mode 100755 index 0000000..edda5c1 --- /dev/null +++ b/modules/cs162/files/shell/bin/i386-exec @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +qemu-i386 -L /usr/i686-linux-gnu "$@" \ No newline at end of file diff --git a/modules/cs162/files/shell/bin/i386-gcc b/modules/cs162/files/shell/bin/i386-gcc new file mode 100755 index 0000000..993c3bb --- /dev/null +++ b/modules/cs162/files/shell/bin/i386-gcc @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +i686-linux-gnu-gcc -m32 "$@" \ No newline at end of file diff --git a/modules/cs162/files/shell/bin/i386-gdb b/modules/cs162/files/shell/bin/i386-gdb new file mode 100755 index 0000000..675e2d0 --- /dev/null +++ b/modules/cs162/files/shell/bin/i386-gdb @@ -0,0 +1,4 @@ +#!/usr/bin/bash + +i386-exec -g 16200 "$1" &\ +gdb-multiarch -ex "file $1" -ex "target remote localhost:16200" \ No newline at end of file diff --git a/modules/cs162/files/shell/bin/i386-objdump b/modules/cs162/files/shell/bin/i386-objdump new file mode 100755 index 0000000..5c6e4f7 --- /dev/null +++ b/modules/cs162/files/shell/bin/i386-objdump @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +i686-linux-gnu-objdump -mi386 "$@" \ No newline at end of file diff --git a/modules/cs162/manifests/i386_gcc.pp b/modules/cs162/manifests/i386_gcc.pp deleted file mode 100644 index aacf1d5..0000000 --- a/modules/cs162/manifests/i386_gcc.pp +++ /dev/null @@ -1,23 +0,0 @@ -class cs162::i386_gcc($home_directory, $owner, $group) { - - $install_script = "$home_directory/.i386-gcc.install.sh" - - Package<| |> - -> - file { $install_script: - ensure => present, - owner => $owner, - group => $group, - mode => "0755", - content => template("cs162/i386-gcc/install.sh"), - } - -> - exec { "install i386 GCC from source": - cwd => $home_directory, - user => $owner, - command => $install_script, - creates => "/usr/local/i386elfgcc", - timeout => 0, - } - -} diff --git a/modules/cs162/templates/i386-gcc/install.sh b/modules/cs162/templates/i386-gcc/install.sh deleted file mode 100755 index 4c524c2..0000000 --- a/modules/cs162/templates/i386-gcc/install.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -mkdir /i386 - -cd /i386 - -export CC=/bin/gcc -export LD=/bin/gcc -export PREFIX="/usr/local/i386elfgcc" -export TARGET=i386-elf -export PATH="$PREFIX/bin:$PATH" -curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.40.tar.gz -tar -xf binutils-2.40.tar.gz -mkdir binutils-build -cd binutils-build -../binutils-2.40/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log -sudo make all install 2>&1 | tee make.log - -# Building gcc for i386 -cd /i386 -wget https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz -tar xzf gcc-11.3.0.tar.gz -cd gcc-11.3.0 -./contrib/download_prerequisites -cd .. -mkdir objdir -cd objdir -../gcc-11.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-languages=c --without-headers -make all-gcc -make all-target-libgcc -sudo make install-gcc -sudo make install-target-libgcc diff --git a/modules/cs162/templates/shell/bashrc b/modules/cs162/templates/shell/bashrc index 1742c92..008172c 100644 --- a/modules/cs162/templates/shell/bashrc +++ b/modules/cs162/templates/shell/bashrc @@ -136,7 +136,6 @@ if [[ $(uname -m) =~ ^arm|^aarch ]]; then export LD=/bin/gcc export PREFIX="/usr/local/i386elfgcc" export TARGET=i386-elf - export PATH="$PREFIX/bin:/home/vagrant/binutils-build/binutils:$PATH" fi . ~/.cs162.bashrc From 70d308d0942aab96e929a20b5d0ead3aeb50ee6d Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:36:30 -0700 Subject: [PATCH 5/6] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index a96068e..268d50b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,6 +6,7 @@ src=/vagrant if [ -z "$(ls -A $home)" ]; then sudo cp -R $src/. $home sudo chown -R vagrant $home + sudo chmod -R 0700 ~/ fi sudo service ssh start From d468eea645a2f31892b3a87bde16540df14245d9 Mon Sep 17 00:00:00 2001 From: Wilson Nguyen <45542237+PotatoParser@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:58:32 -0700 Subject: [PATCH 6/6] Remove environment variables --- modules/cs162/templates/shell/bashrc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/cs162/templates/shell/bashrc b/modules/cs162/templates/shell/bashrc index 008172c..345b56e 100644 --- a/modules/cs162/templates/shell/bashrc +++ b/modules/cs162/templates/shell/bashrc @@ -131,13 +131,6 @@ if ! shopt -oq posix; then fi fi -if [[ $(uname -m) =~ ^arm|^aarch ]]; then - export CC=/bin/gcc - export LD=/bin/gcc - export PREFIX="/usr/local/i386elfgcc" - export TARGET=i386-elf -fi - . ~/.cs162.bashrc [ -f ~/.fzf.bash ] && source ~/.fzf.bash