Add debianization support

Add support to generate Debian packages.
For details see debian/README.

debian/changelog is manually intialized, ready to be updated by gbp dch
command.

Tracked-On: #6688
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
This commit is contained in:
Helmut Buchsbaum 2022-04-04 12:11:57 +02:00 committed by acrnsi-robot
parent aa8d636507
commit 300a8b259d
49 changed files with 1417 additions and 0 deletions

76
debian/README vendored Normal file
View File

@ -0,0 +1,76 @@
The Debian Package acrn-hypervisor
----------------------------------
ACRN is a flexible, lightweight reference hypervisor, built with real-time and
safety-criticality in mind, optimized to streamline embedded development through
an open source platform.
The Debian source package ``acrn-hypervisor`` provides the
following Debian packages:
* ``acrn-dev``: Public headers and libraries for ACRN manager.
* ``acrn-devicemodel``: Device model for ACRN Hypervisor
* ``acrn-doc``: Reference to ACRN Documentation
* ``acrn-hypervisor``: ACRN Hypervisor for IoT
* ``acrn-lifemngr``: ACRN life manager service
* ``acrn-system``: metapackage to deploy a minimum of ACRN packages
* ``acrn-tools``: Supplementary tools for ACRN Hypervisor
* ``acrnd``: ACRN Hypervisor control daemon
* ``grub-acrn``: Grub setup scripts for ACRN Hypervisor
* ``python3-board-inspector``: Generate Board Configuration for ACRN
**Building**
The ``acrn-hypervisor`` source package uses ``git-buildpackage`` (``gbp``) for
package building (see ``debian/gbp.conf``). For more information on ``gbp``
refer to
http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.html.
**Special Package Properties**
* ``acrn-hypervisor``
This package contains multiple ACRN hypervisor binaries, with the final binary
being chosen usually at install time via Debian's ``debconf`` mechanism. This
allows you to choose the board as well as the respective scenario but still
use the same Debian for varoius hardware platforms.
To reconfigure the choice later, use
``dpkg-reconfigure acrn-hypervisor``
You also can preseed your choice by setting the respective ``debconf`` keys
``acrn-hypervisor/board`` and ``acrn-hypervisor/scenario``, e.g. during
image creation. Please refer to https://wiki.debian.org/debconf for details.
The ACRN hypervisor configurations are chosen as follows:
All directories given in ``CONFIGDIRS`` in ``debian/rules`` are searched
for valid board- and scenario-configuration files. The ``ACRN_BOARDLIST``
and ``ACRN_SCENARIOLIST`` in debian/rules can be use to restrict the
hypervisor/scenario configurations built into ``acrn-hypervisor``. If
unset, all possible configurations found under the directories given are
built.
* ``acrn-lifemngr``
To adapt the the needs of a Debian distribution the service file has been
adapted and a start script wrapper added to automatically set up the
parameters for User VMs or the Service VM.
* ``acrnd``
There is also an adapted variant for the systemd service file. As for
``acrn-lifemngr`` this also is provided as part of the Debian packaging
process rather than patching the files provided with the sources.
**General Remarks and Restrictions**
* ACRN >=2.6 needs a Linux 5.10 kernel with the respective Intel/ACRN patches
applied.
* The packages are built in debug mode to be able to access the HV console.
This can be changed by setting the ``RELEASE`` variable in ``debian/rules``
to 1.
* The built configurations are restricted to the hardware platforms available
for testing.
-- Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com> Sat, 26 Nov 2022 20:45:00 +0100

View File

@ -0,0 +1,17 @@
#!/bin/bash -e
# wrapper to call board_inspector.py
modprobe msr
IA32_FEATURE_CONTROL=0x3A
if [ "$(($(rdmsr ${IA32_FEATURE_CONTROL}) & 0x6))" = "0" ]; then
echo "VMX is not enabled, update your BIOS settings" >&2
exit 1
fi
if [ ! -f /sys/firmware/acpi/tables/DMAR ]; then
echo "Cannot find ACPI DMAR table. Is VT-d enabled/supported?" >&2
exit 1
fi
python3 -m acrn_board_inspector.board_inspector "$@"

64
debian/acrn-board-inspector/setup.py vendored Normal file
View File

@ -0,0 +1,64 @@
"""
Out-of-tree setup.py for board-inspector and its associated libraries tweaked
to perform the required actions at setup time.
This enables the usage of dh_python3 even in absence of an upstream setup.py.
"""
import os
from setuptools import find_namespace_packages
from setuptools import setup
setup(
name="acrn_board_inspector",
version=os.environ["ACRNVERSION"],
description="ACRN Board Inspector",
long_description="acrn-board-inspector will collect all board related info to generate a board configuration file for ACRN.",
url="https://projectacrn.org/",
license="BSD-3-Clause",
# add additional namespace acrn_board_inspector
packages=[
"acrn_board_inspector",
"acrn_board_inspector.acpiparser",
"acrn_board_inspector.acpiparser.aml",
"acrn_board_inspector.cpuparser",
"acrn_board_inspector.extractors",
"acrn_board_inspector.inspectorlib",
"acrn_board_inspector.legacy",
"acrn_board_inspector.memmapparser",
"acrn_board_inspector.pcieparser",
"acrn_board_inspector.schema",
"acrn_board_inspector.smbiosparser",
],
package_dir={
"acrn_board_inspector": "../../misc/config_tools/board_inspector",
"acrn_board_inspector.acpiparser": "../../misc/config_tools/board_inspector/acpiparser",
"acrn_board_inspector.acpiparser.aml": "../../misc/config_tools/board_inspector/acpiparser/aml",
"acrn_board_inspector.cpuparser": "../../misc/config_tools/board_inspector/cpuparser",
"acrn_board_inspector.extractors": "../../misc/config_tools/board_inspector/extractors",
"acrn_board_inspector.inspectorlib": "../../misc/config_tools/board_inspector/inspectorlib",
"acrn_board_inspector.legacy": "../../misc/config_tools/board_inspector/legacy",
"acrn_board_inspector.memmapparser": "../../misc/config_tools/board_inspector/memmapparser",
"acrn_board_inspector.pcieparser": "../../misc/config_tools/board_inspector/pcieparser",
"acrn_board_inspector.schema": "../../misc/config_tools/board_inspector/schema",
"acrn_board_inspector.smbiosparser": "../../misc/config_tools/board_inspector/smbiosparser",
},
package_data={
"acrn_board_inspector.schema": ["*", "checks/*"],
},
# use namespace packages from board inspector
#packages=find_namespace_packages(
# where="../../misc/config_tools/board_inspector",
#),
#package_dir={"": "../../misc/config_tools/board_inspector"},
## add the standalone board_inspector.py file
#py_modules=["board_inspector"],
install_requires=[
"lxml",
"xmlschema"
],
# use wrapper script to call board_inspector.py
scripts=["acrn-board-inspector"],
)

