This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-26 at 14:30 UTC+2 (a few minutes of down time)

Commit d4d78dbd authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU scripts: removed hardcoded references to ../magic-lantern

and documented how the directories can be customized

--HG--
branch : qemu
parent ecde6a51b8b2
...@@ -75,6 +75,23 @@ copies the following files: ...@@ -75,6 +75,23 @@ copies the following files:
magic-lantern/contrib/qemu/scripts/*/patches.gdb -> qemu/*/patches.gdb (patches required for emulation — only on some models) magic-lantern/contrib/qemu/scripts/*/patches.gdb -> qemu/*/patches.gdb (patches required for emulation — only on some models)
magic-lantern/contrib/qemu/tests -> qemu/tests (guess) magic-lantern/contrib/qemu/tests -> qemu/tests (guess)
Customizing directories
```````````````````````
Once QEMU is compiled into some subdirectory (such as ``/path/to/qemu/qemu-2.5.0/``),
it will no longer work elsewhere (you will not be able to rename/move this directory
without a full reconfiguration and recompilation).
Should you want to customize these paths, you may set the following environment variables:
- ``QEMU_NAME``: defaults to ``qemu-2.5.0`` (a subdirectory under your ``qemu/`` directory)
- ``ML_PATH``: defaults to ``../magic-lantern``, relative to your ``qemu`` directory
Tip: after installation, you may change ``ML_PATH`` to emulate ML from other directories, located anywhere in the filesystem.
Misc notes
``````````
Model-specific parameters: eos/model_list.c (todo: move all hardcoded stuff there). Model-specific parameters: eos/model_list.c (todo: move all hardcoded stuff there).
MMIO handlers: eos_handle_whatever (with io_log for debug messages). MMIO handlers: eos_handle_whatever (with io_log for debug messages).
...@@ -982,14 +999,14 @@ you may try a script similar to the following: ...@@ -982,14 +999,14 @@ you may try a script similar to the following:
#!/bin/bash #!/bin/bash
QEMU_PATH=${QEMU_PATH:=qemu-2.5.0} QEMU_PATH=${QEMU_PATH:=qemu-2.5.0}
ML=${ML:=magic-lantern} ML_PATH=${ML_PATH:=../magic-lantern}
cp -v ../$ML/contrib/qemu/eos/* $QEMU_PATH/hw/eos/ cp -v $ML_PATH/contrib/qemu/eos/* $QEMU_PATH/hw/eos/
cp -v ../$ML/contrib/qemu/eos/mpu_spells/* $QEMU_PATH/hw/eos/mpu_spells/ cp -v $ML_PATH/contrib/qemu/eos/mpu_spells/* $QEMU_PATH/hw/eos/mpu_spells/
cp -v ../$ML/contrib/qemu/eos/dbi/* $QEMU_PATH/hw/eos/dbi/ cp -v $ML_PATH/contrib/qemu/eos/dbi/* $QEMU_PATH/hw/eos/dbi/
cp -v ../$ML/src/backtrace.[ch] $QEMU_PATH/hw/eos/dbi/ cp -v $ML_PATH/src/backtrace.[ch] $QEMU_PATH/hw/eos/dbi/
cp -vr ../$ML/contrib/qemu/tests/* tests/ cp -vr $ML_PATH/contrib/qemu/tests/* tests/
cp -vr ../magic-lantern/contrib/qemu/scripts/* . cp -vr $ML_PATH/contrib/qemu/scripts/* .
Test suite Test suite
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
set -e set -e
# paths relative to the "qemu" directory (where it will be installed)
QEMU_NAME=${QEMU_NAME:=qemu-2.5.0} QEMU_NAME=${QEMU_NAME:=qemu-2.5.0}
ML=${ML:=magic-lantern} ML_PATH=${ML_PATH:=../magic-lantern}
ML_NAME=${ML_PATH##*/}
GREP=${GREP:=grep} GREP=${GREP:=grep}
ALLOW_64BIT_GDB=n ALLOW_64BIT_GDB=n
...@@ -340,11 +343,11 @@ pip2 list | grep vncdotool || vncdotool -h > /dev/null || pip2 install vncdotool ...@@ -340,11 +343,11 @@ pip2 list | grep vncdotool || vncdotool -h > /dev/null || pip2 install vncdotool
function die { echo "${1:-"Unknown Error"}" 1>&2 ; exit 1; } function die { echo "${1:-"Unknown Error"}" 1>&2 ; exit 1; }
pwd | grep $ML/contrib/qemu > /dev/null || die "error: we should be in $ML/contrib/qemu" pwd | grep $ML_NAME/contrib/qemu > /dev/null || die "error: we should be in $ML_NAME/contrib/qemu"
# go to the parent of magic-lantern folder # go to the parent of magic-lantern folder
cd ../../.. cd ../../..
ls | $GREP $ML > /dev/null || die "error: expecting to find $ML here" ls | $GREP $ML_NAME > /dev/null || die "error: expecting to find $ML_NAME here"
mkdir -p qemu mkdir -p qemu
cd qemu cd qemu
...@@ -353,7 +356,7 @@ echo ...@@ -353,7 +356,7 @@ echo
echo "*** Setting up QEMU in $(pwd)..." echo "*** Setting up QEMU in $(pwd)..."
echo echo
if [ -d $QEMU_NAME ]; then if [ -d $QEMU_PATH ]; then
DATE=`date '+%Y-%m-%d_%H-%M-%S'` DATE=`date '+%Y-%m-%d_%H-%M-%S'`
echo "*** Directory $(pwd)/$QEMU_NAME already exists." echo "*** Directory $(pwd)/$QEMU_NAME already exists."
echo "*** To reinstall, please rename or delete it first." echo "*** To reinstall, please rename or delete it first."
...@@ -396,25 +399,25 @@ cd .. ...@@ -396,25 +399,25 @@ cd ..
echo "Copying files..." echo "Copying files..."
# copy our helper scripts # copy our helper scripts
cp -r ../$ML/contrib/qemu/scripts/* . cp -r $ML_PATH/contrib/qemu/scripts/* .
chmod +x *.sh chmod +x *.sh
# copy our testing scripts # copy our testing scripts
mkdir -p tests mkdir -p tests
cp -r ../$ML/contrib/qemu/tests/* tests/ cp -r $ML_PATH/contrib/qemu/tests/* tests/
chmod +x tests/*.sh chmod +x tests/*.sh
# apply our patch # apply our patch
cd ${QEMU_NAME} cd ${QEMU_NAME}
mkdir -p hw/eos mkdir -p hw/eos
cp -r ../../$ML/contrib/qemu/eos/* hw/eos/ cp -r ../$ML_PATH/contrib/qemu/eos/* hw/eos/
cp -r ../../$ML/src/backtrace.[ch] hw/eos/dbi/ cp -r ../$ML_PATH/src/backtrace.[ch] hw/eos/dbi/
if gcc -v 2>&1 | grep -q "gcc version 7"; then if gcc -v 2>&1 | grep -q "gcc version 7"; then
patch -N -p1 < ../../$ML/contrib/qemu/$QEMU_NAME-gcc7.patch patch -N -p1 < ../$ML_PATH/contrib/qemu/$QEMU_NAME-gcc7.patch
git add -u . && git commit -q -m "$QEMU_NAME patched for gcc 7.x" git add -u . && git commit -q -m "$QEMU_NAME patched for gcc 7.x"
fi fi
patch -N -p1 < ../../$ML/contrib/qemu/$QEMU_NAME.patch patch -N -p1 < ../$ML_PATH/contrib/qemu/$QEMU_NAME.patch
# don't commit this one - we'll use "git diff" to update the above patch # don't commit this one - we'll use "git diff" to update the above patch
cd .. cd ..
...@@ -422,7 +425,7 @@ cd .. ...@@ -422,7 +425,7 @@ cd ..
# setup the card image # setup the card image
if [ ! -f "sd.img" ]; then if [ ! -f "sd.img" ]; then
echo "Setting up SD card image..." echo "Setting up SD card image..."
cp -v ../$ML/contrib/qemu/sd.img.xz . cp -v $ML_PATH/contrib/qemu/sd.img.xz .
unxz -v sd.img.xz unxz -v sd.img.xz
else else
echo "SD image already exists, skipping." echo "SD image already exists, skipping."
......
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
# run this if you make changes to qemu and want to commit them back into ML tree # run this if you make changes to qemu and want to commit them back into ML tree
QEMU_PATH=${QEMU_PATH:=qemu-2.5.0} QEMU_PATH=${QEMU_PATH:=qemu-2.5.0}
ML=${ML:=magic-lantern} ML_PATH=${ML_PATH:=../magic-lantern}
cp -v *.sh *.py *.gdb gdbopts ../$ML/contrib/qemu/scripts cp -v *.sh *.py *.gdb gdbopts $ML_PATH/contrib/qemu/scripts
cp -v --parents */*.gdb ../$ML/contrib/qemu/scripts cp -v --parents */*.gdb $ML_PATH/contrib/qemu/scripts
cp -v $QEMU_PATH/hw/eos/* ../$ML/contrib/qemu/eos cp -v $QEMU_PATH/hw/eos/* $ML_PATH/contrib/qemu/eos
cp -v $QEMU_PATH/hw/eos/mpu_spells/* ../$ML/contrib/qemu/eos/mpu_spells cp -v $QEMU_PATH/hw/eos/mpu_spells/* $ML_PATH/contrib/qemu/eos/mpu_spells
cp -v $QEMU_PATH/hw/eos/dbi/* ../$ML/contrib/qemu/eos/dbi cp -v $QEMU_PATH/hw/eos/dbi/* $ML_PATH/contrib/qemu/eos/dbi
cp -v --parents tests/*.sh tests/*.py ../$ML/contrib/qemu/ cp -v --parents tests/*.sh tests/*.py $ML_PATH/contrib/qemu/
cp -v --parents tests/*/*.md5 ../$ML/contrib/qemu/ cp -v --parents tests/*/*.md5 $ML_PATH/contrib/qemu/
cd $QEMU_PATH cd $QEMU_PATH
git diff > ../../$ML/contrib/qemu/$QEMU_PATH.patch git diff > ../$ML_PATH/contrib/qemu/$QEMU_PATH.patch
cd .. cd ..
cd ../$ML/contrib/qemu/ cd $ML_PATH/contrib/qemu/
hg diff . hg diff .
...@@ -5,15 +5,17 @@ ...@@ -5,15 +5,17 @@
[ "$0" = "$BASH_SOURCE" ] && echo "This script must be 'sourced': [ "$0" = "$BASH_SOURCE" ] && echo "This script must be 'sourced':
. $0 5D3.113" && exit . $0 5D3.113" && exit
ML_PATH=${ML_PATH:=../magic-lantern}
export QEMU_ML_PATH= export QEMU_ML_PATH=
export QEMU_EOS_ML_MEMCPY= export QEMU_EOS_ML_MEMCPY=
export QEMU_EOS_ML_MEMCCPY= export QEMU_EOS_ML_MEMCCPY=
export QEMU_EOS_DEBUGMSG= export QEMU_EOS_DEBUGMSG=
if [ -d ../magic-lantern/platform/$1 ]; then if [ -d $ML_PATH/platform/$1 ]; then
export QEMU_ML_PATH=../magic-lantern/platform/$1 export QEMU_ML_PATH=$ML_PATH/platform/$1
elif [ -d ../magic-lantern/$1 ]; then elif [ -d $ML_PATH/$1 ]; then
export QEMU_ML_PATH=../magic-lantern/$1 export QEMU_ML_PATH=$ML_PATH/$1
elif [ "$1" == "clear" ]; then elif [ "$1" == "clear" ]; then
return return
else else
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# script options (environment variables) # script options (environment variables)
# example: TIMEOUT=10 AUTOEXEC_ONLY=1 ./run_ml_all_cams.sh # example: TIMEOUT=10 AUTOEXEC_ONLY=1 ./run_ml_all_cams.sh
ML_PATH=${ML_PATH:=../magic-lantern}
TIMEOUT=${TIMEOUT:=20} # timeout for default QEMU monitor script TIMEOUT=${TIMEOUT:=20} # timeout for default QEMU monitor script
SCREENSHOT=${SCREENSHOT:=} # optional screenshot ($CAM_FW.ppm) SCREENSHOT=${SCREENSHOT:=} # optional screenshot ($CAM_FW.ppm)
QEMU_ARGS=${QEMU_ARGS:=} # command-line arguments for QEMU QEMU_ARGS=${QEMU_ARGS:=} # command-line arguments for QEMU
...@@ -30,7 +31,7 @@ echo quit" ...@@ -30,7 +31,7 @@ echo quit"
. ./mtools_setup.sh . ./mtools_setup.sh
cd ../magic-lantern/platform cd $ML_PATH/platform
for CAM_DIR in $ML_PLATFORMS; do for CAM_DIR in $ML_PLATFORMS; do
# CAM_DIR is e.g. 50D.111/ (includes a slash) # CAM_DIR is e.g. 50D.111/ (includes a slash)
...@@ -81,8 +82,8 @@ for CAM_DIR in $ML_PLATFORMS; do ...@@ -81,8 +82,8 @@ for CAM_DIR in $ML_PLATFORMS; do
# go to QEMU dir and copy ML to the card images # go to QEMU dir and copy ML to the card images
if [ "$AUTOEXEC_ONLY" ]; then if [ "$AUTOEXEC_ONLY" ]; then
cd ../../qemu/ cd ../../qemu/
mcopy -o -i $MSD ../magic-lantern/$BuildDir/autoexec.bin :: mcopy -o -i $MSD $ML_PATH/$BuildDir/autoexec.bin ::
mcopy -o -i $MCF ../magic-lantern/$BuildDir/autoexec.bin :: mcopy -o -i $MCF $ML_PATH/$BuildDir/autoexec.bin ::
else else
make -C ../$BuildDir install_qemu $MLOptions make -C ../$BuildDir install_qemu $MLOptions
cd ../../qemu/ cd ../../qemu/
...@@ -122,5 +123,5 @@ $QemuInvoke -s -S" ...@@ -122,5 +123,5 @@ $QemuInvoke -s -S"
( eval "$QemuScript" ) \ ( eval "$QemuScript" ) \
| ( eval "$QemuInvoke" ) &> $LogName | ( eval "$QemuInvoke" ) &> $LogName
cd ../magic-lantern/platform/ cd $ML_PATH/platform/
done done
...@@ -35,6 +35,8 @@ CF_CAMS=( 5D 5D2 5D3 5D4 7D 7D2M 40D 50D 400D ) ...@@ -35,6 +35,8 @@ CF_CAMS=( 5D 5D2 5D3 5D4 7D 7D2M 40D 50D 400D )
# cameras able to run the FA_CaptureTestImage test (full-res silent picture backend) # cameras able to run the FA_CaptureTestImage test (full-res silent picture backend)
FRSP_CAMS=( 5D3 500D 550D 50D 60D 1100D 1200D ) FRSP_CAMS=( 5D3 500D 550D 50D 60D 1100D 1200D )
ML_PATH=${ML_PATH:=../magic-lantern}
# newer openbsd netcat requires -N (since 1.111) # newer openbsd netcat requires -N (since 1.111)
# older openbsd netcat does not have -N (prints error if we attempt to use it) # older openbsd netcat does not have -N (prints error if we attempt to use it)
# try to autodetect which one should be used, and let the user override it # try to autodetect which one should be used, and let the user override it
...@@ -186,7 +188,7 @@ mv cf.img cf-user.img ...@@ -186,7 +188,7 @@ mv cf.img cf-user.img
trap sd_restore EXIT trap sd_restore EXIT
trap - SIGINT trap - SIGINT
cp -v ../magic-lantern/contrib/qemu/sd.img.xz . cp -v $ML_PATH/contrib/qemu/sd.img.xz .
unxz -k sd.img.xz unxz -k sd.img.xz
cp sd.img cf.img cp sd.img cf.img
...@@ -782,7 +784,7 @@ done; cleanup ...@@ -782,7 +784,7 @@ done; cleanup
function test_frsp { function test_frsp {
# compile it from ML dir, for each camera # compile it from ML dir, for each camera
FRSP_PATH=../magic-lantern/minimal/qemu-frsp FRSP_PATH=$ML_PATH/minimal/qemu-frsp
rm -f $FRSP_PATH/autoexec.bin rm -f $FRSP_PATH/autoexec.bin
[ $CAM == "1200D" ] && (cd $FRSP_PATH; hg up qemu -C; hg merge 1200D; cd $OLDPWD) &>> tests/$CAM/$TEST-build.log [ $CAM == "1200D" ] && (cd $FRSP_PATH; hg up qemu -C; hg merge 1200D; cd $OLDPWD) &>> tests/$CAM/$TEST-build.log
make MODEL=$CAM -C $FRSP_PATH clean &>> tests/$CAM/$TEST-build.log make MODEL=$CAM -C $FRSP_PATH clean &>> tests/$CAM/$TEST-build.log
...@@ -1147,7 +1149,7 @@ done; cleanup ...@@ -1147,7 +1149,7 @@ done; cleanup
function test_hptimer { function test_hptimer {
# compile it from ML dir, for each camera # compile it from ML dir, for each camera
HPTIMER_PATH=../magic-lantern/minimal/qemu-hptimer HPTIMER_PATH=$ML_PATH/minimal/qemu-hptimer
rm -f $HPTIMER_PATH/autoexec.bin rm -f $HPTIMER_PATH/autoexec.bin
make MODEL=$CAM -C $HPTIMER_PATH clean &>> tests/$CAM/$TEST-build.log make MODEL=$CAM -C $HPTIMER_PATH clean &>> tests/$CAM/$TEST-build.log
make MODEL=$CAM -C $HPTIMER_PATH &>> tests/$CAM/$TEST-build.log make MODEL=$CAM -C $HPTIMER_PATH &>> tests/$CAM/$TEST-build.log
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment