Meta: Allow running run.sh from any where by setting SERENITY_BUILD

If SERENITY_BUILD is not set or empty, SERENITY_BUILD is treated as if
it was set to '.'.

`run.sh` will cd to SERENITY_BUILD before running the emulator.

Also, export SERENITY_BUILD in `Meta/CLion/run.sh` since we are using it
in `Meta/run.sh`.

Also, allow using a different bochs configuration file by setting the
SERENITY_BOCHSRC variable.
This commit is contained in:
Emanuele Torre 2020-06-24 04:47:20 +02:00 committed by Andreas Kling
parent aabb482d5c
commit 1d9791bcdf
2 changed files with 15 additions and 1 deletions

View file

@ -7,6 +7,7 @@ export SERENITY_RAM_SIZE
# set this to the Build directory in serenity
: "${SERENITY_BUILD:='/mnt/c/Users/Ragnarok/serenity-project/serenity/Build'}"
export SERENITY_BUILD
cd -P -- "$SERENITY_BUILD" || exit
make install

View file

@ -3,6 +3,11 @@
set -e
die() {
echo "die: $*"
exit 1
}
#SERENITY_PACKET_LOGGING_ARG="-object filter-dump,id=hue,netdev=breh,file=e1000.pcap"
[ -e /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ] && SERENITY_KVM_ARG="-enable-kvm"
@ -47,9 +52,17 @@ $SERENITY_EXTRA_QEMU_ARGS
export SDL_VIDEO_X11_DGAMOUSE=0
: "${SERENITY_BUILD:=.}"
cd -P -- "$SERENITY_BUILD" || die "Could not cd to \"$SERENITY_BUILD\""
if [ "$1" = "b" ]; then
# ./run b: bochs
"$SERENITY_BOCHS_BIN" -q -f "$SERENITY_ROOT/Meta/bochsrc"
[ -z "$SERENITY_BOCHSRC" ] && {
# Make sure that SERENITY_ROOT is set and not empty
[ -z "$SERENITY_ROOT" ] && die 'SERENITY_ROOT not set or empty'
SERENITY_BOCHSRC="$SERENITY_ROOT/Meta/bochsrc"
}
"$SERENITY_BOCHS_BIN" -q -f "$SERENITY_BOCHSRC"
elif [ "$1" = "qn" ]; then
# ./run qn: qemu without network
"$SERENITY_QEMU_BIN" \