From 415676d3fdd7192a8afcadaf51dd8a5fee63f374 Mon Sep 17 00:00:00 2001 From: Kabir Oberai <koberai@uwaterloo.ca> Date: Wed, 14 Sep 2022 17:15:18 -0400 Subject: [PATCH] Support Apple Silicon and aarch64 Linux --- README.md | 6 ------ os161-container/Dockerfile | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 83cdb05..71d81af 100644 --- a/README.md +++ b/README.md @@ -143,9 +143,3 @@ If the assignments repo has changed, either due to assignments being changed or This is due to windows placing return characters in the strings that get passed to the scripts. Please use git bash or a terminal that does UNIX string passing. - -**Cannot figure out the host** -This occurs within newer level Macs that use Apple Silicon, docker -currently requires x86 architectures to work, you'll need to use the -student environment. - diff --git a/os161-container/Dockerfile b/os161-container/Dockerfile index 67bb4b0..4945e72 100644 --- a/os161-container/Dockerfile +++ b/os161-container/Dockerfile @@ -10,12 +10,16 @@ RUN mkdir -p /os161/tools/bin; \ mkdir -p /os161/tools/share/man/man1; \ mkdir -p /os161/tools/share/mk; +# Install a newer version of config.guess with ARM support. Pin it to a specific commit for stability. +ADD https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=20403c5701973a4cbd7e0b4bbeb627fcd424a0f1 /tmp/config.guess +RUN chmod +x /tmp/config.guess COPY dependencies/os161-binutils.tar.gz /binutils.tar.gz RUN mkdir /binutils-src; \ tar -xf /binutils.tar.gz -C /binutils-src --strip-components 1 WORKDIR /binutils-src +RUN cp -f /tmp/config.guess . RUN find . -name '*.info' | xargs touch; \ ./configure --nfp --disable-werror --target=mips-harvard-os161 --prefix=/os161/tools; \ make -j 4 && make install; \ @@ -30,6 +34,7 @@ RUN mkdir /gcc-src; \ tar -xf /gcc.tar.gz -C /gcc-src --strip-components 1 WORKDIR /gcc-src +RUN cp -f /tmp/config.guess . RUN CFLAGS="-std=gnu89" ./configure -nfp --disable-shared --disable-threads \ --disable-libmudflap --disable-libssp --target=mips-harvard-os161 --prefix=/os161/tools; \ make -j 4 && make install; \ @@ -65,12 +70,14 @@ COPY dependencies/os161-gdb.tar.gz /os161-gdb.tar.gz RUN mkdir /os161-gdb/ && tar -xf /os161-gdb.tar.gz -C /os161-gdb --strip-components 1 WORKDIR /os161-gdb +RUN cp -f /tmp/config.guess . RUN CFLAGS="-std=gnu89" ./configure --target=mips-harvard-os161 --prefix=/os161/tools --disable-werror && \ make && make install WORKDIR / RUN rm -rf /os161-gdb /os161-gdb.tar.gz +RUN rm -f /tmp/config.guess RUN cd /os161/tools/bin && sh -c 'for i in mips-*; do ln -s /os161/tools/bin/$i /os161/tools/bin/cs350-`echo $i | cut -d- -f4-`; done' RUN python3 -m pip install -U prettytable -- GitLab