-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-workdir.sh
52 lines (42 loc) · 1.19 KB
/
setup-workdir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/bash
#set -xe
## variables for directory names
SCRIPT_DIR=/root/os161Setup
OS161_DIR=/root/os161
TOOLBUILD_DIR=$OS161_DIR/toolbuild
TOOLS_DIR=$OS161_DIR/tools
WORKING_DIR=/root/cs4300
ROOT_DIR=$WORKING_DIR/root
SRC_DIR=$WORKING_DIR/src
## flags
MAKE_FLAGS="-j"
MAKE_INSTALL_FLAGS="-j"
BMAKE_FLAGS="-j 4"
## create working directory and copy files
mkdir -p $WORKING_DIR $ROOT_DIR $SRC_DIR
tar -xvf $SCRIPT_DIR/os161-* -C $WORKING_DIR
mv $WORKING_DIR/os161-*/* $WORKING_DIR/src
rm -r $WORKING_DIR/os161-*
## copy the build kernel file and necessary replacements
cp $SCRIPT_DIR/build-kernel.sh $WORKING_DIR/build-kernel.sh
cp $SCRIPT_DIR/replacements/usemtest.c $SRC_DIR/userland/testbin/usemtest/usemtest.c
## make user files
cd $SRC_DIR
./configure --ostree=$ROOT_DIR
bmake $BMAKE_FLAGS
bmake $BMAKE_FLAGS install
## configure the kernel
cd $SRC_DIR/kern/conf
./config DUMBVM
## make kernel files
cd ../compile/DUMBVM
bmake $BMAKE_FLAGS depend
bmake $BMAKE_FLAGS
bmake $BMAKE_FLAGS install
## copy configuration file
cp $TOOLS_DIR/share/examples/sys161/sys161.conf.sample $ROOT_DIR/sys161.conf
## create disks in the root directory
cd $ROOT_DIR
disk161 create LHD0.img 5M
disk161 create LHD1.img 5M
exit