Created
January 27, 2016 22:58
-
-
Save samfishman/482642a0397f6e5f2f77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful aliases for cs161 | |
os161-latest() { | |
ls -t "$HOME/cs161/os161/kern/compile" | head -n 1 | |
} | |
os161-build() { | |
if [ -z "$1" ]; then | |
local conf=$(os161-latest) | |
else | |
local conf=$1 | |
fi | |
if [ -z "$conf" ]; then | |
echo "Usage: kbuild ASSTN" | |
return 1 | |
fi | |
touch "$HOME/cs161/os161/kern/compile/$conf" | |
echo "BUILD $conf" | |
pushd "$HOME/cs161/os161/kern/compile/$conf" > /dev/null | |
bmake -j4 && bmake install -s | |
popd > /dev/null | |
} | |
os161-config() { | |
if [ -z "$1" ]; then | |
local conf=$(os161-latest) | |
else | |
local conf=$1 | |
fi | |
if [ -z "$conf" ]; then | |
echo "Usage: kconfig ASSTN" | |
return 1 | |
fi | |
echo "CONFIG $conf" | |
pushd "$HOME/cs161/os161/kern/conf" > /dev/null | |
./config "$conf" | |
popd > /dev/null | |
pushd "$HOME/cs161/os161/kern/compile/$conf" > /dev/null | |
bmake -s -j4 depend | |
popd > /dev/null | |
os161-build "$conf" | |
} | |
os161-run() { | |
bash -c "cd ~/cs161/root && sys161 kernel \"$@\"" | |
} | |
os161-fsrun() { | |
if [ "$1" ]; then | |
local doom="-D $1" | |
else | |
local doom="" | |
fi | |
local cmd="cd ~/cs161/root && sys161 $doom kernel \"mount sfs lhd1; cd lhd1:; s;\"" | |
bash -c "$cmd" | |
} | |
os161-debug() { | |
bash -c "cd ~/cs161/root && sys161 -w kernel \"$@\"" | |
} | |
os161-user-build() { | |
if [ "$1" ]; then | |
pushd "$HOME/cs161/os161/userland/$1" > /dev/null | |
bmake depend -s && bmake && bmake install | |
popd > /dev/null | |
return 0 | |
fi | |
pushd "$HOME/cs161/os161/" > /dev/null | |
bmake -s | |
popd > /dev/null | |
pushd "$HOME/cs161/os161/userland" > /dev/null | |
bmake -s -j4 depend && bmake -s -j4 && bmake install -s -j4 | |
popd > /dev/null | |
} | |
# Aliases to config, build, run, debug, and start gdb | |
# kc and kb take a configuration file in kern/conf as an argument. | |
# e.g. kc ASST0 | |
# e.g. kb ASST3-OPT | |
alias kc='os161-config' | |
alias kconfig=kc | |
alias kb='os161-build' | |
alias kbuild=kb | |
alias kr='os161-run' | |
alias krun=kr | |
alias kf='os161-fsrun' | |
alias nd='host-poisondisk $root/lhd1.img; host-mksfs $root/lhd1.img dsk' | |
alias dj='host-dumpsfs -j $root/lhd1.img' | |
alias kd='os161-debug' | |
alias kdebug=kd | |
alias kg='cd ~/cs161/root && os161-gdb -q kernel' | |
alias cg='cd ~/cs161/root && cgdb -d os161-gdb kernel' | |
alias kgdb=kg | |
alias ub='os161-user-build' | |
alias ubuild=ub | |
# Aliases to move to common directories | |
alias cdo='cd $HOME/cs161/os161' | |
alias cdr='cd $root' | |
alias cdp='cd $HOME/cs161/ports' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment