Add --firmwarepath to configure

Add a firmware path config option to configure.  Multiple directories
are accepted, with the usual colon as separator.  Default value is
${prefix}/share/qemu-firmware.  The path is searched in addition to the
current search path (typically ${prefix}/share/qemu).

This prepares qemu for the planned split of the prebuilt firmware blobs
into a separate project.

Distributions can also use this to get rid of the firmware symlink farm
and add -- for example -- /usr/share/seabios to the firmware path
instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170914114236.25343-3-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2017-09-14 13:42:36 +02:00
parent 2a1cce9058
commit 3d5eecab4a
3 changed files with 16 additions and 4 deletions

6
configure vendored
View File

@ -332,6 +332,7 @@ modules="no"
prefix="/usr/local" prefix="/usr/local"
mandir="\${prefix}/share/man" mandir="\${prefix}/share/man"
datadir="\${prefix}/share" datadir="\${prefix}/share"
firmwarepath="\${prefix}/share/qemu-firmware"
qemu_docdir="\${prefix}/share/doc/qemu" qemu_docdir="\${prefix}/share/doc/qemu"
bindir="\${prefix}/bin" bindir="\${prefix}/bin"
libdir="\${prefix}/lib" libdir="\${prefix}/lib"
@ -915,6 +916,8 @@ for opt do
;; ;;
--localstatedir=*) local_statedir="$optarg" --localstatedir=*) local_statedir="$optarg"
;; ;;
--firmwarepath=*) firmwarepath="$optarg"
;;
--sbindir=*|--sharedstatedir=*|\ --sbindir=*|--sharedstatedir=*|\
--oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
--htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
@ -1416,6 +1419,7 @@ Advanced options (experts only):
--libdir=PATH install libraries in PATH --libdir=PATH install libraries in PATH
--sysconfdir=PATH install config in PATH$confsuffix --sysconfdir=PATH install config in PATH$confsuffix
--localstatedir=PATH install local state in PATH (set at runtime on win32) --localstatedir=PATH install local state in PATH (set at runtime on win32)
--firmwarepath=PATH search PATH for firmware files
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
--enable-debug enable common debug build options --enable-debug enable common debug build options
--disable-strip disable stripping binaries --disable-strip disable stripping binaries
@ -5265,6 +5269,7 @@ libs_softmmu="$pixman_libs $libs_softmmu"
echo "Install prefix $prefix" echo "Install prefix $prefix"
echo "BIOS directory $(eval echo $qemu_datadir)" echo "BIOS directory $(eval echo $qemu_datadir)"
echo "firmware path $(eval echo $firmwarepath)"
echo "binary directory $(eval echo $bindir)" echo "binary directory $(eval echo $bindir)"
echo "library directory $(eval echo $libdir)" echo "library directory $(eval echo $libdir)"
echo "module directory $(eval echo $qemu_moddir)" echo "module directory $(eval echo $qemu_moddir)"
@ -5456,6 +5461,7 @@ echo "mandir=$mandir" >> $config_host_mak
echo "sysconfdir=$sysconfdir" >> $config_host_mak echo "sysconfdir=$sysconfdir" >> $config_host_mak
echo "qemu_confdir=$qemu_confdir" >> $config_host_mak echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
echo "qemu_datadir=$qemu_datadir" >> $config_host_mak echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
echo "qemu_docdir=$qemu_docdir" >> $config_host_mak echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
echo "qemu_moddir=$qemu_moddir" >> $config_host_mak echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
if test "$mingw32" = "no" ; then if test "$mingw32" = "no" ; then

View File

@ -15,7 +15,7 @@ case $line in
echo "#define QEMU_VERSION_MINOR $minor" echo "#define QEMU_VERSION_MINOR $minor"
echo "#define QEMU_VERSION_MICRO $micro" echo "#define QEMU_VERSION_MICRO $micro"
;; ;;
qemu_*dir=*) # qemu-specific directory configuration qemu_*dir=* | qemu_*path=*) # qemu-specific directory configuration
name=${line%=*} name=${line%=*}
value=${line#*=} value=${line#*=}
define_name=$(echo $name | LC_ALL=C tr '[a-z]' '[A-Z]') define_name=$(echo $name | LC_ALL=C tr '[a-z]' '[A-Z]')

12
vl.c
View File

@ -3125,6 +3125,7 @@ int main(int argc, char **argv, char **envp)
Error *main_loop_err = NULL; Error *main_loop_err = NULL;
Error *err = NULL; Error *err = NULL;
bool list_data_dirs = false; bool list_data_dirs = false;
char **dirs;
typedef struct BlockdevOptions_queue { typedef struct BlockdevOptions_queue {
BlockdevOptions *bdo; BlockdevOptions *bdo;
Location loc; Location loc;
@ -4309,11 +4310,16 @@ int main(int argc, char **argv, char **envp)
qemu_set_log(0); qemu_set_log(0);
} }
/* If no data_dir is specified then try to find it relative to the /* add configured firmware directories */
executable path. */ dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
for (i = 0; dirs[i] != NULL; i++) {
qemu_add_data_dir(dirs[i]);
}
/* try to find datadir relative to the executable path */
qemu_add_data_dir(os_find_datadir()); qemu_add_data_dir(os_find_datadir());
/* If all else fails use the install path specified when building. */ /* add the datadir specified when building */
qemu_add_data_dir(CONFIG_QEMU_DATADIR); qemu_add_data_dir(CONFIG_QEMU_DATADIR);
/* -L help lists the data directories and exits. */ /* -L help lists the data directories and exits. */