2
debian/acrn-dev.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/*/libacrn-mngr.a
usr/include/acrn/

1
debian/acrn-dev.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-dev/html

3
debian/acrn-devicemodel.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin/acrn-dm
usr/share/acrn/bios/
usr/share/doc/acrn-devicemodel/samples/

1
debian/acrn-devicemodel.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-devicemodel/html

View File

@ -0,0 +1,2 @@
# manpages are missing in upstream
acrn-devicemodel: binary-without-manpage usr/bin/acrn-dm

1
debian/acrn-doc-index-html.in vendored Normal file
View File

@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0; url='https://projectacrn.github.io/@acrnversion@/'" />

10
debian/acrn-doc.doc-base vendored Normal file
View File

@ -0,0 +1,10 @@
Document: acrn-doc-html
Section: System/Administration
Title: ACRN HTML documentation
Abstract: ACRN interfaces, howtos and much more
ACRN upstream provides much of its documentation in HTML form.
This entry referes to the top-level index of the ACRN HTML docs.
Format: HTML
Index: /usr/share/doc/acrn/html/index.html
Files: /usr/share/doc/acrn/html

1
debian/acrn-doc.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html/

1
debian/acrn-doc.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-doc/html

13
debian/acrn-hypervisor.config vendored Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Exit on error
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
# query board
db_input critical acrn-hypervisor/board || true
# Show interface
db_go || true

1
debian/acrn-hypervisor.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/x86_64-linux-gnu/acrn/*

1
debian/acrn-hypervisor.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-hypervisor/html

67
debian/acrn-hypervisor.postinst.in vendored Normal file
View File

@ -0,0 +1,67 @@
#!/bin/sh
# postinst script for acrn-hypervisor
#
# see: dh_installdeb(1)
set -e
ACRNDIR=@acrndir@
. /usr/share/debconf/confmodule
db_get acrn-hypervisor/board
BOARD=${RET}
SCENARIOS=$(find ${ACRNDIR}/${BOARD} -maxdepth 1 -type d \
| tail -n +2 | sed "s#${ACRNDIR}/${BOARD}/##" \
| sort | awk '{s=s (s?OFS:x) $1} END {print s}' OFS=", ")
db_subst acrn-hypervisor/scenario scenariolist ${SCENARIOS}
db_clear
db_input critical acrn-hypervisor/scenario || true
db_go || true
db_get acrn-hypervisor/scenario
SCENARIO=${RET}
ACRNCFG="${ACRNDIR}/${BOARD}/${SCENARIO}/acrn.${BOARD}.${SCENARIO}.config"
ACRNMAP="${ACRNDIR}/${BOARD}/${SCENARIO}/acrn.${BOARD}.${SCENARIO}.map"
ACRNBIN="${ACRNDIR}/${BOARD}/${SCENARIO}/acrn.${BOARD}.${SCENARIO}.bin"
ACRNACPI="${ACRNDIR}/${BOARD}/${SCENARIO}/acpi"
ACRNETC="${ACRNDIR}/${BOARD}/${SCENARIO}/etc"
case "$1" in
configure)
if [ -f ${ACRNCFG} ] && [ -f ${ACRNMAP} ] && [ -f ${ACRNBIN} ]; then
cp ${ACRNCFG} /boot/acrn-@acrnversion@.config
cp ${ACRNMAP} /boot/acrn-@acrnversion@.map
cp ${ACRNBIN} /boot/acrn-@acrnversion@.bin
if [ -d ${ACRNACPI} ]; then
cp ${ACRNACPI}/ACPI_VM* /boot
fi
if [ -f ${ACRNETC}/serial.conf ]; then
echo "# START - ACRN HYPERVISOR INSTALL" >> /etc/serial.conf
cat ${ACRNETC}/serial.conf >> /etc/serial.conf
echo "# END - ACRN HYPERVISOR INSTALL" >> /etc/serial.conf
fi
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

54
debian/acrn-hypervisor.postrm.in vendored Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
# postrm script for acrn-hypervisor
#
# see: dh_installdeb(1)
set -e
rm_acrn()
{
rm -f /boot/acrn-@acrnversion@.config
rm -f /boot/acrn-@acrnversion@.map
rm -f /boot/acrn-@acrnversion@.bin
rm -f /boot/ACPI_VM*
}
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|purge)
rm_acrn
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
;;
upgrade)
rm_acrn
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

53
debian/acrn-hypervisor.prerm.in vendored Normal file
View File

@ -0,0 +1,53 @@
#!/bin/sh
# prerm script for acrn-hypervisor
#
# see: dh_installdeb(1)
set -e
rm_acrn()
{
rm -f /boot/acrn-@acrnversion@.config
rm -f /boot/acrn-@acrnversion@.map
rm -f /boot/acrn-@acrnversion@.bin
rm -f /boot/ACPI_VM*
if [ -f /etc/serial.conf ]; then
sed '/ START - ACRN HYPERVISOR INSTALL/,/# END - ACRN HYPERVISOR INSTALL/{d}' /etc/serial.conf
fi
}
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
deconfigure)
rm_acrn
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
;;
remove|upgrade|failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

13
debian/acrn-hypervisor.templates.in vendored Normal file
View File

@ -0,0 +1,13 @@
Template: acrn-hypervisor/board
Type: select
Choices: @boardlist@
Description: ACRN hypervisor board selection
Define the board ACRN will be running on. Selecting the wrong board
might render your board unusable!
Template: acrn-hypervisor/scenario
Type: select
Choices: ${scenariolist}
Description: ACRN hypervisor scenario selection
Define the appropriate VM configuration (aka scenario) for the ACRN
hypervisor.

2
debian/acrn-lifemngr.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/bin/acrn-lifemngr
usr/share/acrn-lifemngr/*

1
debian/acrn-lifemngr.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-lifemngr/html

View File

@ -0,0 +1,2 @@
# manpages are missing in upstream
acrn-lifemngr: binary-without-manpage usr/bin/acrn-lifemngr

13
debian/acrn-lifemngr.service vendored Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=ACRN lifemngr daemon
After=systemd-resolved.service
[Service]
Type=simple
ExecStart=/usr/share/acrn-lifemngr/start-acrn-lifemngr.sh
StandardOutput=journal
StandardError=journal
Restart=always
[Install]
WantedBy=multi-user.target

12
debian/acrn-tools.install vendored Normal file
View File

@ -0,0 +1,12 @@
usr/bin/acrnlog
usr/bin/acrnprobe
usr/bin/acrntrace
usr/bin/crashlogctl
usr/bin/debugger
usr/bin/usercrash_c
usr/bin/usercrash_s
usr/bin/usercrash-wrapper
usr/share/acrn/crashlog/*
lib/systemd/system/acrnlog.service
lib/systemd/system/acrnprobe.service
lib/systemd/system/usercrash.service

1
debian/acrn-tools.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrn-tools/html

9
debian/acrn-tools.lintian-overrides vendored Normal file
View File

@ -0,0 +1,9 @@
# manpages are missing in upstream
acrn-tools: binary-without-manpage usr/bin/acrnlog
acrn-tools: binary-without-manpage usr/bin/acrnprobe
acrn-tools: binary-without-manpage usr/bin/acrntrace
acrn-tools: binary-without-manpage usr/bin/crashlogctl
acrn-tools: binary-without-manpage usr/bin/debugger
acrn-tools: binary-without-manpage usr/bin/usercrash-wrapper
acrn-tools: binary-without-manpage usr/bin/usercrash_c
acrn-tools: binary-without-manpage usr/bin/usercrash_s

1
debian/acrnd.dirs vendored Normal file
View File

@ -0,0 +1 @@
usr/share/acrn/conf/add/

3
debian/acrnd.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin/acrnd
usr/bin/acrnctl
usr/share/doc/acrnd/examples/

1
debian/acrnd.links vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/acrn/html usr/share/doc/acrnd/html

3
debian/acrnd.lintian-overrides vendored Normal file
View File

@ -0,0 +1,3 @@
# manpages are missing in upstream
acrnd: binary-without-manpage usr/bin/acrnctl
acrnd: binary-without-manpage usr/bin/acrnd

14
debian/acrnd.service vendored Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=ACRN manager deamon
After=systemd-resolved.service
ConditionPathExists=/sys/kernel/debug/gvt
ConditionPathExists=/dev/acrn_hsm
[Service]
Type=simple
ExecStart=/usr/bin/acrnd -t
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
acrn-hypervisor (3.0~0.gbpXXXXXX) UNRELEASED; urgency=medium
* Initial native packaging release for ACRN.
-- Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com> Tue, 26 Apr 2022 10:18:30 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
11

151
debian/control vendored Normal file
View File

@ -0,0 +1,151 @@
Source: acrn-hypervisor
Priority: optional
Maintainer: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
Section: admin
Build-Depends:
debhelper (>= 12),
dh-python,
python3,
python3-setuptools,
git,
libssl-dev,
libpciaccess-dev,
libsystemd-dev,
libevent-dev,
libxml2-dev,
libxml2-utils,
libusb-1.0-0-dev,
libblkid-dev,
e2fslibs-dev,
pkg-config,
libnuma-dev,
libsdl2-dev,
libpixman-1-dev,
liblz4-tool,
linux-libc-dev (>= 4.20),
libdrm-dev,
libcjson-dev,
flex,
bison,
xsltproc,
clang-format,
bc,
acpica-tools (>= 20200326),
python3-lxml,
python3-defusedxml,
python3-xmlschema
Standards-Version: 4.3.0
Homepage: https://projectacrn.org/
Vcs-Browser: https://github.com/projectacrn/acrn-hypervisor
Vcs-Git: https://github.com/projectacrn/acrn-hypervisor.git
Package: acrn-system
Section: admin
Architecture: amd64
Depends:
acrn-hypervisor,
acrnd,
${misc:Depends}
Suggests: acrn-doc
Description: ACRN System on AMD64 (metapackage)
This package depends on the ACRN hypervisor for use on AMD64 and the
its devicemodel utils.
Package: acrn-hypervisor
Section: kernel
Architecture: amd64
Depends:
${misc:Depends},
grub-acrn,
acrn-devicemodel,
debconf (>=1.5.71)
Suggests: acrn-doc
Recommends: setserial
Description: ACRN Hypervisor for IoT
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development.
.
In order to boot an ACRN system along with this package you also need a
kernel specifically crafted to work as the Service OS. This build provides
binaries for the given board/scenario configurations and installs the
respective binary at install time controlled via environment variables.
Package: grub-acrn
Section: admin
Architecture: any-amd64
Depends: ${misc:Depends}, grub-efi-amd64
Description: Grub setup scripts for ACRN Hypervisor
This package provides additional scripts to fit into the Grub bootloader config
creation. It supports generating the respective Grub boot entries for an ACRN
system.
Package: acrn-devicemodel
Section: otherosfs
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, acpica-tools (>= 20200326)
Suggests: acrn-doc
Description: Devicemodel for ACRN Hypervisor
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development. This is the ACRN specific devicemodel for
ACRN only.
Package: acrnd
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: acrn-doc
Description: ACRN Hypervisor control daemon
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development. This is the ACRN daemon for hypervisor
control.
Package: acrn-tools
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: acrn-doc
Description: Supplementary tools for ACRN Hypervisor on AMD64
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development. These are ACRN specific additional
tools meant for debug use only.
Package: acrn-dev
Section: libdevel
Architecture: amd64
Depends: ${misc:Depends}
Suggests: acrn-doc
Description: Public headers and libs for ACRN
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development. This package contains the public
headers and static libraries for ACRN.
Package: acrn-lifemngr
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: acrn-doc
Description: ACRN life manager
ACRN is an open source reference hypervisor, built to meet the unique
needs of embedded IoT development. This package contains the helper
service for Linux VMs to provide proper shutdown/suspend
Package: acrn-doc
Section: doc
Architecture: all
Depends: ${misc:Depends}
Description: ACRN Documentation
ACRN is an open source reference hypervisor, built to meets the unique
needs of embedded IoT development. This is the documentation for ACRN and
its tools, how to install, configure and use.
Package: python3-acrn-board-inspector
Section: admin
Architecture: all
Depends:
cpuid,
msr-tools,
pciutils,
dmidecode,
${misc:Depends},
${python3:Depends},
Suggests: acrn-doc
Description: Generate Board Configuration for ACRN
This package collects all board related info to generate a board
configuration file for ACRN.

38
debian/copyright vendored Normal file
View File

@ -0,0 +1,38 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: acrn-hypervisor
Source: https://github.com/projectacrn/acrn-hypervisor
Files: *
Copyright: 2017-2018, Project ACRN
License: BSD-3-Clause
Files: debian/*
Copyright: 2020 TTTech Industrial Automation AG
2020 Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
License: BSD-3-Clause
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2
debian/docker/.dockerignore vendored Normal file
View File

@ -0,0 +1,2 @@
run-docker-build.sh

2
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,2 @@
[DEFAULT]
debian-branch = master

2
debian/grub-acrn.install vendored Normal file
View File

@ -0,0 +1,2 @@
debian/grub/acrn.cfg etc/default/grub.d
debian/grub/25_linux_acrn /etc/grub.d

29
debian/grub-acrn.postinst vendored Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# postinst script for grub-acrn
#
# see: dh_installdeb(1)
set -e
case "$1" in
configure)
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

42
debian/grub-acrn.postrm vendored Normal file
View File

@ -0,0 +1,42 @@
#!/bin/sh
# postrm script for grub-acrn
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|purge)
if command -v update-grub > /dev/null && [ -d /boot/grub ]; then
update-grub || :
fi
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

304
debian/grub/25_linux_acrn vendored Executable file
View File

@ -0,0 +1,304 @@
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
CLASS="--class gnu-linux --class gnu --class os --class acrn"
SUPPORTED_INITS="systemd:/lib/systemd/systemd"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
# We can't cope with devices loop-mounted from files here.
case ${GRUB_DEVICE} in
/dev/*) ;;
*) exit 0 ;;
esac
;;
esac
# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
# and mounting btrfs requires user space scanning, so force UUID in this case.
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
if [ "${GRUB_CMDLINE_LINUX_ACRN_REPLACE}" ]; then
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_ACRN_REPLACE}"
fi
if [ "${GRUB_CMDLINE_LINUX_ACRN_REPLACE_DEFAULT}" ]; then
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_ACRN_REPLACE_DEFAULT}"
fi
case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
;;
esac
title_correction_code=
linux_entry ()
{
os="$1"
version="$2"
acrn_version="$3"
type="$4"
args="$5"
acrn_args="$6"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ x$type != xsimple ] ; then
if [ x$type = xrecovery ] ; then
title="$(gettext_printf "%s, with Acrn %s and Linux %s (%s)" "${os}" "${acrn_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
elif [ "${type#init-}" != "$type" ] ; then
title="$(gettext_printf "%s, with Acrn %s and Linux %s (%s)" "${os}" "${acrn_version}" "${version}" "${type#init-}")"
else
title="$(gettext_printf "%s, with Acrn %s and Linux %s" "${os}" "${acrn_version}" "${version}")"
fi
replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
if [ x"Acrn ${acrn_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
fi
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'acrn-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
title="$(gettext_printf "%s, with ACRN hypervisor" "${os}")"
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'acrn-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
xmessage="$(gettext_printf "Loading Acrn %s ..." ${acrn_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$xmessage" | grub_quote)'
${acrn_loader} ${rel_acrn_dirname}/${acrn_basename} ${acrn_args}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} Linux_bzImage root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
${module_loader} --nounzip ${rel_dirname}/${initrd} Linux_initrd
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
}
EOF
}
linux_list=
for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
if grub_file_is_not_garbage "$i"; then
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
dirname=$(dirname $i)
config=
for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${j}" ; then
config="${j}"
break
fi
done
if grep -Eqx "^CONFIG_ACRN_HSM=(y|m)" "${config}" 2> /dev/null; then linux_list="$linux_list $i" ; fi
fi
done
if [ "x${linux_list}" = "x" ] ; then
exit 0
fi
file_is_not_sym () {
case "$1" in
*/acrn-syms-*)
return 1;;
*)
return 0;;
esac
}
# use ELF *.out files for multiboot
acrn_out_list=
for i in /boot/acrn*.out; do
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && grub-file --is-x86-multiboot "$i"; then acrn_out_list="$acrn_out_list $i" ; fi
done
# use raw binary *.bin files for multiboot2
acrn_bin_list=
for i in /boot/acrn*.bin; do
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && grub-file --is-x86-multiboot2 "$i"; then acrn_bin_list="$acrn_bin_list $i" ; fi
done
# we prefer multiboot2
if [ "x${acrn_bin_list}" != "x" ]; then
acrn_list="${acrn_bin_list}"
acrn_loader="multiboot2"
module_loader="module2"
else
acrn_list="${acrn_out_list}"
acrn_loader="multiboot --quirk-modules-after-kernel"
module_loader="module"
fi
prepare_boot_cache=
boot_device_id=
title_correction_code=
machine=`uname -m`
case "$machine" in
i?86) GENKERNEL_ARCH="x86" ;;
mips|mips64) GENKERNEL_ARCH="mips" ;;
mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
arm*) GENKERNEL_ARCH="arm" ;;
*) GENKERNEL_ARCH="$machine" ;;
esac
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
submenu_indentation=""
is_top_level=true
while [ "x${acrn_list}" != "x" ] ; do
list="${linux_list}"
current_acrn=`version_find_latest $acrn_list`
acrn_basename=`basename ${current_acrn}`
acrn_dirname=`dirname ${current_acrn}`
rel_acrn_dirname=`make_system_path_relative_to_its_root $acrn_dirname`
acrn_version=`echo $acrn_basename | sed -e "s,.out$,,g;s,.bin$,,g;s,^acrn-,,g"`
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ "x$is_top_level" != xtrue ]; then
echo " submenu '$(gettext_printf "ACRN hypervisor, version %s" "${acrn_version}" | grub_quote)' \$menuentry_id_option 'acrn-hypervisor-$acrn_version-$boot_device_id' {"
fi
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
gettext_printf "Found linux image: %s\n" "$linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
"initrd-${version}" "initramfs-${version}.img" \
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" ; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
linux_entry "${OS}" "${version}" "${acrn_version}" simple \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_ACRN} ${GRUB_CMDLINE_ACRN_DEFAULT}"
submenu_indentation="$grub_tab$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
# TRANSLATORS: %s is replaced with an OS name
echo "submenu '$(gettext_printf "Advanced options for %s (with ACRN hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
echo " submenu '$(gettext_printf "ACRN hypervisor, version %s" "${acrn_version}" | grub_quote)' \$menuentry_id_option 'acrn-hypervisor-$acrn_version-$boot_device_id' {"
is_top_level=false
fi
linux_entry "${OS}" "${version}" "${acrn_version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_ACRN} ${GRUB_CMDLINE_ACRN_DEFAULT}"
for supported_init in ${SUPPORTED_INITS}; do
init_path="${supported_init#*:}"
if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
linux_entry "${OS}" "${version}" "${acrn_version}" "init-${supported_init%%:*}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "init=${init_path} ${GRUB_CMDLINE_ACRN} ${GRUB_CMDLINE_ACRN_DEFAULT}"
fi
done
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" "${acrn_version}" recovery \
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_ACRN}"
fi
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
done
if [ x"$is_top_level" != xtrue ]; then
echo ' }'
fi
acrn_list=`echo $acrn_list | tr ' ' '\n' | fgrep -vx "$current_acrn" | tr '\n' ' '`
done
# If at least one kernel was found, then we need to
# add a closing '}' for the submenu command.
if [ x"$is_top_level" != xtrue ]; then
echo '}'
fi
echo "$title_correction_code"

35
debian/grub/acrn.cfg vendored Normal file
View File

@ -0,0 +1,35 @@
# When running update-grub with the ACRN hypervisor installed, there are
# some additional variables that can be used to pass options to the
# hypervisor or the SOS kernel.
#
# The configuration in here makes it possible to have different options set
# for the linux kernel when booting with or without ACRN.
echo "Including ACRN overrides from /etc/default/grub.d/acrn.cfg"
#######################################################################
# SOS Kernel Command Line Options
#
# The next options are used for creating additional kernel arguments for
# SOS kernel. ACRN already has built-in parameters so be careful
# in what you add!
#
#GRUB_CMDLINE_LINUX_ACRN_REPLACE_DEFAULT=""
#GRUB_CMDLINE_LINUX_ACRN_REPLACE=""
# Make booting into ACRN the default. Set the following variable to 0 or 1
# explicitly to avoid the message warning from being printed.
#
#ACRN_OVERRIDE_GRUB_DEFAULT=
#
if [ "$ACRN_OVERRIDE_GRUB_DEFAULT" = "" ]; then
echo "WARNING: GRUB_DEFAULT changed to boot into ACRN by default!"
echo " Edit /etc/default/grub.d/acrn.cfg to avoid this warning."
ACRN_OVERRIDE_GRUB_DEFAULT=1
fi
if [ "$ACRN_OVERRIDE_GRUB_DEFAULT" = "1" ]; then
GRUB_DEFAULT=$( \
printf "$(gettext "%s, with ACRN hypervisor")" \
"$GRUB_DISTRIBUTOR GNU/Linux")
fi

9
debian/lifemngr/acrn-lifemngr.conf vendored Normal file
View File

@ -0,0 +1,9 @@
# ACRN lifemngr invocation configuration file
# set the following items accordingly to override default:
# Use 'sos' or 'uos' here. Usually detect automatically.
# LIFEMNGR_VM=<vm type>
# Use the respective serial port here:
# LIFEMNGR_TTY=<serial port device>

14
debian/lifemngr/start-acrn-lifemngr.sh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# helper to start ACRN lifemnr according to VM type
LIFEMNGR_CONF=/usr/share/acrn-lifemngr/acrn-lifemngr.conf
# eventually include configuration for overriding default configuration
if [ -f ${LIFEMNGR_CONF} ]; then
. ${LIFEMNGR_CONF}
fi
LIFEMNGR_VM=${LIFEMNGR_VM:-$(if [ -c /dev/acrn_hsm ]; then echo sos; else echo uos; fi)}
LIFEMNGR_TTY=${LIFEMNGR_TTY:-/dev/ttyS1}
/usr/bin/acrn-lifemngr ${LIFEMNGR_VM} ${LIFEMNGR_TTY}

4
debian/not-installed vendored Normal file
View File

@ -0,0 +1,4 @@
lib/systemd/network/*
lib/systemd/system/acrn_guest.service
usr/lib/acrn/*

View File

@ -0,0 +1,2 @@
# manpages are missing in upstream
python3-acrn-board-inspector: no-manual-page usr/bin/acrn-board-inspector

328
debian/rules vendored Executable file
View File

@ -0,0 +1,328 @@
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/vendor.mk
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# python packages do not contain any tests
export PYBUILD_DISABLE=test
export MAKEFLAGS = --no-print-directory
# set these variables to restrict build to certain boards/scenarios, e.g.
ACRN_BOARDLIST := whl-ipc-i5 nuc11tnbi5 cfl-k700-i7 tgl-vecow-spc-7100-Corei7
ACRN_SCENARIOLIST := partitioned shared hybrid hybrid_rt
# alternatively, unset ACRN_BOARDLIST to build for all boards,
# ACRN_SCENARIOLIST must be set explicitly: scenario configs must be located
# in the same directory as the board config, since there are no board and
# scenario attributes any more in the scenario configs since
# commit c25de24a92c26faa59e7d5e23966dd54215b66e4
#
# undefine ACRN_BOARDLIST
# undefine ACRN_SCENARIOLIST
# helper to compare strings
strequ=$(if $(subst x$1,,x$2)$(subst x$2,,x$1),,1)
bold := $(shell which tput >/dev/null 2>&1 && tput bold 2>/dev/null)
sgr0 := $(shell which tput >/dev/null 2>&1 && tput sgr0 2>/dev/null)
# special characters
empty :=
space := $(empty) $(empty)
comma := ,
# helper to create comma separated list from space separated list
commasep = $(subst $(space),$(comma)$(space),$1)
# recursive wildcard
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
# add builtin and eventually explicitely provided config directories
# misc/config_tools/data: contains ACRN supported configuration
# debian/configs: add additional configurations here!
CONFIGDIRS = misc/config_tools/data debian/configs
CONFIGXMLS := $(call rwildcard,$(CONFIGDIRS),*.xml)
# remove double quotes
unquote = $(subst $\",,$1)
# get relevant data from acrn-config attributes of an XML
#
# This evaluates the attributes of acn-config tag got from xmllint (after unquoting).
# It create the following variables:
# * boardlist: accumulated list of all board configurations detected
# * scenariolist_<board>: accumulated list of sceanrios for the given <board>
# * config_<board>: respective board configuration file
# * config_<board>_<scenario>: respective scenario configuration file
# Launcher configurations are not used and therefore ignored
define get-xml-data
$(eval $(call unquote,$(shell xmllint --xpath '/acrn-config/@board' $1)))
$(foreach expr,$(shell xmllint --xpath '/acrn-config/@*' $1),$(eval $(call unquote,$(expr))))
$(eval $(if $(user_vm_launcher),, \
$(if $(scenario), \
config_$(board)_$(scenario) := $1, \
config_$(board) := $1 \
) \
))
$(eval $(if $(user_vm_launcher),, \
$(if $(scenario), \
scenariolist_$(board) := $(sort $(scenariolist_$(board)) $(scenario)), \
boardlist := $(sort $(boardlist) $(board)) \
) \
))
$(eval undefine user_vm_launcher)
$(eval undefine scenario)
$(eval undefine board)
endef
# get all XML data
$(foreach xml,$(CONFIGXMLS),$(call get-xml-data,$(xml)))
# honor variable ACRN_BOARDLIST
ifneq ($(ACRN_BOARDLIST),)
boardlist := $(sort $(ACRN_BOARDLIST))
endif
# honor variable ACRN_SCENARIOLIST
ifneq ($(ACRN_SCENARIOLIST),)
$(foreach b,$(boardlist),$(eval scenariolist_$(b) := $(filter $(scenariolist_$(b)),$(ACRN_SCENARIOLIST))))
endif
# board config name -> board config file
bfile = $(abspath $(config_$1))
# board/scenario config name -> scenario config file
sfile = $(abspath $(config_$1_$2))
# uncomment for debugging purposes
# $(info boardlist: $(boardlist))
# $(foreach b,$(boardlist),$(info scenariolist_$(b): $(scenariolist_$(b))))
# $(foreach b,$(boardlist),$(info config_$(b): $(config_$(b))))
# $(foreach b,$(boardlist),$(foreach s,$(scenariolist_$(b)),$(info config_$(b)_$(s): $(config_$(b)_$(s)))))
# get version data for ACRN
include VERSION
export ACRNVERSION := $(MAJOR_VERSION).$(MINOR_VERSION)
# for now build the debug versions
export RELEASE ?= 0
# set paths (see also paths.make)
export prefix = /usr
export bindir = $(prefix)/bin
export libdir = $(prefix)/lib/$(DEB_HOST_MULTIARCH)
export nonarchlibdir = $(prefix)/lib
export datadir = $(prefix)/share
export includedir = $(prefix)/include
export systemd_unitdir = /lib/systemd
export docdir = $(datadir)/doc
export sysconfdir = /etc
export BUILD_VERSION = "$(DEB_VERSION_UPSTREAM)"
export BUILD_TAG = "$(DEB_VENDOR)/$(DEB_VERSION)"
# set iASL compiler
ifeq ($(ASL_COMPILER),)
export ASL_COMPILER:=$(shell which iasl)
ifeq ($(ASL_COMPILER),)
$(error ASL_COMPILER missing)
endif
endif
# let make verbosity be controlled by DH_VERBOSE
ifeq ($(DH_VERBOSE),1)
Q=
echo-verbose = echo " $@$(if $1,: $(bold)$1$(sgr0))"
echo-silent = true
devnull =
else
Q=@
echo-verbose = true
echo-silent = echo " $@$(if $1,: $(bold)$1$(sgr0))"
devnull = >/dev/null
endif
### dh_installdeb ############################################################
debian/acrn-hypervisor.postinst: debian/acrn-hypervisor.postinst.in
@$(call echo-verbose)
@$(call echo-silent,CREATE $@)
$(Q)sed -e 's/@acrnversion@/$(ACRNVERSION)/g' \
-e 's%@acrndir@%$(libdir)/acrn%g' $< > $@
debian/acrn-hypervisor.postrm: debian/acrn-hypervisor.postrm.in
@$(call echo-verbose)
@$(call echo-silent,CREATE $@)
$(Q)sed -e 's/@acrnversion@/$(ACRNVERSION)/g' $< > $@
debian/acrn-hypervisor.prerm: debian/acrn-hypervisor.prerm.in
@$(call echo-verbose)
@$(call echo-silent,CREATE $@)
$(Q)sed -e 's/@acrnversion@/$(ACRNVERSION)/g' $< > $@
override_dh_installdeb: debian/acrn-hypervisor.postinst debian/acrn-hypervisor.postrm debian/acrn-hypervisor.prerm
$(Q)dh_installdeb
### dh_installdebconf-arch ###################################################
debian/acrn-hypervisor.templates: debian/acrn-hypervisor.templates.in
@$(call echo-verbose)
@$(call echo-silent,CREATE $@)
$(Q)sed -e 's/@boardlist@/$(call commasep,$(boardlist))/g' $< > $@
override_dh_installdebconf-arch: debian/acrn-hypervisor.templates
$(Q)dh_installdebconf -a
### build-arch ###############################################################
override_dh_auto_build-arch: O=build
override_dh_auto_build-arch:
@$(call echo-verbose)
@# Only build lifemngr here, since other parts are built during
@# dh_auto_install (even if built here). This is deficiency
@# of ACRN's makefile structure, e.g. make hypervisor-install
@# always rebuilds the hypervisor, even if built with
@# make hypervisor in a previous step.
$(Q)set -e; $(call echo-silent,BUILD life_mngr)
$(Q)mkdir -p $(O)/common/misc
$(Q)$(MAKE) -C misc \
OUT_DIR=$(abspath $(O)/common/misc) \
life_mngr $(devnull)
### build-indep ##############################################################
ifeq ($(EXTRA_VERSION),)
ACRN_DOC_VERSION := $(DEB_VERSION_UPSTREAM)
else
ACRN_DOC_VERSION := latest
endif
build/documentation/html/index.html: debian/acrn-doc-index-html.in
@$(call echo-verbose)
@$(call echo-silent,BUILD documentation)
$(Q)mkdir -p $(@D)
$(Q)sed -e 's/@acrnversion@/$(ACRN_DOC_VERSION)/g' $< > $@
override_dh_auto_build-indep: build/documentation/html/index.html
@$(call echo-verbose)
@$(call echo-silent,BUILD acrn-board-inspector)
$(Q)export PYBUILD_NAME=acrn_board_inspector; \
dh_auto_build \
--buildsystem=pybuild \
--package=python3-acrn-board-inspector \
--sourcedirectory=debian/acrn-board-inspector $(devnull)
### binary-arch ##############################################################
override_dh_auto_install-arch: O=build
override_dh_auto_install-arch: DESTDIR=$(abspath debian/tmp)
override_dh_auto_install-arch:
@$(call echo-verbose)
$(Q)set -e;$(foreach b,$(boardlist),$(foreach s,$(scenariolist_$b),\
$(call echo-silent,BUILD & INSTALL hypervisor for $b:$s); \
$(MAKE) O=$(O)/$b/$s \
BOARD=$(call bfile,$b) \
SCENARIO=$(call sfile,$b,$s) \
DESTDIR=$(DESTDIR) \
hypervisor-install $(devnull); \
install -d $(DESTDIR)$(libdir)/acrn/$b/$s; \
rm -f $(DESTDIR)$(libdir)/acrn/*.out; \
mv $(DESTDIR)$(libdir)/acrn/*.bin \
$(DESTDIR)$(libdir)/acrn/$b/$s; \
if [ -d $(DESTDIR)$(sysconfdir) ]; then \
mv $(DESTDIR)$(sysconfdir) \
$(DESTDIR)$(libdir)/acrn/$b/$s; \
fi; \
if [ -d $(DESTDIR)$(libdir)/acrn/acpi ]; then \
mv $(DESTDIR)$(libdir)/acrn/acpi \
$(DESTDIR)$(libdir)/acrn/$b/$s; \
fi; \
cp $(O)/$b/$s/hypervisor/configs/config.mk \
$(DESTDIR)$(libdir)/acrn/$b/$s/acrn.$b.$s.config;\
cp $(O)/$b/$s/hypervisor/acrn.map \
$(DESTDIR)$(libdir)/acrn/$b/$s/acrn.$b.$s.map; \
chmod 644 $(DESTDIR)$(libdir)/acrn/$b/$s/*.bin; \
if [ -d $(DESTDIR)$(libdir)/acrn/$b/$s/acpi ]; then \
chmod 644 $(DESTDIR)$(libdir)/acrn/$b/$s/acpi/*;\
fi; \
))
@:
@# install devicemodel & tools
@$(call echo-silent,BUILD & INSTALL devicemodel & tools)
$(Q)$(MAKE) O=$(O)/common DESTDIR=$(DESTDIR) devicemodel-install $(devnull)
$(Q)$(MAKE) O=$(O)/common DESTDIR=$(DESTDIR) tools-install $(devnull)
@:
@# install life_mngr
@$(call echo-silent,INSTALL devicemodel & tools)
$(Q)install -d $(DESTDIR)$(bindir)
@# install life_mngr as acrn-lifemngr
$(Q)install -m 0755 -T $(O)/common/misc/services/life_mngr $(DESTDIR)$(bindir)/acrn-lifemngr
@# install invocation helper and config
$(Q)install -d $(DESTDIR)$(datadir)/acrn-lifemngr
$(Q)install -m 0755 debian/lifemngr/start-acrn-lifemngr.sh $(DESTDIR)$(datadir)/acrn-lifemngr
$(Q)install -m 0644 debian/lifemngr/acrn-lifemngr.conf $(DESTDIR)$(datadir)/acrn-lifemngr
@:
@# move/adapt network configs as examples only
$(Q)mkdir -p $(DESTDIR)$(docdir)/acrnd/examples
$(Q)cp $(DESTDIR)$(systemd_unitdir)/network/* \
$(DESTDIR)$(docdir)/acrnd/examples
$(Q)sed -i 's/acrn_tap\* //g' \
$(DESTDIR)$(docdir)/acrnd/examples/50-acrn.network
@:
@# remove acrnd.service, use explicitly provided service file instead
$(Q)rm -f $(DESTDIR)$(systemd_unitdir)/system/acrnd.service
@:
@# move devicemodel samples
$(Q)mkdir -p $(DESTDIR)$(docdir)/acrn-devicemodel
$(Q)mv $(DESTDIR)$(datadir)/acrn/samples \
$(DESTDIR)$(docdir)/acrn-devicemodel
@:
@# adapt systemd services for tools (available in DEBUG build only)
$(if $(call strequ,${RELEASE},0), \
$(Q)sed -i -e '/telemd.socket/d' -e '/prepare.service/d' \
$(DESTDIR)$(systemd_unitdir)/system/acrnprobe.service; \
sed -i '/telemd/d' \
$(DESTDIR)$(systemd_unitdir)/system/usercrash.service; \
)
### binary-indep #############################################################
override_dh_auto_install-indep: O=build
override_dh_auto_install-indep: DESTDIR=$(abspath debian/tmp)
override_dh_auto_install-indep:
@$(call echo-verbose)
@$(call echo-silent,INSTALL acrn-board-inspector)
$(Q)export PYBUILD_NAME=acrn_board_inspector; \
dh_auto_install \
--buildsystem=pybuild \
--package=python3-acrn-board-inspector \
--sourcedirectory=debian/acrn-board-inspector $(devnull)
@:
@$(call echo-silent,INSTALL documentation)
$(Q)mkdir -p ${DESTDIR}$(docdir)/acrn/
$(Q)cp -a $(O)/documentation/html ${DESTDIR}$(docdir)/acrn/
### dh_missing ###############################################################
# there is no libtelemetry used
override_dh_missing:
$(Q)dh_missing --fail-missing -Xusr/share/defaults/telemetrics/acrnprobe.xml
### dh_strip #################################################################
# only strip release variant binaries
override_dh_strip: DESTDIR=$(abspath debian/tmp)
override_dh_strip:
$(Q)dh_strip -X.out -X.bin
$(Q)strip --strip-debug \
--remove-section=.comment \
--remove-section=.note \
--enable-deterministic-archiv \
$(DESTDIR)$(libdir)/libacrn-mngr.a;
### clean ####################################################################
override_dh_auto_clean:
@echo "Building ACRN $(ACRNVERSION) for boards: $(bold)$(call commasep,$(boardlist))$(sgr0)"
@echo "The scenarios used are:"
@$(foreach b,$(boardlist),echo " $b: $(bold)$(call commasep,$(scenariolist_$b))$(sgr0)";)
@$(call echo-verbose)
@$(call echo-silent,CLEAN)
$(Q)dh_auto_clean $(devnull)
### others ###################################################################
%:
$(Q)dh $@ --with python3

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

5
debian/source/lintian-overrides vendored Normal file
View File

@ -0,0 +1,5 @@
# ???
source-is-missing doc/static/js/modernizr.min.js
# we do not (yet) translate templates
untranslatable-debconf-templates