- Login with username = root, password = jeffondich.
You should see the "fvwm" window manager; pink and puce color scheme.
- Open a terminal window by left-clicking on the
background and selecting Xterm.
- Make yourself a subdirectory of /root. Before you
modify any linux source file, first copy it into your directory so
you can restore the original sources when you're done
using the machine. Remember that you're sharing these
machines with other groups.
- Modify several syscall-related files. In each case, make
sure to make copies of the files in /root/yourname before changing
the original files.
- Add a line of the form ".long SYMBOL_NAME(sys_yoursyscall)"
to the bottom of the system call table in
/usr/src/linux/arch/i386/kernel/entry.S.
- Add a constant __NR_yoursyscall to the table of constants
in /usr/src/linux/include/asm/unistd.h.
- Copy your modified version of unistd.h into
/usr/include/asm/.
- If there isn't one already, make a directory called
/usr/src/linux/cs307. Go into that directory and execute
"cp ../mm/Makefile .".
- Whether it's new or not, edit /usr/src/linux/cs307/Makefile,
setting O_TARGET to cs307.o, and O_OBJS to yoursyscall.o.
(Here, "yoursyscall" might be replaced by "joHello" or something
that identifies you and the system call just in case you leave your
source code lying around.)
- If you just created the cs307 directory, modify
/usr/src/linux/Makefile. Change these lines
CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
SUBDIRS =kernel drivers mm fs net ipc lib
to say this:
CORE_FILES =cs307/cs307.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
SUBDIRS =cs307 kernel drivers mm fs net ipc lib
- Go back into /usr/src/linux/cs307, and create your system
call source file, yoursyscall.c (using the same "yoursyscall"
as when you changed O_OBJS in the cs307 Makefile. You will
need at least one function in your source:
asmlinkage int sys_yoursyscall( ...parameter list...)
The name "sys_yoursyscall" must be the same as in entry.S.
See hello_syscall.c for an
example.
- Change directories to /usr/src/linux. If you have added new
files or changed the #include statements in existing source
files, run "make dep", which updates the dependencies between
the source files. This takes about 3 minutes on the Pentium 100
machines.
Then run "make bzImage", which should take no more than a couple minutes,
unless you have wilfully deleted lots of object files.
- Assuming your code compiled successfully, copy
/usr/src/linux/arch/i386/boot/bzImage to /boot/yournameKernel.
- Edit /etc/lilo.conf and add the following lines
image=/boot/yournameKernel
label=yourname
root=/dev/hda5
initrd=/boot/initrd-2.2.5-15.img
read-only
- Enter the command "lilo".
- Restart the machine with the "reboot" command.
At the lilo boot prompt, type "?" or TAB to get a list of
kernels, and enter your kernel name.
- Login as root and change directories to /root/yourname.
Create a C program to test your system call. Your test
code will need to create the wrapper function by invoking one of
the _syscalln macros (depending on the number of parameters
your system call takes). Take a look at
hellotest.c for a zero-parameter
example. Compile and run your test program to see whether
your system call works.
- When you are done with your session, restore all original
Linux sources and header files.