P436 Discussion Week 1
Download nachos and set up ACLs
Each team should have one team member whose home directory will keep the
team's nachos code, and he/she should do the following, where YOURID is
that team member's userid:
-
If you are logged into a machine in the Burrow, cd to your home directory
cd
-
Make your burrow home directory readable (if it isn't already).
chmod go+rx .
cp ~os/faclfile .
-
Edit your copy of faclfile, inserting the userid's of everyone on your
team.
xemacs faclfile &
-
Make sure your copy of the faclfile is readable by your teammates, etc.
chmod go+r faclfile
cp -pR ~os/nachos-dfs .
-
Make sure your nachos directory is not readable by other students.
chmod go-rx nachos-dfs
-
Set ACLs so that (1) your teammates can read and write files in your nachos
directory and (2) the instructor and AI can read them.
find nachos-dfs -exec setfacl -r -f /u/YOURID/faclfile {} \;
Every team member should do the following, where OWNERID is the userid
of the team member who copied the Nachos files:
-
Add the following line to your .cshrc:
alias os-setfacl "setfacl -r -f /u/OWNERID/faclfile"
Whenever any team member creates a new file, he should run "os-setfacl
FILENAME" on it, where FILENAME is the name of the new file. If a teamate
modify a file he doesn't own, he should also run the setfacl
command on it.
After compiling nachos, the ACL of the nachos executable must be set
to give other team members (and graders) access to it.
-
Modify the nachos Makefile so that the ACL of the executable will be set
automatically after each compilation. Edit nachos-dfs/code/Makefile.common,
find the lines
$(PROGRAM): $(OFILES)
$(LD) $(OFILES) $(LDFLAGS) -o $(PROGRAM)
and add "setfacl -r -f FACLFILE $(PROGRAM)" on the following line - remember
to add a tab instead of spaces at the beginning of the line - where
FACLFILE is /u/OWNERID/faclfile if you and your teammates log into Burrow
machines where OWNERID has the same meaning as above.
-
Add the following line (Note that there's a tab at the beginning of the
line) to the very end of Makefile.common, so that Makefiles created by
"make depend" are readable by your teammates:
setfacl -r -f FACLFILE Makefile
where FACLFILE has the same meaning as above.
-
Before you handin your code, use ls or getfacl command to check whether
you set ACLs correctly for all the directories and files: If the ACL is
set on a file, ls shows a + after the normal permission list, and getfacl
will display the ACL for the file and confirm that the settings are effective
(look for+"#effective:", if "---" is following it, that means the setting
is not effective, try to run setfacl -r again on the file).
% ls -l main.c
% getfacl main.c
Note: Be sure that all levels of directories (from your home
directory down to the subdirectory in nachos-dfs/code where your current
project is) are readable, and all source files and executables are
accessible to os.
Compile and run nachos
-
Edit Makefile.commom to choose a compiler: To use CC, the lines following
"for
SUN CC:" should be uncommented, and the lines following "for GNU g++"
should be
commented out. To use g++, vice versa.
-
Go to directory nachos-dfs/code/thread in your home directory.
cd nachos-dfs/code/thread
/usr/local/gnu/bin/make nachos
Note: There's a small bug in schedule.cc, which will cause a compilation
error. You can get around this by commenting out line 125, as below
// DEBUG('p', "Switching from PID %d to PID %d\n", oldThread->GetPID(), CurrentThread->GetPID());
-
When you change the file dependencies file, you need to run "make depend"
before running "make nachos" (in the same directory).
-
To run nachos, you need to either give an explicit pathname (eg. "./nachos")
or add the name of the directory containing the executable to your PATH
environment variable (by modifying the appropriate line in your .cshrc
file).