Commit 9e0ddd78 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: moved default installation directory to qemu-eos

Rationale: user is likely to have another qemu directory, unrelated to ML (such as the vanilla qemu repo)
Can be changed by setting QEMU_DIR, e.g. "export QEMU_DIR=qemu" before running install.sh will install QEMU in the old path
To be thoroughly tested.

--HG--
branch : qemu
parent dd1e602259dc
......@@ -15,8 +15,8 @@ You will want to modify the sources, sooner or later.
How is this code organazized?
`````````````````````````````
By default, the install script sets up QEMU by creating a ``qemu`` subdirectory
"near" the magic-lantern directory (so both directories will end up at the same level).
By default, the install script sets up QEMU by creating a ``qemu-eos`` subdirectory
"near" the ``magic-lantern`` directory (so both directories will end up at the same level).
The default directory structure looks like this::
.
......@@ -37,7 +37,7 @@ The default directory structure looks like this::
│ ├── installer/ # for building ML-SETUP.FIR (which enables/disables the boot flag)
│ └── ...
└── qemu/ # QEMU working directory
└── qemu-eos/ # QEMU working directory
├── qemu-2.5.0/ # QEMU sources and binaries
......@@ -70,29 +70,32 @@ copies the following files:
.. code:: shell
magic-lantern/contrib/qemu/eos/ -> qemu/qemu-2.5.0/hw/eos/ (emulation sources)
magic-lantern/contrib/qemu/eos/mpu_spells/ -> qemu/qemu-2.5.0/hw/eos/mpu_spells/ (MPU messages, button codes)
magic-lantern/contrib/qemu/eos/dbi/ -> qemu/qemu-2.5.0/hw/eos/dbi/ (instrumentation)
magic-lantern/src/backtrace.[ch] -> qemu/qemu-2.5.0/hw/eos/dbi/backtrace.[ch] (shared with ML)
magic-lantern/contrib/qemu/scripts/ -> qemu/ (helper scripts, such as run_canon_fw.sh)
magic-lantern/contrib/qemu/scripts/*/debugmsg.gdb -> qemu/*/debugmsg.gdb (GDB scripts for reverse engineering)
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/eos/ -> qemu-eos/qemu-2.5.0/hw/eos/ (emulation sources)
magic-lantern/contrib/qemu/eos/mpu_spells/ -> qemu-eos/qemu-2.5.0/hw/eos/mpu_spells/ (MPU messages, button codes)
magic-lantern/contrib/qemu/eos/dbi/ -> qemu-eos/qemu-2.5.0/hw/eos/dbi/ (instrumentation)
magic-lantern/src/backtrace.[ch] -> qemu-eos/qemu-2.5.0/hw/eos/dbi/backtrace.[ch] (shared with ML)
magic-lantern/contrib/qemu/scripts/ -> qemu-eos/ (helper scripts, such as run_canon_fw.sh)
magic-lantern/contrib/qemu/scripts/*/debugmsg.gdb -> qemu-eos/*/debugmsg.gdb (GDB scripts for reverse engineering)
magic-lantern/contrib/qemu/scripts/*/patches.gdb -> qemu-eos/*/patches.gdb (patches required for emulation — only on some models)
magic-lantern/contrib/qemu/tests -> qemu-eos/tests (guess)
Customizing directories
'''''''''''''''''''''''
Once QEMU is compiled into some subdirectory (such as ``/path/to/qemu/qemu-2.5.0/``),
Once QEMU is compiled into some subdirectory (such as ``/path/to/qemu-eos/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
- ``QEMU_DIR``: defaults to ``qemu-eos`` (QEMU working directory, created near ``magic-lantern``)
- ``QEMU_NAME``: defaults to ``qemu-2.5.0`` (a subdirectory under your ``qemu-eos`` 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.
When using ``make install_qemu``, the Makefiles will also find the QEMU working directory from ``QEMU_DIR``.
Basic concepts
``````````````
......
......@@ -141,6 +141,11 @@ without additional gymnastics (you will **not** have to merge ``qemu`` into your
/path/to/magic-lantern$ cd contrib/qemu
/path/to/magic-lantern/contrib/qemu$ ./install.sh
By default, QEMU will be installed in the ``qemu-eos`` directory,
near the ``magic-lantern`` one, at the same level - e.g. ``/path/to/qemu-eos``.
Please refer to `HACKING.rst <HACKING.rst#rst-header-how-is-this-code-organazized>`__
for details on the directory structure and how to change the installation directory.
|
3. Follow the instructions; you will have to supply your ROM files and compile QEMU:
......@@ -148,11 +153,11 @@ without additional gymnastics (you will **not** have to merge ``qemu`` into your
.. code:: shell
# replace camera model (60D) with yours
/path/to/qemu$ cp /path/to/sdcard/ML/LOGS/ROM*.BIN 60D/
/path/to/qemu$ cd qemu-2.5.0
/path/to/qemu/qemu-2.5.0$ ../configure_eos.sh
/path/to/qemu/qemu-2.5.0$ make -j2
/path/to/qemu/qemu-2.5.0$ cd ..
/path/to/qemu-eos$ cp /path/to/sdcard/ML/LOGS/ROM*.BIN 60D/
/path/to/qemu-eos$ cd qemu-2.5.0
/path/to/qemu-eos/qemu-2.5.0$ ../configure_eos.sh
/path/to/qemu-eos/qemu-2.5.0$ make -j2
/path/to/qemu-eos/qemu-2.5.0$ cd ..
Some recent camera models also use a serial flash. To list them, run this command:
......@@ -178,7 +183,7 @@ without additional gymnastics (you will **not** have to merge ``qemu`` into your
.. code:: shell
# all EOS models should run this without any trickery
/path/to/qemu$ ./run_canon_fw.sh 60D,firmware="boot=1"
/path/to/qemu-eos$ ./run_canon_fw.sh 60D,firmware="boot=1"
|
......@@ -187,13 +192,13 @@ without additional gymnastics (you will **not** have to merge ``qemu`` into your
.. code:: shell
# from the QEMU directory
/path/to/qemu$ make -C ../magic-lantern 60D_install_qemu
/path/to/qemu-eos$ make -C ../magic-lantern 60D_install_qemu
# some models will work only with this:
/path/to/qemu$ ./run_canon_fw.sh 60D,firmware="boot=1"
/path/to/qemu-eos$ ./run_canon_fw.sh 60D,firmware="boot=1"
# some models require running under GDB (they won't boot the GUI otherwise)
/path/to/qemu$ ./run_canon_fw.sh EOSM,firmware="boot=1" -s -S & arm-none-eabi-gdb -x EOSM/patches.gdb -ex quit
/path/to/qemu-eos$ ./run_canon_fw.sh EOSM,firmware="boot=1" -s -S & arm-none-eabi-gdb -x EOSM/patches.gdb -ex quit
|
......@@ -208,12 +213,12 @@ it is possible to install QEMU and ML development tools
Running Canon firmware
----------------------
From the QEMU directory, use the ``run_canon_fw.sh`` script and make sure
From the ``qemu-eos`` directory, use the ``run_canon_fw.sh`` script and make sure
the `boot flag <http://magiclantern.wikia.com/wiki/Bootflags>`_ is disabled:
.. code:: shell
# from the qemu directory
# from the qemu-eos directory
./run_canon_fw.sh 60D,firmware="boot=0"
Some models may need additional patches to run — these are stored under ``CAM/patches.gdb``.
......@@ -286,33 +291,33 @@ To install Magic Lantern to the virtual card, you may:
make 60D_clean
make 60D_install_qemu
They also work from the qemu directory:
They also work from the ``qemu-eos`` directory:
.. code:: shell
# from the qemu directory
# from the qemu-eos directory
make -C ../magic-lantern/platform/60D.111 clean
make -C ../magic-lantern/platform/60D.111 install_qemu
.. code:: shell
# from the qemu directory
# from the qemu-eos directory
make -C ../magic-lantern 5D3.113_clean
make -C ../magic-lantern 5D3.113_install_qemu
Please note: ``make install_qemu`` is a recent addition and may not be available in all branches.
In this case, you may either use the first method, or sync with the "unified" branch (``hg merge unified``),
or manually import changeset `27f4105 <https://bitbucket.org/hudson/magic-lantern/commits/27f4105cfa83>`_.
or manually import changeset `d5ad86f <https://bitbucket.org/hudson/magic-lantern/commits/d5ad86f0d284>`_.
Unfortunately, these rules won't work from ``Makefile.user``.
The included card images are already bootable for EOS firmwares (but not for PowerShots).
After you have copied Magic Lantern to the card, you may run it from the ``qemu`` directory
After you have copied Magic Lantern to the card, you may run it from the ``qemu-eos`` directory
(near the ``magic-lantern`` one, at the same level):
.. code:: shell
# from the qemu directory
# from the qemu-eos directory
./run_canon_fw.sh 60D,firmware="boot=1"
# or, if your camera requires patches.gdb:
......@@ -403,7 +408,7 @@ Running ML Lua scripts
.. code:: shell
# from the qemu directory
# from the qemu-eos directory
wget http://builds.magiclantern.fm/jenkins/job/lua_fix/431/artifact/platform/60D.111/magiclantern-lua_fix.2017Dec23.60D111.zip
unzip magiclantern-lua_fix.2017Dec23.60D111.zip -d ml-tmp
./mtools_copy_ml.sh ml-tmp
......@@ -446,19 +451,19 @@ The invocation looks like this (notice the ``113``):
And the directory layout should be like this::
/path/to/qemu/5D3/113/ROM0.BIN
/path/to/qemu/5D3/113/ROM1.BIN
/path/to/qemu/5D3/123/ROM0.BIN
/path/to/qemu/5D3/123/ROM1.BIN
/path/to/qemu/5D3/113/ROM0.BIN
/path/to/qemu/5D3/debugmsg.gdb # common to both versions
/path/to/qemu/5D3/patches.gdb # common to both versions
/path/to/qemu-eos/5D3/113/ROM0.BIN
/path/to/qemu-eos/5D3/113/ROM1.BIN
/path/to/qemu-eos/5D3/123/ROM0.BIN
/path/to/qemu-eos/5D3/123/ROM1.BIN
/path/to/qemu-eos/5D3/113/ROM0.BIN
/path/to/qemu-eos/5D3/debugmsg.gdb # common to both versions
/path/to/qemu-eos/5D3/patches.gdb # common to both versions
Compare this to a camera model where only one firmware version is supported::
/path/to/qemu/60D/ROM0.BIN
/path/to/qemu/60D/ROM1.BIN
/path/to/qemu/5D3/patches.gdb
/path/to/qemu-eos/60D/ROM0.BIN
/path/to/qemu-eos/60D/ROM1.BIN
/path/to/qemu-eos/5D3/patches.gdb
You may also store ``debugmsg.gdb`` and ``patches.gdb`` under the firmware version subdirectory if you prefer, but other QEMU-related scripts won't pick them up.
......
......@@ -2,7 +2,9 @@
set -e
# paths relative to the "qemu" directory (where it will be installed)
QEMU_DIR=${QEMU_DIR:=qemu-eos}
# paths relative to QEMU_DIR (where it will be installed)
QEMU_NAME=${QEMU_NAME:=qemu-2.5.0}
ML_PATH=${ML_PATH:=../magic-lantern}
......@@ -349,8 +351,8 @@ pwd | grep $ML_NAME/contrib/qemu > /dev/null || die "error: we should be in $ML_
cd ../../..
ls | $GREP $ML_NAME > /dev/null || die "error: expecting to find $ML_NAME here"
mkdir -p qemu
cd qemu
mkdir -p $QEMU_DIR
cd $QEMU_DIR
echo
echo "*** Setting up QEMU in $(pwd)..."
......
......@@ -4,6 +4,7 @@
# example: TIMEOUT=10 AUTOEXEC_ONLY=1 ./run_ml_all_cams.sh
ML_PATH=${ML_PATH:=../magic-lantern}
QEMU_PATH=${QEMU_PATH:=../qemu-eos}
TIMEOUT=${TIMEOUT:=20} # timeout for default QEMU monitor script
SCREENSHOT=${SCREENSHOT:=} # optional screenshot ($CAM_FW.ppm)
QEMU_ARGS=${QEMU_ARGS:=} # command-line arguments for QEMU
......@@ -81,19 +82,19 @@ for CAM_DIR in $ML_PLATFORMS; do
# go to QEMU dir and copy ML to the card images
if [ "$AUTOEXEC_ONLY" ]; then
cd ../../qemu/
cd ../$QEMU_DIR
mcopy -o -i $MSD $ML_PATH/$BuildDir/autoexec.bin ::
mcopy -o -i $MCF $ML_PATH/$BuildDir/autoexec.bin ::
else
make -C ../$BuildDir install_qemu $MLOptions
cd ../../qemu/
cd ../$QEMU_DIR
fi
# export any ML symbols we might want to use in QEMU
. ./export_ml_syms.sh $BuildDir
else
# back to QEMU directory without compiling
cd ../../qemu/
cd ../$QEMU_DIR
# clear previously-exported symbols, if any
. ./export_ml_syms.sh clear
......
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