├── .gitignore ├── Makefile ├── README.md └── init.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.* 2 | * 3 | !*/ 4 | !/nemu/* 5 | !/nexus-am/* 6 | !/nanos-lite/* 7 | !/navy-apps/* 8 | !Makefile 9 | !README.md 10 | !.gitignore 11 | !init.sh 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | STUID = 231220000 2 | STUNAME = 张三 3 | 4 | # DO NOT modify the following code!!! 5 | 6 | GITFLAGS = -q --author='tracer-ics2024 ' --no-verify --allow-empty 7 | 8 | # prototype: git_commit(msg) 9 | define git_commit 10 | -@git add $(NEMU_HOME)/.. -A --ignore-errors 11 | -@while (test -e .git/index.lock); do sleep 0.1; done 12 | -@(echo "> $(1)" && echo $(STUID) $(STUNAME) && uname -a && uptime) | git commit -F - $(GITFLAGS) 13 | -@sync 14 | endef 15 | 16 | _default: 17 | @echo "Please run 'make' under subprojects." 18 | 19 | submit: 20 | git gc 21 | STUID=$(STUID) STUNAME=$(STUNAME) bash -c "$$(curl -s http://why.ink:8080/static/submit.sh)" 22 | 23 | .PHONY: default submit 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ICS2024 Programming Assignment 2 | 3 | This project is the programming assignment of the class ICS(Introduction to Computer System) 4 | in Department of Computer Science and Technology, Nanjing University. 5 | 6 | For the guide of this programming assignment, 7 | refer to https://nju-projectn.github.io/ics-pa-gitbook/ics2024/ 8 | 9 | To initialize, run 10 | ```bash 11 | bash init.sh subproject-name 12 | ``` 13 | See `init.sh` for more details. 14 | 15 | The following subprojects/components are included. Some of them are not fully implemented. 16 | * [NEMU](https://github.com/NJU-ProjectN/nemu) 17 | * [Abstract-Machine](https://github.com/NJU-ProjectN/abstract-machine) 18 | * [Nanos-lite](https://github.com/NJU-ProjectN/nanos-lite) 19 | * [Navy-apps](https://github.com/NJU-ProjectN/navy-apps) 20 | -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # usage: addenv env_name path 4 | function addenv() { 5 | sed -i -e "/^export $1=.*/d" ~/.bashrc 6 | echo -e "\nexport $1=`readlink -e $2`" >> ~/.bashrc 7 | echo "By default this script will add environment variables into ~/.bashrc." 8 | echo "After that, please run 'source ~/.bashrc' to let these variables take effect." 9 | echo "If you use shell other than bash, please add these environment variables manually." 10 | } 11 | 12 | # usage: init repo branch directory trace [env] 13 | # trace = true|false 14 | function init() { 15 | if [ -d $3 ]; then 16 | echo "$3 is already initialized, skipping..." 17 | return 18 | fi 19 | 20 | while [ ! -d $3 ]; do 21 | git clone -b $2 git@github.com:$1.git $3 22 | done 23 | log="$1 `cd $3 && git log --oneline --no-abbrev-commit -n1`"$'\n' 24 | 25 | if [ $4 == "true" ] ; then 26 | rm -rf $3/.git 27 | git add -A $3 28 | git commit -am "$1 $2 initialized"$'\n\n'"$log" 29 | else 30 | sed -i -e "/^\/$3/d" .gitignore 31 | echo "/$3" >> .gitignore 32 | git add -A .gitignore 33 | git commit --no-verify --allow-empty -am "$1 $2 initialized without tracing"$'\n\n'"$log" 34 | fi 35 | 36 | if [ $5 ] ; then 37 | addenv $5 $3 38 | fi 39 | } 40 | 41 | case $1 in 42 | nemu) 43 | init NJU-ProjectN/nemu ics2024 nemu true NEMU_HOME 44 | ;; 45 | abstract-machine) 46 | init NJU-ProjectN/abstract-machine ics2024 abstract-machine true AM_HOME 47 | init NJU-ProjectN/fceux-am ics2021 fceux-am false 48 | ;; 49 | am-kernels) 50 | init NJU-ProjectN/am-kernels ics2021 am-kernels false 51 | ;; 52 | nanos-lite) 53 | init NJU-ProjectN/nanos-lite ics2021 nanos-lite true 54 | ;; 55 | navy-apps) 56 | init NJU-ProjectN/navy-apps ics2024 navy-apps true NAVY_HOME 57 | ;; 58 | *) 59 | echo "Invalid input..." 60 | exit 61 | ;; 62 | esac 63 | --------------------------------------------------------------------------------