Skip to content

Instantly share code, notes, and snippets.

@roguesherlock
Last active March 25, 2018 07:11
Show Gist options
  • Save roguesherlock/4c5db158f490a84b88f931bf0bbea1d9 to your computer and use it in GitHub Desktop.
Save roguesherlock/4c5db158f490a84b88f931bf0bbea1d9 to your computer and use it in GitHub Desktop.
Simple functions to aid me in building and running os161 kernel in bash, fish, powershell
function makeos
switch $argv[1]
case 'ast1'
set ASST 'ASST1'
case 'ast2'
set ASST 'ASST2'
case 'ast3'
set ASST 'ASST3'
case '*'
set ASST 'DUMBVM'
end
set BUILDDIR $HOME'/Developer/os161/kern/compile/'$ASST
set ROOTDIR $HOME'/os161/root'
cd $BUILDDIR
bmake; and bmake install; and cd $ROOTDIR
echo 'Done!'
end
function makeos ($ast = 'DUMBVM'){
switch ($ast) {
'ast1' {setx ASST 'ASST1'; break}
'ast1' {setx ASST 'ASST1'; break}
'ast1' {setx ASST 'ASST1'; break}
default {Write-Error 'No such assignment exists!'; return;}
}
$BUILDDIR = $HOME+'/Developer/os161/kern/compile/'+$ASST
$ROOTDIR = $HOME+'/os161/root'
Set-Location $BUILDDIR
bmake; if($?){bmake install}; if($?){Set-Location $ROOTDIR};
Write-Output 'Done!'
}
alias makeos='function _makeos {
ASST=""
case "$1" in
"asst0")
ASST="DUMBVM"
;;
"asst1")
ASST="ASST1"
;;
"asst2")
ASST="ASST2"
;;
"asst3")
ASST="ASST3"
;;
*)
echo "No such assignment exists"
return 1
esac
BUILDDIR=$HOME"/Developer/os161/kern/compile/"$ASST
ROOTDIR=$HOME"/os161/root"
cd $BUILDDIR
bmake && bmake install && cd $ROOTDIR && echo "Done!"
}; _makeos'
# Add this to your ~/.bashrc or source it.
alias ss='function _ss {
ROOTDIR=$HOME"/os161/root"
cd $ROOTDIR
sys161 kernel
}; _ss'
alias ssw='function _ssw {
ROOTDIR=$HOME"/os161/root"
cd $ROOTDIR
sys161 -w kernel
}; _ssw'
alias sg='function _sg {
ROOTDIR=$HOME"/os161/root"
cd $ROOTDIR
os161-gdb -x $ROOTDIR/gdb_commands.txt kernel
}; _sg'
# Add this to your ~/.bashrc or source it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment