Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -0,0 +1,12 @@
|
||||
Different components of meta-phosphor are under different licenses (a mix
|
||||
of MIT and Apache-2.0). Please see:
|
||||
|
||||
COPYING.Apache-2.0
|
||||
COPYING.MIT (MIT)
|
||||
|
||||
All metadata is MIT licensed unless otherwise stated. Source code
|
||||
included in tree for individual recipes is under the LICENSE stated in
|
||||
the associated recipe (.bb file) unless otherwise stated.
|
||||
|
||||
License information for any other files is either explicitly stated
|
||||
or defaults to Apache-2.0.
|
||||
@@ -0,0 +1,10 @@
|
||||
owners:
|
||||
- bradleyb@fuzziesquirrel.com
|
||||
- edtanous@google.com
|
||||
- geissonator@yahoo.com
|
||||
- patrick@stwcx.xyz
|
||||
|
||||
matchers:
|
||||
- partial_regex: recipes-phosphor/initrdscripts
|
||||
reviewers:
|
||||
- zev@bewilderbeest.net
|
||||
@@ -0,0 +1,6 @@
|
||||
OpenBMC
|
||||
================
|
||||
|
||||
meta-phosphor is the OpenBMC layer. This layer should be included for all
|
||||
OpenBMC systems. The OpenBMC layer contains content which is shared between all
|
||||
OpenBMC systems.
|
||||
@@ -0,0 +1,2 @@
|
||||
dbus_system_confdir="${datadir}/dbus-1/system.d/"
|
||||
dbus_system_servicesdir="${datadir}/dbus-1/system-services/"
|
||||
@@ -0,0 +1,685 @@
|
||||
inherit uboot-config
|
||||
|
||||
CONVERSIONTYPES += "fitImage"
|
||||
|
||||
CONVERSION_CMD:fitImage = "run_assemble_fitimage ${IMAGE_NAME}.${type}"
|
||||
INITRAMFS_IMAGE="${IMAGE_NAME}.cpio.${INITRAMFS_CTYPE}"
|
||||
KERNEL_OUTPUT_DIR="${DEPLOY_DIR_IMAGE}"
|
||||
|
||||
do_image_cpio[depends] += "virtual/kernel:do_deploy"
|
||||
|
||||
run_assemble_fitimage() {
|
||||
export linux_comp="none"
|
||||
fitimage_assemble $1.its $1.fitImage 1
|
||||
|
||||
# The fitimage_assemble puts the image into DEPLOY_DIR_NAME due to
|
||||
# KERNEL_OUTPUT_DIR, but we really want it still in ${IMGDEPLOYDIR}, so
|
||||
# move it.
|
||||
mv ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}.fitImage .
|
||||
# Delete the spurious linux.bin created by our stubbed uboot_prep_kimage.
|
||||
rm linux.bin
|
||||
}
|
||||
|
||||
UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
|
||||
uboot_prep_kimage() {
|
||||
cp ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} linux.bin
|
||||
}
|
||||
|
||||
DEPENDS:append = " u-boot-tools-native dtc-native virtual/${TARGET_PREFIX}binutils"
|
||||
|
||||
# Description string
|
||||
FIT_DESC ?= "Kernel fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
|
||||
|
||||
# Kernel fitImage Hash Algo
|
||||
FIT_HASH_ALG ?= "sha256"
|
||||
|
||||
# Kernel fitImage Signature Algo
|
||||
FIT_SIGN_ALG ?= "rsa2048"
|
||||
|
||||
# Kernel / U-Boot fitImage Padding Algo
|
||||
FIT_PAD_ALG ?= "pkcs-1.5"
|
||||
|
||||
# Generate keys for signing Kernel fitImage
|
||||
FIT_GENERATE_KEYS ?= "0"
|
||||
|
||||
# Size of private keys in number of bits
|
||||
FIT_SIGN_NUMBITS ?= "2048"
|
||||
|
||||
# args to openssl genrsa (Default is just the public exponent)
|
||||
FIT_KEY_GENRSA_ARGS ?= "-F4"
|
||||
|
||||
# args to openssl req (Default is -batch for non interactive mode and
|
||||
# -new for new certificate)
|
||||
FIT_KEY_REQ_ARGS ?= "-batch -new"
|
||||
|
||||
# Standard format for public key certificate
|
||||
FIT_KEY_SIGN_PKCS ?= "-x509"
|
||||
|
||||
# Sign individual images as well
|
||||
FIT_SIGN_INDIVIDUAL ?= "0"
|
||||
|
||||
FIT_CONF_PREFIX ?= "conf-"
|
||||
FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name"
|
||||
|
||||
FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS header
|
||||
#
|
||||
# $1 ... .its filename
|
||||
fitimage_emit_fit_header() {
|
||||
cat << EOF >> $1
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "${FIT_DESC}";
|
||||
#address-cells = <1>;
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage section bits
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Section bit type: imagestart - image section start
|
||||
# confstart - configuration section start
|
||||
# sectend - section end
|
||||
# fitend - fitimage end
|
||||
#
|
||||
fitimage_emit_section_maint() {
|
||||
case $2 in
|
||||
imagestart)
|
||||
cat << EOF >> $1
|
||||
|
||||
images {
|
||||
EOF
|
||||
;;
|
||||
confstart)
|
||||
cat << EOF >> $1
|
||||
|
||||
configurations {
|
||||
EOF
|
||||
;;
|
||||
sectend)
|
||||
cat << EOF >> $1
|
||||
};
|
||||
EOF
|
||||
;;
|
||||
fitend)
|
||||
cat << EOF >> $1
|
||||
};
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS kernel section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to kernel image
|
||||
# $4 ... Compression type
|
||||
fitimage_emit_section_kernel() {
|
||||
|
||||
kernel_csum="${FIT_HASH_ALG}"
|
||||
kernel_sign_algo="${FIT_SIGN_ALG}"
|
||||
kernel_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
|
||||
|
||||
ENTRYPOINT="${UBOOT_ENTRYPOINT}"
|
||||
if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
|
||||
ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
|
||||
awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
|
||||
fi
|
||||
|
||||
cat << EOF >> $1
|
||||
kernel-$2 {
|
||||
description = "Linux kernel";
|
||||
data = /incbin/("$3");
|
||||
type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
os = "linux";
|
||||
compression = "$4";
|
||||
load = <${UBOOT_LOADADDRESS}>;
|
||||
entry = <$ENTRYPOINT>;
|
||||
hash-1 {
|
||||
algo = "$kernel_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$kernel_sign_keyname" ] ; then
|
||||
sed -i '$ d' $1
|
||||
cat << EOF >> $1
|
||||
signature-1 {
|
||||
algo = "$kernel_csum,$kernel_sign_algo";
|
||||
key-name-hint = "$kernel_sign_keyname";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS DTB section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to DTB image
|
||||
fitimage_emit_section_dtb() {
|
||||
|
||||
dtb_csum="${FIT_HASH_ALG}"
|
||||
dtb_sign_algo="${FIT_SIGN_ALG}"
|
||||
dtb_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
|
||||
|
||||
dtb_loadline=""
|
||||
dtb_ext=${DTB##*.}
|
||||
if [ "${dtb_ext}" = "dtbo" ]; then
|
||||
if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
|
||||
dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
|
||||
fi
|
||||
elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
|
||||
dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
|
||||
fi
|
||||
cat << EOF >> $1
|
||||
fdt-$2 {
|
||||
description = "Flattened Device Tree blob";
|
||||
data = /incbin/("$3");
|
||||
type = "flat_dt";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
compression = "none";
|
||||
$dtb_loadline
|
||||
hash-1 {
|
||||
algo = "$dtb_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$dtb_sign_keyname" ] ; then
|
||||
sed -i '$ d' $1
|
||||
cat << EOF >> $1
|
||||
signature-1 {
|
||||
algo = "$dtb_csum,$dtb_sign_algo";
|
||||
key-name-hint = "$dtb_sign_keyname";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS u-boot script section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to boot script image
|
||||
fitimage_emit_section_boot_script() {
|
||||
|
||||
bootscr_csum="${FIT_HASH_ALG}"
|
||||
bootscr_sign_algo="${FIT_SIGN_ALG}"
|
||||
bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
|
||||
|
||||
cat << EOF >> $1
|
||||
bootscr-$2 {
|
||||
description = "U-boot script";
|
||||
data = /incbin/("$3");
|
||||
type = "script";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "$bootscr_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
|
||||
sed -i '$ d' $1
|
||||
cat << EOF >> $1
|
||||
signature-1 {
|
||||
algo = "$bootscr_csum,$bootscr_sign_algo";
|
||||
key-name-hint = "$bootscr_sign_keyname";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS setup section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to setup image
|
||||
fitimage_emit_section_setup() {
|
||||
|
||||
setup_csum="${FIT_HASH_ALG}"
|
||||
|
||||
cat << EOF >> $1
|
||||
setup-$2 {
|
||||
description = "Linux setup.bin";
|
||||
data = /incbin/("$3");
|
||||
type = "x86_setup";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
load = <0x00090000>;
|
||||
entry = <0x00090000>;
|
||||
hash-1 {
|
||||
algo = "$setup_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS ramdisk section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to ramdisk image
|
||||
fitimage_emit_section_ramdisk() {
|
||||
|
||||
ramdisk_csum="${FIT_HASH_ALG}"
|
||||
ramdisk_sign_algo="${FIT_SIGN_ALG}"
|
||||
ramdisk_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
|
||||
ramdisk_loadline=""
|
||||
ramdisk_entryline=""
|
||||
|
||||
if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
|
||||
ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
|
||||
fi
|
||||
if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
|
||||
ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
|
||||
fi
|
||||
|
||||
cat << EOF >> $1
|
||||
ramdisk-$2 {
|
||||
description = "${INITRAMFS_IMAGE}";
|
||||
data = /incbin/("$3");
|
||||
type = "ramdisk";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
$ramdisk_loadline
|
||||
$ramdisk_entryline
|
||||
hash-1 {
|
||||
algo = "$ramdisk_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$ramdisk_sign_keyname" ] ; then
|
||||
sed -i '$ d' $1
|
||||
cat << EOF >> $1
|
||||
signature-1 {
|
||||
algo = "$ramdisk_csum,$ramdisk_sign_algo";
|
||||
key-name-hint = "$ramdisk_sign_keyname";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# echoes symlink destination if it points below directory
|
||||
#
|
||||
# $1 ... file that's a potential symlink
|
||||
# $2 ... expected parent directory
|
||||
symlink_points_below() {
|
||||
file="$2/$1"
|
||||
dir=$2
|
||||
|
||||
if ! [ -L "$file" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
realpath="$(realpath --relative-to=$dir $file)"
|
||||
if [ -z "${realpath%%../*}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "$realpath"
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS configuration section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Linux kernel ID
|
||||
# $3 ... DTB image name
|
||||
# $4 ... ramdisk ID
|
||||
# $5 ... u-boot script ID
|
||||
# $6 ... config ID
|
||||
# $7 ... default flag
|
||||
fitimage_emit_section_config() {
|
||||
|
||||
conf_csum="${FIT_HASH_ALG}"
|
||||
conf_sign_algo="${FIT_SIGN_ALG}"
|
||||
conf_padding_algo="${FIT_PAD_ALG}"
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
|
||||
conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
|
||||
fi
|
||||
|
||||
its_file="$1"
|
||||
kernel_id="$2"
|
||||
dtb_image="$3"
|
||||
ramdisk_id="$4"
|
||||
bootscr_id="$5"
|
||||
config_id="$6"
|
||||
default_flag="$7"
|
||||
|
||||
# Test if we have any DTBs at all
|
||||
sep=""
|
||||
conf_desc=""
|
||||
conf_node="${FIT_CONF_PREFIX}"
|
||||
kernel_line=""
|
||||
fdt_line=""
|
||||
ramdisk_line=""
|
||||
bootscr_line=""
|
||||
setup_line=""
|
||||
default_line=""
|
||||
|
||||
dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}")
|
||||
if [ -z "$dtb_image_sect" ]; then
|
||||
dtb_image_sect=$dtb_image
|
||||
fi
|
||||
|
||||
dtb_image=$(echo $dtb_image | tr '/' '_')
|
||||
dtb_image_sect=$(echo "${dtb_image_sect}" | tr '/' '_')
|
||||
|
||||
# conf node name is selected based on dtb ID if it is present,
|
||||
# otherwise its selected based on kernel ID
|
||||
if [ -n "$dtb_image" ]; then
|
||||
conf_node=$conf_node$dtb_image
|
||||
else
|
||||
conf_node=$conf_node$kernel_id
|
||||
fi
|
||||
|
||||
if [ -n "$kernel_id" ]; then
|
||||
conf_desc="Linux kernel"
|
||||
sep=", "
|
||||
kernel_line="kernel = \"kernel-$kernel_id\";"
|
||||
fi
|
||||
|
||||
if [ -n "$dtb_image" ]; then
|
||||
conf_desc="$conf_desc${sep}FDT blob"
|
||||
sep=", "
|
||||
fdt_line="fdt = \"fdt-$dtb_image_sect\";"
|
||||
fi
|
||||
|
||||
if [ -n "$ramdisk_id" ]; then
|
||||
conf_desc="$conf_desc${sep}ramdisk"
|
||||
sep=", "
|
||||
ramdisk_line="ramdisk = \"ramdisk-$ramdisk_id\";"
|
||||
fi
|
||||
|
||||
if [ -n "$bootscr_id" ]; then
|
||||
conf_desc="$conf_desc${sep}u-boot script"
|
||||
sep=", "
|
||||
bootscr_line="bootscr = \"bootscr-$bootscr_id\";"
|
||||
fi
|
||||
|
||||
if [ -n "$config_id" ]; then
|
||||
conf_desc="$conf_desc${sep}setup"
|
||||
setup_line="setup = \"setup-$config_id\";"
|
||||
fi
|
||||
|
||||
if [ "$default_flag" = "1" ]; then
|
||||
# default node is selected based on dtb ID if it is present,
|
||||
# otherwise its selected based on kernel ID
|
||||
if [ -n "$dtb_image" ]; then
|
||||
default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
|
||||
else
|
||||
default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
|
||||
fi
|
||||
fi
|
||||
|
||||
cat << EOF >> $its_file
|
||||
$default_line
|
||||
$conf_node {
|
||||
description = "$default_flag $conf_desc";
|
||||
$kernel_line
|
||||
$fdt_line
|
||||
$ramdisk_line
|
||||
$bootscr_line
|
||||
$setup_line
|
||||
hash-1 {
|
||||
algo = "$conf_csum";
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ -n "$conf_sign_keyname" ] ; then
|
||||
|
||||
sign_line="sign-images = "
|
||||
sep=""
|
||||
|
||||
if [ -n "$kernel_id" ]; then
|
||||
sign_line="$sign_line${sep}\"kernel\""
|
||||
sep=", "
|
||||
fi
|
||||
|
||||
if [ -n "$dtb_image" ]; then
|
||||
sign_line="$sign_line${sep}\"fdt\""
|
||||
sep=", "
|
||||
fi
|
||||
|
||||
if [ -n "$ramdisk_id" ]; then
|
||||
sign_line="$sign_line${sep}\"ramdisk\""
|
||||
sep=", "
|
||||
fi
|
||||
|
||||
if [ -n "$bootscr_id" ]; then
|
||||
sign_line="$sign_line${sep}\"bootscr\""
|
||||
sep=", "
|
||||
fi
|
||||
|
||||
if [ -n "$config_id" ]; then
|
||||
sign_line="$sign_line${sep}\"setup\""
|
||||
fi
|
||||
|
||||
sign_line="$sign_line;"
|
||||
|
||||
cat << EOF >> $its_file
|
||||
signature-1 {
|
||||
algo = "$conf_csum,$conf_sign_algo";
|
||||
key-name-hint = "$conf_sign_keyname";
|
||||
padding = "$conf_padding_algo";
|
||||
$sign_line
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF >> $its_file
|
||||
};
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# Assemble fitImage
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... fitImage name
|
||||
# $3 ... include ramdisk
|
||||
fitimage_assemble() {
|
||||
kernelcount=1
|
||||
dtbcount=""
|
||||
DTBS=""
|
||||
ramdiskcount=$3
|
||||
setupcount=""
|
||||
bootscr_id=""
|
||||
rm -f $1 ${KERNEL_OUTPUT_DIR}/$2
|
||||
|
||||
if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
|
||||
bbfatal "Keys used to sign images and configuration nodes must be different."
|
||||
fi
|
||||
|
||||
fitimage_emit_fit_header $1
|
||||
|
||||
#
|
||||
# Step 1: Prepare a kernel image section.
|
||||
#
|
||||
fitimage_emit_section_maint $1 imagestart
|
||||
|
||||
uboot_prep_kimage
|
||||
fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
|
||||
|
||||
#
|
||||
# Step 2: Prepare a DTB image section
|
||||
#
|
||||
|
||||
if [ -n "${KERNEL_DEVICETREE}" ]; then
|
||||
dtbcount=1
|
||||
for DTB in ${KERNEL_DEVICETREE}; do
|
||||
if echo $DTB | grep -q '/dts/'; then
|
||||
bbwarn "$DTB contains the full path to the the dts file, but only the dtb name should be used."
|
||||
DTB=`basename $DTB | sed 's,\.dts$,.dtb,g'`
|
||||
fi
|
||||
|
||||
# Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
|
||||
if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
DTB_PATH="${KERNEL_OUTPUT_DIR}/dts/$DTB"
|
||||
if [ ! -e "$DTB_PATH" ]; then
|
||||
DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB"
|
||||
fi
|
||||
|
||||
# Skip DTB if we've picked it up previously
|
||||
echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
|
||||
|
||||
DTBS="$DTBS $DTB"
|
||||
DTB=$(echo $DTB | tr '/' '_')
|
||||
fitimage_emit_section_dtb $1 $DTB $DTB_PATH
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
|
||||
dtbcount=1
|
||||
for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
|
||||
# Skip DTB if we've picked it up previously
|
||||
echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
|
||||
|
||||
DTBS="$DTBS $DTB"
|
||||
|
||||
# Also skip if a symlink. We'll later have each config section point at it
|
||||
[ $(symlink_points_below $DTB "${EXTERNAL_KERNEL_DEVICETREE}") ] && continue
|
||||
|
||||
DTB=$(echo $DTB | tr '/' '_')
|
||||
fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
|
||||
done
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 3: Prepare a u-boot script section
|
||||
#
|
||||
|
||||
if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
|
||||
if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
|
||||
cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
|
||||
bootscr_id="${UBOOT_ENV_BINARY}"
|
||||
fitimage_emit_section_boot_script $1 "$bootscr_id" ${UBOOT_ENV_BINARY}
|
||||
else
|
||||
bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 4: Prepare a setup section. (For x86)
|
||||
#
|
||||
if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
|
||||
setupcount=1
|
||||
fitimage_emit_section_setup $1 $setupcount ${KERNEL_OUTPUT_DIR}/setup.bin
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 5: Prepare a ramdisk section.
|
||||
#
|
||||
if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
|
||||
# Find and use the first initramfs image archive type we find
|
||||
found=
|
||||
for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
|
||||
initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
|
||||
if [ -e "$initramfs_path" ]; then
|
||||
bbnote "Found initramfs image: $initramfs_path"
|
||||
found=true
|
||||
fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
|
||||
break
|
||||
else
|
||||
bbnote "Did not find initramfs image: $initramfs_path"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$found" ] && [ -e ${INITRAMFS_IMAGE} ]; then
|
||||
found=true
|
||||
bbnote "Found initramfs image: ${INITRAMFS_IMAGE}"
|
||||
fitimage_emit_section_ramdisk $1 "$ramdiskcount" "${INITRAMFS_IMAGE}"
|
||||
fi
|
||||
|
||||
if [ -z "$found" ]; then
|
||||
bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
|
||||
fi
|
||||
fi
|
||||
|
||||
fitimage_emit_section_maint $1 sectend
|
||||
|
||||
# Force the first Kernel and DTB in the default config
|
||||
kernelcount=1
|
||||
if [ -n "$dtbcount" ]; then
|
||||
dtbcount=1
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 6: Prepare a configurations section
|
||||
#
|
||||
fitimage_emit_section_maint $1 confstart
|
||||
|
||||
# kernel-fitimage.bbclass currently only supports a single kernel (no less or
|
||||
# more) to be added to the FIT image along with 0 or more device trees and
|
||||
# 0 or 1 ramdisk.
|
||||
# It is also possible to include an initramfs bundle (kernel and rootfs in one binary)
|
||||
# When the initramfs bundle is used ramdisk is disabled.
|
||||
# If a device tree is to be part of the FIT image, then select
|
||||
# the default configuration to be used is based on the dtbcount. If there is
|
||||
# no dtb present than select the default configuation to be based on
|
||||
# the kernelcount.
|
||||
if [ -n "$DTBS" ]; then
|
||||
i=1
|
||||
for DTB in ${DTBS}; do
|
||||
dtb_ext=${DTB##*.}
|
||||
if [ "$dtb_ext" = "dtbo" ]; then
|
||||
fitimage_emit_section_config $1 "" "$DTB" "" "$bootscr_id" "" "`expr $i = $dtbcount`"
|
||||
else
|
||||
fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`"
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
else
|
||||
defaultconfigcount=1
|
||||
fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount
|
||||
fi
|
||||
|
||||
fitimage_emit_section_maint $1 sectend
|
||||
|
||||
fitimage_emit_section_maint $1 fitend
|
||||
|
||||
#
|
||||
# Step 7: Assemble the image
|
||||
#
|
||||
${UBOOT_MKIMAGE} \
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
-f $1 \
|
||||
${KERNEL_OUTPUT_DIR}/$2
|
||||
|
||||
#
|
||||
# Step 8: Sign the image
|
||||
#
|
||||
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
|
||||
${UBOOT_MKIMAGE_SIGN} \
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
-F -k "${UBOOT_SIGN_KEYDIR}" \
|
||||
-r ${KERNEL_OUTPUT_DIR}/$2 \
|
||||
${UBOOT_MKIMAGE_SIGN_ARGS}
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,761 @@
|
||||
# Base image class extension, inlined into every image.
|
||||
|
||||
inherit image_version
|
||||
|
||||
FIT_IMAGE_INHERIT=""
|
||||
FIT_IMAGE_INHERIT:df-obmc-static-norootfs = "fit-image"
|
||||
inherit ${FIT_IMAGE_INHERIT}
|
||||
|
||||
# Phosphor image types
|
||||
#
|
||||
# Phosphor OpenBMC supports a fixed partition mtd layout,
|
||||
# A dynamic mtd with ubi layout, and a tar file for use with
|
||||
# The reference BMC software update implementation.
|
||||
|
||||
# Image composition
|
||||
FLASH_KERNEL_IMAGE ?= "fitImage-${INITRAMFS_IMAGE}-${MACHINE}-${MACHINE}"
|
||||
FLASH_KERNEL_IMAGE:df-obmc-ubi-fs ?= "fitImage-${MACHINE}.bin"
|
||||
|
||||
IMAGE_BASETYPE ?= "squashfs-xz"
|
||||
IMAGE_BASETYPE:df-obmc-static-norootfs ?= "cpio"
|
||||
OVERLAY_BASETYPE ?= "jffs2"
|
||||
FLASH_UBI_BASETYPE ?= "${IMAGE_BASETYPE}"
|
||||
FLASH_UBI_OVERLAY_BASETYPE ?= "ubifs"
|
||||
FLASH_EXT4_BASETYPE ?= "ext4"
|
||||
FLASH_EXT4_OVERLAY_BASETYPE ?= "ext4"
|
||||
|
||||
PHOSPHOR_IMAGE_TYPES += " \
|
||||
mtd-static \
|
||||
mtd-static-alltar \
|
||||
mtd-static-tar \
|
||||
mtd-static-norootfs \
|
||||
mtd-ubi \
|
||||
mtd-ubi-tar \
|
||||
mmc-ext4-tar \
|
||||
"
|
||||
IMAGE_TYPES += "${PHOSPHOR_IMAGE_TYPES}"
|
||||
IMAGE_TYPES_MASKED += "${PHOSPHOR_IMAGE_TYPES}"
|
||||
|
||||
IMAGE_TYPEDEP:mtd-static = "${IMAGE_BASETYPE}"
|
||||
IMAGE_TYPEDEP:mtd-static-tar = "${IMAGE_BASETYPE}"
|
||||
IMAGE_TYPEDEP:mtd-static-alltar = "mtd-static"
|
||||
IMAGE_TYPEDEP:mtd-static-norootfs = "${IMAGE_BASETYPE}"
|
||||
IMAGE_TYPEDEP:mtd-ubi = "${FLASH_UBI_BASETYPE}"
|
||||
IMAGE_TYPEDEP:mtd-ubi-tar = "${FLASH_UBI_BASETYPE}"
|
||||
IMAGE_TYPEDEP:mmc-ext4-tar = "${FLASH_EXT4_BASETYPE}"
|
||||
|
||||
# Flash characteristics in KB unless otherwise noted
|
||||
DISTROOVERRIDES .= ":flash-${FLASH_SIZE}"
|
||||
FLASH_PEB_SIZE ?= "64"
|
||||
# Flash page and overhead sizes in bytes
|
||||
FLASH_PAGE_SIZE ?= "1"
|
||||
FLASH_NOR_UBI_OVERHEAD ?= "64"
|
||||
|
||||
# Fixed partition offsets
|
||||
FLASH_UBOOT_SPL_SIZE ?= "64"
|
||||
FLASH_UBOOT_OFFSET ?= "0"
|
||||
FLASH_MANIFEST_OFFSET ?= "380"
|
||||
FLASH_MANIFEST_OFFSET:flash-65536 ?= "888"
|
||||
FLASH_MANIFEST_OFFSET:flash-131072 ?= "888"
|
||||
FLASH_UBOOT_ENV_OFFSET ?= "384"
|
||||
FLASH_UBOOT_ENV_OFFSET:flash-65536 ?= "896"
|
||||
FLASH_UBOOT_ENV_OFFSET:flash-131072 ?= "896"
|
||||
FLASH_KERNEL_OFFSET ?= "512"
|
||||
FLASH_KERNEL_OFFSET:flash-65536 ?= "1024"
|
||||
FLASH_KERNEL_OFFSET:flash-131072 ?= "1024"
|
||||
FLASH_UBI_OFFSET ?= "${FLASH_KERNEL_OFFSET}"
|
||||
FLASH_ROFS_OFFSET ?= "4864"
|
||||
FLASH_ROFS_OFFSET:flash-65536 ?= "10240"
|
||||
FLASH_ROFS_OFFSET:flash-131072 ?= "10240"
|
||||
FLASH_RWFS_OFFSET ?= "28672"
|
||||
FLASH_RWFS_OFFSET:flash-65536 ?= "43008"
|
||||
FLASH_RWFS_OFFSET:flash-131072 ?= "98304"
|
||||
|
||||
# UBI volume sizes in KB unless otherwise noted.
|
||||
FLASH_UBI_RWFS_SIZE ?= "6144"
|
||||
FLASH_UBI_RWFS_SIZE:flash-131072 ?= "32768"
|
||||
FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB"
|
||||
FLASH_UBI_RWFS_TXT_SIZE:flash-131072 ?= "32MiB"
|
||||
|
||||
# eMMC sizes in KB unless otherwise noted.
|
||||
MMC_UBOOT_SIZE ?= "1024"
|
||||
MMC_BOOT_PARTITION_SIZE ?= "65536"
|
||||
|
||||
SIGNING_PUBLIC_KEY ?= ""
|
||||
SIGNING_PUBLIC_KEY_TYPE = "${@os.path.splitext(os.path.basename('${SIGNING_PUBLIC_KEY}'))[0]}"
|
||||
|
||||
SIGNING_KEY ?= "${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv"
|
||||
INSECURE_KEY = "${@'${SIGNING_KEY}' == '${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv'}"
|
||||
SIGNING_KEY_DEPENDS = "${@oe.utils.conditional('INSECURE_KEY', 'True', 'phosphor-insecure-signing-key-native:do_populate_sysroot', '', d)}"
|
||||
|
||||
VERSION_PURPOSE ?= "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"
|
||||
|
||||
UBOOT_SUFFIX ?= "bin"
|
||||
|
||||
IMAGE_NAME_SUFFIX=""
|
||||
|
||||
python() {
|
||||
# Compute rwfs LEB count and LEB size.
|
||||
page_size = d.getVar('FLASH_PAGE_SIZE', True)
|
||||
nor_overhead_size = d.getVar('FLASH_NOR_UBI_OVERHEAD', True)
|
||||
overhead_size = max(int(page_size), int(nor_overhead_size))
|
||||
peb_size = d.getVar('FLASH_PEB_SIZE', True)
|
||||
leb_size = (int(peb_size) * 1024) - (2 * overhead_size)
|
||||
d.setVar('FLASH_LEB_SIZE', str(leb_size)) # In bytes
|
||||
|
||||
rwfs_size = d.getVar('FLASH_UBI_RWFS_SIZE', True)
|
||||
rwfs_size = int(rwfs_size) * 1024
|
||||
lebs = int((rwfs_size + leb_size - 1) / leb_size) # Rounding up
|
||||
d.setVar('FLASH_UBI_RWFS_LEBS', str(lebs))
|
||||
}
|
||||
|
||||
# Allow rwfs mkfs configuration through OVERLAY_MKFS_OPTS and OVERRIDES. However,
|
||||
# avoid setting 'ext4' or 'jffs2' in OVERRIDES as such raw filesystem types are
|
||||
# reserved for the primary image (and setting them currently breaks the build).
|
||||
# Instead, prefix the overlay override value with 'rwfs-' to avoid collisions.
|
||||
DISTROOVERRIDES .= ":static-rwfs-${OVERLAY_BASETYPE}"
|
||||
DISTROOVERRIDES .= ":ubi-rwfs-${FLASH_UBI_OVERLAY_BASETYPE}"
|
||||
DISTROOVERRIDES .= ":mmc-rwfs-${FLASH_EXT4_OVERLAY_BASETYPE}"
|
||||
|
||||
JFFS2_RWFS_CMD = "mkfs.jffs2 --root=jffs2 --faketime --output=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.jffs2"
|
||||
UBIFS_RWFS_CMD = "mkfs.ubifs -r ubifs -c ${FLASH_UBI_RWFS_LEBS} -m ${FLASH_PAGE_SIZE} -e ${FLASH_LEB_SIZE} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubifs"
|
||||
EXT4_RWFS_CMD = "mkfs.ext4 -F ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4"
|
||||
|
||||
FLASH_STATIC_RWFS_CMD:static-rwfs-jffs2 = "${JFFS2_RWFS_CMD}"
|
||||
FLASH_UBI_RWFS_CMD:ubi-rwfs-jffs2 = "${JFFS2_RWFS_CMD}"
|
||||
FLASH_UBI_RWFS_CMD:ubi-rwfs-ubifs = "${UBIFS_RWFS_CMD}"
|
||||
FLASH_EXT4_RWFS_CMD:mmc-rwfs-ext4 = "${EXT4_RWFS_CMD}"
|
||||
|
||||
mk_empty_image() {
|
||||
image_dst="$1"
|
||||
image_size_kb=$2
|
||||
dd if=/dev/zero bs=1k count=$image_size_kb \
|
||||
| tr '\000' '\377' > $image_dst
|
||||
}
|
||||
|
||||
mk_empty_image_zeros() {
|
||||
image_dst="$1"
|
||||
image_size_kb=$2
|
||||
dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb
|
||||
}
|
||||
|
||||
clean_rwfs() {
|
||||
type=$1
|
||||
shift
|
||||
|
||||
rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type
|
||||
rm -rf $type
|
||||
mkdir $type
|
||||
}
|
||||
|
||||
make_rwfs() {
|
||||
type=$1
|
||||
cmd=$2
|
||||
shift
|
||||
shift
|
||||
opts="$@"
|
||||
|
||||
mkdir -p $type
|
||||
|
||||
$cmd $opts
|
||||
}
|
||||
|
||||
do_generate_rwfs_static() {
|
||||
clean_rwfs ${OVERLAY_BASETYPE}
|
||||
make_rwfs ${OVERLAY_BASETYPE} "${FLASH_STATIC_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
|
||||
}
|
||||
do_generate_rwfs_static[dirs] = " ${S}/static"
|
||||
do_generate_rwfs_static[depends] += " \
|
||||
mtd-utils-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
do_generate_rwfs_ubi() {
|
||||
clean_rwfs ${FLASH_UBI_OVERLAY_BASETYPE}
|
||||
make_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} "${FLASH_UBI_RWFS_CMD}"
|
||||
}
|
||||
do_generate_rwfs_ubi[dirs] = " ${S}/ubi"
|
||||
do_generate_rwfs_ubi[depends] += " \
|
||||
mtd-utils-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
do_generate_rwfs_ext4() {
|
||||
clean_rwfs rwfs.${FLASH_EXT4_OVERLAY_BASETYPE}
|
||||
mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4 1024
|
||||
make_rwfs ${FLASH_EXT4_OVERLAY_BASETYPE} "${FLASH_EXT4_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
|
||||
}
|
||||
do_generate_rwfs_ext4[dirs] = " ${S}/ext4"
|
||||
do_generate_rwfs_ext4[depends] += " \
|
||||
e2fsprogs-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
add_volume() {
|
||||
config_file=$1
|
||||
vol_id=$2
|
||||
vol_type=$3
|
||||
vol_name=$4
|
||||
image=$5
|
||||
vol_size=$6
|
||||
|
||||
echo \[$vol_name\] >> $config_file
|
||||
echo mode=ubi >> $config_file
|
||||
echo image=$image >> $config_file
|
||||
echo vol_type=$vol_type >> $config_file
|
||||
echo vol_name=$vol_name >> $config_file
|
||||
echo vol_id=$vol_id >> $config_file
|
||||
if [ ! -z $vol_size ]; then
|
||||
echo vol_size=$vol_size >> $config_file
|
||||
fi
|
||||
}
|
||||
|
||||
python do_generate_ubi() {
|
||||
version_id = do_get_versionID(d)
|
||||
d.setVar('VERSION_ID', version_id)
|
||||
bb.build.exec_func("do_make_ubi", d)
|
||||
}
|
||||
do_generate_ubi[dirs] = "${S}/ubi"
|
||||
do_generate_ubi[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
mtd-utils-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
do_make_ubi() {
|
||||
cfg=ubinize-${IMAGE_NAME}.cfg
|
||||
rm -f $cfg ubi-img
|
||||
# Construct the ubinize config file
|
||||
add_volume $cfg 0 static kernel-${VERSION_ID} \
|
||||
${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE}
|
||||
|
||||
add_volume $cfg 1 static rofs-${VERSION_ID} \
|
||||
${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_BASETYPE}
|
||||
|
||||
add_volume $cfg 2 dynamic rwfs ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_RWFS_TXT_SIZE}
|
||||
|
||||
# Build the ubi partition image
|
||||
ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ubi-img $cfg
|
||||
|
||||
# Concatenate the uboot and ubi partitions
|
||||
mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd ${FLASH_SIZE}
|
||||
dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
|
||||
if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
|
||||
of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
|
||||
dd bs=1k conv=notrunc seek=${FLASH_UBI_OFFSET} \
|
||||
if=ubi-img \
|
||||
of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
|
||||
|
||||
cd ${IMGDEPLOYDIR}
|
||||
ln -sf ${IMAGE_NAME}.ubi.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubi.mtd
|
||||
}
|
||||
do_make_ubi[dirs] = "${S}/ubi"
|
||||
do_make_ubi[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
mtd-utils-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
do_mk_static_nor_image() {
|
||||
# Assemble the flash image
|
||||
mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE}
|
||||
}
|
||||
|
||||
do_generate_image_uboot_file() {
|
||||
image_dst="$1"
|
||||
uboot_offset=${FLASH_UBOOT_OFFSET}
|
||||
|
||||
if [ ! -z ${SPL_BINARY} ]; then
|
||||
dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
|
||||
if=${DEPLOY_DIR_IMAGE}/u-boot-spl.${UBOOT_SUFFIX} \
|
||||
of=${image_dst}
|
||||
uboot_offset=${FLASH_UBOOT_SPL_SIZE}
|
||||
fi
|
||||
|
||||
dd bs=1k conv=notrunc seek=${uboot_offset} \
|
||||
if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
|
||||
of=${image_dst}
|
||||
}
|
||||
|
||||
python do_generate_static() {
|
||||
import subprocess
|
||||
|
||||
bb.build.exec_func("do_mk_static_nor_image", d)
|
||||
|
||||
nor_image = os.path.join(d.getVar('IMGDEPLOYDIR', True),
|
||||
'%s.static.mtd' % d.getVar('IMAGE_NAME', True))
|
||||
|
||||
def _append_image(imgpath, start_kb, finish_kb):
|
||||
imgsize = os.path.getsize(imgpath)
|
||||
maxsize = (finish_kb - start_kb) * 1024
|
||||
bb.debug(1, 'Considering file size=' + str(imgsize) + ' name=' + imgpath)
|
||||
bb.debug(1, 'Spanning start=' + str(start_kb) + 'K end=' + str(finish_kb) + 'K')
|
||||
bb.debug(1, 'Compare needed=' + str(imgsize) + ' available=' + str(maxsize) + ' margin=' + str(maxsize - imgsize))
|
||||
if imgsize > maxsize:
|
||||
bb.fatal("Image '%s' is %d bytes too large!" % (imgpath, imgsize - maxsize))
|
||||
|
||||
subprocess.check_call(['dd', 'bs=1k', 'conv=notrunc',
|
||||
'seek=%d' % start_kb,
|
||||
'if=%s' % imgpath,
|
||||
'of=%s' % nor_image])
|
||||
|
||||
uboot_offset = int(d.getVar('FLASH_UBOOT_OFFSET', True))
|
||||
|
||||
spl_binary = d.getVar('SPL_BINARY', True)
|
||||
if spl_binary:
|
||||
_append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot-spl.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
int(d.getVar('FLASH_UBOOT_OFFSET', True)),
|
||||
int(d.getVar('FLASH_UBOOT_SPL_SIZE', True)))
|
||||
uboot_offset += int(d.getVar('FLASH_UBOOT_SPL_SIZE', True))
|
||||
|
||||
_append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
uboot_offset,
|
||||
int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)))
|
||||
|
||||
_append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
d.getVar('FLASH_KERNEL_IMAGE', True)),
|
||||
int(d.getVar('FLASH_KERNEL_OFFSET', True)),
|
||||
int(d.getVar('FLASH_ROFS_OFFSET', True)))
|
||||
|
||||
_append_image(os.path.join(d.getVar('IMGDEPLOYDIR', True),
|
||||
'%s.%s' % (
|
||||
d.getVar('IMAGE_LINK_NAME', True),
|
||||
d.getVar('IMAGE_BASETYPE', True))),
|
||||
int(d.getVar('FLASH_ROFS_OFFSET', True)),
|
||||
int(d.getVar('FLASH_RWFS_OFFSET', True)))
|
||||
|
||||
_append_image(os.path.join(d.getVar('IMGDEPLOYDIR', True),
|
||||
'%s.%s' % (
|
||||
d.getVar('IMAGE_LINK_NAME', True),
|
||||
d.getVar('OVERLAY_BASETYPE', True))),
|
||||
int(d.getVar('FLASH_RWFS_OFFSET', True)),
|
||||
int(d.getVar('FLASH_SIZE', True)))
|
||||
|
||||
bb.build.exec_func("do_mk_static_symlinks", d)
|
||||
}
|
||||
|
||||
do_mk_static_symlinks() {
|
||||
cd ${IMGDEPLOYDIR}
|
||||
ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd
|
||||
|
||||
# Maintain non-standard legacy links
|
||||
do_generate_image_uboot_file ${IMGDEPLOYDIR}/image-u-boot
|
||||
ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/flash-${MACHINE}
|
||||
ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/image-bmc
|
||||
ln -sf ${FLASH_KERNEL_IMAGE} ${IMGDEPLOYDIR}/image-kernel
|
||||
ln -sf ${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} ${IMGDEPLOYDIR}/image-rofs
|
||||
ln -sf ${IMAGE_LINK_NAME}.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/image-rwfs
|
||||
}
|
||||
do_generate_static[dirs] = "${S}/static"
|
||||
do_generate_static[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
"
|
||||
|
||||
make_signatures() {
|
||||
signing_key="${SIGNING_KEY}"
|
||||
|
||||
if [ "${INSECURE_KEY}" = "True" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
|
||||
echo "Using SIGNING_PUBLIC_KEY"
|
||||
signing_key=""
|
||||
fi
|
||||
|
||||
if [ -n "${signing_key}" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
|
||||
echo "Both SIGNING_KEY and SIGNING_PUBLIC_KEY are defined, expecting only one"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
signature_files=""
|
||||
if [ -n "${signing_key}" ]; then
|
||||
for file in "$@"; do
|
||||
openssl dgst -sha256 -sign ${signing_key} -out "${file}.sig" $file
|
||||
signature_files="${signature_files} ${file}.sig"
|
||||
done
|
||||
|
||||
if [ -n "${signature_files}" ]; then
|
||||
sort_signature_files=$(echo "${signature_files}" | tr ' ' '\n' | sort | tr '\n' ' ')
|
||||
cat ${sort_signature_files} > image-full
|
||||
openssl dgst -sha256 -sign ${signing_key} -out image-full.sig image-full
|
||||
signature_files="${signature_files} image-full.sig"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
do_generate_static_alltar() {
|
||||
ln -sf ${S}/MANIFEST MANIFEST
|
||||
ln -sf ${S}/publickey publickey
|
||||
ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd image-bmc
|
||||
|
||||
make_signatures image-bmc MANIFEST publickey
|
||||
|
||||
tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd.all.tar \
|
||||
image-bmc MANIFEST publickey ${signature_files}
|
||||
|
||||
cd ${IMGDEPLOYDIR}
|
||||
|
||||
ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
|
||||
${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd.all.tar
|
||||
|
||||
# Maintain non-standard legacy link.
|
||||
ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
|
||||
${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.all.tar
|
||||
|
||||
}
|
||||
do_generate_static_alltar[vardepsexclude] = "DATETIME"
|
||||
do_generate_static_alltar[dirs] = "${S}/static"
|
||||
do_generate_static_alltar[depends] += " \
|
||||
openssl-native:do_populate_sysroot \
|
||||
${SIGNING_KEY_DEPENDS} \
|
||||
${PN}:do_copy_signing_pubkey \
|
||||
"
|
||||
|
||||
make_image_links() {
|
||||
rwfs=$1
|
||||
rofs=$2
|
||||
shift
|
||||
shift
|
||||
|
||||
# Create some links to help make the tar archive in the format
|
||||
# expected by phosphor-bmc-code-mgmt.
|
||||
do_generate_image_uboot_file image-u-boot
|
||||
ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel
|
||||
ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rofs image-rofs
|
||||
ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rwfs image-rwfs
|
||||
}
|
||||
|
||||
make_tar_of_images() {
|
||||
type=$1
|
||||
shift
|
||||
extra_files="$@"
|
||||
|
||||
# Create the tar archive
|
||||
tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type.tar \
|
||||
image-u-boot image-kernel image-rofs image-rwfs $extra_files
|
||||
|
||||
cd ${IMGDEPLOYDIR}
|
||||
ln -sf ${IMAGE_NAME}.$type.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type.tar
|
||||
}
|
||||
|
||||
do_generate_static_tar() {
|
||||
ln -sf ${S}/MANIFEST MANIFEST
|
||||
ln -sf ${S}/publickey publickey
|
||||
make_image_links ${OVERLAY_BASETYPE} ${IMAGE_BASETYPE}
|
||||
make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
|
||||
make_tar_of_images static.mtd MANIFEST publickey ${signature_files}
|
||||
|
||||
# Maintain non-standard legacy link.
|
||||
cd ${IMGDEPLOYDIR}
|
||||
ln -sf ${IMAGE_NAME}.static.mtd.tar ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.tar
|
||||
}
|
||||
do_generate_static_tar[dirs] = " ${S}/static"
|
||||
do_generate_static_tar[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
openssl-native:do_populate_sysroot \
|
||||
${SIGNING_KEY_DEPENDS} \
|
||||
${PN}:do_copy_signing_pubkey \
|
||||
"
|
||||
do_generate_static_tar[vardepsexclude] = "DATETIME"
|
||||
|
||||
python do_generate_static_norootfs() {
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
manifest = {
|
||||
"type": "phosphor-image-manifest",
|
||||
"version": 1,
|
||||
"info": {
|
||||
"purpose": d.getVar('VERSION_PURPOSE', True),
|
||||
"machine": d.getVar('MACHINE', True),
|
||||
"version": do_get_version(d).strip('"'),
|
||||
"build-id": do_get_buildID(d).strip('"'),
|
||||
},
|
||||
"partitions": [],
|
||||
# Create an empty hash-value so that the dictionary can be emitted,
|
||||
# hashed, and then updated.
|
||||
"manifest-sha256": "",
|
||||
}
|
||||
extended_version = do_get_extended_version(d).strip('"')
|
||||
if extended_version:
|
||||
manifest["info"]["extended-version"] = extended_version
|
||||
compatible_names = d.getVar('OBMC_COMPATIBLE_NAMES', True)
|
||||
if compatible_names:
|
||||
manifest["info"]["compatible-names"] = compatible_names.split()
|
||||
|
||||
manifest_json_file = os.path.join(d.getVar('IMGDEPLOYDIR', True),
|
||||
"phosphor-image-manifest.json")
|
||||
|
||||
nor_image_basename = '%s.static.mtd' % d.getVar('IMAGE_NAME', True)
|
||||
nor_image = os.path.join(d.getVar('IMGDEPLOYDIR', True), nor_image_basename)
|
||||
|
||||
def _add_manifest(partname, typename, offset, size, sha256_value = None):
|
||||
manifest["partitions"].append(
|
||||
{
|
||||
"name": partname,
|
||||
"type": typename,
|
||||
"offset": offset,
|
||||
"size": size,
|
||||
}
|
||||
)
|
||||
if typename == "fit":
|
||||
if "u-boot-fit" == partname:
|
||||
manifest["partitions"][-1]["num-nodes"] = 1
|
||||
elif "os-fit" == partname:
|
||||
manifest["partitions"][-1]["num-nodes"] = 3
|
||||
else:
|
||||
bb.fatal(f"Unknown FIT partition type: {partname}")
|
||||
if sha256_value:
|
||||
manifest["partitions"][-1]["sha256"] = sha256_value
|
||||
|
||||
|
||||
def _append_image(partname, typename, imgpath, start_kb, finish_kb):
|
||||
imgsize = os.path.getsize(imgpath)
|
||||
maxsize = (finish_kb - start_kb) * 1024
|
||||
bb.debug(1, 'Considering file size=' + str(imgsize) + ' name=' + imgpath)
|
||||
bb.debug(1, 'Spanning start=' + str(start_kb) + 'K end=' + str(finish_kb) + 'K')
|
||||
bb.debug(1, 'Compare needed=' + str(imgsize) + ' available=' + str(maxsize) + ' margin=' + str(maxsize - imgsize))
|
||||
if imgsize > maxsize:
|
||||
bb.fatal("Image '%s' is too large!" % imgpath)
|
||||
|
||||
with open(imgpath, "rb") as fp:
|
||||
sha256 = hashlib.sha256(fp.read()).hexdigest()
|
||||
|
||||
_add_manifest(partname, typename, start_kb * 1024, imgsize, sha256)
|
||||
|
||||
subprocess.check_call(['dd', 'bs=1k', 'conv=notrunc',
|
||||
'seek=%d' % start_kb,
|
||||
'if=%s' % imgpath,
|
||||
'of=%s' % nor_image])
|
||||
|
||||
uboot_offset = int(d.getVar('FLASH_UBOOT_OFFSET', True))
|
||||
|
||||
spl_binary = d.getVar('SPL_BINARY', True)
|
||||
if spl_binary:
|
||||
_append_image("spl", "u-boot",
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot-spl.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
int(d.getVar('FLASH_UBOOT_OFFSET', True)),
|
||||
int(d.getVar('FLASH_UBOOT_SPL_SIZE', True)))
|
||||
uboot_offset += int(d.getVar('FLASH_UBOOT_SPL_SIZE', True))
|
||||
|
||||
_append_image("u-boot-fit", "fit",
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
uboot_offset,
|
||||
int(d.getVar('FLASH_MANIFEST_OFFSET', True)))
|
||||
|
||||
_add_manifest("manifest", "json",
|
||||
int(d.getVar('FLASH_MANIFEST_OFFSET', True)) * 1024,
|
||||
(int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)) -
|
||||
int(d.getVar('FLASH_MANIFEST_OFFSET', True))) * 1024)
|
||||
|
||||
_add_manifest("u-boot-env", "data",
|
||||
int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)) * 1024,
|
||||
(int(d.getVar('FLASH_KERNEL_OFFSET', True)) -
|
||||
int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True))) * 1024)
|
||||
|
||||
_append_image("os-fit", "fit",
|
||||
os.path.join(d.getVar('IMGDEPLOYDIR', True),
|
||||
'%s.cpio.%s.fitImage' % (
|
||||
d.getVar('IMAGE_LINK_NAME', True),
|
||||
d.getVar('INITRAMFS_CTYPE', True))),
|
||||
int(d.getVar('FLASH_KERNEL_OFFSET', True)),
|
||||
int(d.getVar('FLASH_RWFS_OFFSET', True)))
|
||||
|
||||
_add_manifest("rwfs", "data",
|
||||
int(d.getVar('FLASH_RWFS_OFFSET', True)) * 1024,
|
||||
(int(d.getVar('FLASH_SIZE', True)) -
|
||||
int(d.getVar('FLASH_RWFS_OFFSET', True))) * 1024)
|
||||
|
||||
# Calculate the sha256 of the current manifest and update.
|
||||
manifest_raw = json.dumps(manifest, indent=4)
|
||||
manifest_raw = manifest_raw[:manifest_raw.find("manifest-sha256")]
|
||||
manifest["manifest-sha256"] = hashlib.sha256(
|
||||
manifest_raw.encode('utf-8')).hexdigest()
|
||||
|
||||
# Write the final manifest json and add it to the image.
|
||||
with open(manifest_json_file, "wb") as fp:
|
||||
fp.write(json.dumps(manifest, indent=4).encode('utf-8'))
|
||||
_append_image("manifest", "json", manifest_json_file,
|
||||
int(d.getVar('FLASH_MANIFEST_OFFSET', True)),
|
||||
int(d.getVar('FLASH_UBOOT_ENV_OFFSET', True)))
|
||||
|
||||
flash_symlink = os.path.join(
|
||||
d.getVar('IMGDEPLOYDIR', True),
|
||||
'flash-%s' % d.getVar('MACHINE', True))
|
||||
if os.path.exists(flash_symlink):
|
||||
os.remove(flash_symlink)
|
||||
os.symlink(nor_image_basename, flash_symlink)
|
||||
}
|
||||
do_generate_static_norootfs[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('IMAGE_BASETYPE', True).replace('-', '_')} \
|
||||
u-boot:do_deploy \
|
||||
"
|
||||
|
||||
do_generate_ubi_tar() {
|
||||
ln -sf ${S}/MANIFEST MANIFEST
|
||||
ln -sf ${S}/publickey publickey
|
||||
make_image_links ${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_BASETYPE}
|
||||
make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
|
||||
make_tar_of_images ubi.mtd MANIFEST publickey ${signature_files}
|
||||
}
|
||||
do_generate_ubi_tar[dirs] = " ${S}/ubi"
|
||||
do_generate_ubi_tar[depends] += " \
|
||||
${PN}:do_image_${@d.getVar('FLASH_UBI_BASETYPE', True).replace('-', '_')} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
openssl-native:do_populate_sysroot \
|
||||
${SIGNING_KEY_DEPENDS} \
|
||||
${PN}:do_copy_signing_pubkey \
|
||||
"
|
||||
|
||||
do_generate_ext4_tar() {
|
||||
# Generate the U-Boot image
|
||||
mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE}
|
||||
do_generate_image_uboot_file image-u-boot
|
||||
|
||||
# Generate a compressed ext4 filesystem with the fitImage file in it to be
|
||||
# flashed to the boot partition of the eMMC
|
||||
install -d boot-image
|
||||
install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage
|
||||
mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE}
|
||||
mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE}
|
||||
# Error codes 0-3 indicate successfull operation of fsck
|
||||
fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ]
|
||||
zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} boot-image.${FLASH_EXT4_BASETYPE} > boot-image.${FLASH_EXT4_BASETYPE}.zst
|
||||
|
||||
# Generate the compressed ext4 rootfs
|
||||
zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst
|
||||
|
||||
ln -sf boot-image.${FLASH_EXT4_BASETYPE}.zst image-kernel
|
||||
ln -sf ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs
|
||||
ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs
|
||||
ln -sf ${S}/MANIFEST MANIFEST
|
||||
ln -sf ${S}/publickey publickey
|
||||
|
||||
hostfw_update_file="${DEPLOY_DIR_IMAGE}/hostfw/update/image-hostfw"
|
||||
if [ -e "${hostfw_update_file}" ]; then
|
||||
ln -sf "${hostfw_update_file}" image-hostfw
|
||||
make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey image-hostfw
|
||||
make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} image-hostfw
|
||||
else
|
||||
make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
|
||||
make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files}
|
||||
fi
|
||||
}
|
||||
do_generate_ext4_tar[dirs] = " ${S}/ext4"
|
||||
do_generate_ext4_tar[depends] += " \
|
||||
zstd-native:do_populate_sysroot \
|
||||
${PN}:do_image_${FLASH_EXT4_BASETYPE} \
|
||||
virtual/kernel:do_deploy \
|
||||
u-boot:do_deploy \
|
||||
openssl-native:do_populate_sysroot \
|
||||
${SIGNING_KEY_DEPENDS} \
|
||||
${PN}:do_copy_signing_pubkey \
|
||||
phosphor-hostfw-image:do_deploy \
|
||||
"
|
||||
|
||||
def get_pubkey_basedir(d):
|
||||
return os.path.join(
|
||||
d.getVar('STAGING_DIR_TARGET', True),
|
||||
d.getVar('sysconfdir', True).strip(os.sep),
|
||||
'activationdata')
|
||||
|
||||
def get_pubkey_type(d):
|
||||
return os.listdir(get_pubkey_basedir(d))[0]
|
||||
|
||||
def get_pubkey_path(d):
|
||||
return os.path.join(
|
||||
get_pubkey_basedir(d),
|
||||
get_pubkey_type(d),
|
||||
'publickey')
|
||||
|
||||
python do_generate_phosphor_manifest() {
|
||||
purpose = d.getVar('VERSION_PURPOSE', True)
|
||||
version = do_get_version(d)
|
||||
build_id = do_get_buildID(d)
|
||||
target_machine = d.getVar('MACHINE', True)
|
||||
extended_version = do_get_extended_version(d)
|
||||
compatible_names = d.getVar('OBMC_COMPATIBLE_NAMES', True)
|
||||
with open('MANIFEST', 'w') as fd:
|
||||
fd.write('purpose={}\n'.format(purpose))
|
||||
fd.write('version={}\n'.format(version.strip('"')))
|
||||
fd.write('BuildId={}\n'.format(build_id.strip('"')))
|
||||
if extended_version:
|
||||
fd.write('ExtendedVersion={}\n'.format(extended_version))
|
||||
if compatible_names:
|
||||
for name in compatible_names.split():
|
||||
fd.write('CompatibleName={}\n'.format(name))
|
||||
fd.write('KeyType={}\n'.format(get_pubkey_type(d)))
|
||||
fd.write('HashType=RSA-SHA256\n')
|
||||
fd.write('MachineName={}\n'.format(target_machine))
|
||||
}
|
||||
do_generate_phosphor_manifest[dirs] = "${S}"
|
||||
do_generate_phosphor_manifest[depends] += " \
|
||||
os-release:do_populate_sysroot \
|
||||
phosphor-image-signing:do_populate_sysroot \
|
||||
"
|
||||
|
||||
python do_copy_signing_pubkey() {
|
||||
with open(get_pubkey_path(d), 'r') as read_fd:
|
||||
with open('publickey', 'w') as write_fd:
|
||||
write_fd.write(read_fd.read())
|
||||
}
|
||||
|
||||
do_copy_signing_pubkey[dirs] = "${S}"
|
||||
do_copy_signing_pubkey[depends] += " \
|
||||
phosphor-image-signing:do_populate_sysroot \
|
||||
"
|
||||
|
||||
addtask copy_signing_pubkey after do_rootfs
|
||||
addtask generate_phosphor_manifest after do_rootfs
|
||||
addtask generate_rwfs_static after do_rootfs
|
||||
addtask generate_rwfs_ubi after do_rootfs
|
||||
addtask generate_rwfs_ext4 after do_rootfs
|
||||
|
||||
python() {
|
||||
types = d.getVar('IMAGE_FSTYPES', True).split()
|
||||
|
||||
if any([x in types for x in ['mtd-static', 'mtd-static-alltar']]):
|
||||
bb.build.addtask(
|
||||
'do_generate_static',
|
||||
'do_image_complete',
|
||||
'do_generate_rwfs_static', d)
|
||||
if 'mtd-static-alltar' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_static_alltar',
|
||||
'do_image_complete',
|
||||
'do_generate_static do_generate_phosphor_manifest', d)
|
||||
if 'mtd-static-tar' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_static_tar',
|
||||
'do_image_complete',
|
||||
'do_generate_rwfs_static do_generate_phosphor_manifest', d)
|
||||
|
||||
if 'mtd-static-norootfs' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_static_norootfs',
|
||||
'do_image_complete',
|
||||
'do_image_cpio', d)
|
||||
|
||||
if 'mtd-ubi' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_ubi',
|
||||
'do_image_complete',
|
||||
'do_generate_rwfs_ubi', d)
|
||||
if 'mtd-ubi-tar' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_ubi_tar',
|
||||
'do_image_complete',
|
||||
'do_generate_rwfs_ubi do_generate_phosphor_manifest', d)
|
||||
|
||||
if 'mmc-ext4-tar' in types:
|
||||
bb.build.addtask(
|
||||
'do_generate_ext4_tar',
|
||||
'do_image_complete',
|
||||
'do_generate_rwfs_ext4 do_generate_phosphor_manifest', d)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
UBOOT_BINARY := "u-boot.${UBOOT_SUFFIX}"
|
||||
BOOTBLOCK = "Poleg_bootblock.bin"
|
||||
FULL_SUFFIX = "full"
|
||||
MERGED_SUFFIX = "merged"
|
||||
UBOOT_SUFFIX:append = ".${MERGED_SUFFIX}"
|
||||
|
||||
IGPS_DIR = "${STAGING_DIR_NATIVE}/${datadir}/npcm7xx-igps"
|
||||
|
||||
# Prepare the Bootblock and U-Boot images using npcm7xx-bingo
|
||||
do_prepare_bootloaders() {
|
||||
local olddir="$(pwd)"
|
||||
cd ${DEPLOY_DIR_IMAGE}
|
||||
bingo ${IGPS_DIR}/BootBlockAndHeader_${IGPS_MACHINE}.xml \
|
||||
-o ${DEPLOY_DIR_IMAGE}/${BOOTBLOCK}.${FULL_SUFFIX}
|
||||
|
||||
bingo ${IGPS_DIR}/UbootHeader_${IGPS_MACHINE}.xml \
|
||||
-o ${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY}.${FULL_SUFFIX}
|
||||
|
||||
bingo ${IGPS_DIR}/mergedBootBlockAndUboot.xml \
|
||||
-o ${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY}.${MERGED_SUFFIX}
|
||||
cd "$olddir"
|
||||
}
|
||||
|
||||
do_prepare_bootloaders[depends] += " \
|
||||
u-boot:do_deploy \
|
||||
npcm7xx-bootblock:do_deploy \
|
||||
npcm7xx-bingo-native:do_populate_sysroot \
|
||||
npcm7xx-igps-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
addtask do_prepare_bootloaders before do_generate_static after do_generate_rwfs_static
|
||||
|
||||
# Include the full bootblock and u-boot in the final static image
|
||||
python do_generate_static:append() {
|
||||
_append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
int(d.getVar('FLASH_UBOOT_OFFSET', True)),
|
||||
int(d.getVar('FLASH_KERNEL_OFFSET', True)))
|
||||
}
|
||||
|
||||
do_make_ubi:append() {
|
||||
# Concatenate the uboot and ubi partitions
|
||||
dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
|
||||
if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
|
||||
of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
|
||||
}
|
||||
|
||||
do_make_ubi[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_ubi_tar[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_static_tar[depends] += "${PN}:do_prepare_bootloaders"
|
||||
@@ -0,0 +1,267 @@
|
||||
UBOOT_BINARY := "u-boot.${UBOOT_SUFFIX}"
|
||||
BB_HEADER_BINARY := "BootBlockAndHeader.bin"
|
||||
BL31_HEADER_BINARY := "bl31AndHeader.bin"
|
||||
OPTEE_HEADER_BINARY := "teeAndHeader.bin"
|
||||
KMT_TIPFW_BINARY := "Kmt_TipFwL0_Skmt_TipFwL1.bin"
|
||||
KMT_TIPFW_BB_BINARY = "Kmt_TipFw_BootBlock.bin"
|
||||
KMT_TIPFW_BB_BL31_BINARY = "Kmt_TipFw_BootBlock_BL31.bin"
|
||||
KMT_TIPFW_BB_BL31_TEE_BINARY = "Kmt_TipFw_BootBlock_BL31_Tee.bin"
|
||||
KMT_TIPFW_BB_UBOOT_BINARY = "u-boot.bin.merged"
|
||||
|
||||
BB_BL31_BINARY = "BootBlock_BL31_no_tip.bin"
|
||||
BB_BL31_TEE_BINARY = "BootBlock_BL31_Tee_no_tip.bin"
|
||||
BB_BL31_TEE_UBOOT_BINARY = "u-boot.bin.merged"
|
||||
|
||||
FULL_SUFFIX = "full"
|
||||
MERGED_SUFFIX = "merged"
|
||||
UBOOT_SUFFIX:append = ".${MERGED_SUFFIX}"
|
||||
UBOOT_HEADER_BINARY := "${UBOOT_BINARY}.${FULL_SUFFIX}"
|
||||
|
||||
IGPS_DIR = "${STAGING_DIR_NATIVE}/${datadir}/npcm8xx-igps"
|
||||
|
||||
BB_BIN = "arbel_a35_bootblock.bin"
|
||||
BL31_BIN = "bl31.bin"
|
||||
OPTEE_BIN = "tee.bin"
|
||||
UBOOT_BIN = "u-boot.bin"
|
||||
BB_NO_TIP_BIN = "arbel_a35_bootblock_no_tip.bin"
|
||||
|
||||
# Align images if needed
|
||||
python do_pad_binary() {
|
||||
TIP_IMAGE = d.getVar('TIP_IMAGE', True)
|
||||
def Pad_bin_file_inplace(inF, align):
|
||||
padding_size = 0
|
||||
padding_size_end = 0
|
||||
|
||||
F_size = os.path.getsize(inF)
|
||||
|
||||
padding_size = align - (F_size % align)
|
||||
|
||||
infile = open(inF, "ab")
|
||||
infile.seek(0, 2)
|
||||
infile.write(b'\x00' * padding_size)
|
||||
infile.close()
|
||||
|
||||
if TIP_IMAGE == "True":
|
||||
Pad_bin_file_inplace(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'%s' % d.getVar('BB_BIN',True)), int(d.getVar('PAD_ALIGN', True)))
|
||||
else:
|
||||
Pad_bin_file_inplace(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'%s' % d.getVar('BB_NO_TIP_BIN',True)), int(d.getVar('PAD_ALIGN', True)))
|
||||
|
||||
Pad_bin_file_inplace(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'%s' % d.getVar('BL31_BIN',True)), int(d.getVar('PAD_ALIGN', True)))
|
||||
|
||||
Pad_bin_file_inplace(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'%s' % d.getVar('OPTEE_BIN',True)), int(d.getVar('PAD_ALIGN', True)))
|
||||
|
||||
Pad_bin_file_inplace(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'%s' % d.getVar('UBOOT_BIN',True)), int(d.getVar('PAD_ALIGN', True)))
|
||||
}
|
||||
|
||||
# Prepare the Bootblock and U-Boot images using npcm8xx-bingo
|
||||
do_prepare_bootloaders() {
|
||||
local olddir="$(pwd)"
|
||||
cd ${DEPLOY_DIR_IMAGE}
|
||||
|
||||
bingo ${IGPS_DIR}/BL31_AndHeader.xml \
|
||||
-o ${BL31_HEADER_BINARY}
|
||||
|
||||
bingo ${IGPS_DIR}/OpTeeAndHeader.xml \
|
||||
-o ${OPTEE_HEADER_BINARY}
|
||||
|
||||
if [ "${TIP_IMAGE}" = "True" ]; then
|
||||
bingo ${IGPS_DIR}/BootBlockAndHeader_${DEVICE_GEN}_${IGPS_MACHINE}.xml \
|
||||
-o ${BB_HEADER_BINARY}
|
||||
else
|
||||
bingo ${IGPS_DIR}/BootBlockAndHeader_${DEVICE_GEN}_${IGPS_MACHINE}_NoTip.xml \
|
||||
-o ${BB_HEADER_BINARY}
|
||||
fi
|
||||
|
||||
bingo ${IGPS_DIR}/UbootHeader_${DEVICE_GEN}.xml \
|
||||
-o ${UBOOT_HEADER_BINARY}
|
||||
|
||||
cd "$olddir"
|
||||
}
|
||||
|
||||
check_keys() {
|
||||
if [ -n "${KEY_FOLDER}" ]; then
|
||||
echo "local"
|
||||
else
|
||||
echo "default"
|
||||
fi
|
||||
}
|
||||
|
||||
# Sign images for secure os be enabled and TIP mode only
|
||||
do_sign_binary() {
|
||||
if [ "${SECURED_IMAGE}" != "True" -o "${TIP_IMAGE}" != "True" ]; then
|
||||
return
|
||||
fi
|
||||
checked=`check_keys`
|
||||
if [ "${checked}" = "local" ]; then
|
||||
bbnote "Sign image with local keys"
|
||||
key_bb=${KEY_FOLDER}/${KEY_BB}
|
||||
key_bl31=${KEY_FOLDER}/${KEY_BL31}
|
||||
key_optee=${KEY_FOLDER}/${KEY_OPTEE}
|
||||
key_uboot=${KEY_FOLDER}/${KEY_UBOOT}
|
||||
else
|
||||
bbnote "Sign image with default keys"
|
||||
key_bb=${KEY_FOLDER_DEFAULT}/${KEY_BB}
|
||||
key_bl31=${KEY_FOLDER_DEFAULT}/${KEY_BL31}
|
||||
key_optee=${KEY_FOLDER_DEFAULT}/${KEY_OPTEE}
|
||||
key_uboot=${KEY_FOLDER_DEFAULT}/${KEY_UBOOT}
|
||||
fi
|
||||
bbnote "BB sign key from ${checked}: ${key_bb}"
|
||||
bbnote "BL31 sign key from ${checked}: ${key_bl31}"
|
||||
bbnote "OPTEE sign key from ${checked}: ${key_optee}"
|
||||
bbnote "UBOOT sign key from ${checked}: ${key_uboot}"
|
||||
# Used to embed the key index inside the image, usually at offset 0x140
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Replace_binary_single_byte \
|
||||
${DEPLOY_DIR_IMAGE}/${BB_HEADER_BINARY} 140 ${KEY_BB_INDEX}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Replace_binary_single_byte \
|
||||
${DEPLOY_DIR_IMAGE}/${BL31_HEADER_BINARY} 140 ${SKMT_BL31_KEY_INDEX}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Replace_binary_single_byte \
|
||||
${DEPLOY_DIR_IMAGE}/${OPTEE_HEADER_BINARY} 140 ${SKMT_BL32_KEY_INDEX}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Replace_binary_single_byte \
|
||||
${DEPLOY_DIR_IMAGE}/${UBOOT_HEADER_BINARY} 140 ${SKMT_BL33_KEY_INDEX}
|
||||
|
||||
# Sign specific image with specific key
|
||||
res=`python3 ${IGPS_DIR}/BinarySignatureGenerator.py Sign_binary \
|
||||
${DEPLOY_DIR_IMAGE}/${BB_HEADER_BINARY} 112 ${key_bb} 16 \
|
||||
${DEPLOY_DIR_IMAGE}/${BB_HEADER_BINARY} ${SIGN_TYPE} 0 ${KEY_BB_ID}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Sign_binary \
|
||||
${DEPLOY_DIR_IMAGE}/${BL31_HEADER_BINARY} 112 ${key_bl31} 16 \
|
||||
${DEPLOY_DIR_IMAGE}/${BL31_HEADER_BINARY} ${SIGN_TYPE} 0 ${KEY_BL31_ID}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Sign_binary \
|
||||
${DEPLOY_DIR_IMAGE}/${OPTEE_HEADER_BINARY} 112 ${key_optee} 16 \
|
||||
${DEPLOY_DIR_IMAGE}/${OPTEE_HEADER_BINARY} ${SIGN_TYPE} 0 ${KEY_OPTEE_ID}
|
||||
|
||||
python3 ${IGPS_DIR}/BinarySignatureGenerator.py Sign_binary \
|
||||
${DEPLOY_DIR_IMAGE}/${UBOOT_HEADER_BINARY} 112 ${key_uboot} 16 \
|
||||
${DEPLOY_DIR_IMAGE}/${UBOOT_HEADER_BINARY} ${SIGN_TYPE} 0 ${KEY_UBOOT_ID}`
|
||||
|
||||
# Stop full image build process when sign binary got failed
|
||||
set +e
|
||||
err=`echo $res | grep -E "missing|Invalid|failed"`
|
||||
if [ -n "${err}" ]; then
|
||||
bbfatal "Sign binary failed: keys are not found or invalid. Please check your KEY_FOLDER and KEY definition."
|
||||
fi
|
||||
set -e
|
||||
}
|
||||
|
||||
python do_merge_bootloaders() {
|
||||
TIP_IMAGE = d.getVar('TIP_IMAGE', True)
|
||||
def Merge_bin_files_and_pad(inF1, inF2, outF, align, align_end):
|
||||
padding_size = 0
|
||||
padding_size_end = 0
|
||||
F1_size = os.path.getsize(inF1)
|
||||
F2_size = os.path.getsize(inF2)
|
||||
|
||||
if ((F1_size % align) != 0):
|
||||
padding_size = align - (F1_size % align)
|
||||
|
||||
if ((F2_size % align_end) != 0):
|
||||
padding_size_end = align_end - (F2_size % align_end)
|
||||
|
||||
with open(outF, "wb") as file3:
|
||||
with open(inF1, "rb") as file1:
|
||||
data = file1.read()
|
||||
file3.write(data)
|
||||
|
||||
file3.write(b'\xFF' * padding_size)
|
||||
|
||||
with open(inF2, "rb") as file2:
|
||||
data = file2.read()
|
||||
file3.write(data)
|
||||
|
||||
file3.write(b'\xFF' * padding_size_end)
|
||||
|
||||
if TIP_IMAGE == "True":
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BINARY',True)),
|
||||
int(d.getVar('BB_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BL31_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_BINARY',True)),
|
||||
int(d.getVar('ATF_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('OPTEE_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_TEE_BINARY',True)),
|
||||
int(d.getVar('OPTEE_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_TEE_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('UBOOT_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_UBOOT_BINARY',True)),
|
||||
int(d.getVar('UBOOT_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
else:
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BL31_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_BL31_BINARY',True)),
|
||||
int(d.getVar('ATF_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_BL31_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('OPTEE_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_BL31_TEE_BINARY',True)),
|
||||
int(d.getVar('OPTEE_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
|
||||
Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_BL31_TEE_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('UBOOT_HEADER_BINARY',True)),
|
||||
os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BB_BL31_TEE_UBOOT_BINARY',True)),
|
||||
int(d.getVar('UBOOT_ALIGN', True)), int(d.getVar('ALIGN_END', True)))
|
||||
}
|
||||
|
||||
do_pad_binary[depends] += " \
|
||||
${@'npcm8xx-tip-fw:do_deploy' if d.getVar('TIP_IMAGE', True) == 'True' else ''} \
|
||||
npcm8xx-bootblock:do_deploy \
|
||||
u-boot-nuvoton:do_deploy \
|
||||
trusted-firmware-a:do_deploy \
|
||||
optee-os:do_deploy \
|
||||
npcm7xx-bingo-native:do_populate_sysroot \
|
||||
npcm8xx-igps-native:do_populate_sysroot \
|
||||
"
|
||||
|
||||
# link images for we only need to flash partial image with idea name
|
||||
do_generate_ext4_tar:append() {
|
||||
cd ${DEPLOY_DIR_IMAGE}
|
||||
ln -sf ${UBOOT_BINARY}.${MERGED_SUFFIX} image-u-boot
|
||||
ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel
|
||||
ln -sf ${S}/ext4/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs
|
||||
ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs
|
||||
ln -sf ${IMAGE_NAME}.rootfs.wic.gz image-emmc.gz
|
||||
}
|
||||
|
||||
addtask do_pad_binary before do_prepare_bootloaders
|
||||
addtask do_sign_binary before do_merge_bootloaders after do_prepare_bootloaders
|
||||
addtask do_prepare_bootloaders before do_generate_static after do_generate_rwfs_static
|
||||
addtask do_merge_bootloaders before do_generate_static after do_sign_binary
|
||||
addtask do_merge_bootloaders before do_generate_ext4_tar after do_prepare_bootloaders
|
||||
|
||||
# Include the full bootblock and u-boot in the final static image
|
||||
python do_generate_static:append() {
|
||||
_append_image(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True),
|
||||
'u-boot.%s' % d.getVar('UBOOT_SUFFIX',True)),
|
||||
int(d.getVar('FLASH_UBOOT_OFFSET', True)),
|
||||
int(d.getVar('FLASH_KERNEL_OFFSET', True)))
|
||||
}
|
||||
|
||||
do_make_ubi:append() {
|
||||
# Concatenate the uboot and ubi partitions
|
||||
dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
|
||||
if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
|
||||
of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
|
||||
}
|
||||
|
||||
do_make_ubi[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_ubi_tar[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_ubi_tar[depends] += "${PN}:do_merge_bootloaders"
|
||||
do_generate_static_tar[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_static_tar[depends] += "${PN}:do_merge_bootloaders"
|
||||
do_generate_ext4_tar[depends] += "${PN}:do_prepare_bootloaders"
|
||||
do_generate_ext4_tar[depends] += "${PN}:do_merge_bootloaders"
|
||||
@@ -0,0 +1,40 @@
|
||||
# Base image version class extension
|
||||
|
||||
DEPENDS:append = " os-release"
|
||||
|
||||
def do_get_os_release_value(d, key):
|
||||
import configparser
|
||||
import io
|
||||
path = d.getVar('STAGING_DIR_TARGET', True) + d.getVar('sysconfdir', True)
|
||||
path = os.path.join(path, 'os-release')
|
||||
parser = configparser.ConfigParser(strict=False)
|
||||
parser.optionxform = str
|
||||
value = ''
|
||||
try:
|
||||
with open(path, 'r') as fd:
|
||||
buf = '[root]\n' + fd.read()
|
||||
fd = io.StringIO(buf)
|
||||
parser.read_file(fd)
|
||||
value = parser['root'][key]
|
||||
except:
|
||||
pass
|
||||
return value
|
||||
|
||||
def do_get_version(d):
|
||||
version = do_get_os_release_value(d, 'VERSION_ID')
|
||||
return version
|
||||
|
||||
def do_get_versionID(d):
|
||||
import hashlib
|
||||
version = do_get_version(d)
|
||||
version = version.strip('"')
|
||||
version_id = (hashlib.sha512(version.encode('utf-8')).hexdigest())[:8]
|
||||
return version_id
|
||||
|
||||
def do_get_buildID(d):
|
||||
build_id = do_get_os_release_value(d, 'BUILD_ID')
|
||||
return build_id
|
||||
|
||||
def do_get_extended_version(d):
|
||||
extended_version = do_get_os_release_value(d, 'EXTENDED_VERSION')
|
||||
return extended_version
|
||||
@@ -0,0 +1,64 @@
|
||||
####
|
||||
# Copyright 2021 Intel Corporation
|
||||
#
|
||||
# Add a class to support serving license info through bmcweb.
|
||||
#
|
||||
# bmcweb serves static content from the /usr/share/www folder, so this class
|
||||
# copies the license info from /usr/share/common-licenses to
|
||||
# /usr/share/www/common-licenses so it will be statically served by bmcweb.
|
||||
#
|
||||
# Requires 'COPY_LIC_DIRS' to be enabled to create /usr/share/common-licenses.
|
||||
#
|
||||
# Class can be inherited in a project bbclass to copy the license info.
|
||||
#
|
||||
# Example:
|
||||
# inherit license_static
|
||||
####
|
||||
|
||||
STATIC_LICENSE_DIR = "${IMAGE_ROOTFS}${datadir}/www/common-licenses"
|
||||
|
||||
|
||||
def add_index_html_header(f):
|
||||
f.write("<!DOCTYPE html>")
|
||||
f.write("<html>")
|
||||
f.write("<body>")
|
||||
f.write("<p>")
|
||||
|
||||
|
||||
def add_index_html_footer(f):
|
||||
f.write("</p>")
|
||||
f.write("</body>")
|
||||
f.write("</html>")
|
||||
|
||||
|
||||
def create_index_files(d):
|
||||
import os
|
||||
|
||||
static_license_dir = d.getVar('STATIC_LICENSE_DIR')
|
||||
for dirpath, dirnames, filenames in os.walk(static_license_dir):
|
||||
with open(os.path.join(dirpath, "index.html"), "w") as f:
|
||||
add_index_html_header(f)
|
||||
full_list = filenames+dirnames
|
||||
full_list.sort()
|
||||
f.write("<br>".join(full_list))
|
||||
add_index_html_footer(f)
|
||||
|
||||
|
||||
def copy_license_files(d):
|
||||
import shutil
|
||||
|
||||
rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR')
|
||||
static_license_dir = d.getVar('STATIC_LICENSE_DIR')
|
||||
shutil.copytree(rootfs_license_dir, static_license_dir)
|
||||
|
||||
|
||||
python do_populate_static_lic() {
|
||||
copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
|
||||
if copy_lic_dirs == "1":
|
||||
copy_license_files(d)
|
||||
create_index_files(d)
|
||||
else:
|
||||
bb.warn("Static licenses not copied because 'COPY_LIC_DIRS' is disabled.")
|
||||
}
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND:append = "do_populate_static_lic; "
|
||||
@@ -0,0 +1,5 @@
|
||||
MRW_API_SRC_URI ?= "git://github.com/open-power/serverwiz.git;branch=master;protocol=https"
|
||||
MRW_API_SRCREV ?= "60c8e10cbb11768cd1ba394b35cb1d6627efec42"
|
||||
|
||||
MRW_TOOLS_SRC_URI ?= "git://github.com/openbmc/phosphor-mrw-tools;branch=master;protocol=https"
|
||||
MRW_TOOLS_SRCREV ?= "b4edc27a3c25cf78c6eeb06f5e45c3b379da445d"
|
||||
@@ -0,0 +1,4 @@
|
||||
MRW_XML ??= "${MACHINE}.xml"
|
||||
mrw_datadir = "${datadir}/obmc-mrw"
|
||||
SKIP_BROKEN_MRW ?= "0"
|
||||
EXTRA_MRW_SCRIPT_ARGS = "${@bb.utils.contains("SKIP_BROKEN_MRW", "0", "", "--skip-broken-mrw", d)}"
|
||||
@@ -0,0 +1,177 @@
|
||||
# Utilities and shortcuts for recipes providing D-Bus services.
|
||||
# Variables:
|
||||
# DBUS_PACKAGES ?= "${PN}"
|
||||
# The list of packages to which files should be added.
|
||||
#
|
||||
# DBUS_SERVICE:${PN} += "org.openbmc.Foo.service"
|
||||
# A list of dbus service names. The class will look for a
|
||||
# dbus configuration file with the same base name with .conf
|
||||
# appended. If one is found, it is added to the package
|
||||
# and used verbatim. If it is not found, a default one
|
||||
# (with very open permissions) is generated and used.
|
||||
#
|
||||
# Additionally the class will instantiate obmc-phosphor-systemd
|
||||
# with any SYSTEMD_SERVICE:%s variables translated appropriately.
|
||||
#
|
||||
# If a service begins with 'dbus-' DBus activation will be
|
||||
# configured. The class will look for an activation file
|
||||
# with the 'dbus-' prefix removed. If found, it is added to
|
||||
# the package and used verbatim. If it is not found, a default
|
||||
# one is generated and used.
|
||||
|
||||
|
||||
inherit dbus-dir
|
||||
inherit obmc-phosphor-utils
|
||||
|
||||
RDEPENDS:${PN}:append:class-target = " dbus-perms"
|
||||
DBUS_PACKAGES ?= "${PN}"
|
||||
|
||||
_INSTALL_DBUS_CONFIGS=""
|
||||
_DEFAULT_DBUS_CONFIGS=""
|
||||
_INSTALL_DBUS_ACTIVATIONS=""
|
||||
_DEFAULT_DBUS_ACTIVATIONS=""
|
||||
|
||||
|
||||
python dbus_do_postinst() {
|
||||
def make_default_dbus_config(d, unit, user):
|
||||
bus = unit.base
|
||||
if unit.is_template:
|
||||
bus = '%s*' % bus
|
||||
|
||||
path = d.getVar('D', True)
|
||||
path += d.getVar('dbus_system_confdir', True)
|
||||
with open('%s/%s.conf' % (path, unit.base), 'w+') as fd:
|
||||
fd.write('<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"\n')
|
||||
fd.write(' "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">\n')
|
||||
fd.write('<busconfig>\n')
|
||||
fd.write(' <policy user="%s">\n' % user)
|
||||
fd.write(' <allow own="%s"/>\n' % bus)
|
||||
fd.write(' <allow send_destination="%s"/>\n' % bus)
|
||||
fd.write(' </policy>\n')
|
||||
fd.write('</busconfig>\n')
|
||||
fd.close()
|
||||
|
||||
|
||||
def make_default_dbus_activation(d, unit, user):
|
||||
dest = unit.base
|
||||
sd_unit = unit.name
|
||||
if unit.is_instance:
|
||||
dest = '%s.%s' % (unit.base, unit.instance)
|
||||
sd_unit = '%s@%s' % (unit.base, unit.instance)
|
||||
|
||||
path = d.getVar('D', True)
|
||||
path += d.getVar('dbus_system_servicesdir', True)
|
||||
with open('%s/%s.service' % (path, dest), 'w+') as fd:
|
||||
fd.write('[D-BUS Service]\n')
|
||||
fd.write('Name=%s\n' % dest)
|
||||
fd.write('Exec=/bin/false\n')
|
||||
fd.write('User=%s\n' % user)
|
||||
fd.write('SystemdService=dbus-%s.service\n' % sd_unit)
|
||||
fd.close()
|
||||
|
||||
|
||||
for service_user in listvar_to_list(d, '_DEFAULT_DBUS_CONFIGS'):
|
||||
service, user = service_user.split(':')
|
||||
make_default_dbus_config(d, SystemdUnit(service), user)
|
||||
for service_user in listvar_to_list(d, '_DEFAULT_DBUS_ACTIVATIONS'):
|
||||
service, user = service_user.split(':')
|
||||
make_default_dbus_activation(d, SystemdUnit(service), user)
|
||||
}
|
||||
|
||||
|
||||
python() {
|
||||
searchpaths = d.getVar('FILESPATH', True)
|
||||
|
||||
def get_user(d, service, pkg):
|
||||
user = d.getVar(
|
||||
'SYSTEMD_USER_%s' % service, True)
|
||||
if user is None:
|
||||
user = d.getVar(
|
||||
'SYSTEMD_USER_%s' % pkg, True) or 'root'
|
||||
return user
|
||||
|
||||
|
||||
def add_dbus_config(d, unit, pkg):
|
||||
path = bb.utils.which(searchpaths, '%s.conf' % unit.base)
|
||||
if not os.path.isfile(path):
|
||||
user = get_user(d, unit.name, pkg)
|
||||
set_doappend(d, '_DEFAULT_DBUS_CONFIGS', '%s:%s' % (
|
||||
unit.name, user))
|
||||
else:
|
||||
set_doappend(d, 'SRC_URI', 'file://%s.conf' % unit.base)
|
||||
set_doappend(d, '_INSTALL_DBUS_CONFIGS', '%s.conf' % unit.base)
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s%s.conf' \
|
||||
% (d.getVar('dbus_system_confdir', True), unit.base))
|
||||
|
||||
|
||||
def add_dbus_activation(d, unit, pkg):
|
||||
if not unit.is_activated or unit.is_template:
|
||||
return
|
||||
search_match = '%s.service' % unit.base
|
||||
if unit.is_instance:
|
||||
search_match = '%s.%s.service' % (unit.base, unit.instance)
|
||||
|
||||
path = bb.utils.which(searchpaths, search_match)
|
||||
|
||||
if not os.path.isfile(path):
|
||||
user = get_user(d, unit.base, pkg)
|
||||
set_doappend(d, '_DEFAULT_DBUS_ACTIVATIONS', '%s:%s' % (
|
||||
unit.name, user))
|
||||
else:
|
||||
set_doappend(d, 'SRC_URI', 'file://%s' % search_match)
|
||||
set_doappend(d, '_INSTALL_DBUS_ACTIVATIONS', search_match)
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s%s' \
|
||||
% (d.getVar('dbus_system_servicesdir', True), search_match))
|
||||
|
||||
|
||||
if d.getVar('CLASSOVERRIDE', True) != 'class-target':
|
||||
return
|
||||
|
||||
d.appendVarFlag('do_install', 'postfuncs', ' dbus_do_postinst')
|
||||
|
||||
for pkg in listvar_to_list(d, 'DBUS_PACKAGES'):
|
||||
if pkg not in (d.getVar('SYSTEMD_PACKAGES', True) or ''):
|
||||
set_doappend(d, 'SYSTEMD_PACKAGES', pkg)
|
||||
|
||||
svc = listvar_to_list(d, 'DBUS_SERVICE:%s' % pkg)
|
||||
svc = [SystemdUnit(x) for x in svc]
|
||||
inst = [x for x in svc if x.is_instance]
|
||||
tmpl = [x.template for x in svc if x.is_instance]
|
||||
tmpl = list(set(tmpl))
|
||||
tmpl = [SystemdUnit(x) for x in tmpl]
|
||||
svc = [x for x in svc if not x.is_instance]
|
||||
|
||||
for unit in inst:
|
||||
set_doappend(
|
||||
d, 'SYSTEMD_SERVICE:%s' % pkg, unit.name)
|
||||
|
||||
for unit in tmpl + svc:
|
||||
add_dbus_config(d, unit, pkg)
|
||||
add_dbus_activation(d, unit, pkg)
|
||||
set_doappend(
|
||||
d, 'SYSTEMD_SERVICE:%s' % pkg, unit.name)
|
||||
set_doappend(d, 'SYSTEMD_SUBSTITUTIONS',
|
||||
'BUSNAME:%s:%s' % (unit.base, unit.name))
|
||||
}
|
||||
|
||||
|
||||
do_install:append() {
|
||||
# install the dbus configuration files
|
||||
[ -z "${_INSTALL_DBUS_CONFIGS}" ] && \
|
||||
[ -z "${_DEFAULT_DBUS_CONFIGS}" ] || \
|
||||
install -d ${D}${dbus_system_confdir}
|
||||
for c in ${_INSTALL_DBUS_CONFIGS}; do
|
||||
install -m 0644 ${WORKDIR}/$c \
|
||||
${D}${dbus_system_confdir}$c
|
||||
done
|
||||
# install the dbus activation files
|
||||
[ -z "${_INSTALL_DBUS_ACTIVATIONS}" ] && \
|
||||
[ -z "${_DEFAULT_DBUS_ACTIVATIONS}" ] || \
|
||||
install -d ${D}${dbus_system_servicesdir}
|
||||
for s in ${_INSTALL_DBUS_ACTIVATIONS}; do
|
||||
install -m 0644 ${WORKDIR}/$s\
|
||||
${D}${dbus_system_servicesdir}$s
|
||||
done
|
||||
}
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
@@ -0,0 +1,21 @@
|
||||
# IMAGE_FSTYPES must appear before image.bbclass
|
||||
# is inherited otherwise image.bbclass will inherit
|
||||
# "live" image fstypes that we don't want.
|
||||
IMAGE_FSTYPES = "tar.xz"
|
||||
|
||||
inherit image
|
||||
|
||||
LICENSE = "Apache-2.0"
|
||||
|
||||
IMAGE_INSTALL:append = " busybox packagegroup-obmc-phosphor-debugtools perf "
|
||||
|
||||
# Override from image_types.bbclass to restrict tarball to /usr tree.
|
||||
IMAGE_CMD:tar = "${IMAGE_CMD_TAR} -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.tar -C ${IMAGE_ROOTFS}/usr ."
|
||||
|
||||
# Remove packages installed by 'extrausers'.
|
||||
IMAGE_INSTALL:remove = "base-passwd shadow"
|
||||
EXTRA_USERS_PARAMS = ""
|
||||
|
||||
# Remove extra packages defaulted by image.bbclass.
|
||||
PACKAGE_INSTALL = "${IMAGE_INSTALL}"
|
||||
IMAGE_LINGUAS = ""
|
||||
@@ -0,0 +1,114 @@
|
||||
inherit obmc-phosphor-utils
|
||||
DISCOVERY_SVC_PACKAGES ?= "${PN}"
|
||||
|
||||
python() {
|
||||
avahi_enabled = bb.utils.contains(
|
||||
'DISTRO_FEATURES', 'avahi', True, False, d)
|
||||
slp_enabled = bb.utils.contains(
|
||||
'DISTRO_FEATURES', 'slp', True, False, d)
|
||||
|
||||
if not avahi_enabled and not slp_enabled:
|
||||
return
|
||||
|
||||
syscnfdir = d.getVar('sysconfdir', True)
|
||||
dest_dir = d.getVar('D', True)
|
||||
|
||||
set_doappend(d, 'AVAHI_SERVICES_DIR', os.path.join(
|
||||
dest_dir+syscnfdir,
|
||||
'avahi',
|
||||
'services'))
|
||||
set_doappend(d, 'SLP_SERVICES_DIR', os.path.join(
|
||||
dest_dir+syscnfdir,
|
||||
'slp',
|
||||
'services'))
|
||||
|
||||
|
||||
for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
|
||||
for service in listvar_to_list(d, 'REGISTERED_SERVICES:%s' % pkg):
|
||||
if avahi_enabled:
|
||||
set_doappend(d, 'RRECOMMENDS:%s' % pkg, 'avahi-daemon')
|
||||
svc_name, svc_type, svc_port, svc_txt_data = service.split(':')
|
||||
set_doappend(d, 'FILES:%s' % pkg, os.path.join(
|
||||
syscnfdir,
|
||||
'avahi',
|
||||
'services',
|
||||
'%s.service' % svc_name))
|
||||
|
||||
if slp_enabled:
|
||||
set_doappend(d, 'RRECOMMENDS:%s' % pkg, 'slpd-lite')
|
||||
svc_name, svc_type, svc_port, svc_txt_data = service.split(':')
|
||||
set_doappend(d, 'FILES:%s' % pkg, os.path.join(
|
||||
syscnfdir,
|
||||
'slp',
|
||||
'services',
|
||||
'%s.service' % svc_name))
|
||||
|
||||
}
|
||||
|
||||
python discovery_services_postinstall() {
|
||||
avahi_enabled = bb.utils.contains(
|
||||
'DISTRO_FEATURES', 'avahi', True, False, d)
|
||||
slp_enabled = bb.utils.contains(
|
||||
'DISTRO_FEATURES', 'slp', True, False, d)
|
||||
|
||||
if not avahi_enabled and not slp_enabled:
|
||||
return
|
||||
|
||||
avahi_service_dir = d.getVar('AVAHI_SERVICES_DIR', True).strip()
|
||||
slp_service_dir = d.getVar('SLP_SERVICES_DIR', True).strip()
|
||||
|
||||
if not os.path.exists(avahi_service_dir):
|
||||
os.makedirs(avahi_service_dir)
|
||||
|
||||
if not os.path.exists(slp_service_dir):
|
||||
os.makedirs(slp_service_dir)
|
||||
|
||||
def register_service_avahi(d, service_name, service_type, service_port, service_txt_data):
|
||||
service_txt_data = service_txt_data.split('|')
|
||||
service_file = os.path.join(
|
||||
avahi_service_dir,
|
||||
'%s.service' % service_name)
|
||||
with open(service_file, 'w') as fd:
|
||||
fd.write('<?xml version="1.0" ?>\n')
|
||||
fd.write('<!DOCTYPE service-group SYSTEM "avahi-service.dtd">\n')
|
||||
fd.write('<service-group>\n')
|
||||
fd.write(' <name replace-wildcards="yes">%s on %%h</name>\n'
|
||||
% service_name)
|
||||
fd.write(' <service>\n')
|
||||
fd.write(' <type>%s</type>\n' % service_type)
|
||||
fd.write(' <port>%s</port>\n' % service_port)
|
||||
for txt_record in service_txt_data:
|
||||
if txt_record:
|
||||
key, value = txt_record.split('=')
|
||||
if key.strip() and value.strip():
|
||||
fd.write(' <txt-record>%s</txt-record>\n' % txt_record)
|
||||
else:
|
||||
bb.fatal('Invalid Additional data : \'%s\'. Ignoring!' % txt_record)
|
||||
fd.write(' </service>\n')
|
||||
fd.write('</service-group>\n')
|
||||
|
||||
def register_service_slp(d, service_name, service_type, service_port):
|
||||
service_file = os.path.join(
|
||||
slp_service_dir,
|
||||
'%s.service' % service_name)
|
||||
with open(service_file, 'w') as fd:
|
||||
fd.write('%s %s %s' % (service_name, service_type, service_port))
|
||||
|
||||
def register_services(d,pkg):
|
||||
for service in listvar_to_list(d, 'REGISTERED_SERVICES:%s' % pkg):
|
||||
svc_info = service.split(":")
|
||||
try:
|
||||
svc_name, svc_type, svc_port, svc_txt_data = svc_info
|
||||
except:
|
||||
continue
|
||||
if avahi_enabled:
|
||||
avahi_svc_type = "_" + svc_name + "._" + svc_type
|
||||
register_service_avahi(d, svc_name, avahi_svc_type, svc_port, svc_txt_data)
|
||||
if slp_enabled:
|
||||
register_service_slp(d, svc_name, svc_type, svc_port)
|
||||
|
||||
for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
|
||||
register_services(d, pkg)
|
||||
|
||||
}
|
||||
do_install[postfuncs] += "discovery_services_postinstall"
|
||||
@@ -0,0 +1,104 @@
|
||||
# Common code for generating Phosphor OpenBMC images.
|
||||
|
||||
# Additional IMAGE_FEATURES available with Phosphor OpenBMC:
|
||||
#
|
||||
# - obmc-bmc-state-mgmt - OpenBMC BMC state management
|
||||
# - obmc-bmcweb - OpenBMC webserver
|
||||
# - obmc-chassis-mgmt - OpenBMC chassis management
|
||||
# - obmc-chassis-state-mgmt - OpenBMC chassis state management
|
||||
# - obmc-console - OpenBMC serial over LAN
|
||||
# - obmc-dbus-monitor - OpenBMC dbus monitoring
|
||||
# - obmc-debug-collector - OpenBMC debug collector
|
||||
# - obmc-devtools - OpenBMC development and debugging tools
|
||||
# - obmc-fan-control - OpenBMC fan management
|
||||
# - obmc-fan-mgmt - Deprecated - use obmc-fan-control instead
|
||||
# - obmc-flash-mgmt - OpenBMC flash management
|
||||
# - obmc-fru-ipmi - OpenBMC IPMI FRU EEPROM support
|
||||
# - obmc-health-monitor - OpenBMC health monitoring
|
||||
# - obmc-host-ctl - OpenBMC host control
|
||||
# - obmc-host-ipmi - OpenBMC host IPMI
|
||||
# - obmc-host-state-mgmt - OpenBMC host state management
|
||||
# - obmc-ikvm - OpenBMC KVM over IP
|
||||
# - obmc-inventory - OpenBMC inventory support
|
||||
# - obmc-leds - OpenBMC LED support
|
||||
# - obmc-logging-mgmt - OpenBMC logging management
|
||||
# - obmc-remote-logging-mgmt - OpenBMC remote logging management
|
||||
# - obmc-rng - OpenBMC random number generator
|
||||
# - obmc-sensors - OpenBMC sensor support
|
||||
# - obmc-settings-mgmt - OpenBMC settings management
|
||||
# - obmc-software - OpenBMC software management
|
||||
# - obmc-system-mgmt - OpenBMC system management
|
||||
# - obmc-telemetry - OpenBMC telemetry solution
|
||||
# - obmc-user-mgmt - OpenBMC user management
|
||||
# - obmc-user-mgmt-ldap - OpenBMC LDAP users
|
||||
|
||||
inherit core-image
|
||||
inherit obmc-phosphor-utils
|
||||
|
||||
FEATURE_PACKAGES_obmc-bmc-state-mgmt ?= "packagegroup-obmc-apps-bmc-state-mgmt"
|
||||
FEATURE_PACKAGES_obmc-bmcweb ?= "packagegroup-obmc-apps-bmcweb"
|
||||
FEATURE_PACKAGES_obmc-chassis-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-chassis-mgmt', 'virtual-obmc-chassis-mgmt', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-chassis-state-mgmt ?= "packagegroup-obmc-apps-chassis-state-mgmt"
|
||||
FEATURE_PACKAGES_obmc-console ?= "packagegroup-obmc-apps-console"
|
||||
FEATURE_PACKAGES_obmc-dbus-monitor ?= "packagegroup-obmc-apps-dbus-monitor"
|
||||
FEATURE_PACKAGES_obmc-devtools ?= "packagegroup-obmc-apps-devtools"
|
||||
FEATURE_PACKAGES_obmc-fan-control ?= "packagegroup-obmc-apps-fan-control"
|
||||
FEATURE_PACKAGES_obmc-fan-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-fan-mgmt', 'virtual-obmc-fan-mgmt', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-flash-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-flash-mgmt', 'virtual-obmc-flash-mgmt', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-fru-ipmi ?= "packagegroup-obmc-apps-fru-ipmi"
|
||||
FEATURE_PACKAGES_obmc-health-monitor ?= "packagegroup-obmc-apps-health-monitor"
|
||||
FEATURE_PACKAGES_obmc-host-ctl ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ctl', 'virtual-obmc-host-ctl', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-host-ipmi ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-host-state-mgmt ?= "packagegroup-obmc-apps-host-state-mgmt"
|
||||
FEATURE_PACKAGES_obmc-ikvm ?= "packagegroup-obmc-apps-ikvm"
|
||||
FEATURE_PACKAGES_obmc-inventory ?= "packagegroup-obmc-apps-inventory"
|
||||
FEATURE_PACKAGES_obmc-leds ?= "packagegroup-obmc-apps-leds"
|
||||
FEATURE_PACKAGES_obmc-logging-mgmt ?= "packagegroup-obmc-apps-logging"
|
||||
FEATURE_PACKAGES_obmc-remote-logging-mgmt ?= "packagegroup-obmc-apps-remote-logging"
|
||||
FEATURE_PACKAGES_obmc-rng ?= "packagegroup-obmc-apps-rng"
|
||||
FEATURE_PACKAGES_obmc-net-ipmi ?= "phosphor-ipmi-net"
|
||||
FEATURE_PACKAGES_obmc-sensors ?= "packagegroup-obmc-apps-sensors"
|
||||
FEATURE_PACKAGES_obmc-software ?= "packagegroup-obmc-apps-software"
|
||||
FEATURE_PACKAGES_obmc-system-mgmt ?= "${@bb.utils.contains('DISTRO_FEATURES', 'obmc-phosphor-system-mgmt', 'virtual-obmc-system-mgmt', '', d)}"
|
||||
FEATURE_PACKAGES_obmc-debug-collector ?= "packagegroup-obmc-apps-debug-collector"
|
||||
FEATURE_PACKAGES_obmc-settings-mgmt ?= "packagegroup-obmc-apps-settings"
|
||||
FEATURE_PACKAGES_obmc-network-mgmt ?= "packagegroup-obmc-apps-network"
|
||||
FEATURE_PACKAGES_obmc-telemetry ?= "packagegroup-obmc-apps-telemetry"
|
||||
FEATURE_PACKAGES_obmc-user-mgmt ?= "packagegroup-obmc-apps-user-mgmt"
|
||||
FEATURE_PACKAGES_obmc-user-mgmt-ldap ?= "packagegroup-obmc-apps-user-mgmt-ldap"
|
||||
FEATURE_PACKAGES_obmc-dmtf-pmci ?= "packagegroup-obmc-apps-dmtf-pmci"
|
||||
|
||||
# FIXME: phosphor-net-ipmi depends on phosphor-ipmi-host !?!? and
|
||||
# cannot be built on core-qemu machines because of the dependency
|
||||
# tree under phosphor-ipmi-host
|
||||
FEATURE_PACKAGES_obmc-net-ipmi:qemuall = ""
|
||||
|
||||
# EVB systems do not have a managed system.
|
||||
FEATURE_PACKAGES_obmc-system-mgmt:phosphor-evb = ""
|
||||
# QEMU systems are like EVBs and do not have a managed system.
|
||||
FEATURE_PACKAGES_obmc-system-mgmt:qemuall = ""
|
||||
|
||||
# Add new packages to be installed to a package group in
|
||||
# packagegroup-obmc-apps, not here.
|
||||
OBMC_IMAGE_BASE_INSTALL = " \
|
||||
packagegroup-obmc-apps-extras \
|
||||
${OBMC_IMAGE_EXTRA_INSTALL} \
|
||||
"
|
||||
|
||||
OBMC_IMAGE_EXTRA_INSTALL ?= ""
|
||||
|
||||
CORE_IMAGE_EXTRA_INSTALL += "${OBMC_IMAGE_BASE_INSTALL}"
|
||||
|
||||
remove_etc_version() {
|
||||
rm ${IMAGE_ROOTFS}${sysconfdir}/version
|
||||
}
|
||||
|
||||
enable_ldap_nsswitch() {
|
||||
sed -i 's/\(\(passwd\|group\):\s*\).*/\1files systemd ldap/' \
|
||||
"${IMAGE_ROOTFS}${sysconfdir}/nsswitch.conf"
|
||||
sed -i 's/\(shadow:\s*\).*/\1files ldap/' \
|
||||
"${IMAGE_ROOTFS}${sysconfdir}/nsswitch.conf"
|
||||
}
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('IMAGE_FEATURES', 'obmc-user-mgmt-ldap', 'enable_ldap_nsswitch ;', '', d)}"
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Common code for recipes that create IPMI provider libraries
|
||||
|
||||
inherit obmc-phosphor-utils
|
||||
|
||||
# This LIBDIR is searched for the libraries.
|
||||
LIBDIR = "${D}/${libdir}/ipmid-providers/"
|
||||
|
||||
# The symlinks are installed in the following directories depending on the
|
||||
# variable.
|
||||
HOSTIPMI_LIBDIR = "${D}/${libdir}/host-ipmid/"
|
||||
NETIPMI_LIBDIR = "${D}/${libdir}/net-ipmid/"
|
||||
BLOBIPMI_LIBDIR = "${D}/${libdir}/blob-ipmid/"
|
||||
|
||||
python symlink_create_postinstall() {
|
||||
def install_symlink(d, libname, install_dir):
|
||||
import glob;
|
||||
|
||||
if not os.path.exists(install_dir):
|
||||
os.makedirs(install_dir)
|
||||
|
||||
lib_dir = d.getVar('LIBDIR', True)
|
||||
|
||||
# find the library extension libxxx.so.?
|
||||
install_file = lib_dir + libname + ".?"
|
||||
|
||||
filelist = glob.glob(install_file);
|
||||
|
||||
# get the library name
|
||||
path, file = os.path.split(filelist[0])
|
||||
source = "../ipmid-providers/" + file
|
||||
|
||||
# create the symlink
|
||||
os.symlink(source, os.path.join(install_dir, file))
|
||||
|
||||
for libname in listvar_to_list(d, 'HOSTIPMI_PROVIDER_LIBRARY'):
|
||||
install_dir = d.getVar('HOSTIPMI_LIBDIR', True)
|
||||
install_symlink(d, libname, install_dir)
|
||||
|
||||
for libname in listvar_to_list(d, 'NETIPMI_PROVIDER_LIBRARY'):
|
||||
install_dir = d.getVar('NETIPMI_LIBDIR', True)
|
||||
install_symlink(d, libname, install_dir)
|
||||
|
||||
for libname in listvar_to_list(d, 'BLOBIPMI_PROVIDER_LIBRARY'):
|
||||
install_dir = d.getVar('BLOBIPMI_LIBDIR', True)
|
||||
install_symlink(d, libname, install_dir)
|
||||
}
|
||||
do_install[postfuncs] += "symlink_create_postinstall"
|
||||
@@ -0,0 +1,17 @@
|
||||
do_kernel_configme:append() {
|
||||
# Remove previous CONFIG_LOCALVERSION
|
||||
sed -i '/CONFIG_LOCALVERSION/d' ${B}/.config
|
||||
|
||||
# Latest version after yocto patched (if any)
|
||||
latestVersion="-$(git rev-parse --verify HEAD)"
|
||||
shortLatestVersion="$(echo ${latestVersion} | cut -c1-8)"
|
||||
|
||||
shortLinuxVersionExt="$(echo ${LINUX_VERSION_EXTENSION} | cut -c1-8)"
|
||||
|
||||
if [ "${latestVersion}" != "${LINUX_VERSION_EXTENSION}" ]; then
|
||||
dirtyString="-dirty"
|
||||
echo "CONFIG_LOCALVERSION="\"${shortLinuxVersionExt}${dirtyString}${shortLatestVersion}\" >> ${B}/.config
|
||||
else
|
||||
echo "CONFIG_LOCALVERSION="\"${shortLinuxVersionExt}\" >> ${B}/.config
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# Common code for applications providing a D-Bus service using sd-bus bindings.
|
||||
|
||||
# Class users should define DBUS_SERVICES prior to including.
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += "libsystemd"
|
||||
|
||||
inherit obmc-phosphor-dbus-service
|
||||
@@ -0,0 +1,347 @@
|
||||
# Common code for systemd based services.
|
||||
#
|
||||
# Prior to inheriting this class, recipes can define services like this:
|
||||
#
|
||||
# SYSTEMD_SERVICE:${PN} = "foo.service bar.socket baz@.service"
|
||||
#
|
||||
# and these files will be added to the main package if they exist.
|
||||
#
|
||||
# Alternatively this class can just be inherited and
|
||||
# ${PN}.service will be added to the main package.
|
||||
#
|
||||
# Other variables:
|
||||
# INHIBIT_SYSTEMD_RESTART_POLICY_${unit}
|
||||
# Inhibit the warning that is displayed if a service unit without a
|
||||
# restart policy is detected.
|
||||
#
|
||||
# SYSTEMD_SUBSTITUTIONS = "var:val:file"
|
||||
# A specification for making python style {format} string
|
||||
# substitutions where:
|
||||
# var: the format string to search for
|
||||
# val: the value to replace with
|
||||
# file: the file in which to make the substitution
|
||||
#
|
||||
# SYSTEMD_USER_${PN}.service = "foo"
|
||||
# SYSTEMD_USER_${unit}.service = "foo"
|
||||
# The user for the unit/package.
|
||||
#
|
||||
# SYSTEMD_ENVIRONMENT_FILE:${PN} = "foo"
|
||||
# One or more environment files to be installed.
|
||||
#
|
||||
# SYSTEMD_LINK:${PN} = "tgt:name"
|
||||
# A specification for installing arbitrary links in
|
||||
# the ${systemd_system_unitdir} namespace, where:
|
||||
# tgt: the link target
|
||||
# name: the link name, relative to ${systemd_system_unitdir}
|
||||
#
|
||||
# SYSTEMD_OVERRIDE:${PN} = "src:dest"
|
||||
# A specification for installing unit overrides where:
|
||||
# src: the override file template
|
||||
# dest: the override install location, relative to ${systemd_system_unitdir}
|
||||
#
|
||||
# Typically SYSTEMD_SUBSTITUTIONS is used to deploy a range
|
||||
# of overrides from a single template file. To simply install
|
||||
# a single override use "foo.conf:my-service.d/foo.conf"
|
||||
|
||||
|
||||
inherit obmc-phosphor-utils
|
||||
inherit systemd
|
||||
inherit useradd
|
||||
|
||||
_INSTALL_SD_UNITS=""
|
||||
SYSTEMD_DEFAULT_TARGET ?= "multi-user.target"
|
||||
envfiledir ?= "${sysconfdir}/default"
|
||||
|
||||
# Big ugly hack to prevent useradd.bbclass post-parse sanity checker failure.
|
||||
# If there are users to be added, we'll add them in our post-parse.
|
||||
# If not...there don't seem to be any ill effects...
|
||||
USERADD_PACKAGES ?= " "
|
||||
USERADD_PARAM:${PN} ?= ";"
|
||||
|
||||
|
||||
def SystemdUnit(unit):
|
||||
class Unit(object):
|
||||
def __init__(self, unit):
|
||||
self.unit = unit
|
||||
|
||||
def __getattr__(self, item):
|
||||
if item == 'name':
|
||||
return self.unit
|
||||
if item == 'is_activated':
|
||||
return self.unit.startswith('dbus-')
|
||||
if item == 'is_template':
|
||||
return '@.' in self.unit
|
||||
if item == 'is_instance':
|
||||
return '@' in self.unit and not self.is_template
|
||||
if item in ['is_service', 'is_target']:
|
||||
return self.unit.split('.')[-1] == item
|
||||
if item == 'base':
|
||||
cls = self.unit.split('.')[-1]
|
||||
base = self.unit.replace('dbus-', '')
|
||||
base = base.replace('.%s' % cls, '')
|
||||
if self.is_instance:
|
||||
base = base.replace('@%s' % self.instance, '')
|
||||
if self.is_template:
|
||||
base = base.rstrip('@')
|
||||
return base
|
||||
if item == 'instance' and self.is_instance:
|
||||
inst = self.unit.rsplit('@')[-1]
|
||||
return inst.rsplit('.')[0]
|
||||
if item == 'template' and self.is_instance:
|
||||
cls = self.unit.split('.')[-1]
|
||||
return '%s@.%s' % (self.base, cls)
|
||||
if item == 'template' and self.is_template:
|
||||
return '.'.join(self.base.split('@')[:-1])
|
||||
|
||||
raise AttributeError(item)
|
||||
return Unit(unit)
|
||||
|
||||
|
||||
def systemd_parse_unit(d, path):
|
||||
import configparser
|
||||
parser = configparser.ConfigParser(strict=False)
|
||||
parser.optionxform = str
|
||||
parser.read('%s' % path)
|
||||
return parser
|
||||
|
||||
|
||||
python() {
|
||||
def check_sd_unit(d, unit):
|
||||
searchpaths = d.getVar('FILESPATH', True)
|
||||
path = bb.utils.which(searchpaths, '%s' % unit.name)
|
||||
if not os.path.isfile(path):
|
||||
# Unit does not exist in tree. Allow it to install from repo.
|
||||
# Return False here to indicate it does not exist.
|
||||
return False
|
||||
|
||||
parser = systemd_parse_unit(d, path)
|
||||
inhibit = listvar_to_list(d, 'INHIBIT_SYSTEMD_RESTART_POLICY_WARNING')
|
||||
if unit.is_service and \
|
||||
not unit.is_template and \
|
||||
unit.name not in inhibit and \
|
||||
not parser.has_option('Service', 'Restart'):
|
||||
bb.warn('Systemd unit \'%s\' does not '
|
||||
'have a restart policy defined.' % unit.name)
|
||||
return True
|
||||
|
||||
|
||||
def add_default_subs(d, file):
|
||||
for x in [
|
||||
'base_bindir',
|
||||
'bindir',
|
||||
'sbindir',
|
||||
'libexecdir',
|
||||
'envfiledir',
|
||||
'sysconfdir',
|
||||
'localstatedir',
|
||||
'datadir',
|
||||
'SYSTEMD_DEFAULT_TARGET' ]:
|
||||
set_doappend(d, 'SYSTEMD_SUBSTITUTIONS',
|
||||
'%s:%s:%s' % (x, d.getVar(x, True), file))
|
||||
|
||||
|
||||
def add_sd_unit(d, unit, pkg, unit_exist):
|
||||
# Do not add unit if it does not exist in tree.
|
||||
# It will be installed from repo.
|
||||
if not unit_exist:
|
||||
return
|
||||
|
||||
name = unit.name
|
||||
unit_dir = d.getVar('systemd_system_unitdir', True)
|
||||
set_doappend(d, 'SRC_URI', 'file://%s' % name)
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s/%s' % (unit_dir, name))
|
||||
set_doappend(d, '_INSTALL_SD_UNITS', name)
|
||||
add_default_subs(d, name)
|
||||
|
||||
|
||||
def add_sd_user(d, file, pkg):
|
||||
opts = [
|
||||
'--system',
|
||||
'--home',
|
||||
'/',
|
||||
'--no-create-home',
|
||||
'--shell /sbin/nologin',
|
||||
'--user-group']
|
||||
|
||||
var = 'SYSTEMD_USER_%s' % file
|
||||
user = listvar_to_list(d, var)
|
||||
if len(user) == 0:
|
||||
var = 'SYSTEMD_USER_%s' % pkg
|
||||
user = listvar_to_list(d, var)
|
||||
if len(user) != 0:
|
||||
if len(user) != 1:
|
||||
bb.fatal('Too many users assigned to %s: \'%s\'' % (var, ' '.join(user)))
|
||||
|
||||
user = user[0]
|
||||
set_doappend(d, 'SYSTEMD_SUBSTITUTIONS',
|
||||
'USER:%s:%s' % (user, file))
|
||||
if user not in d.getVar('USERADD_PARAM:%s' % pkg, True):
|
||||
set_doappend(
|
||||
d,
|
||||
'USERADD_PARAM:%s' % pkg,
|
||||
'%s' % (' '.join(opts + [user])),
|
||||
';')
|
||||
if pkg not in d.getVar('USERADD_PACKAGES', True):
|
||||
set_doappend(d, 'USERADD_PACKAGES', pkg)
|
||||
|
||||
|
||||
def add_env_file(d, name, pkg):
|
||||
set_doappend(d, 'SRC_URI', 'file://%s' % name)
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s/%s' \
|
||||
% (d.getVar('envfiledir', True), name))
|
||||
set_doappend(d, '_INSTALL_ENV_FILES', name)
|
||||
|
||||
|
||||
def install_link(d, spec, pkg):
|
||||
tgt, dest = spec.split(':')
|
||||
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s/%s' \
|
||||
% (d.getVar('systemd_system_unitdir', True), dest))
|
||||
set_doappend(d, '_INSTALL_LINKS', spec)
|
||||
|
||||
|
||||
def add_override(d, spec, pkg):
|
||||
tmpl, dest = spec.split(':')
|
||||
set_doappend(d, '_INSTALL_OVERRIDES', '%s' % spec)
|
||||
unit_dir = d.getVar('systemd_system_unitdir', True)
|
||||
set_doappend(d, 'FILES:%s' % pkg, '%s/%s' % (unit_dir, dest))
|
||||
add_default_subs(d, '%s' % dest)
|
||||
add_sd_user(d, '%s' % dest, pkg)
|
||||
|
||||
|
||||
if d.getVar('CLASSOVERRIDE', True) != 'class-target':
|
||||
return
|
||||
|
||||
d.appendVarFlag('do_install', 'postfuncs', ' systemd_do_postinst')
|
||||
|
||||
pn = d.getVar('PN', True)
|
||||
if d.getVar('SYSTEMD_SERVICE:%s' % pn, True) is None:
|
||||
d.setVar('SYSTEMD_SERVICE:%s' % pn, '%s.service' % pn)
|
||||
|
||||
for pkg in listvar_to_list(d, 'SYSTEMD_PACKAGES'):
|
||||
svc = listvar_to_list(d, 'SYSTEMD_SERVICE:%s' % pkg)
|
||||
svc = [SystemdUnit(x) for x in svc]
|
||||
tmpl = [x.template for x in svc if x.is_instance]
|
||||
tmpl = list(set(tmpl))
|
||||
tmpl = [SystemdUnit(x) for x in tmpl]
|
||||
svc = [x for x in svc if not x.is_instance]
|
||||
|
||||
for unit in tmpl + svc:
|
||||
unit_exist = check_sd_unit(d, unit)
|
||||
add_sd_unit(d, unit, pkg, unit_exist)
|
||||
add_sd_user(d, unit.name, pkg)
|
||||
for name in listvar_to_list(d, 'SYSTEMD_ENVIRONMENT_FILE:%s' % pkg):
|
||||
add_env_file(d, name, pkg)
|
||||
for spec in listvar_to_list(d, 'SYSTEMD_LINK:%s' % pkg):
|
||||
install_link(d, spec, pkg)
|
||||
for spec in listvar_to_list(d, 'SYSTEMD_OVERRIDE:%s' % pkg):
|
||||
add_override(d, spec, pkg)
|
||||
}
|
||||
|
||||
|
||||
python systemd_do_postinst() {
|
||||
def make_subs(d):
|
||||
all_subs = {}
|
||||
for spec in listvar_to_list(d, 'SYSTEMD_SUBSTITUTIONS'):
|
||||
spec, file = spec.rsplit(':', 1)
|
||||
all_subs.setdefault(file, []).append(spec)
|
||||
|
||||
for f, v in all_subs.items():
|
||||
subs = dict([ x.split(':') for x in v])
|
||||
if not subs:
|
||||
continue
|
||||
|
||||
path = d.getVar('D', True)
|
||||
path += d.getVar('systemd_system_unitdir', True)
|
||||
path += '/%s' % f
|
||||
with open(path, 'r') as fd:
|
||||
content = fd.read()
|
||||
with open(path, 'w+') as fd:
|
||||
try:
|
||||
fd.write(content.format(**subs))
|
||||
except KeyError as e:
|
||||
bb.fatal('No substitution found for %s in '
|
||||
'file \'%s\'' % (e, f))
|
||||
|
||||
|
||||
def install_envs(d):
|
||||
install_dir = d.getVar('D', True)
|
||||
install_dir += d.getVar('envfiledir', True)
|
||||
searchpaths = d.getVar('FILESPATH', True)
|
||||
|
||||
for f in listvar_to_list(d, '_INSTALL_ENV_FILES'):
|
||||
src = bb.utils.which(searchpaths, f)
|
||||
if not os.path.isfile(src):
|
||||
bb.fatal('Did not find SYSTEMD_ENVIRONMENT_FILE:'
|
||||
'\'%s\'' % src)
|
||||
|
||||
dest = os.path.join(install_dir, f)
|
||||
parent = os.path.dirname(dest)
|
||||
if not os.path.exists(parent):
|
||||
os.makedirs(parent)
|
||||
|
||||
with open(src, 'r') as fd:
|
||||
content = fd.read()
|
||||
with open(dest, 'w+') as fd:
|
||||
fd.write(content)
|
||||
|
||||
|
||||
def install_links(d):
|
||||
install_dir = d.getVar('D', True)
|
||||
install_dir += d.getVar('systemd_system_unitdir', True)
|
||||
|
||||
for spec in listvar_to_list(d, '_INSTALL_LINKS'):
|
||||
tgt, dest = spec.split(':')
|
||||
dest = os.path.join(install_dir, dest)
|
||||
parent = os.path.dirname(dest)
|
||||
if not os.path.exists(parent):
|
||||
os.makedirs(parent)
|
||||
os.symlink(tgt, dest)
|
||||
|
||||
|
||||
def install_overrides(d):
|
||||
install_dir = d.getVar('D', True)
|
||||
install_dir += d.getVar('systemd_system_unitdir', True)
|
||||
searchpaths = d.getVar('FILESPATH', True)
|
||||
|
||||
for spec in listvar_to_list(d, '_INSTALL_OVERRIDES'):
|
||||
tmpl, dest = spec.split(':')
|
||||
source = bb.utils.which(searchpaths, tmpl)
|
||||
if not os.path.isfile(source):
|
||||
bb.fatal('Did not find SYSTEMD_OVERRIDE '
|
||||
'template: \'%s\'' % source)
|
||||
|
||||
dest = os.path.join(install_dir, dest)
|
||||
parent = os.path.dirname(dest)
|
||||
if not os.path.exists(parent):
|
||||
os.makedirs(parent)
|
||||
|
||||
with open(source, 'r') as fd:
|
||||
content = fd.read()
|
||||
with open('%s' % dest, 'w+') as fd:
|
||||
fd.write(content)
|
||||
|
||||
|
||||
install_links(d)
|
||||
install_envs(d)
|
||||
install_overrides(d)
|
||||
make_subs(d)
|
||||
}
|
||||
|
||||
|
||||
do_install:append() {
|
||||
# install systemd service/socket/template files
|
||||
[ -z "${_INSTALL_SD_UNITS}" ] || \
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
for s in ${_INSTALL_SD_UNITS}; do
|
||||
install -m 0644 ${WORKDIR}/$s \
|
||||
${D}${systemd_system_unitdir}/$s
|
||||
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
|
||||
-e 's,@BINDIR@,${bindir},g' \
|
||||
-e 's,@SBINDIR@,${sbindir},g' \
|
||||
-e 's,@LIBEXECDIR@,${libexecdir},g' \
|
||||
-e 's,@LOCALSTATEDIR@,${localstatedir},g' \
|
||||
-e 's,@DATADIR@,${datadir},g' \
|
||||
${D}${systemd_system_unitdir}/$s
|
||||
done
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
def set_doappend(d, var, val, sep=' '):
|
||||
values = (d.getVar(var, True) or '').split(sep)
|
||||
if filter(bool, values):
|
||||
d.appendVar(var, '%s%s' %(sep, val))
|
||||
else:
|
||||
d.setVar(var, val)
|
||||
|
||||
|
||||
def listvar_to_list(d, list_var, sep=' '):
|
||||
return list(filter(bool, (d.getVar(list_var, True) or '').split(sep)))
|
||||
|
||||
|
||||
def compose_list(d, fmtvar, *listvars, **kw):
|
||||
import itertools
|
||||
fmt = d.getVar(fmtvar, True)
|
||||
lists = [listvar_to_list(d, x) for x in listvars]
|
||||
lst = [fmt.format(*x) for x in itertools.product(*lists)]
|
||||
return (kw.get('sep') or ' ').join(lst)
|
||||
|
||||
|
||||
def compose_list_zip(d, fmtvar, *listvars, **kw):
|
||||
fmt = d.getVar(fmtvar, True)
|
||||
lists = [listvar_to_list(d, x) for x in listvars]
|
||||
lst = [fmt.format(*x) for x in zip(*lists)]
|
||||
return (kw.get('sep') or ' ').join(lst)
|
||||
@@ -0,0 +1,74 @@
|
||||
#This class applies patches to an XML file during do_patch(). The
|
||||
#patches themselves are specified in XML in a separate file that must
|
||||
#be in SRC_URI and end in .patch.xml. The patch XML file must also
|
||||
#have a <targetFile> element that specifies the base name of the file
|
||||
#that needs to be patched.
|
||||
#
|
||||
#See patchxml.py for details on the XML patch format.
|
||||
#
|
||||
|
||||
inherit python3native
|
||||
inherit obmc-phosphor-utils
|
||||
do_patch[depends] = "mrw-patch-native:do_populate_sysroot"
|
||||
|
||||
|
||||
def find_patch_files(d):
|
||||
all_patches = listvar_to_list(d, 'SRC_URI')
|
||||
xml_patches = [x for x in all_patches if x.endswith('.patch.xml') and
|
||||
x.startswith('file://')]
|
||||
|
||||
return [x.lstrip('file://') for x in xml_patches]
|
||||
|
||||
|
||||
def apply_xml_patch(base_patch_name, d):
|
||||
import xml.etree.ElementTree as et
|
||||
import subprocess
|
||||
|
||||
patch_file = os.path.join(d.getVar("WORKDIR", True), base_patch_name)
|
||||
|
||||
if not os.path.exists(patch_file):
|
||||
bb.fatal("Could not find patch file " + patch_file +
|
||||
" specified in SRC_URI")
|
||||
|
||||
patch_tree = et.parse(patch_file)
|
||||
patch_root = patch_tree.getroot()
|
||||
target_file_element = patch_root.find("targetFile")
|
||||
|
||||
if target_file_element is None:
|
||||
bb.fatal("Could not find <targetFile> element in patch file "
|
||||
+ patch_file)
|
||||
else:
|
||||
xml = target_file_element.text
|
||||
|
||||
xml = os.path.join(d.getVar("S", True), xml)
|
||||
|
||||
if not os.path.exists(xml):
|
||||
bb.fatal("Could not find XML file to patch: " + xml)
|
||||
|
||||
print("Applying XML fixes found in " + patch_file + " to " + xml)
|
||||
|
||||
cmd = []
|
||||
cmd.append(os.path.join(d.getVar("bindir", True), "obmc-mrw/patchxml.py"))
|
||||
cmd.append("-x")
|
||||
cmd.append(xml)
|
||||
cmd.append("-p")
|
||||
cmd.append(patch_file)
|
||||
cmd.append("-o")
|
||||
cmd.append(xml + ".patched")
|
||||
|
||||
try:
|
||||
subprocess.check_call(cmd)
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.fatal("Failed patching XML:\n%s" % e.output)
|
||||
|
||||
os.rename(xml, xml + ".orig")
|
||||
os.rename(xml + ".patched", xml)
|
||||
|
||||
|
||||
python xmlpatch_do_patch() {
|
||||
|
||||
for patch in find_patch_files(d):
|
||||
apply_xml_patch(patch, d)
|
||||
}
|
||||
|
||||
do_patch[postfuncs] += "xmlpatch_do_patch"
|
||||
@@ -0,0 +1 @@
|
||||
config_dir="${datadir}/phosphor-dbus-monitor"
|
||||
@@ -0,0 +1,4 @@
|
||||
yaml_dir = "${datadir}/phosphor-dbus-yaml/yaml"
|
||||
|
||||
PACKAGE_BEFORE_PN += "${PN}-yaml"
|
||||
FILES:${PN}-yaml += "${yaml_dir}"
|
||||
@@ -0,0 +1,5 @@
|
||||
bmc_dump_path="/var/lib/phosphor-debug-collector/dumps"
|
||||
dreport_plugin_dir = "${datadir}/dreport.d/plugins.d"
|
||||
dreport_include_dir = "${datadir}/dreport.d/include.d"
|
||||
dreport_conf_dir = "${datadir}/dreport.d/conf.d"
|
||||
dreport_dir = "${datadir}/dreport.d/"
|
||||
@@ -0,0 +1,63 @@
|
||||
####
|
||||
# Copyright 2020 Hewlett Packard Enterprise Development LP.
|
||||
# Copyright 2021 Intel Corporation
|
||||
#
|
||||
# Add a basic class to add a privileged user from an ssh
|
||||
# standpoint and a public key passed as an input parameter
|
||||
# from the local.conf file
|
||||
# Example:
|
||||
# INHERIT += "phosphor-deploy-ssh-keys"
|
||||
#
|
||||
# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub"
|
||||
# or
|
||||
# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub;root:/path/to/id_rsa.pub"
|
||||
####
|
||||
|
||||
inherit useradd_base
|
||||
|
||||
IMAGE_PREPROCESS_COMMAND += "deploy_local_user;"
|
||||
|
||||
deploy_local_user () {
|
||||
if [ "${SSH_KEYS}" == "" ]; then
|
||||
bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)"
|
||||
return
|
||||
fi
|
||||
|
||||
ssh_keys="${SSH_KEYS}"
|
||||
while [ "${ssh_keys}" != "" ]; do
|
||||
current_key=`echo "$ssh_keys" | cut -d ';' -f1`
|
||||
ssh_keys=`echo "$ssh_keys" | cut -s -d ';' -f2-`
|
||||
|
||||
username=`echo "$current_key" | awk -F":" '{ print $1}'`
|
||||
key_path=`echo "$current_key" | awk -F":" '{ print $2}'`
|
||||
|
||||
if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then
|
||||
perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}"
|
||||
fi
|
||||
|
||||
if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then
|
||||
install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/
|
||||
fi
|
||||
|
||||
if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then
|
||||
install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
|
||||
else
|
||||
cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
|
||||
fi
|
||||
|
||||
uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'`
|
||||
guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'`
|
||||
|
||||
chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh
|
||||
chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
|
||||
chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh
|
||||
|
||||
is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true`
|
||||
|
||||
if [ -z "${is_group}" ]; then
|
||||
perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin"
|
||||
fi
|
||||
|
||||
perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}"
|
||||
done
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
presence_datadir="${datadir}/phosphor-fan-presence"
|
||||
control_datadir="${datadir}/phosphor-fan-control"
|
||||
monitor_datadir="${datadir}/phosphor-fan-monitor"
|
||||
@@ -0,0 +1,2 @@
|
||||
base_datadir="${datadir}/phosphor-inventory-manager"
|
||||
rules_datadir="${base_datadir}/events.d"
|
||||
@@ -0,0 +1,4 @@
|
||||
hostfw_datadir="${datadir}/phosphor-ipmi-fru/hostfw"
|
||||
inventory_datadir="${datadir}/phosphor-ipmi-fru/inventory"
|
||||
config_datadir="${datadir}/phosphor-ipmi-fru/config"
|
||||
properties_datadir="${datadir}/phosphor-ipmi-fru/properties"
|
||||
@@ -0,0 +1,27 @@
|
||||
# Common code for recipes that implement Phosphor IPMI Whitelist
|
||||
# packages
|
||||
|
||||
WHITELIST ?= "${PN}.conf"
|
||||
INSTALLDIR = "${D}${datadir}/phosphor-ipmi-host/"
|
||||
|
||||
python phosphor_ipmi_host_whitelist_postinstall() {
|
||||
def install_whitelist(d):
|
||||
# Create the install directory if needed
|
||||
whitelist_file = d.getVar('WHITELIST', True)
|
||||
install_dir = d.getVar('INSTALLDIR', True)
|
||||
if not os.path.exists(install_dir):
|
||||
os.makedirs(install_dir)
|
||||
install_file = os.path.join(install_dir, whitelist_file)
|
||||
|
||||
# Search for conf file in FILESPATH
|
||||
searchpaths = d.getVar('FILESPATH', True)
|
||||
path = bb.utils.which(searchpaths, whitelist_file)
|
||||
if not os.path.isfile(path):
|
||||
bb.fatal('Did not find conf file "%s"' % whitelist_file)
|
||||
|
||||
# Copy the conf file into install directory
|
||||
bb.utils.copyfile(path, install_file)
|
||||
|
||||
install_whitelist(d)
|
||||
}
|
||||
do_install[postfuncs] += "phosphor_ipmi_host_whitelist_postinstall"
|
||||
@@ -0,0 +1,4 @@
|
||||
sensor_datadir="${datadir}/phosphor-ipmi-host/sensor"
|
||||
sensor_yamldir="${datadir}/phosphor-ipmi-host/sensor-yamls"
|
||||
hostfw_datadir="${datadir}/phosphor-ipmi-fru/hostfw"
|
||||
config_datadir="${datadir}/phosphor-ipmi-host/config"
|
||||
@@ -0,0 +1,28 @@
|
||||
inherit phosphor-dbus-yaml
|
||||
|
||||
LOGGING_YAML_SUBDIRS ??= "${OBMC_ORG_YAML_SUBDIRS}"
|
||||
|
||||
do_install:append() {
|
||||
for yaml_d in ${LOGGING_YAML_SUBDIRS} ;
|
||||
do
|
||||
if [ -d ${S}/${yaml_d} ];
|
||||
then
|
||||
yaml_base=${S}
|
||||
elif [ -d ${S}/yaml/${yaml_d} ];
|
||||
then
|
||||
yaml_base=${S}/yaml
|
||||
else
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
for yaml_f in $(find ${yaml_base}/${yaml_d} -name "*.errors.yaml" -or \
|
||||
-name "*.metadata.yaml") ;
|
||||
do
|
||||
subpath=$(realpath --relative-to=${yaml_base} ${yaml_f})
|
||||
install -d $(dirname ${D}${yaml_dir}/$subpath)
|
||||
|
||||
install -m 0644 ${yaml_f} ${D}${yaml_dir}/$subpath
|
||||
done
|
||||
done
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
callouts_datadir="${datadir}/phosphor-logging/callouts"
|
||||
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# This function is intended to add root to corresponding groups if 'debug-tweaks' or 'allow-root-login' is in IMAGE_FEATURES.
|
||||
#
|
||||
update_root_user_groups () {
|
||||
if [ -e ${IMAGE_ROOTFS}/etc/group ]; then
|
||||
sed -i '/^\(ipmi\|web\|redfish\|priv-admin\):.*:.*:$/s/$/root/' ${IMAGE_ROOTFS}/etc/group
|
||||
fi
|
||||
}
|
||||
# Add root user to the needed groups
|
||||
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "update_root_user_groups; ", "", d)}'
|
||||
@@ -0,0 +1 @@
|
||||
settings_datadir="${datadir}/phosphor-settings/default"
|
||||
@@ -0,0 +1,24 @@
|
||||
# eMMC-specific configuration for the phosphor-manager-software package
|
||||
|
||||
PACKAGECONFIG:append = " mmc_layout"
|
||||
|
||||
EXTRA_OEMESON:append = " \
|
||||
-Dactive-bmc-max-allowed=2 \
|
||||
-Dmedia-dir='/media' \
|
||||
-Doptional-images='image-hostfw' \
|
||||
"
|
||||
|
||||
RDEPENDS:phosphor-software-manager-updater-mmc += " \
|
||||
gptfdisk \
|
||||
parted \
|
||||
zstd \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:phosphor-software-manager-updater-mmc += " \
|
||||
obmc-flash-mmc@.service \
|
||||
obmc-flash-mmc-remove@.service \
|
||||
obmc-flash-mmc-setprimary@.service \
|
||||
obmc-flash-mmc-mount.service \
|
||||
obmc-flash-mmc-umount.service \
|
||||
obmc-flash-mmc-mirroruboot.service \
|
||||
"
|
||||
@@ -0,0 +1,37 @@
|
||||
# UBI-specific configuration for the phosphor-manager-software package
|
||||
|
||||
PACKAGECONFIG:append = " ubifs_layout"
|
||||
|
||||
RDEPENDS:phosphor-software-manager-updater-ubi += " \
|
||||
mtd-utils-ubifs \
|
||||
"
|
||||
|
||||
# Add ubi-fs configs
|
||||
EXTRA_OEMESON:append = " \
|
||||
-Dactive-bmc-max-allowed=2 \
|
||||
-Dmedia-dir='/media' \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:phosphor-software-manager-updater-ubi += " \
|
||||
obmc-flash-bmc-ubirw.service \
|
||||
obmc-flash-bmc-ubiro@.service \
|
||||
obmc-flash-bmc-ubirw-remove.service \
|
||||
obmc-flash-bmc-ubiro-remove@.service \
|
||||
obmc-flash-bmc-ubiremount.service \
|
||||
obmc-flash-bmc-updateubootvars@.service \
|
||||
obmc-flash-bmc-cleanup.service \
|
||||
obmc-flash-bmc-mirroruboot.service \
|
||||
"
|
||||
|
||||
# Name of the mtd device where the ubi volumes should be created
|
||||
BMC_RW_MTD ??= "bmc"
|
||||
BMC_RO_MTD ??= "bmc"
|
||||
BMC_KERNEL_MTD ??= "bmc"
|
||||
DISTROOVERRIDES .= ":flash-${FLASH_SIZE}"
|
||||
BMC_RW_SIZE ??= "0x600000"
|
||||
BMC_RW_SIZE:flash-131072 = "0x2000000"
|
||||
SYSTEMD_SUBSTITUTIONS += "RW_MTD:${BMC_RW_MTD}:obmc-flash-bmc-ubirw.service"
|
||||
SYSTEMD_SUBSTITUTIONS += "RO_MTD:${BMC_RO_MTD}:obmc-flash-bmc-ubiro@.service"
|
||||
SYSTEMD_SUBSTITUTIONS += "KERNEL_MTD:${BMC_KERNEL_MTD}:obmc-flash-bmc-ubiro@.service"
|
||||
SYSTEMD_SUBSTITUTIONS += "RW_SIZE:${BMC_RW_SIZE}:obmc-flash-bmc-ubirw.service"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
inherit skeleton
|
||||
|
||||
DEPENDS:append:class-target = " glib-2.0 obmc-libobmc-intf"
|
||||
|
||||
do_compile:class-native() {
|
||||
:
|
||||
}
|
||||
|
||||
do_install:append:class-target() {
|
||||
oe_runmake install DESTDIR=${D}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
SRCREV ?= "d8c6f5a38f20b9d2eac921af46a90eb33716f51d"
|
||||
SKELETON_URI ?= "git://github.com/openbmc/skeleton;branch=master;protocol=https"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
|
||||
@@ -0,0 +1,6 @@
|
||||
inherit skeleton-rev
|
||||
|
||||
HOMEPAGE = "http://github.com/openbmc/skeleton"
|
||||
|
||||
SRC_URI += "${SKELETON_URI}"
|
||||
S = "${WORKDIR}/git/${SKELETON_DIR}"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "etcd"
|
||||
DISTROOVERRIDES .= "df-etcd"
|
||||
@@ -0,0 +1 @@
|
||||
DISTRO_FEATURES += "extra-dev-debug-tools"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "obmc-aspeed-spi-master"
|
||||
DISTROOVERRIDES .= ":df-aspeed-spi-master"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "obmc-aspeednic-use-mac2"
|
||||
DISTROOVERRIDES .= ":df-aspeednic-use-mac2"
|
||||
@@ -0,0 +1,150 @@
|
||||
require conf/distro/include/phosphor-defaults.inc
|
||||
require conf/distro/include/phosphor-pkg-tweaks.inc
|
||||
|
||||
# Match the distro codename from upstream poky.
|
||||
DISTRO_CODENAME ?= "mickledore"
|
||||
|
||||
# Override these in poky based distros
|
||||
POKY_DEFAULT_DISTRO_FEATURES = "opengl ptest multiarch wayland vulkan"
|
||||
POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot"
|
||||
POKY_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet"
|
||||
|
||||
DISTRO_EXTRA_RDEPENDS += " ${POKY_DEFAULT_EXTRA_RDEPENDS}"
|
||||
DISTRO_EXTRA_RRECOMMENDS += " ${POKY_DEFAULT_EXTRA_RRECOMMENDS}"
|
||||
|
||||
DISTROOVERRIDES .= ":openbmc-phosphor"
|
||||
|
||||
TCLIBCAPPEND = ""
|
||||
|
||||
QEMU_TARGETS ?= "arm aarch64 i386 riscv32 riscv64 ppc64le x86_64"
|
||||
|
||||
PREMIRRORS ??= "\
|
||||
bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
gitsm://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
hg://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
osc://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
p4://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
svn://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
|
||||
|
||||
MIRRORS =+ "\
|
||||
ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
http://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
|
||||
https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
|
||||
|
||||
# The CONNECTIVITY_CHECK_URI's are used to test whether we can successfully
|
||||
# fetch from the network (and warn you if not). To disable the test set
|
||||
# the variable to be empty.
|
||||
# Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=https;rev=master
|
||||
CONNECTIVITY_CHECK_URIS ?= "https://yoctoproject.org/connectivity.html"
|
||||
|
||||
SANITY_TESTED_DISTROS ?= " \
|
||||
poky-2.4 \n \
|
||||
poky-2.5 \n \
|
||||
ubuntu-15.04 \n \
|
||||
ubuntu-16.04 \n \
|
||||
ubuntu-16.10 \n \
|
||||
ubuntu-17.04 \n \
|
||||
fedora-26 \n \
|
||||
centos-7 \n \
|
||||
debian-8 \n \
|
||||
debian-9 \n \
|
||||
opensuse-42.1 \n \
|
||||
opensuse-42.2 \n \
|
||||
"
|
||||
#
|
||||
# OELAYOUT_ABI allows us to notify users when the format of TMPDIR changes in
|
||||
# an incompatible way. Such changes should usually be detailed in the commit
|
||||
# that breaks the format and have been previously discussed on the mailing list
|
||||
# with general agreement from the core team.
|
||||
#
|
||||
|
||||
OELAYOUT_ABI = "12"
|
||||
|
||||
# QA check settings - a little stricter than the OE-Core defaults
|
||||
WARN_TO_ERROR_QA = "already-stripped compile-host-path install-host-path \
|
||||
installed-vs-shipped ldflags pn-overrides rpaths staticdev \
|
||||
useless-rpaths"
|
||||
WARN_QA:remove = "${WARN_TO_ERROR_QA}"
|
||||
ERROR_QA:append = " ${WARN_TO_ERROR_QA}"
|
||||
|
||||
require conf/distro/include/no-static-libs.inc
|
||||
require conf/distro/include/yocto-uninative.inc
|
||||
|
||||
DISTRO_NAME ?= "Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)"
|
||||
TARGET_VENDOR="-openbmc"
|
||||
|
||||
VIRTUAL-RUNTIME_keymaps = ""
|
||||
|
||||
# Phosphor OpenBMC uses systemd and udev
|
||||
VIRTUAL-RUNTIME_init_manager = "systemd"
|
||||
VIRTUAL-RUNTIME_initscripts = ""
|
||||
|
||||
DISTRO_FEATURES_BACKFILL_CONSIDERED = " \
|
||||
bluez5 \
|
||||
ldconfig \
|
||||
gobject-introspection-data \
|
||||
pulseaudio \
|
||||
sysvinit \
|
||||
"
|
||||
|
||||
DISTRO_FEATURES_OBMC = " \
|
||||
obmc-host-ctl \
|
||||
obmc-host-ipmi \
|
||||
obmc-phosphor-chassis-mgmt \
|
||||
obmc-phosphor-fan-mgmt \
|
||||
obmc-phosphor-flash-mgmt \
|
||||
obmc-phosphor-system-mgmt \
|
||||
"
|
||||
|
||||
DISTRO_FEATURES_DEFAULT = " \
|
||||
avahi \
|
||||
ipv4 \
|
||||
ipv6 \
|
||||
pam \
|
||||
security \
|
||||
slp \
|
||||
systemd \
|
||||
seccomp \
|
||||
usrmerge \
|
||||
"
|
||||
|
||||
DISTRO_FEATURES += " \
|
||||
${DISTRO_FEATURES_DEFAULT} \
|
||||
${DISTRO_FEATURES_OBMC} \
|
||||
"
|
||||
|
||||
DISTRO_EXTRA_RDEPENDS:remove:qemuarm = "packagegroup-core-device-devel"
|
||||
|
||||
include conf/distro/include/openbmc-phosphor/${MACHINE}.inc
|
||||
|
||||
IMAGE_CLASSES:append = " image_types_phosphor phosphor-rootfs-postcommands"
|
||||
IMAGE_CLASSES:append:npcm7xx = " image_types_phosphor_nuvoton"
|
||||
IMAGE_CLASSES:append:npcm8xx = " image_types_phosphor_nuvoton_npcm8xx"
|
||||
|
||||
IMAGE_INSTALL:append = " dbus-broker libnss-systemd"
|
||||
|
||||
# Skip the udev database by default. It adds around 2MB
|
||||
# compressed to the root filesystem, and probably doesn't
|
||||
# make sense on a BMC anyway.
|
||||
BAD_RECOMMENDATIONS += "udev-hwdb"
|
||||
BAD_RECOMMENDATIONS += "shared-mime-info"
|
||||
|
||||
# e2fsprogs isn't needed on a BMC without MMC, where it gets explicitly added
|
||||
BAD_RECOMMENDATIONS += "e2fsprogs-e2fsck"
|
||||
|
||||
LAYER_CONF_VERSION ?= "8"
|
||||
|
||||
KERNEL_CLASSES:append = " obmc-phosphor-kernel-version"
|
||||
|
||||
# Some packages have directory trees of YAML files arranged based on
|
||||
# canonical organization names. 'org/freedesktop' and 'xyz/openbmc_project'
|
||||
# should be used everywhere in phosphor, but some layers may append this with
|
||||
# their own organization(s).
|
||||
OBMC_ORG_YAML_SUBDIRS += " org/freedesktop xyz/openbmc_project"
|
||||
|
||||
PREFERRED_VERSION_libgpiod = "1.6.4"
|
||||
|
||||
# Enable SBOM: https://docs.yoctoproject.org/next/dev-manual/sbom.html
|
||||
INHERIT += "create-spdx"
|
||||
@@ -0,0 +1,166 @@
|
||||
OBMC_BMC_INSTANCES ?= "0"
|
||||
OBMC_CHASSIS_INSTANCES ?= "0"
|
||||
OBMC_HOST_INSTANCES ?= "0"
|
||||
OBMC_POWER_INSTANCES ?= "0"
|
||||
|
||||
# obmc-bmc-state-manager
|
||||
#
|
||||
# Provides an implementation of the xyz.openbmc_project.State.BMC
|
||||
# interface.
|
||||
VIRTUAL-RUNTIME_obmc-bmc-state-manager ?= "phosphor-state-manager-bmc"
|
||||
|
||||
# obmc-chassis-state-manager
|
||||
#
|
||||
# Provides an implementation of the xyz.openbmc_project.State.Chassis
|
||||
# interface.
|
||||
VIRTUAL-RUNTIME_obmc-chassis-state-manager ?= "phosphor-state-manager-chassis"
|
||||
|
||||
# obmc-host-state-manager
|
||||
#
|
||||
# Provides an implementation of the xyz.openbmc_project.State.Host
|
||||
# interface.
|
||||
VIRTUAL-RUNTIME_obmc-host-state-manager ?= "phosphor-state-manager-host"
|
||||
|
||||
# obmc-discover-system-state
|
||||
#
|
||||
# Provides an implementation of phosphor-discover-system-state, which, if the
|
||||
# host is powered off, will check the current power policy and, if necessary,
|
||||
# power the host back on.
|
||||
VIRTUAL-RUNTIME_obmc-discover-system-state ?= "phosphor-state-manager-discover"
|
||||
|
||||
# obmc-fan-presence
|
||||
#
|
||||
# Provides implementations of fan presence detection
|
||||
VIRTUAL-RUNTIME_obmc-fan-presence ?= "phosphor-fan-presence-tach"
|
||||
|
||||
# obmc-fan-control
|
||||
#
|
||||
# Provides implementations of fan control
|
||||
VIRTUAL-RUNTIME_obmc-fan-control ?= "phosphor-fan-control"
|
||||
|
||||
# obmc-inventory-manager
|
||||
#
|
||||
# Provides an implementation of the xyz.openbmc_project.Inventory.Manager
|
||||
# interface.
|
||||
VIRTUAL-RUNTIME_obmc-inventory-manager ?= "phosphor-inventory-manager"
|
||||
|
||||
# obmc-sensors-hwmon
|
||||
#
|
||||
# Provides an implementation of xyz.openbmc_project.Sensor.Value
|
||||
# for hwmon sensors.
|
||||
VIRTUAL-RUNTIME_obmc-sensors-hwmon ?= "phosphor-hwmon"
|
||||
|
||||
# phosphor-hwmon-config
|
||||
#
|
||||
# The phosphor-hwmon package can have its configuration generated
|
||||
# automatically if the MRW feature is enabled.
|
||||
VIRTUAL-RUNTIME_phosphor-hwmon-config ?= ""
|
||||
|
||||
# Configuration overrides for phosphor-ipmi-fru.
|
||||
#
|
||||
# The phosphor-ipmi-fru application is data-driven and requires an input
|
||||
# mapping of how the host firmware reports inventory via IPMI and the mapping
|
||||
# of that inventory metadata to DBus objects interfaces and properties.
|
||||
|
||||
# The phosphor-ipmi-fru application is data-driven and requires an input
|
||||
# mapping of how the host firmware reports inventory via IPMI.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-ipmi-fru build process.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-hostfw-config ?= "phosphor-ipmi-fru-hostfw-config-example-native"
|
||||
|
||||
# The phosphor-ipmi-fru application is data-driven and requires an input
|
||||
# mapping of IPMI inventory metadata to DBus objects interfaces and properties.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-ipmi-fru build process in the native sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-inventory ?= "phosphor-ipmi-fru-inventory-example-native"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-properties ?= "phosphor-ipmi-fru-properties-native"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-read-inventory ?= "phosphor-ipmi-fru-read-inventory-example-native"
|
||||
|
||||
# Configuration overrides for phosphor-host-ipmid.
|
||||
#
|
||||
# The phosphor-host-ipmid application is data-driven.
|
||||
|
||||
# The phosphor-host-ipmid application is data-driven and requires an input
|
||||
# mapping of IPMI inventory sensor metadata to DBus objects interfaces and properties.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-host-ipmid build process in the native sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-sensor-inventory ?= "phosphor-ipmi-sensor-inventory-native"
|
||||
|
||||
# The phosphor-host-ipmid application is data-driven and requires an input
|
||||
# mapping of inventory object path to the sensor number and sensor metadata.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-host-ipmid build process in the native sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-inventory-sel ?= "phosphor-ipmi-inventory-sel-native"
|
||||
|
||||
# Various other overrides.
|
||||
|
||||
# The phosphor-led-manager application is data-driven and requires an input
|
||||
# yaml of LED group and members.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-led-manager build process in the native sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native ?= "phosphor-led-manager-config-example-native"
|
||||
|
||||
# The phosphor-logging application has a data driven plugin that adds FRU
|
||||
# callout information to error logs, when applications generating error logs
|
||||
# add the requisite callout metadata to the systemd journal. The plugin requires
|
||||
# an input mapping of Linux sysfs devices to OpenBMC DBus objects.
|
||||
# This virtual is a native recipe that provides that mapping by installing
|
||||
# configuration files in the format and native sysroot location expected by
|
||||
# the phosphor-logging build process in the native sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-logging-callouts ?= "phosphor-logging-callouts-example-native"
|
||||
|
||||
# The phosphor-fan-presence application is data driven and requires an input
|
||||
# YAML that maps fans to their tach sensors. This virtual is a recipe that
|
||||
# provides that mapping by installing configuration files in the format and
|
||||
# sysroot location expected by the phosphor-fan-presence build process in the
|
||||
# sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-fan-presence-config ?= "phosphor-fan-presence-config"
|
||||
|
||||
# The phosphor-fan-control application is data driven and requires a YAML file
|
||||
# to define the fans in the system. This virtual is a recipe that provides
|
||||
# that definition by installing the YAML file in the format and sysroot
|
||||
# location expected by the phosphor-fan-control build process in the sysroot.
|
||||
PREFERRED_PROVIDER_virtual/phosphor-fan-control-fan-config ?= "phosphor-fan-control-fan-config"
|
||||
|
||||
OBMC_DBUS_PATH_ROOT ?= "/xyz/openbmc_project"
|
||||
OBMC_DBUS_IFACE_ROOT ?= "xyz.openbmc_project"
|
||||
|
||||
# VIRTUAL-RUNTIME_phosphor-ipmi-providers are the set of shared library
|
||||
# plugins for the host-ipmid application. By default the IPMI FRU plugin
|
||||
# is enabled. Additionally the host-ipmid recipe uses
|
||||
# VIRTUAL-RUNTIME_phosphor-ipmi-providers to compute a list of potential
|
||||
# IPMI whitelist recipe dependencies. For example:
|
||||
#
|
||||
# VIRTUAL-RUNTIME_phosphor-ipmi-providers ?= "phosphor-ipmi-fru"
|
||||
#
|
||||
# Will add a build dependency to host-ipmid on the
|
||||
# phosphor-ipmi-fru-whitelist-native recipe.
|
||||
VIRTUAL-RUNTIME_phosphor-ipmi-providers ?= "phosphor-ipmi-fru"
|
||||
|
||||
# Set security headers on builds
|
||||
require conf/distro/include/security_flags.inc
|
||||
|
||||
# obmc-libobmc-intf doesn't compile with security flags enabled
|
||||
SECURITY_CFLAGS:pn-obmc-libobmc-intf = ""
|
||||
|
||||
# We generally want to enable LTO with meson
|
||||
EXTRA_OEMESON:append:class-target = " -Db_lto=true"
|
||||
|
||||
# Set the root password to '0penBmc'
|
||||
# Override this in your local.conf
|
||||
inherit extrausers
|
||||
|
||||
# This is the default password for the OpenBMC root user account (0penBmc)
|
||||
# salted and hashed with SHA512 suitable for /etc/shadow or `usermod -p`.
|
||||
DEFAULT_OPENBMC_PASSWORD = "'\$6\$UGMqyqdG\$GqTb3tXPFx9AJlzTw/8X5RoW2Z.100dT.acuk8AFJfNQYr.ZRL8itMIgLqsdq46RNHgiv78XayOSl.IbR4DFU.'"
|
||||
|
||||
EXTRA_USERS_PARAMS:pn-obmc-phosphor-image = " \
|
||||
usermod -p ${DEFAULT_OPENBMC_PASSWORD} root; \
|
||||
"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "isolate-bmc"
|
||||
DISTROOVERRIDES .= ":df-isolate-bmc"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "phosphor-mmc"
|
||||
DISTROOVERRIDES .= ":df-phosphor-mmc"
|
||||
@@ -0,0 +1,17 @@
|
||||
DISTRO_FEATURES += "obmc-mrw"
|
||||
DISTRO_FEATURES_FILTER_NATIVE += "obmc-mrw"
|
||||
DISTRO_FEATURES_FILTER_NATIVESDK += "obmc-mrw"
|
||||
|
||||
DISTROOVERRIDES .= ":df-mrw"
|
||||
|
||||
VIRTUAL-RUNTIME_phosphor-hwmon-config:df-mrw ?= "phosphor-hwmon-config-mrw"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-inventory:df-mrw ?= "phosphor-ipmi-fru-inventory-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-properties:df-mrw ?= "phosphor-ipmi-fru-properties-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-read-inventory:df-mrw ?= "phosphor-ipmi-fru-read-inventory-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-sensor-inventory:df-mrw ?= "phosphor-ipmi-sensor-inventory-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-inventory-sel:df-mrw ?= "phosphor-ipmi-inventory-sel-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native:df-mrw ?= "phosphor-led-manager-config-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-logging-callouts:df-mrw ?= "phosphor-logging-callouts-mrw-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-fan-presence-config:df-mrw ?= "phosphor-fan-presence-mrw"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-fan-control-fan-config:df-mrw ?= "phosphor-fan-control-fan-config-mrw"
|
||||
@@ -0,0 +1,7 @@
|
||||
## Some packages do not allow a simple bbappend to tweak the PACKAGECONFIG
|
||||
## because they can end up inheriting bbclasses, which cause other
|
||||
## side-effects before the bbappend is applied. Place tweaks for those
|
||||
## packages in this file.
|
||||
|
||||
# Disable python from btrfs-tools
|
||||
PACKAGECONFIG:remove:pn-btrfs-tools = "python"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "obmc-static-norootfs"
|
||||
DISTROOVERRIDES .= ":df-obmc-static-norootfs"
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTRO_FEATURES += "obmc-ubi-fs"
|
||||
DISTROOVERRIDES .= ":df-obmc-ubi-fs"
|
||||
@@ -0,0 +1 @@
|
||||
require conf/distro/include/phosphor-base.inc
|
||||
@@ -0,0 +1,26 @@
|
||||
# We have a conf and classes directory, add to BBPATH
|
||||
BBPATH .= ":${LAYERDIR}"
|
||||
|
||||
# We have recipes-* directories, add to BBFILES
|
||||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
|
||||
${LAYERDIR}/recipes-*/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "phosphor-layer"
|
||||
BBFILE_PATTERN_phosphor-layer := "^${LAYERDIR}/"
|
||||
LAYERVERSION_phosphor-layer = "1"
|
||||
LAYERDEPENDS_phosphor-layer = "core"
|
||||
LAYERDEPENDS_phosphor-layer += "openembedded-layer"
|
||||
LAYERDEPENDS_phosphor-layer += "meta-python"
|
||||
LAYERDEPENDS_phosphor-layer += "networking-layer"
|
||||
LAYERSERIES_COMPAT_phosphor-layer = "langdale mickledore"
|
||||
|
||||
IMAGE_FEATURES[validitems] += "tools-profile"
|
||||
|
||||
BBFILES_DYNAMIC += " \
|
||||
aspeed-layer:${LAYERDIR}/dynamic-layers/aspeed-layer/recipes-*/*/*.bb \
|
||||
aspeed-layer:${LAYERDIR}/dynamic-layers/aspeed-layer/recipes-*/*/*.bbappend \
|
||||
nuvoton-layer:${LAYERDIR}/dynamic-layers/nuvoton-layer/recipes-*/*/*.bb \
|
||||
nuvoton-layer:${LAYERDIR}/dynamic-layers/nuvoton-layer/recipes-*/*/*.bbappend \
|
||||
tpm-layer:${LAYERDIR}/dynamic-layers/tpm-layer/recipes-*/*/*.bb \
|
||||
tpm-layer:${LAYERDIR}/dynamic-layers/tpm-layer/recipes-*/*/*.bbappend \
|
||||
"
|
||||
@@ -0,0 +1 @@
|
||||
MACHINEOVERRIDES =. "ibm-power-cpu:"
|
||||
@@ -0,0 +1,2 @@
|
||||
MACHINEOVERRIDES =. "ibm-power10-cpu:"
|
||||
require conf/machine/include/ibm-power-cpu.inc
|
||||
@@ -0,0 +1,2 @@
|
||||
MACHINEOVERRIDES =. "ibm-power8-cpu:"
|
||||
require conf/machine/include/ibm-power-cpu.inc
|
||||
@@ -0,0 +1,2 @@
|
||||
MACHINEOVERRIDES =. "ibm-power9-cpu:"
|
||||
require conf/machine/include/ibm-power-cpu.inc
|
||||
@@ -0,0 +1,2 @@
|
||||
IMAGE_FSTYPES += "wic.xz mmc-ext4-tar"
|
||||
INITRAMFS_IMAGE = "obmc-phosphor-initramfs"
|
||||
@@ -0,0 +1,11 @@
|
||||
INITRAMFS_CTYPE="zst"
|
||||
INITRAMFS_CTYPE:flash-32768="xz"
|
||||
|
||||
IMAGE_FSTYPES += "cpio.${INITRAMFS_CTYPE}.fitImage mtd-static-norootfs"
|
||||
|
||||
# We don't want to build an initial kernel-based FIT image because the
|
||||
# initramfs is going to be the eventual rootfs from this image and not
|
||||
# a smaller initramfs.
|
||||
INITRAMFS_IMAGE = ""
|
||||
KERNEL_IMAGETYPE = "${ARCH_DEFAULT_KERNELIMAGETYPE}"
|
||||
KERNEL_IMAGETYPES = "${ARCH_DEFAULT_KERNELIMAGETYPE}"
|
||||
@@ -0,0 +1,2 @@
|
||||
IMAGE_FSTYPES += "mtd-static mtd-static-tar mtd-static-alltar"
|
||||
INITRAMFS_IMAGE = "obmc-phosphor-initramfs"
|
||||
@@ -0,0 +1,2 @@
|
||||
IMAGE_FSTYPES += "mtd-ubi mtd-ubi-tar"
|
||||
INITRAMFS_IMAGE = ""
|
||||
@@ -0,0 +1,18 @@
|
||||
#@TYPE: Machine
|
||||
#@NAME: OpenBMC
|
||||
#@DESCRIPTION: Common machine configuration for OpenBMC chips
|
||||
|
||||
KERNEL_CLASSES ?= "kernel-fitimage"
|
||||
KERNEL_IMAGETYPES ?= "fitImage vmlinux"
|
||||
|
||||
FLASH_SIZE ?= "32768"
|
||||
|
||||
OBMC_IMAGE_INCLUDE = "static"
|
||||
OBMC_IMAGE_INCLUDE:df-obmc-static-norootfs = "static-norootfs"
|
||||
OBMC_IMAGE_INCLUDE:df-obmc-ubi-fs = "ubi-fs"
|
||||
OBMC_IMAGE_INCLUDE:df-phosphor-mmc = "mmc"
|
||||
|
||||
require conf/machine/include/image-type/${OBMC_IMAGE_INCLUDE}.inc
|
||||
|
||||
INITRAMFS_CTYPE ?= "xz"
|
||||
INITRAMFS_FSTYPES = "cpio.${INITRAMFS_CTYPE}"
|
||||
@@ -0,0 +1,4 @@
|
||||
# EVB systems have different packages they can support, due to not having a
|
||||
# managed host. Enable this machine override to allow other recipes to know
|
||||
# that the machine is a special type.
|
||||
MACHINEOVERRIDES =. "phosphor-evb:"
|
||||
@@ -0,0 +1,15 @@
|
||||
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
|
||||
# changes incompatibly
|
||||
LCONF_VERSION = "8"
|
||||
|
||||
BBPATH = "${TOPDIR}"
|
||||
BBFILES ?= ""
|
||||
|
||||
BBLAYERS ?= " \
|
||||
##OEROOT##/meta \
|
||||
##OEROOT##/meta-poky \
|
||||
##OEROOT##/meta-openembedded/meta-oe \
|
||||
##OEROOT##/meta-openembedded/meta-networking \
|
||||
##OEROOT##/meta-openembedded/meta-python \
|
||||
##OEROOT##/meta-phosphor \
|
||||
"
|
||||
@@ -0,0 +1,5 @@
|
||||
Common targets are:
|
||||
obmc-phosphor-image
|
||||
|
||||
You can also run generated qemu images with a command like:
|
||||
runqemu qemuarm
|
||||
@@ -0,0 +1,19 @@
|
||||
MACHINE ??= "qemuarm"
|
||||
DISTRO ?= "openbmc-phosphor"
|
||||
PACKAGE_CLASSES ?= "package_ipk"
|
||||
SANITY_TESTED_DISTROS:append ?= " *"
|
||||
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
|
||||
USER_CLASSES ?= "buildstats"
|
||||
PATCHRESOLVE = "noop"
|
||||
BB_DISKMON_DIRS ??= "\
|
||||
STOPTASKS,${TMPDIR},1G,100K \
|
||||
STOPTASKS,${DL_DIR},1G,100K \
|
||||
STOPTASKS,${SSTATE_DIR},1G,100K \
|
||||
STOPTASKS,/tmp,100M,100K \
|
||||
HALT,${TMPDIR},100M,1K \
|
||||
HALT,${DL_DIR},100M,1K \
|
||||
HALT,${SSTATE_DIR},100M,1K \
|
||||
HALT,/tmp,10M,1K"
|
||||
CONF_VERSION = "2"
|
||||
MACHINE_FEATURES_BACKFILL_CONSIDERED = "qemu-usermode"
|
||||
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
From 97566253f336d85d23abef777b54dc572ca7ac9a Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jeffery <andrew@aj.id.au>
|
||||
Date: Mon, 23 Jul 2018 15:22:34 +0930
|
||||
Subject: [PATCH] aspeed: Disable unnecessary features
|
||||
|
||||
Adjust board_init() to disable hardware features that we don't need
|
||||
available during normal BMC operation.
|
||||
|
||||
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
||||
---
|
||||
arch/arm/include/asm/arch-aspeed/regs-lpc.h | 29 +++++++++++
|
||||
arch/arm/include/asm/arch-aspeed/regs-scu.h | 8 ++-
|
||||
arch/arm/include/asm/arch-aspeed/regs-sdmc.h | 17 +++++++
|
||||
board/aspeed/ast-g4/ast-g4.c | 46 ++++++++++++++++-
|
||||
board/aspeed/ast-g5/ast-g5.c | 52 +++++++++++++++++++-
|
||||
5 files changed, 149 insertions(+), 3 deletions(-)
|
||||
create mode 100644 arch/arm/include/asm/arch-aspeed/regs-lpc.h
|
||||
|
||||
diff --git a/arch/arm/include/asm/arch-aspeed/regs-lpc.h b/arch/arm/include/asm/arch-aspeed/regs-lpc.h
|
||||
new file mode 100644
|
||||
index 000000000000..b0162ae4f37c
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/include/asm/arch-aspeed/regs-lpc.h
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* arch/arm/mach-aspeed/include/mach/regs-sdmc.h
|
||||
+ *
|
||||
+ * Copyright (C) 2018 IBM Corp
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * History :
|
||||
+ * 1. 2018/07/23 Andrew Jeffery Create
|
||||
+ *
|
||||
+ ******************************************************************************/
|
||||
+#ifndef __AST_REGS_LPC_H
|
||||
+#define __AST_REGS_LPC_H
|
||||
+
|
||||
+/*
|
||||
+ * Register for LPC
|
||||
+ */
|
||||
+
|
||||
+#define AST_LPC_HICR5 0x80
|
||||
+#define AST_LPC_HICRB 0x100
|
||||
+
|
||||
+/* AST_LPC_HICR5 : 0x80 Host Interface Control Register 5 */
|
||||
+#define LPC_HICR5_ENFWH (0x1 << 10)
|
||||
+
|
||||
+/* AST_LPC_HICRB : 0x100 Host Interface Control Register B */
|
||||
+#define LPC_HICRB_ILPC2AHB (0x1 << 6)
|
||||
+
|
||||
+#endif
|
||||
diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h
|
||||
index b714fa92341d..c9b91795d1aa 100644
|
||||
--- a/arch/arm/include/asm/arch-aspeed/regs-scu.h
|
||||
+++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h
|
||||
@@ -466,6 +466,7 @@
|
||||
#define SCU_MISC_JTAG__M_TO_PCIE_EN (0x1 << 14)
|
||||
#define SCU_MISC_VUART_TO_CTRL (0x1 << 13)
|
||||
#define SCU_MISC_DIV13_EN (0x1 << 12)
|
||||
+#define SCU_MISC_DEBUG_UART (0x1 << 10)
|
||||
#define SCU_MISC_Y_CLK_INVERT (0x1 << 11)
|
||||
#define SCU_MISC_OUT_DELAY (0x1 << 9)
|
||||
#define SCU_MISC_PCI_TO_AHB_DIS (0x1 << 8)
|
||||
@@ -548,6 +549,7 @@
|
||||
/* AST_SCU_VGA_SCRATCH7 0x6c - VGA Scratch register */
|
||||
|
||||
/* AST_SCU_HW_STRAP1 0x70 - hardware strapping register */
|
||||
+#define SCU_HW_STRAP_LPC_DEC_SUPER_IO (0x1 << 20)
|
||||
#ifdef AST_SOC_G5
|
||||
|
||||
#define CLK_25M_IN (0x1 << 23)
|
||||
@@ -593,7 +595,6 @@
|
||||
|
||||
#define SCU_HW_STRAP_GPIOE_PT_EN (0x1 << 22)
|
||||
#define SCU_HW_STRAP_GPIOD_PT_EN (0x1 << 21)
|
||||
-#define SCU_HW_STRAP_LPC_DEC_SUPER_IO (0x1 << 20)
|
||||
#define SCU_HW_STRAP_ACPI_DIS (0x1 << 19)
|
||||
|
||||
/* bit 23, 18 [1,0] */
|
||||
@@ -940,6 +941,11 @@
|
||||
|
||||
/* AST_SCU_UART24_REF 0x160 - Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
|
||||
/* AST_SCU_PCIE_CONFIG_SET 0x180 - PCI-E Configuration Setting Control Register */
|
||||
+#define SCU_PCIE_CONFIG_SET_BMC_DMA (0x1 << 14)
|
||||
+#define SCU_PCIE_CONFIG_SET_BMC_MMIO (0x1 << 9)
|
||||
+#define SCU_PCIE_CONFIG_SET_BMC_EN (0x1 << 8)
|
||||
+#define SCU_PCIE_CONFIG_SET_VGA_MMIO (0x1 << 1)
|
||||
+
|
||||
/* AST_SCU_BMC_MMIO_DEC 0x184 - BMC MMIO Decode Setting Register */
|
||||
/* AST_SCU_DEC_AREA1 0x188 - 1st relocated controller decode area location */
|
||||
/* AST_SCU_DEC_AREA2 0x18C - 2nd relocated controller decode area location */
|
||||
diff --git a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
|
||||
index 2cc26d29aa9e..2773d3c19e5a 100644
|
||||
--- a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
|
||||
+++ b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
|
||||
@@ -13,11 +13,14 @@
|
||||
#ifndef __AST_REGS_SDMC_H
|
||||
#define __AST_REGS_SDMC_H
|
||||
|
||||
+#include <asm/arch/aspeed.h>
|
||||
+
|
||||
/*
|
||||
* Register for SDMC
|
||||
*/
|
||||
#define AST_SDMC_PROTECT 0x00 /* protection key register */
|
||||
#define AST_SDMC_CONFIG 0x04 /* Configuration register */
|
||||
+#define AST_SDMC_GFX_PROT 0x08 /* Graphics protection register */
|
||||
|
||||
/* AST_SDMC_PROTECT: 0x00 - protection key register */
|
||||
#define SDMC_PROTECT_UNLOCK 0xFC600309
|
||||
@@ -29,4 +32,18 @@
|
||||
#define SDMC_CONFIG_CACHE_EN (0x1 << 10)
|
||||
#define SDMC_CONFIG_EEC_EN (0x1 << 7)
|
||||
|
||||
+/* AST_SDMC_GFX_PROT : 0x08 - Graphics protection register */
|
||||
+#define SDMC_GFX_PROT_VGA_CURSOR (0x1 << 0)
|
||||
+#define SDMC_GFX_PROT_VGA_CG_READ (0x1 << 1)
|
||||
+#define SDMC_GFX_PROT_VGA_ASCII_READ (0x1 << 2)
|
||||
+#define SDMC_GFX_PROT_VGA_CRT (0x1 << 3)
|
||||
+
|
||||
+#if defined(AST_SOC_G5)
|
||||
+#define SDMC_GFX_PROT_PCIE (0x1 << 16)
|
||||
+#define SDMC_GFX_PROT_XDMA (0x1 << 17)
|
||||
+#elif defined(AST_SOC_G4)
|
||||
+#define SDMC_GFX_PROT_PCIE (0x1 << 10)
|
||||
+#define SDMC_GFX_PROT_XDMA (0x1 << 16)
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
|
||||
index 656495307b03..5b137e7d74bc 100644
|
||||
--- a/board/aspeed/ast-g4/ast-g4.c
|
||||
+++ b/board/aspeed/ast-g4/ast-g4.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* (C) Copyright 2002 Ryan Chen
|
||||
- * Copyright 2016 IBM Corporation
|
||||
+ * Copyright 2016,2018 IBM Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
@@ -12,13 +12,57 @@
|
||||
#include <asm/arch/ast-sdmc.h>
|
||||
#include <asm/arch/ast_scu.h>
|
||||
#include <asm/arch/regs-ahbc.h>
|
||||
+#include <asm/arch/regs-lpc.h>
|
||||
#include <asm/arch/regs-scu.h>
|
||||
+#include <asm/arch/regs-sdmc.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
+ bool sdmc_unlocked;
|
||||
+ u32 val;
|
||||
+
|
||||
+ /* iLPC2AHB */
|
||||
+ val = readl(AST_SCU_BASE + AST_SCU_HW_STRAP1);
|
||||
+ val |= SCU_HW_STRAP_LPC_DEC_SUPER_IO;
|
||||
+ writel(val, AST_SCU_BASE + AST_SCU_HW_STRAP1);
|
||||
+
|
||||
+ val = readl(AST_LPC_BASE + AST_LPC_HICRB);
|
||||
+ val |= LPC_HICRB_ILPC2AHB;
|
||||
+ writel(val, AST_LPC_BASE + AST_LPC_HICRB);
|
||||
+
|
||||
+ /* P2A, PCIe BMC */
|
||||
+ val = readl(AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
|
||||
+ val &= ~(SCU_PCIE_CONFIG_SET_BMC_DMA
|
||||
+ | SCU_PCIE_CONFIG_SET_BMC_MMIO
|
||||
+ | SCU_PCIE_CONFIG_SET_BMC_EN
|
||||
+ | SCU_PCIE_CONFIG_SET_VGA_MMIO);
|
||||
+ writel(val, AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
|
||||
+
|
||||
+ /* X-DMA */
|
||||
+ sdmc_unlocked = readl(AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+ if (!sdmc_unlocked)
|
||||
+ writel(SDMC_PROTECT_UNLOCK, AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+
|
||||
+ val = readl(AST_SDMC_BASE + AST_SDMC_GFX_PROT);
|
||||
+ val |= (SDMC_GFX_PROT_VGA_CURSOR
|
||||
+ | SDMC_GFX_PROT_VGA_CG_READ
|
||||
+ | SDMC_GFX_PROT_VGA_ASCII_READ
|
||||
+ | SDMC_GFX_PROT_VGA_CRT
|
||||
+ | SDMC_GFX_PROT_PCIE
|
||||
+ | SDMC_GFX_PROT_XDMA);
|
||||
+ writel(val, AST_SDMC_BASE + AST_SDMC_GFX_PROT);
|
||||
+
|
||||
+ if (!sdmc_unlocked)
|
||||
+ writel(~SDMC_PROTECT_UNLOCK, AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+
|
||||
+ /* LPC2AHB */
|
||||
+ val = readl(AST_LPC_BASE + AST_LPC_HICR5);
|
||||
+ val &= ~LPC_HICR5_ENFWH;
|
||||
+ writel(val, AST_LPC_BASE + AST_LPC_HICR5);
|
||||
+
|
||||
/* address of boot parameters */
|
||||
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
gd->flags = 0;
|
||||
diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c
|
||||
index e67a4bf8b2b4..12496cea09b7 100644
|
||||
--- a/board/aspeed/ast-g5/ast-g5.c
|
||||
+++ b/board/aspeed/ast-g5/ast-g5.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright 2016 IBM Corporation
|
||||
+ * Copyright 2016,2018 IBM Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -12,12 +12,62 @@
|
||||
|
||||
#include <asm/arch/ast_scu.h>
|
||||
#include <asm/arch/ast-sdmc.h>
|
||||
+#include <asm/arch/regs-lpc.h>
|
||||
+#include <asm/arch/regs-scu.h>
|
||||
+#include <asm/arch/regs-sdmc.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
+ bool sdmc_unlocked;
|
||||
+ u32 val;
|
||||
+
|
||||
+ /* iLPC2AHB */
|
||||
+ val = readl(AST_SCU_BASE + AST_SCU_HW_STRAP1);
|
||||
+ val |= SCU_HW_STRAP_LPC_DEC_SUPER_IO;
|
||||
+ writel(val, AST_SCU_BASE + AST_SCU_HW_STRAP1);
|
||||
+
|
||||
+ val = readl(AST_LPC_BASE + AST_LPC_HICRB);
|
||||
+ val |= LPC_HICRB_ILPC2AHB;
|
||||
+ writel(val, AST_LPC_BASE + AST_LPC_HICRB);
|
||||
+
|
||||
+ /* P2A, PCIe BMC */
|
||||
+ val = readl(AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
|
||||
+ val &= ~(SCU_PCIE_CONFIG_SET_BMC_DMA
|
||||
+ | SCU_PCIE_CONFIG_SET_BMC_MMIO
|
||||
+ | SCU_PCIE_CONFIG_SET_BMC_EN
|
||||
+ | SCU_PCIE_CONFIG_SET_VGA_MMIO);
|
||||
+ writel(val, AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
|
||||
+
|
||||
+ /* Debug UART */
|
||||
+ val = readl(AST_SCU_BASE + AST_SCU_MISC1_CTRL);
|
||||
+ val |= SCU_MISC_DEBUG_UART;
|
||||
+ writel(val, AST_SCU_BASE + AST_SCU_MISC1_CTRL);
|
||||
+
|
||||
+ /* X-DMA */
|
||||
+ sdmc_unlocked = readl(AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+ if (!sdmc_unlocked)
|
||||
+ writel(SDMC_PROTECT_UNLOCK, AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+
|
||||
+ val = readl(AST_SDMC_BASE + AST_SDMC_GFX_PROT);
|
||||
+ val |= (SDMC_GFX_PROT_VGA_CURSOR
|
||||
+ | SDMC_GFX_PROT_VGA_CG_READ
|
||||
+ | SDMC_GFX_PROT_VGA_ASCII_READ
|
||||
+ | SDMC_GFX_PROT_VGA_CRT
|
||||
+ | SDMC_GFX_PROT_PCIE
|
||||
+ | SDMC_GFX_PROT_XDMA);
|
||||
+ writel(val, AST_SDMC_BASE + AST_SDMC_GFX_PROT);
|
||||
+
|
||||
+ if (!sdmc_unlocked)
|
||||
+ writel(~SDMC_PROTECT_UNLOCK, AST_SDMC_BASE + AST_SDMC_PROTECT);
|
||||
+
|
||||
+ /* LPC2AHB */
|
||||
+ val = readl(AST_LPC_BASE + AST_LPC_HICR5);
|
||||
+ val &= ~LPC_HICR5_ENFWH;
|
||||
+ writel(val, AST_LPC_BASE + AST_LPC_HICR5);
|
||||
+
|
||||
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
gd->flags = 0;
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
From 8ef2f4dcd208e072ab491874c06722c3a8ec69e3 Mon Sep 17 00:00:00 2001
|
||||
From: "Edward A. James" <eajames@us.ibm.com>
|
||||
Date: Thu, 13 Jul 2017 13:42:18 -0500
|
||||
Subject: [PATCH 1/4] configs/ast: Add redundnant env
|
||||
|
||||
Configure ast chips to run redundant u-boot environments.
|
||||
|
||||
Signed-off-by: Edward A. James <eajames@us.ibm.com>
|
||||
---
|
||||
include/configs/ast-common.h | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
|
||||
index eff6d2b529..a0243083bd 100644
|
||||
--- a/include/configs/ast-common.h
|
||||
+++ b/include/configs/ast-common.h
|
||||
@@ -104,9 +104,12 @@
|
||||
#define CONFIG_SYS_MAX_FLASH_SECT (8192) /* max number of sectors on one chip */
|
||||
#define CONFIG_ENV_IS_IN_FLASH 1
|
||||
#define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + 0x60000)
|
||||
+#define CONFIG_ENV_ADDR_REDUND (AST_FMC_CS0_BASE + 0x70000)
|
||||
|
||||
#define CONFIG_ENV_OFFSET 0x60000 /* environment starts here */
|
||||
-#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
|
||||
+#define CONFIG_ENV_OFFSET_REDUND 0x70000
|
||||
+#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
|
||||
+#define CONFIG_ENV_SIZE_REDUND 0x10000
|
||||
|
||||
#define CONFIG_BOOTCOMMAND "bootm 20080000"
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
--
|
||||
2.14.3
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
From cbb09e400a5283e5b543e2b01b8c0038890a5260 Mon Sep 17 00:00:00 2001
|
||||
From: Xo Wang <xow@google.com>
|
||||
Date: Thu, 20 Oct 2016 17:42:13 -0700
|
||||
Subject: [PATCH 2/2] board/aspeed, aspeednic: Use MAC2 for networking
|
||||
|
||||
Enable and select MAC2 for aspeednic.
|
||||
|
||||
Signed-off-by: Xo Wang <xow@google.com>
|
||||
---
|
||||
drivers/net/aspeednic.c | 4 ++--
|
||||
include/configs/ast-g5-ncsi.h | 1 +
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
|
||||
index 8b85893..cff8370 100644
|
||||
--- a/drivers/net/aspeednic.c
|
||||
+++ b/drivers/net/aspeednic.c
|
||||
@@ -18,8 +18,8 @@
|
||||
/* From the board config file */
|
||||
#define CONFIG_MAC1_PHY_SETTING 2
|
||||
#define CONFIG_MAC2_PHY_SETTING 0
|
||||
-#define CONFIG_ASPEED_MAC_NUMBER 1
|
||||
-#define CONFIG_ASPEED_MAC_CONFIG 1 // config MAC1
|
||||
+#define CONFIG_ASPEED_MAC_NUMBER 2
|
||||
+#define CONFIG_ASPEED_MAC_CONFIG 2 // config MAC2
|
||||
#define _PHY_SETTING_CONCAT(mac) CONFIG_MAC##mac##_PHY_SETTING
|
||||
#define _GET_MAC_PHY_SETTING(mac) _PHY_SETTING_CONCAT(mac)
|
||||
#define CONFIG_ASPEED_MAC_PHY_SETTING \
|
||||
diff --git a/include/configs/ast-g5-ncsi.h b/include/configs/ast-g5-ncsi.h
|
||||
index f73a8f1..1408618 100644
|
||||
--- a/include/configs/ast-g5-ncsi.h
|
||||
+++ b/include/configs/ast-g5-ncsi.h
|
||||
@@ -22,6 +22,7 @@
|
||||
/* Ethernet */
|
||||
#define CONFIG_LIB_RAND
|
||||
#define CONFIG_ASPEEDNIC
|
||||
+#define CONFIG_MAC2_ENABLE
|
||||
|
||||
/* platform.S settings */
|
||||
#define CONFIG_DRAM_ECC_SIZE 0x10000000
|
||||
--
|
||||
2.8.0.rc3.226.g39d4020
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
From c678bbdad037604850613e775baacc52ed92c9c1 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Williams <patrick@stwcx.xyz>
|
||||
Date: Fri, 21 Jul 2017 16:30:01 -0500
|
||||
Subject: [PATCH 2/4] config/ast-common: hack bootopts
|
||||
|
||||
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
||||
---
|
||||
include/configs/ast-common.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
|
||||
index a0243083bd..7ddba62298 100644
|
||||
--- a/include/configs/ast-common.h
|
||||
+++ b/include/configs/ast-common.h
|
||||
@@ -96,7 +96,10 @@
|
||||
#define CONFIG_CMD_MTDPARTS
|
||||
#endif
|
||||
|
||||
+#if 0
|
||||
#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/ram rw"
|
||||
+#endif
|
||||
+#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/mtdblock4 ro"
|
||||
|
||||
#define CONFIG_AST_SPI_NOR /* AST SPI NOR Flash */
|
||||
#define CONFIG_FMC_CS 1
|
||||
--
|
||||
2.14.3
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
From 0c77be343fc4781719dcc0748bc29a26ea83e0a3 Mon Sep 17 00:00:00 2001
|
||||
From: Adriana Kobylak <anoo@us.ibm.com>
|
||||
Date: Wed, 9 Aug 2017 14:11:56 -0500
|
||||
Subject: [PATCH 3/4] config/ast-common: Add bootopts to support ubi and mtd
|
||||
partitioning
|
||||
|
||||
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
|
||||
---
|
||||
include/configs/ast-common.h | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
|
||||
index 7ddba62298..14191e4ab0 100644
|
||||
--- a/include/configs/ast-common.h
|
||||
+++ b/include/configs/ast-common.h
|
||||
@@ -84,6 +84,12 @@
|
||||
#define CONFIG_SYS_MAXARGS 16
|
||||
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
|
||||
|
||||
+/*
|
||||
+ * Dynamic MTD Partition support
|
||||
+ */
|
||||
+#define MTDIDS_DEFAULT "nor0=bmc"
|
||||
+#define MTDPARTS_DEFAULT "mtdparts=bmc:384k(u-boot),128k(u-boot-env),-(obmc-ubi)"
|
||||
+
|
||||
/*
|
||||
* Optional MTD and UBI support
|
||||
*/
|
||||
@@ -99,7 +105,7 @@
|
||||
#if 0
|
||||
#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/ram rw"
|
||||
#endif
|
||||
-#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/mtdblock4 ro"
|
||||
+#define CONFIG_BOOTARGS "console=ttyS4,115200n8 ubi.mtd=obmc-ubi,0,0,0 ubi.mtd=alt-obmc-ubi,0,0,4 ro rootfstype=squashfs"
|
||||
|
||||
#define CONFIG_AST_SPI_NOR /* AST SPI NOR Flash */
|
||||
#define CONFIG_FMC_CS 1
|
||||
@@ -108,18 +114,27 @@
|
||||
#define CONFIG_ENV_IS_IN_FLASH 1
|
||||
#define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + 0x60000)
|
||||
#define CONFIG_ENV_ADDR_REDUND (AST_FMC_CS0_BASE + 0x70000)
|
||||
+#define CONFIG_LOADADDR 80800000
|
||||
|
||||
#define CONFIG_ENV_OFFSET 0x60000 /* environment starts here */
|
||||
#define CONFIG_ENV_OFFSET_REDUND 0x70000
|
||||
#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
|
||||
#define CONFIG_ENV_SIZE_REDUND 0x10000
|
||||
|
||||
-#define CONFIG_BOOTCOMMAND "bootm 20080000"
|
||||
+#define CONFIG_BOOTCOMMAND "run set_bootargs; run obmc_bootcmd"
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
|
||||
#define ASPEED_ENV_SETTINGS \
|
||||
+ "ubiblock=0,1 \0" \
|
||||
+ "root=/dev/ubiblock0_1 \0" \
|
||||
+ "kernelname=kernel-0 \0" \
|
||||
+ "loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \
|
||||
+ "set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \
|
||||
+ "obmc_bootcmd=ubi part obmc-ubi; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
|
||||
"verify=yes\0" \
|
||||
"spi_dma=yes\0" \
|
||||
+ "mtdids=" MTDIDS_DEFAULT "\0" \
|
||||
+ "mtdparts=" MTDPARTS_DEFAULT "\0" \
|
||||
""
|
||||
|
||||
#endif /* __AST_COMMON_CONFIG_H */
|
||||
--
|
||||
2.14.3
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
From 878651bbaa8a7da203fafccb164ca7b32287b8f9 Mon Sep 17 00:00:00 2001
|
||||
From: "Edward A. James" <eajames@us.ibm.com>
|
||||
Date: Thu, 9 Nov 2017 11:39:10 -0600
|
||||
Subject: [PATCH 4/4] config/ast-common: Add conditional factory reset command
|
||||
|
||||
Factory reset (removing persistent rwfs) has to occur before we've
|
||||
mounted the rwfs. However, the variable to determine whether or not to
|
||||
do the reset is stored in the u-boot env. This is tricky to access
|
||||
before rwfs is mounted except in u-boot. So, check it before every boot.
|
||||
|
||||
Signed-off-by: Edward A. James <eajames@us.ibm.com>
|
||||
---
|
||||
include/configs/ast-common.h | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
|
||||
index 14191e4ab0..aaa5155e00 100644
|
||||
--- a/include/configs/ast-common.h
|
||||
+++ b/include/configs/ast-common.h
|
||||
@@ -121,6 +121,8 @@
|
||||
#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
|
||||
#define CONFIG_ENV_SIZE_REDUND 0x10000
|
||||
|
||||
+#define CONFIG_RWFS_SIZE 0x600000
|
||||
+
|
||||
#define CONFIG_BOOTCOMMAND "run set_bootargs; run obmc_bootcmd"
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
|
||||
@@ -130,11 +132,13 @@
|
||||
"kernelname=kernel-0 \0" \
|
||||
"loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \
|
||||
"set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \
|
||||
- "obmc_bootcmd=ubi part obmc-ubi; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
|
||||
+ "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
|
||||
"verify=yes\0" \
|
||||
"spi_dma=yes\0" \
|
||||
"mtdids=" MTDIDS_DEFAULT "\0" \
|
||||
"mtdparts=" MTDPARTS_DEFAULT "\0" \
|
||||
+ "rwfs_size=" __stringify(CONFIG_RWFS_SIZE) "\0" \
|
||||
+ "do_rwreset=if test \"\${rwreset}\" = \"true\"; then ubi remove rwfs; ubi create rwfs \${rwfs_size}; fi \0" \
|
||||
""
|
||||
|
||||
#endif /* __AST_COMMON_CONFIG_H */
|
||||
--
|
||||
2.14.3
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
From 345b1ade63576f5a8a1c3a4a1b75aab41d84b714 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jeffery <andrew@aj.id.au>
|
||||
Date: Fri, 20 Apr 2018 13:29:58 +0930
|
||||
Subject: [PATCH] config/ast-common: Fall-back to secondary flash on failed
|
||||
bootm
|
||||
|
||||
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
||||
---
|
||||
include/configs/ast-common.h | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
|
||||
index ad08016ec110..10ef6a1955b7 100644
|
||||
--- a/include/configs/ast-common.h
|
||||
+++ b/include/configs/ast-common.h
|
||||
@@ -127,12 +127,14 @@
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
|
||||
#define ASPEED_ENV_SETTINGS \
|
||||
+ "wdt2bite=mw.l 0x1e785024 0xa 1; mw.b 0x1e78502c 0xb3 1 \0" \
|
||||
+ "bootalt=run wdt2bite \0" \
|
||||
"ubiblock=0,1 \0" \
|
||||
"root=/dev/ubiblock0_1 \0" \
|
||||
"kernelname=kernel-0 \0" \
|
||||
"loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \
|
||||
"set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \
|
||||
- "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
|
||||
+ "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} || run bootalt \0" \
|
||||
"verify=yes\0" \
|
||||
"spi_dma=yes\0" \
|
||||
"mtdids=" MTDIDS_DEFAULT "\0" \
|
||||
--
|
||||
2.14.1
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
From 7947dbbfb21e10e8fb0f852a14485cedf5df1d36 Mon Sep 17 00:00:00 2001
|
||||
From: Chanh Nguyen <chanh@os.amperecomputing.com>
|
||||
Date: Sun, 10 Oct 2021 11:57:20 +0700
|
||||
Subject: [PATCH] aspeed: Enable SPI master mode by default
|
||||
|
||||
The ast2500 share the RGMII1 pin and the hw strap pins
|
||||
for SPI interface mode selection ( pin[12:13] ).
|
||||
In some systems, the RGMII/NCSI interface will use the pin.
|
||||
It makes the SPI interface mode setting is not correct.
|
||||
|
||||
This patch will enable the SPI master mode by default.
|
||||
|
||||
Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com>
|
||||
---
|
||||
board/aspeed/ast-g5/ast-g5.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c
|
||||
index e67a4bf8b2..82e9f81acc 100644
|
||||
--- a/board/aspeed/ast-g5/ast-g5.c
|
||||
+++ b/board/aspeed/ast-g5/ast-g5.c
|
||||
@@ -21,6 +21,9 @@ int board_init(void)
|
||||
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
gd->flags = 0;
|
||||
|
||||
+ //pin switch by trap[13:12] -- [0:1] Enable SPI Master
|
||||
+ ast_scu_spi_master(1); /* enable SPI master */
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
ASPEED_IMAGE_SIZE_KB = "${FLASH_SIZE}"
|
||||
@@ -0,0 +1,32 @@
|
||||
inherit image_version
|
||||
|
||||
SRC_URI:append:aspeed = " file://0001-configs-ast-Add-redundnant-env.patch"
|
||||
|
||||
SRC_URI:append:aspeed:df-obmc-ubi-fs = " \
|
||||
file://0002-config-ast-common-hack-bootopts.patch \
|
||||
file://0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch \
|
||||
file://0004-config-ast-common-Add-conditional-factory-reset-comm.patch \
|
||||
file://0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch \
|
||||
"
|
||||
|
||||
SRC_URI:append:aspeed:df-isolate-bmc = " \
|
||||
file://0001-aspeed-Disable-unnecessary-features.patch \
|
||||
"
|
||||
SRC_URI:append:aspeed:df-aspeednic-use-mac2 = " \
|
||||
file://0002-board-aspeed-aspeednic-Use-MAC2-for-networking.patch \
|
||||
"
|
||||
SRC_URI:append:aspeed:df-aspeed-spi-master = " \
|
||||
file://0006-aspeed-Enable-SPI-master-mode-by-default.patch \
|
||||
"
|
||||
do_patch[depends] += "os-release:do_populate_sysroot"
|
||||
|
||||
python do_patch:append:aspeed:df-obmc-ubi-fs () {
|
||||
version_id=do_get_versionID(d)
|
||||
d.setVar('VERSION_ID', version_id)
|
||||
bb.build.exec_func("patch_kernelname", d)
|
||||
}
|
||||
|
||||
patch_kernelname () {
|
||||
sed -ri "s/kernel-(0|[a-fA-F0-9]{8})/kernel-${VERSION_ID}/g" \
|
||||
${S}/include/configs/ast-common.h &> /dev/null
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
require u-boot-aspeed.inc
|
||||
require recipes-bsp/u-boot/u-boot-obmc.inc
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
require u-boot-aspeed.inc
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
SUMMARY = "Firmware for using the ASPEED ColdFire FSI master"
|
||||
SECTION = "kernel"
|
||||
|
||||
LICENSE = "GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
|
||||
|
||||
SRCREV = "bae32e353a3641b5164211f6bf06c5620f6e384d"
|
||||
SRC_URI = "git://github.com/ozbenh/cf-fsi.git;branch=master;protocol=https"
|
||||
|
||||
PR = "r1"
|
||||
PV = "1.0+git${SRCPV}"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit allarch
|
||||
|
||||
do_compile() {
|
||||
:
|
||||
}
|
||||
|
||||
firmware_dir="${nonarch_base_libdir}/firmware/"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${firmware_dir}
|
||||
install -m 0644 ${S}/dist-bin/cf-fsi-fw.bin ${D}${firmware_dir}
|
||||
}
|
||||
|
||||
FILES:${PN} = "${firmware_dir}"
|
||||
+1
@@ -0,0 +1 @@
|
||||
require recipes-bsp/u-boot/u-boot-obmc.inc
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
# OpenBMC loads in kernel features via other mechanisms so this check
|
||||
# in the kernel-yocto.bbclass is not required
|
||||
KERNEL_DANGLING_FEATURES_WARN_ONLY = "1"
|
||||
+1
@@ -0,0 +1 @@
|
||||
SNOOP_DEVICE:npcm7xx = "npcm7xx-lpc-bpc0"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# We don't need pkcs11 support on the BMC by default and it ends up causing a
|
||||
# dependency chain that brings in Rust.
|
||||
RDEPENDS:packagegroup-security-tpm2:remove = "tpm2-pkcs11"
|
||||
@@ -0,0 +1,2 @@
|
||||
# Setting boot delay to -2 disables entering into U-boot shell
|
||||
CONFIG_BOOTDELAY=-2
|
||||
@@ -0,0 +1,5 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
SRC_URI:append = '${@bb.utils.contains_any("DISTRO_FEATURES", "disable-u-boot-shell", \
|
||||
" file://disable-u-boot-shell.cfg", \
|
||||
"", d)}'
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
then
|
||||
echo "usage: $0 <start|stop> <config>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
action=$1
|
||||
config=$2
|
||||
|
||||
gadget_name=mass-storage
|
||||
gadget_dir=/sys/kernel/config/usb_gadget/$gadget_name
|
||||
|
||||
case "$config" in
|
||||
0)
|
||||
nbd_device=/dev/nbd0
|
||||
;;
|
||||
1)
|
||||
nbd_device=/dev/nbd1
|
||||
;;
|
||||
*)
|
||||
echo "invalid config $config" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
set -e
|
||||
|
||||
GADGET_BASE=/sys/kernel/config/usb_gadget
|
||||
|
||||
which_dev()
|
||||
{
|
||||
in_use="$(cat $GADGET_BASE/*/UDC)"
|
||||
cd /sys/class/udc
|
||||
for dev in *; do
|
||||
case "$in_use" in
|
||||
*"$dev"*) ;;
|
||||
*) echo "$dev"; return 0;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
start)
|
||||
mkdir -p $gadget_dir
|
||||
(
|
||||
cd $gadget_dir
|
||||
# http://www.linux-usb.org/usb.ids
|
||||
# |-> 1d6b Linux Foundation
|
||||
# |-> 0104 Multifunction Composite Gadget
|
||||
echo "0x1d6b" > idVendor
|
||||
echo "0x0104" > idProduct
|
||||
mkdir -p strings/0x409
|
||||
echo "OpenBMC" > strings/0x409/manufacturer
|
||||
echo "Virtual Media Device" > strings/0x409/product
|
||||
mkdir -p configs/c.1/strings/0x409
|
||||
echo "config 1" > configs/c.1/strings/0x409/configuration
|
||||
mkdir -p functions/mass_storage.usb0
|
||||
ln -s functions/mass_storage.usb0 configs/c.1
|
||||
echo 1 > functions/mass_storage.usb0/lun.0/removable
|
||||
echo 1 > functions/mass_storage.usb0/lun.0/ro
|
||||
echo 0 > functions/mass_storage.usb0/lun.0/cdrom
|
||||
echo $nbd_device > functions/mass_storage.usb0/lun.0/file
|
||||
device=$(which_dev)
|
||||
echo "$device" > UDC
|
||||
)
|
||||
;;
|
||||
stop)
|
||||
(
|
||||
cd $gadget_dir
|
||||
rm configs/c.1/mass_storage.usb0
|
||||
rmdir functions/mass_storage.usb0
|
||||
rmdir configs/c.1/strings/0x409
|
||||
rmdir configs/c.1
|
||||
rmdir strings/0x409
|
||||
)
|
||||
rmdir $gadget_dir
|
||||
;;
|
||||
*)
|
||||
echo "invalid action $action" >&2
|
||||
exit 1
|
||||
esac
|
||||
@@ -0,0 +1,30 @@
|
||||
SUMMARY = "Network Block Device Proxy"
|
||||
HOMEPAGE = "https://github.com/openbmc/jsnbd"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENCE;md5=3b83ef96387f14655fc854ddc3c6bd57"
|
||||
DEPENDS += "json-c"
|
||||
DEPENDS += "udev"
|
||||
SRCREV = "9b322cb38172985e67d755660167befe8b650ba6"
|
||||
PV = "1.0+git${SRCPV}"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
git://github.com/openbmc/jsnbd;branch=master;protocol=https \
|
||||
file://state_hook \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit meson pkgconfig
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${sysconfdir}/nbd-proxy/
|
||||
install -m 0644 ${NBD_PROXY_CONFIG_JSON} ${D}${sysconfdir}/nbd-proxy/config.json
|
||||
install -m 0755 ${WORKDIR}/state_hook ${D}${sysconfdir}/nbd-proxy/state
|
||||
}
|
||||
|
||||
FILES:${PN} += "${sysconfdir}/nbd-proxy/state"
|
||||
|
||||
RDEPENDS:${PN} += "nbd-client"
|
||||
|
||||
NBD_PROXY_CONFIG_JSON ??= "${S}/config.sample.json"
|
||||
@@ -0,0 +1,4 @@
|
||||
# Don't create an empty openssh-dev package. That would pull in openssh-sshd
|
||||
# even it we are only depending on openssh-sftp, which causes conflicts
|
||||
# with dropbear
|
||||
ALLOW_EMPTY:${PN}-dev = "0"
|
||||
@@ -0,0 +1,23 @@
|
||||
# General config settings.
|
||||
EXTRA_OECONF:append:class-target = " shared no-hw no-err no-psk no-srp "
|
||||
# Disable SSL (keep TLS only).
|
||||
EXTRA_OECONF:append:class-target = " no-ssl2 no-ssl3 "
|
||||
# Disable various algorithms.
|
||||
EXTRA_OECONF:append:class-target = " \
|
||||
no-rmd160 \
|
||||
no-whirlpool \
|
||||
no-rc2 \
|
||||
no-rc4 \
|
||||
no-bf \
|
||||
no-cast \
|
||||
no-gost \
|
||||
"
|
||||
|
||||
do_configure:append() {
|
||||
oe_runmake depend
|
||||
}
|
||||
|
||||
# We don't want to depend on perl in our image
|
||||
RDEPENDS:${PN}-bin:remove = "perl"
|
||||
|
||||
FILES:${PN}-misc:append = " ${bindir}/c_rehash"
|
||||
@@ -0,0 +1,5 @@
|
||||
# Turn on Source Address Verification in all interfaces to
|
||||
# prevent some spoofing attacks
|
||||
net.ipv4.conf.default.rp_filter = 2
|
||||
net.ipv4.conf.all.rp_filter = 2
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# openbmc fstab
|
||||
|
||||
/dev/root / auto defaults 1 1
|
||||
proc /proc proc defaults 0 0
|
||||
devpts /dev/pts devpts mode=0620,gid=5 0 0
|
||||
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
|
||||
tmpfs /var/volatile tmpfs defaults 0 0
|
||||
tmpfs /media tmpfs defaults 0 0
|
||||
/var/persist/home /home none bind 0 0
|
||||
@@ -0,0 +1,9 @@
|
||||
# openbmc fstab
|
||||
|
||||
/dev/root / auto defaults 1 1
|
||||
proc /proc proc defaults 0 0
|
||||
devpts /dev/pts devpts mode=0620,gid=5 0 0
|
||||
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
|
||||
tmpfs /var/volatile tmpfs defaults 0 0
|
||||
tmpfs /media tmpfs defaults 0 0
|
||||
/var/persist/home /home none bind 0 0
|
||||
@@ -0,0 +1,18 @@
|
||||
FILESEXTRAPATHS:prepend:df-obmc-ubi-fs := "${THISDIR}/${PN}/df-ubi:"
|
||||
FILESEXTRAPATHS:prepend:df-phosphor-mmc := "${THISDIR}/${PN}/df-mmc:"
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://50-rp_filter.conf \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
sed -i 's/\(\(passwd\|group\):\s*\).*/\1files systemd/' \
|
||||
"${D}${sysconfdir}/nsswitch.conf"
|
||||
install -d ${D}/srv
|
||||
install -d ${D}/${libdir}/sysctl.d
|
||||
install -D -m 644 ${WORKDIR}/50-rp_filter.conf ${D}/${libdir}/sysctl.d/50-rp_filter.conf
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append:df-obmc-ubi-fs = " preinit-mounts"
|
||||
RDEPENDS:${PN}:append:df-obmc-static-norootfs = " phosphor-static-norootfs-init"
|
||||
@@ -0,0 +1,8 @@
|
||||
CONFIG_DEVMEM=y
|
||||
CONFIG_EXPAND=y
|
||||
CONFIG_FEATURE_LESS_REGEXP=y
|
||||
CONFIG_FEATURE_LESS_TRUNCATE=y
|
||||
CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
|
||||
CONFIG_TRUNCATE=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_WGET=n
|
||||
@@ -0,0 +1,4 @@
|
||||
CONFIG_FLASHCP=y
|
||||
CONFIG_FLASH_LOCK=y
|
||||
CONFIG_FLASH_UNLOCK=y
|
||||
CONFIG_FLASH_ERASEALL=y
|
||||
@@ -0,0 +1,10 @@
|
||||
## In orer to make systemd-pager work well there are a number of busybox less
|
||||
## features we need to enable.
|
||||
CONFIG_FEATURE_LESS_DASHCMD=y
|
||||
CONFIG_FEATURE_LESS_RAW=y
|
||||
CONFIG_FEATURE_LESS_ENV=y
|
||||
|
||||
## These are nice features for users.
|
||||
CONFIG_FEATURE_LESS_WINCH=y
|
||||
CONFIG_FEATURE_LESS_ASK_TERMINAL=y
|
||||
CONFIG_FEATURE_LESS_REGEXP=y
|
||||
@@ -0,0 +1 @@
|
||||
CONFIG_MOUNTPOINT=y
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user