Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Latest commit

 

History

History

project1

1. Files

  • sys.c contains syscall implementations.
  • syscall_table.S contains syscall names and numbers.
  • unistd.h contains syscall numbers for user.
  • sem.h has cs1550 semaphore implementation
  • test.c is the test driver.
  • config is the Linux config file.
  • build.sh is the script for adding cs1550 syscalls to Linux.
  • boot.sh is the script for booting Qemu VM.

2. Adding cs1550 syscalls

Login to thoth:

Navigate to your dedicated directory:

  • cd /u/OSLab/PITT_ID

Clone the cs1550 repo:

Navigate to project 1 dir:

  • cd CS1550/project1

Copy the linux-2.6.23.1.tar.bz file to your local space under /u/OSLab/PITT_ID:

  • cp /u/OSLab/original/linux-2.6.23.1.tar.bz2 .

Extract

  • tar xfj linux-2.6.23.1.tar.bz2

Copy the .config file

  • cp /u/OSLab/original/.config linux-2.6.23.1/

Copy sys.c that contains the cs1550_up and cs1550_down implementations

  • cp sys.c linux-2.6.23.1/kernel/sys.c

Copy system call table

  • cp syscall_table.S linux-2.6.23.1/arch/i386/kernel/syscall_table.S

Copy unistd.h that contains syscall names along with syscall number

  • cp unistd.h linux-2.6.23.1/include/asm/unistd.h

Change into linux-2.6.23.1/ directory

  • cd linux-2.6.23.1

Build

  • make ARCH=i386 bzImage

Navigate to project1 directory

  • cd ..

Building the test program

  • gcc -m32 -o test -I linux-2.6.23.1/include/ test.c

3. Testing cs1550 syscalls

Download the Qemu emulator on your laptop:

Extract and launch Qemu VM:

  • Windows: qemu/qemu-win.bat
  • Mac OS: qemu-test/start.sh

Login to Qemu VM:

  • Username: root
  • Password: root

Use scp to download the kernel to a home directory:

  • scp [email protected]:/u/OSLab/PITT_ID/CS1550/project1/linux-2.6.23.1/arch/i386/boot/bzImage .
  • scp [email protected]:/u/OSLab/PITT_ID/CS1550/project1/linux-2.6.23.1/System.map .

Copy kernel files

  • cp bzImage /boot/bzImage-devel
  • cp System.map /boot/System.map-devel

Boot from modified kernel

  • lilo

Reboot Qemu VM:

  • reboot

Select Linux (devel) from boot loader menu

  • Hit enter

Download the test binary:

Run the test binary:

  • ./test

Windows users can use Ctrl + Alt to exit the Qemu VM

4. build.sh

Script for adding cs1550 syscalls to Linux (compatible with linux-2.6.23.1).

Login to thoth:

Navigate to your dedicated directory:

  • cd /u/OSLab/PITT_ID

Clone the cs1550 repo:

Navigate to project 1 dir:

  • cd CS1550/project1

Give execute permission to the build.sh script:

  • chmod +x build.sh

Run the script:

  • ./build.sh

5. boot.sh

Script for booting Qemu VM. Should be executed inisde the Qemu.

Download the Qemu emulator on your laptop:

Extract and launch Qemu VM:

  • Windows: qemu/qemu-win.bat
  • Mac OS: qemu-test/start.sh

Login to Qemu VM:

  • Username: root
  • Password: root

login to the Qemu and copy boot.sh script from thoth:

In Qemu, change the scp target directory of boot.sh based on your working directory on thoth:

Give execute permission to the script:

  • chmod +x boot.sh

Run the script:

  • ./boot.sh PITT_ID WORKING_DIR (e.g. ./boot.sh moh18 /u/OSLab/moh18/cs1550/project1)

Reboot Qemu VM:

  • reboot

Select Linux (devel) from boot loader menu:

  • Hit enter

Run test binary:

  • ./test

Note: Additional test cases can be fount under test_cases folder.

Note: Please visit Courseweb for a detailed version of project instructions PDF file.