Update to ChromeOS 15047.0.0

Merge commit '2bb5b38e85c3dfd3d3d4c97d0e6ccf38906b9074' into sdk-update-pre

BUG=b/257271340
TEST=presubmit
RELEASE_NOTE=None

Change-Id: Id87e1dff67a95027495685ffc9e5489d5fa43621
diff --git a/PRESUBMIT.cfg b/PRESUBMIT.cfg
index 5a6c0a8..5c3a31e 100644
--- a/PRESUBMIT.cfg
+++ b/PRESUBMIT.cfg
@@ -12,6 +12,9 @@
 # that live in this repository and are installed by packages.
 long_line_check: false
 
+# Make sure RELEASE_NOTE field is present.
+release_note_field_check: true
+
 [Hook Overrides Options]
 # Ignore VERSION file and table file
 cros_license_check:
diff --git a/app-crypt/nss/Manifest b/app-crypt/nss/Manifest
index 023b5b2..7901893 100644
--- a/app-crypt/nss/Manifest
+++ b/app-crypt/nss/Manifest
@@ -1,4 +1,2 @@
-DIST nss-3.68.2.tar.gz 82406396 BLAKE2B 0542278f63770e9d4f3ce51516d7786680f2a869907ec91b2c4160f9fcad60703dd0e2a77bae91306349ff56908af0020e9479815e2b15392da7b14b27f8c7bc SHA512 31fe62f9e6f1695546bf8b087ae35ac2d3f39fde6be6ab3fcbc81ef66cf6290fc34b799e3809fcba4e913d0e305c476ee8ee1f22d0f957ec6978025920bdb9de
-DIST nss-3.75.tar.gz 84738291 BLAKE2B 35e8b1c3a6e2817d30e16b04288a5382332fa37d07f934de139dfb664c6a0ddd6a0e585902bd402cf45be5f9f9ae799c055a51cc4ec4a82c8dd12a454832e141 SHA512 0ad42f663b48649d7d16dc8b8956d2971a9566c0f7f655dd0609b94877f400977e5ad693f2eb44e1e277e55d1669294f07b3ba7a32573d3d72837b3944adf86d
-DIST nss-3.76.tar.gz 84623743 BLAKE2B 4e7ce8cfbfccae4d92357a86a0170427a50594387a73bd101e7400c85945de6104247900b4a0d5c0571370f718dc01b40749eba460b87ff339e097c07769412d SHA512 ffbdd8a27f60b796e1204912cde2fa62ac99747ce550258ccdd6fe96d60a46c6ac3f82758a7aba3c7ee58da4e7bf09f1bf817fb9f0fa4e62faaea08a6301b8bd
+DIST nss-3.73.tar.gz 83928905 BLAKE2B 64c95a04c366dc3d57c42ddb105b3afe5b4b579b3fdb554ffa684f74f5c203b136213a1a67a554756be605722ac03c15cee766afba6edf2c7c0b2162a8181ec5 SHA512 84b6e4ce8838f77674a5587cd227fa103c80f1b36c8bfb9b60a175157f131e59153c79ee77b29feffa57f49b217a90a8a091ee368eb0bc03312894e386a4c01b
 DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
diff --git a/app-crypt/nss/nss-3.68.2-r1.ebuild b/app-crypt/nss/nss-3.68.2-r1.ebuild
deleted file mode 120000
index 0aec18c..0000000
--- a/app-crypt/nss/nss-3.68.2-r1.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-nss-3.68.2.ebuild
\ No newline at end of file
diff --git a/app-crypt/nss/nss-3.73-r1.ebuild b/app-crypt/nss/nss-3.73-r1.ebuild
new file mode 120000
index 0000000..84f63b0
--- /dev/null
+++ b/app-crypt/nss/nss-3.73-r1.ebuild
@@ -0,0 +1 @@
+nss-3.73.ebuild
\ No newline at end of file
diff --git a/app-crypt/nss/nss-3.68.2.ebuild b/app-crypt/nss/nss-3.73.ebuild
similarity index 99%
rename from app-crypt/nss/nss-3.68.2.ebuild
rename to app-crypt/nss/nss-3.73.ebuild
index 04d5576..c606403 100644
--- a/app-crypt/nss/nss-3.68.2.ebuild
+++ b/app-crypt/nss/nss-3.73.ebuild
@@ -258,5 +258,6 @@
 	for f in "${nssutils[@]}"; do
 		dobin "${f}"
 	done
+
 	popd >/dev/null || die
 }
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index 96bd155..2157b27 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -1,3 +1 @@
-DIST qemu-20200718-keycodemapdb.tar.gz 47598 BLAKE2B 8ffeb7afd4c2ccbdb686d61428dc106a98907a96bb4980e187eace15c1c2454196fd16cb7b48d1887db98ff9aea55089ab192479068eaec0ac04c9e632fe5e81 SHA512 0db43f9933b5837ff534415c7084777f939ed3db7523e73fbb046567b96d5c097cf81b7670368447b6da38d514c62e0ede9b4b872954c4f42078b0dc8431e66d
-DIST qemu-20200729-berkeley-testfloat-3.tar.gz 139221 BLAKE2B 7e4a0632224f8e8d5a11ae373bbe334adb3eaee9c0bc5626be1d6148cbb219b2311ce20bc7a8ff7d532f932c497fc8f3ead75ccf4a8d406fcc4e0fca15061c0a SHA512 98a8b1be0c2854e36f1eef9de0ea5609a30e35cf231da7bb63242d636a6139d61ff78f117e8e24e0d076a588abf12cbeea06dc8ba625b84feccc07e05cd365a3
-DIST qemu-20200729-slirp.tar.gz 126451 BLAKE2B cf139056b275b54aec11e708bc7832817b707c91adaaa830c5e73ca03f3283d699073d96cac0c64a2fe72abe60c35b8d7b5f777d70ba7d2aabce1f21b6b1b5e4 SHA512 09038eb718b01a67389d1a9db1b5a4db6e0195ea4365670b90dbb3a87e18b82b85e43c24f718eba3c4045a325469836c6da0286bd5d8952ca171e9eb7800d19f
+DIST qemu-5.2.0.tar.xz 106902800 BLAKE2B 4413d5591cbabf80faba5b0b7347ee7749ff0a71af44bdf7f64b1995e17ecf1f3df539fa8e63959e0d50cd0502a41a2921e60cc6d078ed8ab5b09ab4b86d4ed7 SHA512 bddd633ce111471ebc651e03080251515178808556b49a308a724909e55dac0be0cc0c79c536ac12d239678ae94c60100dc124be9b9d9538340c03a2f27177f3
diff --git a/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch b/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch
new file mode 100644
index 0000000..d79570e
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-2.11.1-capstone_include_path.patch
@@ -0,0 +1,11 @@
+--- qemu-2.11.1/include/disas/capstone.h	2018-02-14 22:53:22.000000000 +0100
++++ qemu-2.11.1/include/disas/capstone.h	2018-02-17 20:12:12.754703951 +0100
+@@ -3,7 +3,7 @@
+ 
+ #ifdef CONFIG_CAPSTONE
+ 
+-#include <capstone.h>
++#include <capstone/capstone.h>
+ 
+ #else
+ 
diff --git a/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch b/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
new file mode 100644
index 0000000..33115f1
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-cleaner-werror.patch
@@ -0,0 +1,40 @@
+-Wall -Wextra compains about unused arguments,
+causes safe-stack to be mis-detected.
+--- a/configure
++++ b/configure
+@@ -2293,7 +2293,7 @@ fi
+ cat > $TMPC << EOF
+ #include <stdint.h>
+ #include <stdio.h>
+-int main(int argc, char *argv[]) {
++int main(void) {
+     return printf("%zu", SIZE_MAX);
+ }
+ EOF
+@@ -4911,7 +4911,7 @@ fi
+ 
+ if test "$safe_stack" = "yes"; then
+ cat > $TMPC << EOF
+-int main(int argc, char *argv[])
++int main(void)
+ {
+ #if ! __has_feature(safe_stack)
+ #error SafeStack Disabled
+@@ -4933,7 +4933,7 @@ EOF
+   fi
+ else
+ cat > $TMPC << EOF
+-int main(int argc, char *argv[])
++int main(void)
+ {
+ #if defined(__has_feature)
+ #if __has_feature(safe_stack)
+@@ -5283,7 +5283,7 @@ static const int Z = 1;
+ #define TAUT(X) ((X) == Z)
+ #define PAREN(X, Y) (X == Y)
+ #define ID(X) (X)
+-int main(int argc, char *argv[])
++int main(void)
+ {
+     int x = 0, y = 0;
+     x = ID(x);
diff --git a/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch b/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch
new file mode 100644
index 0000000..4b5676b
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-disable-keymap.patch
@@ -0,0 +1,25 @@
+Do not use system's 'qemu-keymap' in native case.
+--- a/meson.build
++++ b/meson.build
+@@ -337,6 +337,8 @@ if 'CONFIG_LIBCAP_NG' in config_host
+ endif
+ if get_option('xkbcommon').auto() and not have_system and not have_tools
+   xkbcommon = not_found
++elif get_option('xkbcommon').disabled()
++  xkbcommon = not_found
+ else
+   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
+                          method: 'pkg-config', static: enable_static)
+--- a/pc-bios/keymaps/meson.build
++++ b/pc-bios/keymaps/meson.build
+@@ -33,7 +33,9 @@ keymaps = {
+   'tr': '-l tr',
+ }
+ 
+-if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in config_host
++if meson.is_cross_build()
+   native_qemu_keymap = find_program('qemu-keymap', required: false, disabler: true)
++elif get_option('xkbcommon').disabled()
++  native_qemu_keymap = not_found
+ else
+   native_qemu_keymap = qemu_keymap
diff --git a/app-emulation/qemu/files/qemu-5.2.0-strings.patch b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
new file mode 100644
index 0000000..0b3dcdc
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-strings.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/759310
+--- a/configure
++++ b/configure
+@@ -521,6 +521,7 @@ ld="${LD-${cross_prefix}ld}"
+ ranlib="${RANLIB-${cross_prefix}ranlib}"
+ nm="${NM-${cross_prefix}nm}"
+ strip="${STRIP-${cross_prefix}strip}"
++strings="${STRINGS-${cross_prefix}strings}"
+ windres="${WINDRES-${cross_prefix}windres}"
+ pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+ query_pkg_config() {
+@@ -2265,9 +2266,9 @@ int main(int argc, char *argv[]) {
+ EOF
+ 
+ if compile_object ; then
+-    if strings -a $TMPO | grep -q BiGeNdIaN ; then
++    if $strings -a $TMPO | grep -q BiGeNdIaN ; then
+         bigendian="yes"
+-    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
++    elif $strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
+         bigendian="no"
+     else
+         echo big/little test failed
diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
index 0c30c45..930ce27 100644
--- a/app-emulation/qemu/metadata.xml
+++ b/app-emulation/qemu/metadata.xml
@@ -29,6 +29,8 @@
 		<pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux
 		block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag>
 		<flag name="io-uring">Enable efficient I/O via <pkg>sys-libs/liburing</pkg>.</flag>
+		<flag name="multipath">Enable multipath persistent reservation passthrough via
+		<pkg>sys-fs/multipath-tools</pkg>.</flag>
 		<flag name="ncurses">Enable the ncurses-based console</flag>
 		<flag name="nfs">Enable NFS support</flag>
 		<flag name="numa">Enable NUMA support</flag>
@@ -40,12 +42,12 @@
 		<flag name="rbd">Enable rados block device backend support, see http://ceph.newdream.net/wiki/QEMU-RBD</flag>
 		<flag name="sdl">Enable the SDL-based console</flag>
 		<flag name="sdl-image">SDL Image support for icons</flag>
+		<flag name="slirp">Enable TCP/IP in hypervisor via <pkg>net-libs/libslirp</pkg></flag>
 		<flag name="spice">Enable Spice protocol support via <pkg>app-emulation/spice</pkg></flag>
 		<flag name="ssh">Enable SSH based block device support via <pkg>net-libs/libssh2</pkg></flag>
 		<flag name="static-user">Build the User targets as static binaries</flag>
 		<flag name="static">Build the User and Software MMU (system) targets as well as tools as static binaries</flag>
 		<flag name="systemtap">Enable SystemTAP/DTrace tracing</flag>
-		<flag name="tci">Enable the TCG Interpreter which can speed up or slowdown workloads depending on the host and guest CPUs being emulated. In the future it will be a runtime option but for now its compile time.</flag>
 		<flag name="jemalloc">Enable jemalloc allocator support</flag>
 		<flag name="jpeg">Enable jpeg image support for the VNC console server</flag>
 		<flag name="png">Enable png image support for the VNC console server</flag>
@@ -58,8 +60,7 @@
 		<flag name="virtfs">Enable VirtFS via virtio-9p-pci / fsdev. See http://wiki.qemu.org/Documentation/9psetup</flag>
 		<flag name="vte">Enable terminal support (<pkg>x11-libs/vte</pkg>) in the GTK+ interface</flag>
 		<flag name="xattr">Add support for getting and setting POSIX extended attributes, through
-		<pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.
-	</flag>
+		<pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.</flag>
 		<flag name="xen">Enables support for Xen backends</flag>
 		<flag name="xfs">Support xfsctl() notification and syncing for XFS backed
 		virtual disks.</flag>
diff --git a/app-emulation/qemu/qemu-5.2.0-r1.ebuild b/app-emulation/qemu/qemu-5.2.0-r1.ebuild
new file mode 120000
index 0000000..babb047
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.2.0-r1.ebuild
@@ -0,0 +1 @@
+qemu-5.2.0.ebuild
\ No newline at end of file
diff --git a/app-emulation/qemu/qemu-5.2.0.ebuild b/app-emulation/qemu/qemu-5.2.0.ebuild
new file mode 100644
index 0000000..66da0a4
--- /dev/null
+++ b/app-emulation/qemu/qemu-5.2.0.ebuild
@@ -0,0 +1,857 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+PYTHON_REQ_USE="ncurses,readline"
+
+FIRMWARE_ABI_VERSION="4.0.0-r50"
+
+inherit eutils linux-info toolchain-funcs multilib python-r1 \
+	udev fcaps readme.gentoo-r1 pax-utils l10n xdg-utils
+
+if [[ ${PV} = *9999* ]]; then
+	EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
+	EGIT_SUBMODULES=(
+		meson
+		tests/fp/berkeley-softfloat-3
+		tests/fp/berkeley-testfloat-3
+		ui/keycodemapdb
+	)
+	inherit git-r3
+	SRC_URI=""
+else
+	SRC_URI="https://download.qemu.org/${P}.tar.xz"
+	KEYWORDS="*"
+fi
+
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+
+LICENSE="GPL-2 LGPL-2 BSD-2"
+SLOT="0"
+
+IUSE="accessibility +aio alsa bzip2 capstone +caps +curl debug doc
+	+fdt glusterfs gnutls gtk infiniband iscsi io-uring
+	jack jemalloc +jpeg kernel_linux
+	kernel_FreeBSD lzo multipath
+	ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+	plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
+	+slirp
+	smartcard snappy spice ssh static static-user systemtap test udev usb
+	usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
+	xfs zstd"
+
+COMMON_TARGETS="aarch64 alpha arm cris hppa i386 m68k microblaze microblazeel
+	mips mips64 mips64el mipsel nios2 or1k ppc ppc64 riscv32 riscv64 s390x
+	sh4 sh4eb sparc sparc64 x86_64 xtensa xtensaeb"
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
+	avr lm32 moxie rx tricore unicore32"
+IUSE_USER_TARGETS="${COMMON_TARGETS}
+	aarch64_be armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus
+	tilegx"
+
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
+
+RESTRICT="!test? ( test )"
+# Allow no targets to be built so that people can get a tools-only build.
+# Block USE flag configurations known to not work.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	qemu_softmmu_targets_arm? ( fdt )
+	qemu_softmmu_targets_microblaze? ( fdt )
+	qemu_softmmu_targets_mips64el? ( fdt )
+	qemu_softmmu_targets_ppc64? ( fdt )
+	qemu_softmmu_targets_ppc? ( fdt )
+	qemu_softmmu_targets_riscv32? ( fdt )
+	qemu_softmmu_targets_riscv64? ( fdt )
+	static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy )
+	static-user? ( !plugins )
+	vhost-user-fs? ( caps seccomp )
+	virtfs? ( caps xattr )
+	vte? ( gtk )
+	multipath? ( udev )
+	plugins? ( !static !static-user )
+"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# and user/softmmu targets (qemu-*, qemu-system-*).
+#
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
+#
+# The attr lib isn't always linked in (although the USE flag is always
+# respected).  This is because qemu supports using the C library's API
+# when available rather than always using the external library.
+ALL_DEPEND="
+	>=dev-libs/glib-2.0[static-libs(+)]
+	sys-libs/zlib[static-libs(+)]
+	python? ( ${PYTHON_DEPS} )
+	systemtap? ( dev-util/systemtap )
+	xattr? ( sys-apps/attr[static-libs(+)] )"
+
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
+# softmmu targets (qemu-system-*).
+SOFTMMU_TOOLS_DEPEND="
+	dev-libs/libxml2[static-libs(+)]
+	>=x11-libs/pixman-0.28.0[static-libs(+)]
+	accessibility? (
+		app-accessibility/brltty[api]
+		app-accessibility/brltty[static-libs(+)]
+	)
+	aio? ( dev-libs/libaio[static-libs(+)] )
+	alsa? ( >=media-libs/alsa-lib-1.0.13 )
+	bzip2? ( app-arch/bzip2[static-libs(+)] )
+	capstone? ( dev-libs/capstone:= )
+	caps? ( sys-libs/libcap-ng[static-libs(+)] )
+	curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
+	fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+	glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
+	gnutls? (
+		dev-libs/nettle:=[static-libs(+)]
+		>=net-libs/gnutls-3.0:=[static-libs(+)]
+	)
+	gtk? (
+		x11-libs/gtk+:3
+		vte? ( x11-libs/vte:2.91 )
+	)
+	infiniband? (
+		sys-fabric/libibumad:=[static-libs(+)]
+		sys-fabric/libibverbs:=[static-libs(+)]
+		sys-fabric/librdmacm:=[static-libs(+)]
+	)
+	iscsi? ( net-libs/libiscsi )
+	io-uring? ( sys-libs/liburing:=[static-libs(+)] )
+	jack? ( virtual/jack )
+	jemalloc? ( dev-libs/jemalloc )
+	jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+	lzo? ( dev-libs/lzo:2[static-libs(+)] )
+	multipath? ( sys-fs/multipath-tools )
+	ncurses? (
+		sys-libs/ncurses:0=[unicode]
+		sys-libs/ncurses:0=[static-libs(+)]
+	)
+	nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
+	numa? ( sys-process/numactl[static-libs(+)] )
+	opengl? (
+		virtual/opengl
+		media-libs/libepoxy[static-libs(+)]
+		media-libs/mesa[static-libs(+)]
+		media-libs/mesa[egl,gbm]
+	)
+	png? ( media-libs/libpng:0=[static-libs(+)] )
+	pulseaudio? ( media-sound/pulseaudio )
+	rbd? ( sys-cluster/ceph )
+	sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
+	sdl? (
+		media-libs/libsdl2[video]
+		media-libs/libsdl2[static-libs(+)]
+	)
+	sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
+	seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
+	slirp? ( net-libs/libslirp[static-libs(+)] )
+	smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
+	snappy? ( app-arch/snappy:= )
+	spice? (
+		>=app-emulation/spice-protocol-0.12.3
+		>=app-emulation/spice-0.12.0[static-libs(+)]
+	)
+	ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
+	udev? ( virtual/libudev[static-libs(+)] )
+	usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
+	usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
+	vde? ( net-misc/vde[static-libs(+)] )
+	virgl? ( media-libs/virglrenderer[static-libs(+)] )
+	virtfs? ( sys-libs/libcap )
+	xen? ( app-emulation/xen-tools:= )
+	xfs? ( sys-fs/xfsprogs[static-libs(+)] )
+	zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
+"
+
+X86_FIRMWARE_DEPEND="
+	pin-upstream-blobs? (
+		~sys-firmware/edk2-ovmf-201905[binary]
+		~sys-firmware/ipxe-1.0.0_p20190728[binary,qemu]
+		~sys-firmware/seabios-1.12.0[binary,seavgabios]
+		~sys-firmware/sgabios-0.1_pre8[binary]
+	)
+	!pin-upstream-blobs? (
+		sys-firmware/edk2-ovmf
+		sys-firmware/ipxe[qemu]
+		>=sys-firmware/seabios-1.10.2[seavgabios]
+		sys-firmware/sgabios
+	)"
+PPC64_FIRMWARE_DEPEND="
+	pin-upstream-blobs? (
+		~sys-firmware/seabios-1.12.0[binary,seavgabios]
+	)
+	!pin-upstream-blobs? (
+		>=sys-firmware/seabios-1.10.2[seavgabios]
+	)
+"
+
+BDEPEND="
+	$(python_gen_impl_dep)
+	dev-lang/perl
+	sys-apps/texinfo
+	virtual/pkgconfig
+	doc? ( dev-python/sphinx )
+	gtk? ( nls? ( sys-devel/gettext ) )
+	test? (
+		dev-libs/glib[utils]
+		sys-devel/bc
+	)
+"
+CDEPEND="
+	!static? (
+		${ALL_DEPEND//\[static-libs(+)]}
+		${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
+	)
+	qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
+	qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
+	qemu_softmmu_targets_ppc64? ( ${PPC64_FIRMWARE_DEPEND} )
+"
+DEPEND="${CDEPEND}
+	kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
+	static? (
+		${ALL_DEPEND}
+		${SOFTMMU_TOOLS_DEPEND}
+	)
+	static-user? ( ${ALL_DEPEND} )"
+RDEPEND="${CDEPEND}
+	acct-group/kvm
+	selinux? ( sec-policy/selinux-qemu )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
+	"${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
+	"${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+	"${FILESDIR}"/${PN}-5.2.0-strings.patch
+)
+
+QA_PREBUILT="
+	usr/share/qemu/hppa-firmware.img
+	usr/share/qemu/openbios-ppc
+	usr/share/qemu/openbios-sparc64
+	usr/share/qemu/openbios-sparc32
+	usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
+	usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
+	usr/share/qemu/palcode-clipper
+	usr/share/qemu/s390-ccw.img
+	usr/share/qemu/s390-netboot.img
+	usr/share/qemu/u-boot.e500
+"
+
+QA_WX_LOAD="usr/bin/qemu-i386
+	usr/bin/qemu-x86_64
+	usr/bin/qemu-alpha
+	usr/bin/qemu-arm
+	usr/bin/qemu-cris
+	usr/bin/qemu-m68k
+	usr/bin/qemu-microblaze
+	usr/bin/qemu-microblazeel
+	usr/bin/qemu-mips
+	usr/bin/qemu-mipsel
+	usr/bin/qemu-or1k
+	usr/bin/qemu-ppc
+	usr/bin/qemu-ppc64
+	usr/bin/qemu-ppc64abi32
+	usr/bin/qemu-sh4
+	usr/bin/qemu-sh4eb
+	usr/bin/qemu-sparc
+	usr/bin/qemu-sparc64
+	usr/bin/qemu-armeb
+	usr/bin/qemu-sparc32plus
+	usr/bin/qemu-s390x
+	usr/bin/qemu-unicore32
+"
+
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
+kernel module loaded before running kvm. The easiest way to ensure that the
+kernel module is loaded is to load it on boot.
+	For AMD CPUs the module is called 'kvm-amd'.
+	For Intel CPUs the module is called 'kvm-intel'.
+Please review /etc/conf.d/modules for how to load these.
+
+Make sure your user is in the 'kvm' group. Just run
+	$ gpasswd -a <USER> kvm
+then have <USER> re-login.
+
+For brand new installs, the default permissions on /dev/kvm might not let
+you access it.  You can tell udev to reset ownership/perms:
+	$ udevadm trigger -c add /dev/kvm
+
+If you want to register binfmt handlers for qemu user targets:
+For openrc:
+	# rc-update add qemu-binfmt
+For systemd:
+	# ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
+
+pkg_pretend() {
+	if use kernel_linux && kernel_is lt 2 6 25; then
+		eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
+	elif use kernel_linux; then
+		if ! linux_config_exists; then
+			eerror "Unable to check your kernel for KVM support"
+		else
+			CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
+			ERROR_KVM="You must enable KVM in your kernel to continue"
+			ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
+			ERROR_KVM_AMD+=" your kernel configuration."
+			ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
+			ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
+			ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
+			ERROR_TUN+=" into your kernel or loaded as a module to use the"
+			ERROR_TUN+=" virtual network device if using -net tap."
+			ERROR_BRIDGE="You will also need support for 802.1d"
+			ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
+			use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
+			ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
+			ERROR_VHOST_NET+=" support"
+
+			if use amd64 || use x86 || use amd64-linux || use x86-linux; then
+				if grep -q AuthenticAMD /proc/cpuinfo; then
+					CONFIG_CHECK+=" ~KVM_AMD"
+				elif grep -q GenuineIntel /proc/cpuinfo; then
+					CONFIG_CHECK+=" ~KVM_INTEL"
+				fi
+			fi
+
+			use python && CONFIG_CHECK+=" ~DEBUG_FS"
+			ERROR_DEBUG_FS="debugFS support required for kvm_stat"
+
+			# Now do the actual checks setup above
+			check_extra_config
+		fi
+	fi
+
+	if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
+		eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
+		eerror "instances are still pointing to it.  Please update your"
+		eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
+		eerror "and the right system binary (e.g. qemu-system-x86_64)."
+		die "update your virt configs to not use qemu-kvm"
+	fi
+}
+
+# Sanity check to make sure target lists are kept up-to-date.
+check_targets() {
+	local var=$1 mak=$2
+	local detected sorted
+
+	pushd "${S}"/default-configs/targets/ >/dev/null || die
+
+	# Force C locale until glibc is updated. #564936
+	detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
+	sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
+	if [[ ${sorted} != "${detected}" ]] ; then
+		eerror "The ebuild needs to be kept in sync."
+		eerror "${var}: ${sorted}"
+		eerror "$(printf '%-*s' ${#var} configure): ${detected}"
+		die "sync ${var} to the list of targets"
+	fi
+
+	popd >/dev/null
+}
+
+src_prepare() {
+	check_targets IUSE_SOFTMMU_TARGETS softmmu
+	check_targets IUSE_USER_TARGETS linux-user
+
+	default
+
+	# Use correct toolchain to fix cross-compiling
+	tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
+	export WINDRES=${CHOST}-windres
+
+	# Verbose builds
+	MAKEOPTS+=" V=1"
+
+	# Remove bundled copy of libfdt
+	rm -r dtc || die
+}
+
+##
+# configures qemu based on the build directory and the build type
+# we are using.
+#
+qemu_src_configure() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	local buildtype=$1
+	local builddir="${S}/${buildtype}-build"
+
+	mkdir "${builddir}"
+
+	local conf_opts=(
+		--prefix=/usr
+		--sysconfdir=/etc
+		--bindir=/usr/bin
+		--libdir=/usr/$(get_libdir)
+		--datadir=/usr/share
+		--docdir=/usr/share/doc/${PF}/html
+		--mandir=/usr/share/man
+		--localstatedir=/var
+		--disable-bsd-user
+		--disable-containers # bug #732972
+		--disable-guest-agent
+		--disable-strip
+
+		# bug #746752: TCG interpreter has a few limitations:
+		# - it does not support FPU
+		# - it's generally slower on non-self-modifying code
+		# It's advantage is support for host architectures
+		# where native codegeneration is not implemented.
+		# Gentoo has qemu keyworded only on targets with
+		# native code generation available. Avoid the interpreter.
+		--disable-tcg-interpreter
+
+		--disable-werror
+		# We support gnutls/nettle for crypto operations.  It is possible
+		# to use gcrypt when gnutls/nettle are disabled (but not when they
+		# are enabled), but it's not really worth the hassle.  Disable it
+		# all the time to avoid automatically detecting it. #568856
+		--disable-gcrypt
+		--python="${PYTHON}"
+		--cc="$(tc-getCC)"
+		--cxx="$(tc-getCXX)"
+		--host-cc="$(tc-getBUILD_CC)"
+		$(use_enable debug debug-info)
+		$(use_enable debug debug-tcg)
+		$(use_enable doc docs)
+		$(use_enable nls gettext)
+		$(use_enable plugins)
+		$(use_enable xattr attr)
+	)
+
+	# Disable options not used by user targets. This simplifies building
+	# static user targets (USE=static-user) considerably.
+	conf_notuser() {
+		if [[ ${buildtype} == "user" ]] ; then
+			echo "--disable-${2:-$1}"
+		else
+			use_enable "$@"
+		fi
+	}
+	# Enable option only for softmmu build, but not 'user' or 'tools'
+	conf_softmmu() {
+		if [[ ${buildtype} == "softmmu" ]] ; then
+			use_enable "$@"
+		else
+			echo "--disable-${2:-$1}"
+		fi
+	}
+	# Enable option only for tools build, but not 'user' or 'softmmu'
+	conf_tools() {
+		if [[ ${buildtype} == "tools" ]] ; then
+			use_enable "$@"
+		else
+			echo "--disable-${2:-$1}"
+		fi
+	}
+	conf_opts+=(
+		$(conf_notuser accessibility brlapi)
+		$(conf_notuser aio linux-aio)
+		$(conf_notuser bzip2)
+		$(conf_notuser capstone)
+		$(conf_notuser caps cap-ng)
+		$(conf_notuser curl)
+		$(conf_notuser fdt)
+		$(conf_notuser glusterfs)
+		$(conf_notuser gnutls)
+		$(conf_notuser gnutls nettle)
+		$(conf_notuser gtk)
+		$(conf_notuser infiniband rdma)
+		$(conf_notuser iscsi libiscsi)
+		$(conf_notuser io-uring linux-io-uring)
+		$(conf_notuser jemalloc jemalloc)
+		$(conf_notuser jpeg vnc-jpeg)
+		$(conf_notuser kernel_linux kvm)
+		$(conf_notuser lzo)
+		$(conf_notuser multipath mpath)
+		$(conf_notuser ncurses curses)
+		$(conf_notuser nfs libnfs)
+		$(conf_notuser numa)
+		$(conf_notuser opengl)
+		$(conf_notuser png vnc-png)
+		$(conf_notuser rbd)
+		$(conf_notuser sasl vnc-sasl)
+		$(conf_notuser sdl)
+		$(conf_softmmu sdl-image)
+		$(conf_notuser seccomp)
+		$(conf_notuser slirp slirp system)
+		$(conf_notuser smartcard)
+		$(conf_notuser snappy)
+		$(conf_notuser spice)
+		$(conf_notuser ssh libssh)
+		$(conf_notuser udev libudev)
+		$(conf_notuser usb libusb)
+		$(conf_notuser usbredir usb-redir)
+		$(conf_notuser vde)
+		$(conf_notuser vhost-net)
+		$(conf_notuser vhost-user-fs)
+		$(conf_tools vhost-user-fs virtiofsd)
+		$(conf_notuser virgl virglrenderer)
+		$(conf_notuser virtfs)
+		$(conf_notuser vnc)
+		$(conf_notuser vte)
+		$(conf_notuser xen)
+		$(conf_notuser xen xen-pci-passthrough)
+		$(conf_notuser xfs xfsctl)
+		# use prebuilt keymaps, bug #759604
+		--disable-xkbcommon
+		$(conf_notuser zstd)
+	)
+
+	if [[ ${buildtype} == "user" ]] ; then
+		conf_opts+=( --disable-libxml2 )
+	else
+		conf_opts+=( --enable-libxml2 )
+	fi
+
+	if [[ ! ${buildtype} == "user" ]] ; then
+		# audio options
+		local audio_opts=(
+			# Note: backend order matters here: #716202
+			# We iterate from higher-level to lower level.
+			$(usex pulseaudio pa "")
+			$(usev jack)
+			$(usev sdl)
+			$(usev alsa)
+			$(usev oss)
+		)
+		conf_opts+=(
+			--audio-drv-list=$(printf "%s," "${audio_opts[@]}")
+		)
+	fi
+
+	case ${buildtype} in
+	user)
+		conf_opts+=(
+			--enable-linux-user
+			--disable-system
+			--disable-blobs
+			--disable-tools
+		)
+		local static_flag="static-user"
+		;;
+	softmmu)
+		conf_opts+=(
+			--disable-linux-user
+			--enable-system
+			--disable-tools
+		)
+		local static_flag="static"
+		;;
+	tools)
+		conf_opts+=(
+			--disable-linux-user
+			--disable-system
+			--disable-blobs
+			--enable-tools
+		)
+		local static_flag="static"
+		;;
+	esac
+
+	local targets="${buildtype}_targets"
+	[[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
+
+	# Add support for SystemTAP
+	use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
+
+	# We always want to attempt to build with PIE support as it results
+	# in a more secure binary. But it doesn't work with static or if
+	# the current GCC doesn't have PIE support.
+	if use ${static_flag}; then
+		conf_opts+=( --static --disable-pie )
+	else
+		tc-enables-pie && conf_opts+=( --enable-pie )
+	fi
+
+	# Plumb through equivalent of EXTRA_ECONF to allow experiments
+	# like bug #747928.
+	conf_opts+=( ${EXTRA_CONF_QEMU} )
+
+	echo "../configure ${conf_opts[*]}"
+	cd "${builddir}"
+	../configure "${conf_opts[@]}" || die "configure failed"
+
+	# FreeBSD's kernel does not support QEMU assigning/grabbing
+	# host USB devices yet
+	use kernel_FreeBSD && \
+		sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
+}
+
+src_configure() {
+	local target
+
+	python_setup
+
+	softmmu_targets= softmmu_bins=()
+	user_targets= user_bins=()
+
+	for target in ${IUSE_SOFTMMU_TARGETS} ; do
+		if use "qemu_softmmu_targets_${target}"; then
+			softmmu_targets+=",${target}-softmmu"
+			softmmu_bins+=( "qemu-system-${target}" )
+		fi
+	done
+
+	for target in ${IUSE_USER_TARGETS} ; do
+		if use "qemu_user_targets_${target}"; then
+			user_targets+=",${target}-linux-user"
+			user_bins+=( "qemu-${target}" )
+		fi
+	done
+
+	softmmu_targets=${softmmu_targets#,}
+	user_targets=${user_targets#,}
+
+	[[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
+	[[ -n ${user_targets}    ]] && qemu_src_configure "user"
+	qemu_src_configure "tools"
+}
+
+src_compile() {
+	if [[ -n ${user_targets} ]]; then
+		cd "${S}/user-build"
+		default
+	fi
+
+	if [[ -n ${softmmu_targets} ]]; then
+		cd "${S}/softmmu-build"
+		default
+	fi
+
+	cd "${S}/tools-build"
+	default
+}
+
+src_test() {
+	if [[ -n ${softmmu_targets} ]]; then
+		cd "${S}/softmmu-build"
+		pax-mark m */qemu-system-* #515550
+		emake check
+	fi
+}
+
+qemu_python_install() {
+	python_domodule "${S}/python/qemu"
+
+	python_doscript "${S}/scripts/kvm/vmxcap"
+	python_doscript "${S}/scripts/qmp/qmp-shell"
+	python_doscript "${S}/scripts/qmp/qemu-ga-client"
+}
+
+# Generate binfmt support files.
+#   - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
+#   - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
+generate_initd() {
+	local out="${T}/qemu-binfmt"
+	local out_systemd="${T}/qemu.conf"
+	local d="${T}/binfmt.d"
+
+	einfo "Generating qemu binfmt scripts and configuration files"
+
+	# Generate the debian fragments first.
+	mkdir -p "${d}"
+	"${S}"/scripts/qemu-binfmt-conf.sh \
+		--debian \
+		--exportdir "${d}" \
+		--qemu-path "${EPREFIX}/usr/bin" \
+		|| die
+	# Then turn the fragments into a shell script we can source.
+	sed -E -i \
+		-e 's:^([^ ]+) (.*)$:\1="\2":' \
+		"${d}"/* || die
+
+	# Generate the init.d script by assembling the fragments from above.
+	local f qcpu package interpreter magic mask
+	cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
+	for f in "${d}"/qemu-* ; do
+		source "${f}"
+
+		# Normalize the cpu logic like we do in the init.d for the native cpu.
+		qcpu=${package#qemu-}
+		case ${qcpu} in
+		arm*)   qcpu="arm";;
+		mips*)  qcpu="mips";;
+		ppc*)   qcpu="ppc";;
+		s390*)  qcpu="s390";;
+		sh*)    qcpu="sh";;
+		sparc*) qcpu="sparc";;
+		esac
+
+		# we use 'printf' here to be portable across 'sh'
+		# implementations: #679168
+		cat <<EOF >>"${out}"
+	if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
+		printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
+	fi
+EOF
+
+		echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
+
+	done
+	cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
+}
+
+src_install() {
+	if [[ -n ${user_targets} ]]; then
+		cd "${S}/user-build"
+		emake DESTDIR="${ED}" install
+
+		# Install binfmt handler init script for user targets.
+		generate_initd
+		doinitd "${T}/qemu-binfmt"
+
+		# Install binfmt/qemu.conf.
+		insinto "/usr/share/qemu/binfmt.d"
+		doins "${T}/qemu.conf"
+	fi
+
+	if [[ -n ${softmmu_targets} ]]; then
+		cd "${S}/softmmu-build"
+		emake DESTDIR="${ED}" install
+
+		# This might not exist if the test failed. #512010
+		[[ -e check-report.html ]] && dodoc check-report.html
+
+		if use kernel_linux; then
+			udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
+		fi
+
+		if use python; then
+			python_foreach_impl qemu_python_install
+		fi
+	fi
+
+	cd "${S}/tools-build"
+	emake DESTDIR="${ED}" install
+
+	# Disable mprotect on the qemu binaries as they use JITs to be fast #459348
+	pushd "${ED}"/usr/bin >/dev/null
+	pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
+	popd >/dev/null
+
+	# Install config file example for qemu-bridge-helper
+	insinto "/etc/qemu"
+	doins "${FILESDIR}/bridge.conf"
+
+	cd "${S}"
+	dodoc MAINTAINERS docs/specs/pci-ids.txt
+	newdoc pc-bios/README README.pc-bios
+
+	# Disallow stripping of prebuilt firmware files.
+	dostrip -x ${QA_PREBUILT}
+
+	if [[ -n ${softmmu_targets} ]]; then
+		# Remove SeaBIOS since we're using the SeaBIOS packaged one
+		rm "${ED}/usr/share/qemu/bios.bin"
+		rm "${ED}/usr/share/qemu/bios-256k.bin"
+		if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+			dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
+			dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
+		fi
+
+		# Remove vgabios since we're using the seavgabios packaged one
+		rm "${ED}/usr/share/qemu/vgabios.bin"
+		rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
+		rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
+		rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
+		rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
+		rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
+		# PPC64 loads vgabios-stdvga
+		if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc64; then
+			dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
+			dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
+			dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
+			dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
+			dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
+			dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
+		fi
+
+		# Remove sgabios since we're using the sgabios packaged one
+		rm "${ED}/usr/share/qemu/sgabios.bin"
+		if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+			dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
+		fi
+
+		# Remove iPXE since we're using the iPXE packaged one
+		rm "${ED}"/usr/share/qemu/pxe-*.rom
+		if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
+			dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
+			dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
+			dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
+			dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
+			dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
+			dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
+		fi
+	fi
+
+	DISABLE_AUTOFORMATTING=true
+	readme.gentoo_create_doc
+}
+
+firmware_abi_change() {
+	local pv
+	for pv in ${REPLACING_VERSIONS}; do
+		if ver_test $pv -lt ${FIRMWARE_ABI_VERSION}; then
+			return 0
+		fi
+	done
+	return 1
+}
+
+pkg_postinst() {
+	if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
+		udev_reload
+	fi
+
+	xdg_icon_cache_update
+
+	[[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
+		fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+
+	DISABLE_AUTOFORMATTING=true
+	readme.gentoo_print_elog
+
+	if use pin-upstream-blobs && firmware_abi_change; then
+		ewarn "This version of qemu pins new versions of firmware blobs:"
+		ewarn "	$(best_version sys-firmware/edk2-ovmf)"
+		ewarn "	$(best_version sys-firmware/ipxe)"
+		ewarn "	$(best_version sys-firmware/seabios)"
+		ewarn "	$(best_version sys-firmware/sgabios)"
+		ewarn "This might break resume of hibernated guests (started with a different"
+		ewarn "firmware version) and live migration to/from qemu versions with different"
+		ewarn "firmware. Please (cold) restart all running guests. For functional"
+		ewarn "guest migration ensure that all"
+		ewarn "hosts run at least"
+		ewarn "	app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
+	fi
+}
+
+pkg_info() {
+	echo "Using:"
+	echo "  $(best_version app-emulation/spice-protocol)"
+	echo "  $(best_version sys-firmware/edk2-ovmf)"
+	if has_version 'sys-firmware/edk2-ovmf[binary]'; then
+		echo "    USE=binary"
+	else
+		echo "    USE=''"
+	fi
+	echo "  $(best_version sys-firmware/ipxe)"
+	echo "  $(best_version sys-firmware/seabios)"
+	if has_version 'sys-firmware/seabios[binary]'; then
+		echo "    USE=binary"
+	else
+		echo "    USE=''"
+	fi
+	echo "  $(best_version sys-firmware/sgabios)"
+}
+
+pkg_postrm() {
+	xdg_icon_cache_update
+}
diff --git a/chromeos-base/chromeos-installer/chromeos-installer-0.0.3-r3670.ebuild b/chromeos-base/chromeos-installer/chromeos-installer-0.0.3-r3670.ebuild
index 9cdb564..cc1627e 100644
--- a/chromeos-base/chromeos-installer/chromeos-installer-0.0.3-r3670.ebuild
+++ b/chromeos-base/chromeos-installer/chromeos-installer-0.0.3-r3670.ebuild
@@ -1,7 +1,7 @@
 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI="7"
 
 CROS_WORKON_COMMIT="dbb1136242ba822d539eaf11493f3b68815adb7f"
 CROS_WORKON_TREE=("527abd7a988a45572305a6c44b5324d0d9cf8be2" "60fa47aebd6ebfb702012849bd560717fceddcd4" "aec60c261c19c132b6dda00ed40f61717c823a15" "a65107acb3c4cbbae51687d8409856f07b5dda27" "e7dba8c91c1f3257c34d4a7ffff0ea2537aeb6bb")
@@ -60,6 +60,17 @@
 	platform_test "run" "${OUT}/cros_installer_test"
 }
 
+src_prepare() {
+	# The workdir is platform2/nnapi - we need to pop up one level in the stack
+	# to apply our patches.
+	pushd .. || exit
+	eapply -p1 "${FILESDIR}/installer-support-new-dm-format.patch"
+	eapply -p1 "${FILESDIR}/0001-Add-dm-mod.create.patch"
+	popd || exit
+
+	eapply_user
+}
+
 src_install() {
 	platform_src_install
 
diff --git a/chromeos-base/chromeos-installer/files/0001-Add-dm-mod.create.patch b/chromeos-base/chromeos-installer/files/0001-Add-dm-mod.create.patch
new file mode 100644
index 0000000..59d2660
--- /dev/null
+++ b/chromeos-base/chromeos-installer/files/0001-Add-dm-mod.create.patch
@@ -0,0 +1,26 @@
+From 4af4bfd122b91f01803f63f85b1bf16fbdfb54dc Mon Sep 17 00:00:00 2001
+From: Sejal Sharma <sejalsharma@google.com>
+Date: Fri, 28 Oct 2022 17:39:59 +0000
+Subject: [PATCH] Add dm-mod.create
+
+Change-Id: Iafd550a1d0f8b7740b877c8b465e55d926987ebd
+---
+ installer/chromeos_legacy_test.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/installer/chromeos_legacy_test.cc b/installer/chromeos_legacy_test.cc
+index fd46d64e61..91415221cb 100644
+--- a/installer/chromeos_legacy_test.cc
++++ b/installer/chromeos_legacy_test.cc
+@@ -38,7 +38,7 @@ TEST(LegacyTest, EfiGrubUpdateTest) {
+       "  linux /syslinux/vmlinuz.B cros_efi cros_debug "
+       " root=PARTUUID=5BFD65FE-0398-804A-B090-A201E022A7C6\n"
+       "  linux /syslinux/vmlinuz.A cros_efi cros_debug "
+-      "root=/dev/dm-0 dm=\"verity args\"\n"
++      "root=/dev/dm-0 dm-mod.create=\"verity args\"\n"
+       "  linux /syslinux/vmlinuz.B cros_efi cros_debug "
+       "root=/dev/dm-0 dm=\"DM verity=B\"\n"
+       "  linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init "
+-- 
+2.38.1.273.g43a17bfeac-goog
+
diff --git a/chromeos-base/chromeos-installer/files/installer-support-new-dm-format.patch b/chromeos-base/chromeos-installer/files/installer-support-new-dm-format.patch
new file mode 100644
index 0000000..d9155aa
--- /dev/null
+++ b/chromeos-base/chromeos-installer/files/installer-support-new-dm-format.patch
@@ -0,0 +1,127 @@
+From 5a583d1f3ff73c62a92cef6838412a212d8e94e2 Mon Sep 17 00:00:00 2001
+From: Meena Shanmugam <meenashanmugam@google.com>
+Date: Mon, 10 Oct 2022 00:10:18 +0000
+Subject: [PATCH] LAKITU:chromeos-installer: Update postinstall programs to
+ use new dm format.
+
+COS uses upstream dm format for the upcoming releases. Automatic updates
+update the bootloader configurations. Inorder to auto-update work with
+the upstream format, these auto-update postinstall programs need to be
+modified to support both new and old format. Once these changes are
+approved and merged in chromeOS upstream, this patch can be removed.
+
+Change-Id: Icb9af46e0b2bed4aa7c44f658d1b49252fc993bc
+---
+ installer/chromeos_legacy.cc   | 17 ++++++++++++++---
+ installer/chromeos_setimage.cc | 35 +++++++++++++++++++++++++++++-----
+ 2 files changed, 44 insertions(+), 8 deletions(-)
+
+diff --git a/installer/chromeos_legacy.cc b/installer/chromeos_legacy.cc
+index 10f14ab991..276f633961 100644
+--- a/installer/chromeos_legacy.cc
++++ b/installer/chromeos_legacy.cc
+@@ -38,6 +38,9 @@ bool UpdateLegacyKernel(const InstallConfig& install_config) {
+ string ExplandVerityArguments(const string& kernel_config,
+                               const string& root_uuid) {
+   string kernel_config_dm = ExtractKernelArg(kernel_config, "dm");
++  if ( kernel_config_dm.empty()) {
++    kernel_config_dm = ExtractKernelArg(kernel_config, "dm-mod.create");
++  }
+ 
+   // The verity config from the kernel contains short hand symbols for
+   // partition names that we have to expand to specific UUIDs.
+@@ -228,7 +231,8 @@ bool EfiGrubUpdate(const string& input,
+     base::ReplaceFirstSubstringAfterOffset(&(*line), 0, "linuxefi", "linux");
+ 
+     if (line->find(kernel_pattern) != string::npos) {
+-      if (ExtractKernelArg(*line, "dm").empty()) {
++      if (ExtractKernelArg(*line, "dm").empty() &&
++          ExtractKernelArg(*line, "dm-mod.create").empty()) {
+         // If it's an unverified boot line, just set the root partition to boot.
+         if (!SetKernelArg("root", "PARTUUID=" + root_uuid, &(*line))) {
+           LOG(ERROR) << "Unable to update unverified root flag in " << *line;
+@@ -236,8 +240,15 @@ bool EfiGrubUpdate(const string& input,
+         }
+       } else {
+         if (!SetKernelArg("dm", verity_args, &(*line))) {
+-          LOG(INFO) << "Unable to update verified dm flag.";
+-          return false;
++          if (!SetKernelArg("dm-mod.create", verity_args, &(*line))) {
++            LOG(INFO) << "Unable to update verified dm flag.";
++            return false;
++          }
++        }
++        // Update grub.cfg with the new dm format
++        std::size_t found = line->find("dm=");
++        if (found != std::string::npos) {
++          line->replace(found, 3, "dm-mod.create=");
+         }
+       }
+     }
+diff --git a/installer/chromeos_setimage.cc b/installer/chromeos_setimage.cc
+index b2772d3c25..0906a25d1c 100644
+--- a/installer/chromeos_setimage.cc
++++ b/installer/chromeos_setimage.cc
+@@ -77,7 +77,12 @@ bool SetImage(const InstallConfig& install_config) {
+   //
+ 
+   string kernel_config_root = ExtractKernelArg(kernel_config, "root");
++  int version = 0;
+   string dm_config = ExtractKernelArg(kernel_config, "dm");
++  if (dm_config.empty()) {
++    dm_config = ExtractKernelArg(kernel_config, "dm-mod.create");
++    version =1;
++  }
+   std::vector<string> dm_parts = base::SplitString(
+       dm_config, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
+ 
+@@ -95,11 +100,24 @@ bool SetImage(const InstallConfig& install_config) {
+     return false;
+   }
+ 
++  string rootfs_sectors;
++  string verity_algorithm;
++  string expected_hash;
++  string salt;
+   // Extract specific verity arguments
+-  string rootfs_sectors = ExtractKernelArg(verity_args, "hashstart");
+-  string verity_algorithm = ExtractKernelArg(verity_args, "alg");
+-  string expected_hash = ExtractKernelArg(verity_args, "root_hexdigest");
+-  string salt = ExtractKernelArg(verity_args, "salt");
++  if (version == 1) {
++    std::vector<string> verity_parts = base::SplitString(
++        verity_args, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
++    rootfs_sectors = verity_parts[9];
++    verity_algorithm = verity_parts[10];
++    expected_hash = verity_parts[11];
++    salt = verity_parts[12];
++  } else {
++    rootfs_sectors = ExtractKernelArg(verity_args, "hashstart");
++    verity_algorithm = ExtractKernelArg(verity_args, "alg");
++    expected_hash = ExtractKernelArg(verity_args, "root_hexdigest");
++    salt = ExtractKernelArg(verity_args, "salt");
++  }
+ 
+   bool enable_rootfs_verification = IsReadonly(kernel_config_root);
+ 
+@@ -109,9 +127,16 @@ bool SetImage(const InstallConfig& install_config) {
+   LOG(INFO) << "Setting up verity.";
+   LoggingTimerStart();
+   verity::DmBht bht;
++  uint64_t sectors;
++  if (version == 1) {
++    sectors = (atoi(rootfs_sectors.c_str()) << 3) / 8;
++  } else {
++    sectors = (atoi(rootfs_sectors.c_str())) / 8;
++  }
++
+   int result = chromeos_verity(&bht, verity_algorithm,
+                                install_config.root.device(), getpagesize(),
+-                               (uint64_t)(atoi(rootfs_sectors.c_str()) / 8),
++                               sectors,
+                                salt, expected_hash, enable_rootfs_verification);
+   LoggingTimerFinish();
+ 
+-- 
+2.38.0.413.g74048e4d9e-goog
+
diff --git a/chromeos-base/crash-reporter/crash-reporter-0.0.1-r3846.ebuild b/chromeos-base/crash-reporter/crash-reporter-0.0.1-r3846.ebuild
index b61e2b2..b5a2b38 100644
--- a/chromeos-base/crash-reporter/crash-reporter-0.0.1-r3846.ebuild
+++ b/chromeos-base/crash-reporter/crash-reporter-0.0.1-r3846.ebuild
@@ -52,6 +52,10 @@
 	)
 "
 
+PATCHES="
+	${FILESDIR}/0001-crash-reporter-Fix-anomaly_detector-build.patch
+"
+
 src_configure() {
 	platform_src_configure
 	use arcpp && use_i686 && platform_src_configure_i686
diff --git a/chromeos-base/crash-reporter/crash-reporter-9999.ebuild b/chromeos-base/crash-reporter/crash-reporter-9999.ebuild
index 7f7157f..6d7eb2c 100644
--- a/chromeos-base/crash-reporter/crash-reporter-9999.ebuild
+++ b/chromeos-base/crash-reporter/crash-reporter-9999.ebuild
@@ -50,6 +50,10 @@
 	)
 "
 
+PATCHES="
+	${FILESDIR}/0001-crash-reporter-Fix-anomaly_detector-build.patch
+"
+
 src_configure() {
 	platform_src_configure
 	use arcpp && use_i686 && platform_src_configure_i686
diff --git a/chromeos-base/crash-reporter/files/0001-crash-reporter-Fix-anomaly_detector-build.patch b/chromeos-base/crash-reporter/files/0001-crash-reporter-Fix-anomaly_detector-build.patch
new file mode 100644
index 0000000..8ec2d81
--- /dev/null
+++ b/chromeos-base/crash-reporter/files/0001-crash-reporter-Fix-anomaly_detector-build.patch
@@ -0,0 +1,33 @@
+From 3ec633564cca33cca76177d31b8d7cf6915cfdd4 Mon Sep 17 00:00:00 2001
+From: Robert Kolchmeyer <rkolchmeyer@google.com>
+Date: Wed, 20 Jan 2021 17:27:26 -0800
+Subject: [PATCH] crash-reporter: Fix anomaly_detector build
+
+libcrash depends on symbol VmSupport::Get, which is defined in
+libcrash_reporter. Let's add that dependency to BUILD.gn.
+
+BUG=b/177232752
+TEST=emerge-lakitu crash-reporter
+
+Change-Id: Ic9d30bf29511e92c2b1c4272dce9724dba17a520
+---
+ crash-reporter/BUILD.gn | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/BUILD.gn b/BUILD.gn
+index 0e6f0c2b21a..1c385b75556 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -49,6 +49,9 @@ static_library("libcrash") {
+     "paths.cc",
+     "util.cc",
+   ]
++  deps = [
++    ":libcrash_reporter",
++  ]
+   all_dependent_configs = [ ":libcrash_config" ]
+   defines = [ "USE_DIRENCRYPTION=${use.direncryption}" ]
+ 
+-- 
+2.30.0.296.g2bfb1c46d8-goog
+
diff --git a/chromeos-base/libbrillo/files/remove-glib-usage.patch b/chromeos-base/libbrillo/files/remove-glib-usage.patch
new file mode 100644
index 0000000..89ff35c
--- /dev/null
+++ b/chromeos-base/libbrillo/files/remove-glib-usage.patch
@@ -0,0 +1,1619 @@
+From e6cf7fb1960f544357925fed03e6c738e678f89b Mon Sep 17 00:00:00 2001
+From: Vaibhav Rustagi <vaibhavrustagi@google.com>
+Date: Tue, 21 Sep 2021 09:57:31 -0700
+Subject: [PATCH] libbrillo: remove glib usage
+
+We're ugprading glib to latest 2.68 which causes an API
+breakage and considering it is not used anymore in favor
+of libchrome, we drop glib support instead of fixing it.
+
+ChromeOS Reference: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3103795/
+
+Change-Id: I357b04beb1a4042e3d369189c56e4ddcb536ec08
+---
+ BUILD.gn                            |  42 --
+ brillo/glib/README.md               |   5 -
+ brillo/glib/abstract_dbus_service.cc      |  33 --
+ brillo/glib/abstract_dbus_service.h |  50 --
+ brillo/glib/dbus.cc                 | 331 ------------
+ brillo/glib/dbus.h                  | 450 -----------------
+ brillo/glib/object.h                | 469 ------------------
+ brillo/glib/object_test.cc          | 132 -----
+ 8 files changed, 1512 deletions(-)
+ delete mode 100644 brillo/glib/README.md
+ delete mode 100644 brillo/glib/abstract_dbus_service.cc
+ delete mode 100644 brillo/glib/abstract_dbus_service.h
+ delete mode 100644 brillo/glib/dbus.cc
+ delete mode 100644 brillo/glib/dbus.h
+ delete mode 100644 brillo/glib/object.h
+ delete mode 100644 brillo/glib/object_test.cc
+
+diff --git a/BUILD.gn b/BUILD.gn
+index 7b2073b451..b263e02074 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -9,7 +9,6 @@ import("//common-mk/proto_library.gni")
+ group("all") {
+   deps = [
+     ":libbrillo",
+-    ":libbrillo-glib",
+     ":libbrillo-test",
+     ":libinstallattributes",
+     ":libpolicy",
+@@ -392,45 +391,6 @@ shared_library("libpolicy") {
+   ]
+ }
+ 
+-libbrillo_glib_pkg_deps = [
+-  "glib-2.0",
+-  "gobject-2.0",
+-]
+-if (use.dbus) {
+-  libbrillo_glib_pkg_deps += [
+-    "dbus-1",
+-    "dbus-glib-1",
+-  ]
+-}
+-
+-generate_pkg_config("libbrillo-glib_pc") {
+-  name = "libbrillo-glib"
+-  output_name = "libbrillo-glib"
+-  description = "brillo glib wrapper library"
+-  version = libbase_ver
+-  requires_private = libbrillo_glib_pkg_deps
+-  libs = [ "-lbrillo-glib" ]
+-}
+-
+-shared_library("libbrillo-glib") {
+-  configs += [ ":target_defaults" ]
+-  cflags = [
+-    # glib uses the deprecated "register" attribute in some header files.
+-    "-Wno-deprecated-register",
+-  ]
+-  deps = [
+-    ":libbrillo",
+-    ":libbrillo-glib_pc",
+-  ]
+-  all_dependent_pkg_deps = libbrillo_glib_pkg_deps
+-  if (use.dbus) {
+-    sources = [
+-      "brillo/glib/abstract_dbus_service.cc",
+-      "brillo/glib/dbus.cc",
+-    ]
+-  }
+-}
+-
+ if (use.test) {
+   static_library("libbrillo_static") {
+     configs += [ ":target_defaults" ]
+@@ -469,7 +429,6 @@ if (use.test) {
+       "brillo/files/file_util_test.cc",
+       "brillo/files/safe_fd_test.cc",
+       "brillo/flag_helper_test.cc",
+-      "brillo/glib/object_test.cc",
+       "brillo/http/http_connection_curl_test.cc",
+       "brillo/http/http_form_data_test.cc",
+       "brillo/http/http_request_test.cc",
+@@ -537,7 +496,6 @@ if (use.test) {
+     cflags = [ "-Wno-format-zero-length" ]
+     pkg_deps = [ "libchrome-test" ]
+     deps = [
+-      ":libbrillo-glib",
+       ":libbrillo-test",
+       ":libbrillo_static",
+       ":libbrillo_tests_proto",
+diff --git a/brillo/glib/README.md b/brillo/glib/README.md
+deleted file mode 100644
+index ef9ec9ee85..0000000000
+--- a/brillo/glib/README.md
++++ /dev/null
+@@ -1,5 +0,0 @@
+-# libbrillo GLib support
+-
+-GLib is deprecated in Chrome OS. Use [libchrome] instead.
+-
+-[libchrome]: ../../../libchrome
+diff --git a/brillo/glib/abstract_dbus_service.cc b/brillo/glib/abstract_dbus_service.cc
+deleted file mode 100644
+index 4f3869715e..0000000000
+--- a/brillo/glib/abstract_dbus_service.cc
++++ /dev/null
+@@ -1,33 +0,0 @@
+-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#include <base/logging.h>
+-
+-#include "brillo/glib/abstract_dbus_service.h"
+-
+-namespace brillo {
+-namespace dbus {
+-
+-bool AbstractDbusService::Register(const brillo::dbus::BusConnection& conn) {
+-  return RegisterExclusiveService(conn, service_interface(), service_name(),
+-                                  service_path(), service_object());
+-}
+-
+-bool AbstractDbusService::Run() {
+-  if (!main_loop()) {
+-    LOG(ERROR) << "No run loop. Call Initialize before use.";
+-    return false;
+-  }
+-  ::g_main_loop_run(main_loop());
+-  DLOG(INFO) << "Run() completed";
+-  return true;
+-}
+-
+-bool AbstractDbusService::Shutdown() {
+-  ::g_main_loop_quit(main_loop());
+-  return true;
+-}
+-
+-}  // namespace dbus
+-}  // namespace brillo
+diff --git a/brillo/glib/abstract_dbus_service.h b/brillo/glib/abstract_dbus_service.h
+deleted file mode 100644
+index 32725c71bf..0000000000
+--- a/brillo/glib/abstract_dbus_service.h
++++ /dev/null
+@@ -1,50 +0,0 @@
+-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#ifndef LIBBRILLO_BRILLO_GLIB_ABSTRACT_DBUS_SERVICE_H_
+-#define LIBBRILLO_BRILLO_GLIB_ABSTRACT_DBUS_SERVICE_H_
+-
+-// IMPORTANT: Do not use this in new code. Instead, use
+-// <brillo/daemons/dbus_daemon.h>. See https://goo.gl/EH3MmR for more details.
+-
+-#include <brillo/brillo_export.h>
+-#include <brillo/glib/dbus.h>
+-
+-namespace brillo {
+-
+-namespace dbus {
+-class BRILLO_EXPORT AbstractDbusService {
+- public:
+-  virtual ~AbstractDbusService() {}
+-
+-  // Setup the wrapped GObject and the GMainLoop
+-  virtual bool Initialize() = 0;
+-  virtual bool Reset() = 0;
+-
+-  // Registers the GObject as a service with the system DBus
+-  // TODO(wad) make this testable by making BusConn and Proxy
+-  //           subclassing friendly.
+-  virtual bool Register(const brillo::dbus::BusConnection& conn);
+-
+-  // Starts the run loop
+-  virtual bool Run();
+-
+-  // Stops the run loop
+-  virtual bool Shutdown();
+-
+-  // Used internally during registration to set the
+-  // proper service information.
+-  virtual const char* service_name() const = 0;
+-  virtual const char* service_path() const = 0;
+-  virtual const char* service_interface() const = 0;
+-  virtual GObject* service_object() const = 0;
+-
+- protected:
+-  virtual GMainLoop* main_loop() = 0;
+-};
+-
+-}  // namespace dbus
+-}  // namespace brillo
+-
+-#endif  // LIBBRILLO_BRILLO_GLIB_ABSTRACT_DBUS_SERVICE_H_
+diff --git a/brillo/glib/dbus.cc b/brillo/glib/dbus.cc
+deleted file mode 100644
+index 7525adfdfa..0000000000
+--- a/brillo/glib/dbus.cc
++++ /dev/null
+@@ -1,331 +0,0 @@
+-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#include "brillo/glib/dbus.h"
+-
+-#include <base/check.h>
+-#include <dbus/dbus.h>
+-#include <dbus/dbus-glib-bindings.h>
+-#include <dbus/dbus-glib-lowlevel.h>
+-
+-#include <base/logging.h>
+-#include <base/strings/stringprintf.h>
+-
+-namespace brillo {
+-namespace dbus {
+-
+-bool CallPtrArray(const Proxy& proxy,
+-                  const char* method,
+-                  glib::ScopedPtrArray<const char*>* result) {
+-  glib::ScopedError error;
+-
+-  ::GType g_type_array =
+-      ::dbus_g_type_get_collection("GPtrArray", DBUS_TYPE_G_OBJECT_PATH);
+-
+-  if (!::dbus_g_proxy_call(proxy.gproxy(), method, &Resetter(&error).lvalue(),
+-                           G_TYPE_INVALID, g_type_array,
+-                           &Resetter(result).lvalue(), G_TYPE_INVALID)) {
+-    LOG(WARNING) << "CallPtrArray failed: "
+-                 << (error->message ? error->message : "Unknown Error.");
+-    return false;
+-  }
+-
+-  return true;
+-}
+-
+-BusConnection GetSystemBusConnection() {
+-  glib::ScopedError error;
+-  ::DBusGConnection* result =
+-      ::dbus_g_bus_get(DBUS_BUS_SYSTEM, &Resetter(&error).lvalue());
+-  if (!result) {
+-    LOG(ERROR) << "dbus_g_bus_get(DBUS_BUS_SYSTEM) failed: "
+-               << ((error.get() && error->message) ? error->message
+-                                                   : "Unknown Error");
+-    return BusConnection(nullptr);
+-  }
+-  // Set to not exit when system bus is disconnected.
+-  // This fixes the problem where when the dbus daemon is stopped, exit is
+-  // called which kills Chrome.
+-  ::dbus_connection_set_exit_on_disconnect(
+-      ::dbus_g_connection_get_connection(result), FALSE);
+-  return BusConnection(result);
+-}
+-
+-BusConnection GetPrivateBusConnection(const char* address) {
+-  // Since dbus-glib does not have an API like dbus_g_connection_open_private(),
+-  // we have to implement our own.
+-
+-  // We have to call _dbus_g_value_types_init() to register standard marshalers
+-  // just like as dbus_g_bus_get() and dbus_g_connection_open() do, but the
+-  // function is not exported. So we call GetPrivateBusConnection() which calls
+-  // dbus_g_bus_get() here instead. Note that if we don't call
+-  // _dbus_g_value_types_init(), we might get "WARNING **: No demarshaller
+-  // registered for type xxxxx" error and might not be able to handle incoming
+-  // signals nor method calls.
+-  {
+-    BusConnection system_bus_connection = GetSystemBusConnection();
+-    if (!system_bus_connection.HasConnection()) {
+-      return system_bus_connection;  // returns NULL connection.
+-    }
+-  }
+-
+-  ::DBusError error;
+-  ::dbus_error_init(&error);
+-
+-  ::DBusGConnection* result = nullptr;
+-  ::DBusConnection* raw_connection =
+-      ::dbus_connection_open_private(address, &error);
+-  if (!raw_connection) {
+-    LOG(WARNING) << "dbus_connection_open_private failed: " << address;
+-    return BusConnection(nullptr);
+-  }
+-
+-  if (!::dbus_bus_register(raw_connection, &error)) {
+-    LOG(ERROR) << "dbus_bus_register failed: "
+-               << (error.message ? error.message : "Unknown Error.");
+-    ::dbus_error_free(&error);
+-    // TODO(yusukes): We don't call dbus_connection_close() nor g_object_unref()
+-    // here for now since these calls might interfere with IBusBus connections
+-    // in libcros and Chrome. See the comment in ~InputMethodStatusConnection()
+-    // function in platform/cros/chromeos_input_method.cc for details.
+-    return BusConnection(nullptr);
+-  }
+-
+-  ::dbus_connection_setup_with_g_main(raw_connection,
+-                                      nullptr /* default context */);
+-
+-  // A reference count of |raw_connection| is transferred to |result|. You don't
+-  // have to (and should not) unref the |raw_connection|.
+-  result = ::dbus_connection_get_g_connection(raw_connection);
+-  CHECK(result);
+-
+-  ::dbus_connection_set_exit_on_disconnect(
+-      ::dbus_g_connection_get_connection(result), FALSE);
+-
+-  return BusConnection(result);
+-}
+-
+-bool RetrieveProperties(const Proxy& proxy,
+-                        const char* interface,
+-                        glib::ScopedHashTable* result) {
+-  glib::ScopedError error;
+-
+-  if (!::dbus_g_proxy_call(
+-          proxy.gproxy(), "GetAll", &Resetter(&error).lvalue(), G_TYPE_STRING,
+-          interface, G_TYPE_INVALID,
+-          ::dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
+-          &Resetter(result).lvalue(), G_TYPE_INVALID)) {
+-    LOG(WARNING) << "RetrieveProperties failed: "
+-                 << (error->message ? error->message : "Unknown Error.");
+-    return false;
+-  }
+-  return true;
+-}
+-
+-Proxy::Proxy() : object_(nullptr) {}
+-
+-// Set |connect_to_name_owner| true if you'd like to use
+-// dbus_g_proxy_new_for_name_owner() rather than dbus_g_proxy_new_for_name().
+-Proxy::Proxy(const BusConnection& connection,
+-             const char* name,
+-             const char* path,
+-             const char* interface,
+-             bool connect_to_name_owner)
+-    : object_(GetGProxy(
+-          connection, name, path, interface, connect_to_name_owner)) {}
+-
+-// Equivalent to Proxy(connection, name, path, interface, false).
+-Proxy::Proxy(const BusConnection& connection,
+-             const char* name,
+-             const char* path,
+-             const char* interface)
+-    : object_(GetGProxy(connection, name, path, interface, false)) {}
+-
+-// Creates a peer proxy using dbus_g_proxy_new_for_peer.
+-Proxy::Proxy(const BusConnection& connection,
+-             const char* path,
+-             const char* interface)
+-    : object_(GetGPeerProxy(connection, path, interface)) {}
+-
+-Proxy::Proxy(const Proxy& x) : object_(x.object_) {
+-  if (object_)
+-    ::g_object_ref(object_);
+-}
+-
+-Proxy::~Proxy() {
+-  if (object_)
+-    ::g_object_unref(object_);
+-}
+-
+-/* static */
+-Proxy::value_type Proxy::GetGProxy(const BusConnection& connection,
+-                                   const char* name,
+-                                   const char* path,
+-                                   const char* interface,
+-                                   bool connect_to_name_owner) {
+-  value_type result = nullptr;
+-  if (connect_to_name_owner) {
+-    glib::ScopedError error;
+-    result = ::dbus_g_proxy_new_for_name_owner(
+-        connection.object_, name, path, interface, &Resetter(&error).lvalue());
+-    if (!result) {
+-      DLOG(ERROR) << "Failed to construct proxy: "
+-                  << (error->message ? error->message : "Unknown Error") << ": "
+-                  << path;
+-    }
+-  } else {
+-    result =
+-        ::dbus_g_proxy_new_for_name(connection.object_, name, path, interface);
+-    if (!result) {
+-      LOG(ERROR) << "Failed to construct proxy: " << path;
+-    }
+-  }
+-  return result;
+-}
+-
+-/* static */
+-Proxy::value_type Proxy::GetGPeerProxy(const BusConnection& connection,
+-                                       const char* path,
+-                                       const char* interface) {
+-  value_type result =
+-      ::dbus_g_proxy_new_for_peer(connection.object_, path, interface);
+-  if (!result)
+-    LOG(ERROR) << "Failed to construct peer proxy: " << path;
+-
+-  return result;
+-}
+-
+-bool RegisterExclusiveService(const BusConnection& connection,
+-                              const char* interface_name,
+-                              const char* service_name,
+-                              const char* service_path,
+-                              GObject* object) {
+-  CHECK(object);
+-  CHECK(interface_name);
+-  CHECK(service_name);
+-  // Create a proxy to DBus itself so that we can request to become a
+-  // service name owner and then register an object at the related service path.
+-  Proxy proxy = brillo::dbus::Proxy(connection, DBUS_SERVICE_DBUS,
+-                                    DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+-  // Exclusivity is determined by replacing any existing
+-  // service, not queuing, and ensuring we are the primary
+-  // owner after the name is ours.
+-  glib::ScopedError err;
+-  guint result = 0;
+-  // TODO(wad) determine if we are moving away from using generated functions
+-  if (!org_freedesktop_DBus_request_name(proxy.gproxy(), service_name, 0,
+-                                         &result, &Resetter(&err).lvalue())) {
+-    LOG(ERROR) << "Unable to request service name: "
+-               << (err->message ? err->message : "Unknown Error.");
+-    return false;
+-  }
+-
+-  // Handle the error codes, releasing the name if exclusivity conditions
+-  // are not met.
+-  bool needs_release = false;
+-  if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+-    LOG(ERROR) << "Failed to become the primary owner. Releasing . . .";
+-    needs_release = true;
+-  }
+-  if (result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
+-    LOG(ERROR) << "Service name exists: " << service_name;
+-    return false;
+-  } else if (result == DBUS_REQUEST_NAME_REPLY_IN_QUEUE) {
+-    LOG(ERROR) << "Service name request enqueued despite our flags. Releasing";
+-    needs_release = true;
+-  }
+-  LOG_IF(WARNING, result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER)
+-      << "Service name already owned by this process";
+-  if (needs_release) {
+-    if (!org_freedesktop_DBus_release_name(proxy.gproxy(), service_name,
+-                                           &result, &Resetter(&err).lvalue())) {
+-      LOG(ERROR) << "Unabled to release service name: "
+-                 << (err->message ? err->message : "Unknown Error.");
+-    }
+-    DLOG(INFO) << "ReleaseName returned code " << result;
+-    return false;
+-  }
+-
+-  // Determine a path from the service name and register the object.
+-  dbus_g_connection_register_g_object(connection.g_connection(), service_path,
+-                                      object);
+-  return true;
+-}
+-
+-void CallMethodWithNoArguments(const char* service_name,
+-                               const char* path,
+-                               const char* interface_name,
+-                               const char* method_name) {
+-  Proxy proxy(dbus::GetSystemBusConnection(), service_name, path,
+-              interface_name);
+-  ::dbus_g_proxy_call_no_reply(proxy.gproxy(), method_name, G_TYPE_INVALID);
+-}
+-
+-void SignalWatcher::StartMonitoring(const std::string& interface,
+-                                    const std::string& signal) {
+-  DCHECK(interface_.empty()) << "StartMonitoring() must be called only once";
+-  interface_ = interface;
+-  signal_ = signal;
+-
+-  // Snoop on D-Bus messages so we can get notified about signals.
+-  DBusConnection* dbus_conn =
+-      dbus_g_connection_get_connection(GetSystemBusConnection().g_connection());
+-  DCHECK(dbus_conn);
+-
+-  DBusError error;
+-  dbus_error_init(&error);
+-  dbus_bus_add_match(dbus_conn, GetDBusMatchString().c_str(), &error);
+-  if (dbus_error_is_set(&error)) {
+-    LOG(DFATAL) << "Got error while adding D-Bus match rule: " << error.name
+-                << " (" << error.message << ")";
+-  }
+-
+-  if (!dbus_connection_add_filter(dbus_conn, &SignalWatcher::FilterDBusMessage,
+-                                  this,        // user_data
+-                                  nullptr)) {  // free_data_function
+-    LOG(DFATAL) << "Unable to add D-Bus filter";
+-  }
+-}
+-
+-SignalWatcher::~SignalWatcher() {
+-  if (interface_.empty())
+-    return;
+-
+-  DBusConnection* dbus_conn = dbus_g_connection_get_connection(
+-      dbus::GetSystemBusConnection().g_connection());
+-  DCHECK(dbus_conn);
+-
+-  dbus_connection_remove_filter(dbus_conn, &SignalWatcher::FilterDBusMessage,
+-                                this);
+-
+-  DBusError error;
+-  dbus_error_init(&error);
+-  dbus_bus_remove_match(dbus_conn, GetDBusMatchString().c_str(), &error);
+-  if (dbus_error_is_set(&error)) {
+-    LOG(DFATAL) << "Got error while removing D-Bus match rule: " << error.name
+-                << " (" << error.message << ")";
+-  }
+-}
+-
+-std::string SignalWatcher::GetDBusMatchString() const {
+-  return base::StringPrintf("type='signal', interface='%s', member='%s'",
+-                            interface_.c_str(), signal_.c_str());
+-}
+-
+-/* static */
+-DBusHandlerResult SignalWatcher::FilterDBusMessage(DBusConnection* dbus_conn,
+-                                                   DBusMessage* message,
+-                                                   void* data) {
+-  SignalWatcher* self = static_cast<SignalWatcher*>(data);
+-  if (dbus_message_is_signal(message, self->interface_.c_str(),
+-                             self->signal_.c_str())) {
+-    self->OnSignal(message);
+-    return DBUS_HANDLER_RESULT_HANDLED;
+-  } else {
+-    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+-  }
+-}
+-
+-}  // namespace dbus
+-}  // namespace brillo
+diff --git a/brillo/glib/dbus.h b/brillo/glib/dbus.h
+deleted file mode 100644
+index 299d65159e..0000000000
+--- a/brillo/glib/dbus.h
++++ /dev/null
+@@ -1,450 +0,0 @@
+-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#ifndef LIBBRILLO_BRILLO_GLIB_DBUS_H_
+-#define LIBBRILLO_BRILLO_GLIB_DBUS_H_
+-
+-// IMPORTANT: Do not use this in new code. Instead, use libchrome's D-Bus
+-// bindings. See https://goo.gl/EH3MmR for more details.
+-
+-#include <base/check.h>
+-#include <dbus/dbus-glib.h>
+-#include <glib-object.h>
+-
+-#include <algorithm>
+-#include <string>
+-#include <utility>
+-
+-#include "base/logging.h"
+-#include <brillo/brillo_export.h>
+-#include <brillo/glib/object.h>
+-
+-struct DBusMessage;
+-struct DBusConnection;
+-
+-namespace brillo {
+-
+-namespace dbus {
+-
+-// \brief   BusConnection manages the ref-count for a ::DBusGConnection*.
+-//
+-// A BusConnection has reference semantics bound to a particular communication
+-// bus.
+-//
+-// \models Copyable, Assignable
+-// \related GetSystemBusConnection()
+-
+-class BRILLO_EXPORT BusConnection {
+- public:
+-  typedef ::DBusGConnection* value_type;
+-
+-  BusConnection(const BusConnection& x) : object_(x.object_) {
+-    if (object_)
+-      ::dbus_g_connection_ref(object_);
+-  }
+-
+-  ~BusConnection() {
+-    if (object_)
+-      ::dbus_g_connection_unref(object_);
+-  }
+-
+-  BusConnection& operator=(BusConnection x) {
+-    swap(*this, x);
+-    return *this;
+-  }
+-
+-  const value_type& g_connection() const {
+-    DCHECK(object_) << "referencing an empty connection";
+-    return object_;
+-  }
+-
+-  operator bool() const { return object_; }
+-
+-  bool HasConnection() const { return object_; }
+-
+- private:
+-  friend void swap(BusConnection& x, BusConnection& y);
+-
+-  friend class Proxy;
+-  friend BusConnection GetSystemBusConnection();
+-  friend BusConnection GetPrivateBusConnection(const char* address);
+-
+-  // Constructor takes ownership
+-  BRILLO_PRIVATE explicit BusConnection(::DBusGConnection* x) : object_(x) {}
+-
+-  value_type object_;
+-};
+-
+-inline void swap(BusConnection& x, BusConnection& y) {
+-  std::swap(x.object_, y.object_);
+-}
+-
+-// \brief Proxy manages the ref-count for a ::DBusGProxy*.
+-//
+-// Proxy has reference semantics and represents a connection to on object on
+-// the bus. A proxy object is constructed with a connection to a bus, a name
+-// to an entity on the bus, a path to an object owned by the entity, and an
+-// interface protocol name used to communicate with the object.
+-
+-class BRILLO_EXPORT Proxy {
+- public:
+-  typedef ::DBusGProxy* value_type;
+-
+-  Proxy();
+-
+-  // Set |connect_to_name_owner| true if you'd like to use
+-  // dbus_g_proxy_new_for_name_owner() rather than dbus_g_proxy_new_for_name().
+-  Proxy(const BusConnection& connection,
+-        const char* name,
+-        const char* path,
+-        const char* interface,
+-        bool connect_to_name_owner);
+-
+-  // Equivalent to Proxy(connection, name, path, interface, false).
+-  Proxy(const BusConnection& connection,
+-        const char* name,
+-        const char* path,
+-        const char* interface);
+-
+-  // Creates a peer proxy using dbus_g_proxy_new_for_peer.
+-  Proxy(const BusConnection& connection,
+-        const char* path,
+-        const char* interface);
+-
+-  Proxy(const Proxy& x);
+-
+-  ~Proxy();
+-
+-  Proxy& operator=(Proxy x) {
+-    swap(*this, x);
+-    return *this;
+-  }
+-
+-  const char* path() const {
+-    DCHECK(object_) << "referencing an empty proxy";
+-    return ::dbus_g_proxy_get_path(object_);
+-  }
+-
+-  // gproxy() returns a reference to the underlying ::DBusGProxy*. As this
+-  // library evolves, the gproxy() will be moved to be private.
+-
+-  const value_type& gproxy() const {
+-    DCHECK(object_) << "referencing an empty proxy";
+-    return object_;
+-  }
+-
+-  operator bool() const { return object_; }
+-
+- private:
+-  BRILLO_PRIVATE static value_type GetGProxy(const BusConnection& connection,
+-                                             const char* name,
+-                                             const char* path,
+-                                             const char* interface,
+-                                             bool connect_to_name_owner);
+-
+-  BRILLO_PRIVATE static value_type GetGPeerProxy(
+-      const BusConnection& connection, const char* path, const char* interface);
+-
+-  BRILLO_PRIVATE operator int() const;  // for safe bool cast
+-  friend void swap(Proxy& x, Proxy& y);
+-
+-  value_type object_;
+-};
+-
+-inline void swap(Proxy& x, Proxy& y) {
+-  std::swap(x.object_, y.object_);
+-}
+-
+-// \brief RegisterExclusiveService configures a GObject to run as a service on
+-//  a supplied ::BusConnection.
+-//
+-//  RegisterExclusiveService encapsulates the process of configuring the
+-//  supplied \param object at \param service_path on the \param connection.
+-//  Exclusivity is ensured by replacing any existing services at that named
+-//  location and confirming that the connection is the primary owner.
+-//
+-//  Type information for the \param object must be installed with
+-//  dbus_g_object_type_install_info prior to use.
+-
+-BRILLO_EXPORT bool RegisterExclusiveService(const BusConnection& connection,
+-                                            const char* interface_name,
+-                                            const char* service_name,
+-                                            const char* service_path,
+-                                            GObject* object);
+-
+-template <typename F>  // F is a function signature
+-class MonitorConnection;
+-
+-template <typename A1>
+-class MonitorConnection<void(A1)> {
+- public:
+-  MonitorConnection(const Proxy& proxy,
+-                    const char* name,
+-                    void (*monitor)(void*, A1),
+-                    void* object)
+-      : proxy_(proxy), name_(name), monitor_(monitor), object_(object) {}
+-
+-  static void Run(::DBusGProxy*, A1 x, MonitorConnection* self) {
+-    self->monitor_(self->object_, x);
+-  }
+-  const Proxy& proxy() const { return proxy_; }
+-  const std::string& name() const { return name_; }
+-
+- private:
+-  Proxy proxy_;
+-  std::string name_;
+-  void (*monitor_)(void*, A1);
+-  void* object_;
+-};
+-
+-template <typename A1, typename A2>
+-class MonitorConnection<void(A1, A2)> {
+- public:
+-  MonitorConnection(const Proxy& proxy,
+-                    const char* name,
+-                    void (*monitor)(void*, A1, A2),
+-                    void* object)
+-      : proxy_(proxy), name_(name), monitor_(monitor), object_(object) {}
+-
+-  static void Run(::DBusGProxy*, A1 x, A2 y, MonitorConnection* self) {
+-    self->monitor_(self->object_, x, y);
+-  }
+-  const Proxy& proxy() const { return proxy_; }
+-  const std::string& name() const { return name_; }
+-
+- private:
+-  Proxy proxy_;
+-  std::string name_;
+-  void (*monitor_)(void*, A1, A2);
+-  void* object_;
+-};
+-
+-template <typename A1, typename A2, typename A3>
+-class MonitorConnection<void(A1, A2, A3)> {
+- public:
+-  MonitorConnection(const Proxy& proxy,
+-                    const char* name,
+-                    void (*monitor)(void*, A1, A2, A3),
+-                    void* object)
+-      : proxy_(proxy), name_(name), monitor_(monitor), object_(object) {}
+-
+-  static void Run(::DBusGProxy*, A1 x, A2 y, A3 z, MonitorConnection* self) {
+-    self->monitor_(self->object_, x, y, z);
+-  }
+-  const Proxy& proxy() const { return proxy_; }
+-  const std::string& name() const { return name_; }
+-
+- private:
+-  Proxy proxy_;
+-  std::string name_;
+-  void (*monitor_)(void*, A1, A2, A3);
+-  void* object_;
+-};
+-
+-template <typename A1, typename A2, typename A3, typename A4>
+-class MonitorConnection<void(A1, A2, A3, A4)> {
+- public:
+-  MonitorConnection(const Proxy& proxy,
+-                    const char* name,
+-                    void (*monitor)(void*, A1, A2, A3, A4),
+-                    void* object)
+-      : proxy_(proxy), name_(name), monitor_(monitor), object_(object) {}
+-
+-  static void Run(
+-      ::DBusGProxy*, A1 x, A2 y, A3 z, A4 w, MonitorConnection* self) {
+-    self->monitor_(self->object_, x, y, z, w);
+-  }
+-  const Proxy& proxy() const { return proxy_; }
+-  const std::string& name() const { return name_; }
+-
+- private:
+-  Proxy proxy_;
+-  std::string name_;
+-  void (*monitor_)(void*, A1, A2, A3, A4);
+-  void* object_;
+-};
+-
+-template <typename A1>
+-MonitorConnection<void(A1)>* Monitor(const Proxy& proxy,
+-                                     const char* name,
+-                                     void (*monitor)(void*, A1),
+-                                     void* object) {
+-  typedef MonitorConnection<void(A1)> ConnectionType;
+-
+-  ConnectionType* result = new ConnectionType(proxy, name, monitor, object);
+-
+-  ::dbus_g_proxy_add_signal(proxy.gproxy(), name, glib::type_to_gtypeid<A1>(),
+-                            G_TYPE_INVALID);
+-  ::dbus_g_proxy_connect_signal(
+-      proxy.gproxy(), name, G_CALLBACK(&ConnectionType::Run), result, nullptr);
+-  return result;
+-}
+-
+-template <typename A1, typename A2>
+-MonitorConnection<void(A1, A2)>* Monitor(const Proxy& proxy,
+-                                         const char* name,
+-                                         void (*monitor)(void*, A1, A2),
+-                                         void* object) {
+-  typedef MonitorConnection<void(A1, A2)> ConnectionType;
+-
+-  ConnectionType* result = new ConnectionType(proxy, name, monitor, object);
+-
+-  ::dbus_g_proxy_add_signal(proxy.gproxy(), name, glib::type_to_gtypeid<A1>(),
+-                            glib::type_to_gtypeid<A2>(), G_TYPE_INVALID);
+-  ::dbus_g_proxy_connect_signal(
+-      proxy.gproxy(), name, G_CALLBACK(&ConnectionType::Run), result, nullptr);
+-  return result;
+-}
+-
+-template <typename A1, typename A2, typename A3>
+-MonitorConnection<void(A1, A2, A3)>* Monitor(const Proxy& proxy,
+-                                             const char* name,
+-                                             void (*monitor)(void*, A1, A2, A3),
+-                                             void* object) {
+-  typedef MonitorConnection<void(A1, A2, A3)> ConnectionType;
+-
+-  ConnectionType* result = new ConnectionType(proxy, name, monitor, object);
+-
+-  ::dbus_g_proxy_add_signal(proxy.gproxy(), name, glib::type_to_gtypeid<A1>(),
+-                            glib::type_to_gtypeid<A2>(),
+-                            glib::type_to_gtypeid<A3>(), G_TYPE_INVALID);
+-  ::dbus_g_proxy_connect_signal(
+-      proxy.gproxy(), name, G_CALLBACK(&ConnectionType::Run), result, nullptr);
+-  return result;
+-}
+-
+-template <typename A1, typename A2, typename A3, typename A4>
+-MonitorConnection<void(A1, A2, A3, A4)>* Monitor(
+-    const Proxy& proxy,
+-    const char* name,
+-    void (*monitor)(void*, A1, A2, A3, A4),
+-    void* object) {
+-  typedef MonitorConnection<void(A1, A2, A3, A4)> ConnectionType;
+-
+-  ConnectionType* result = new ConnectionType(proxy, name, monitor, object);
+-
+-  ::dbus_g_proxy_add_signal(proxy.gproxy(), name, glib::type_to_gtypeid<A1>(),
+-                            glib::type_to_gtypeid<A2>(),
+-                            glib::type_to_gtypeid<A3>(),
+-                            glib::type_to_gtypeid<A4>(), G_TYPE_INVALID);
+-  ::dbus_g_proxy_connect_signal(
+-      proxy.gproxy(), name, G_CALLBACK(&ConnectionType::Run), result, nullptr);
+-  return result;
+-}
+-
+-template <typename F>
+-void Disconnect(MonitorConnection<F>* connection) {
+-  typedef MonitorConnection<F> ConnectionType;
+-
+-  ::dbus_g_proxy_disconnect_signal(
+-      connection->proxy().gproxy(), connection->name().c_str(),
+-      G_CALLBACK(&ConnectionType::Run), connection);
+-  delete connection;
+-}
+-
+-// \brief call_PtrArray() invokes a method on a proxy returning a
+-//  glib::PtrArray.
+-//
+-// CallPtrArray is the first instance of what is likely to be a general
+-// way to make method calls to a proxy. It will likely be replaced with
+-// something like Call(proxy, method, arg1, arg2, ..., ResultType*) in the
+-// future. However, I don't yet have enough cases to generalize from.
+-
+-BRILLO_EXPORT bool CallPtrArray(const Proxy& proxy,
+-                                const char* method,
+-                                glib::ScopedPtrArray<const char*>* result);
+-
+-// \brief RetrieveProperty() retrieves a property of an object associated with a
+-//  proxy.
+-//
+-// Given a proxy to an object supporting the org.freedesktop.DBus.Properties
+-// interface, the RetrieveProperty() call will retrieve a property of the
+-// specified interface on the object storing it in \param result and returning
+-// \true. If the dbus call fails or the object returned is not of type \param T,
+-// then \false is returned and \param result is unchanged.
+-//
+-// \example
+-// Proxy proxy(GetSystemBusConnection(),
+-//             "org.freedesktop.DeviceKit.Power", // A named entity on the bus
+-//             battery_name,  // Path to a battery on the bus
+-//             "org.freedesktop.DBus.Properties") // Properties interface
+-//
+-// double x;
+-// if (RetrieveProperty(proxy,
+-//                      "org.freedesktop.DeviceKit.Power.Device",
+-//                      "percentage")
+-//   std::cout << "Battery charge is " << x << "% of capacity.";
+-// \end_example
+-
+-template <typename T>
+-inline bool RetrieveProperty(const Proxy& proxy,
+-                             const char* interface,
+-                             const char* property,
+-                             T* result) {
+-  glib::ScopedError error;
+-  glib::Value value;
+-
+-  if (!::dbus_g_proxy_call(proxy.gproxy(), "Get", &Resetter(&error).lvalue(),
+-                           G_TYPE_STRING, interface, G_TYPE_STRING, property,
+-                           G_TYPE_INVALID, G_TYPE_VALUE, &value,
+-                           G_TYPE_INVALID)) {
+-    LOG(ERROR) << "Getting property failed: "
+-               << (error->message ? error->message : "Unknown Error.");
+-    return false;
+-  }
+-  return glib::Retrieve(value, result);
+-}
+-
+-// \brief RetrieveProperties returns a HashTable of all properties for the
+-// specified interface.
+-
+-BRILLO_EXPORT bool RetrieveProperties(const Proxy& proxy,
+-                                      const char* interface,
+-                                      glib::ScopedHashTable* result);
+-
+-// \brief Returns a connection to the system bus.
+-
+-BRILLO_EXPORT BusConnection GetSystemBusConnection();
+-
+-// \brief Returns a private connection to a bus at |address|.
+-
+-BRILLO_EXPORT BusConnection GetPrivateBusConnection(const char* address);
+-
+-// \brief Calls a method |method_name| with no arguments per the given |path|
+-// and |interface_name|.  Ignores return value.
+-
+-BRILLO_EXPORT void CallMethodWithNoArguments(const char* service_name,
+-                                             const char* path,
+-                                             const char* interface_name,
+-                                             const char* method_name);
+-
+-// \brief Low-level signal monitor base class.
+-//
+-// Used when there is no definite named signal sender (that Proxy
+-// could be used for).
+-
+-class BRILLO_EXPORT SignalWatcher {
+- public:
+-  SignalWatcher() {}
+-  ~SignalWatcher();
+-  void StartMonitoring(const std::string& interface, const std::string& signal);
+-
+- private:
+-  // Callback invoked on the given signal arrival.
+-  virtual void OnSignal(DBusMessage* message) = 0;
+-
+-  // Returns a string matching the D-Bus messages that we want to listen for.
+-  BRILLO_PRIVATE std::string GetDBusMatchString() const;
+-
+-  // A D-Bus message filter to receive signals.
+-  BRILLO_PRIVATE static DBusHandlerResult FilterDBusMessage(
+-      DBusConnection* dbus_conn, DBusMessage* message, void* data);
+-  std::string interface_;
+-  std::string signal_;
+-};
+-
+-}  // namespace dbus
+-}  // namespace brillo
+-
+-#endif  // LIBBRILLO_BRILLO_GLIB_DBUS_H_
+diff --git a/brillo/glib/object.h b/brillo/glib/object.h
+deleted file mode 100644
+index 87e5601648..0000000000
+--- a/brillo/glib/object.h
++++ /dev/null
+@@ -1,469 +0,0 @@
+-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#ifndef LIBBRILLO_BRILLO_GLIB_OBJECT_H_
+-#define LIBBRILLO_BRILLO_GLIB_OBJECT_H_
+-
+-#include <glib-object.h>
+-#include <stdint.h>
+-
+-#include <algorithm>
+-#include <cstddef>
+-#include <memory>
+-#include <string>
+-#include <utility>
+-
+-#include <base/check.h>
+-#include <base/logging.h>
+-#include <base/macros.h>
+-
+-namespace brillo {
+-
+-namespace details {  // NOLINT
+-
+-// \brief ResetHelper is a private class for use with Resetter().
+-//
+-// ResetHelper passes ownership of a pointer to a scoped pointer type with reset
+-// on destruction.
+-
+-template <typename T>  // T models ScopedPtr
+-class ResetHelper {
+- public:
+-  typedef typename T::element_type element_type;
+-
+-  explicit ResetHelper(T* x) : ptr_(nullptr), scoped_(x) {}
+-  ~ResetHelper() { scoped_->reset(ptr_); }
+-  element_type*& lvalue() { return ptr_; }
+-
+- private:
+-  element_type* ptr_;
+-  T* scoped_;
+-};
+-
+-}  // namespace details
+-
+-// \brief Resetter() is a utility function for passing pointers to
+-//  scoped pointers.
+-//
+-// The Resetter() function return a temporary object containing an lvalue of
+-// \code T::element_type which can be assigned to. When the temporary object
+-// destructs, the associated scoped pointer is reset with the lvalue. It is of
+-// general use when a pointer is returned as an out-argument.
+-//
+-// \example
+-// void function(int** x) {
+-//   *x = new int(10);
+-// }
+-// ...
+-// std::unique_ptr<int> x;
+-// function(Resetter(x).lvalue());
+-//
+-// \end_example
+-
+-template <typename T>  // T models ScopedPtr
+-details::ResetHelper<T> Resetter(T* x) {
+-  return details::ResetHelper<T>(x);
+-}
+-
+-namespace glib {
+-
+-// \brief type_to_gtypeid is a type function mapping from a canonical type to
+-// the GType typeid for the associated GType (see type_to_gtype).
+-
+-template <typename T>
+-::GType type_to_gtypeid();
+-
+-template <>
+-inline ::GType type_to_gtypeid<const char*>() {
+-  return G_TYPE_STRING;
+-}
+-template <>
+-inline ::GType type_to_gtypeid<char*>() {
+-  return G_TYPE_STRING;
+-}
+-template <>
+-inline ::GType type_to_gtypeid< ::uint8_t>() {
+-  return G_TYPE_UCHAR;
+-}
+-template <>
+-inline ::GType type_to_gtypeid<double>() {
+-  return G_TYPE_DOUBLE;
+-}
+-template <>
+-inline ::GType type_to_gtypeid<bool>() {
+-  return G_TYPE_BOOLEAN;
+-}
+-class Value;
+-template <>
+-inline ::GType type_to_gtypeid<const Value*>() {
+-  return G_TYPE_VALUE;
+-}
+-
+-template <>
+-inline ::GType type_to_gtypeid< ::uint32_t>() {
+-  // REVISIT (seanparent) : There currently isn't any G_TYPE_UINT32, this code
+-  // assumes sizeof(guint) == sizeof(guint32). Need a static_assert to assert
+-  // that.
+-  return G_TYPE_UINT;
+-}
+-
+-template <>
+-inline ::GType type_to_gtypeid< ::int64_t>() {
+-  return G_TYPE_INT64;
+-}
+-
+-template <>
+-inline ::GType type_to_gtypeid< ::int32_t>() {
+-  return G_TYPE_INT;
+-}
+-
+-// \brief Value (and Retrieve) support using std::string as well as const char*
+-// by promoting from const char* to the string. promote_from provides a mapping
+-// for this promotion (and possibly others in the future).
+-
+-template <typename T>
+-struct promotes_from {
+-  typedef T type;
+-};
+-template <>
+-struct promotes_from<std::string> {
+-  typedef const char* type;
+-};
+-
+-// \brief RawCast converts from a GValue to a value of a canonical type.
+-//
+-// RawCast is a low level function. Generally, use Cast() instead.
+-//
+-// \precondition \param x contains a value of type \param T.
+-
+-template <typename T>
+-inline T RawCast(const ::GValue& x) {
+-  // Use static_assert() to issue a meaningful compile-time error.
+-  // To prevent this from happening for all references to RawCast, use sizeof(T)
+-  // to make static_assert depend on type T and therefore prevent binding it
+-  // unconditionally until the actual RawCast<T> instantiation happens.
+-  static_assert(sizeof(T) == 0, "Using RawCast on unsupported type");
+-  return T();
+-}
+-
+-template <>
+-inline const char* RawCast<const char*>(const ::GValue& x) {
+-  return static_cast<const char*>(::g_value_get_string(&x));
+-}
+-template <>
+-inline double RawCast<double>(const ::GValue& x) {
+-  return static_cast<double>(::g_value_get_double(&x));
+-}
+-template <>
+-inline bool RawCast<bool>(const ::GValue& x) {
+-  return static_cast<bool>(::g_value_get_boolean(&x));
+-}
+-template <>
+-inline ::uint32_t RawCast< ::uint32_t>(const ::GValue& x) {
+-  return static_cast< ::uint32_t>(::g_value_get_uint(&x));
+-}
+-template <>
+-inline ::uint8_t RawCast< ::uint8_t>(const ::GValue& x) {
+-  return static_cast< ::uint8_t>(::g_value_get_uchar(&x));
+-}
+-template <>
+-inline ::int64_t RawCast< ::int64_t>(const ::GValue& x) {
+-  return static_cast< ::int64_t>(::g_value_get_int64(&x));
+-}
+-template <>
+-inline ::int32_t RawCast< ::int32_t>(const ::GValue& x) {
+-  return static_cast< ::int32_t>(::g_value_get_int(&x));
+-}
+-
+-inline void RawSet(GValue* x, const std::string& v) {
+-  ::g_value_set_string(x, v.c_str());
+-}
+-inline void RawSet(GValue* x, const char* v) {
+-  ::g_value_set_string(x, v);
+-}
+-inline void RawSet(GValue* x, double v) {
+-  ::g_value_set_double(x, v);
+-}
+-inline void RawSet(GValue* x, bool v) {
+-  ::g_value_set_boolean(x, v);
+-}
+-inline void RawSet(GValue* x, ::uint32_t v) {
+-  ::g_value_set_uint(x, v);
+-}
+-inline void RawSet(GValue* x, ::uint8_t v) {
+-  ::g_value_set_uchar(x, v);
+-}
+-inline void RawSet(GValue* x, ::int64_t v) {
+-  ::g_value_set_int64(x, v);
+-}
+-inline void RawSet(GValue* x, ::int32_t v) {
+-  ::g_value_set_int(x, v);
+-}
+-
+-// \brief Value is a data type for managing GValues.
+-//
+-// A Value is a polymorphic container holding at most a single value.
+-//
+-// The Value wrapper ensures proper initialization, copies, and assignment of
+-// GValues.
+-//
+-// \note GValues are equationally incomplete and so can't support proper
+-// equality. The semantics of copy are verified with equality of retrieved
+-// values.
+-
+-class Value : public ::GValue {
+- public:
+-  Value() : GValue() {}
+-  explicit Value(const ::GValue& x) : GValue() {
+-    *this = *static_cast<const Value*>(&x);
+-  }
+-  template <typename T>
+-  explicit Value(T x) : GValue() {
+-    ::g_value_init(this, type_to_gtypeid<typename promotes_from<T>::type>());
+-    RawSet(this, x);
+-  }
+-  Value(const Value& x) : GValue() {
+-    if (x.empty())
+-      return;
+-    ::g_value_init(this, G_VALUE_TYPE(&x));
+-    ::g_value_copy(&x, this);
+-  }
+-  ~Value() { clear(); }
+-  Value& operator=(const Value& x) {
+-    if (this == &x)
+-      return *this;
+-    clear();
+-    if (x.empty())
+-      return *this;
+-    ::g_value_init(this, G_VALUE_TYPE(&x));
+-    ::g_value_copy(&x, this);
+-    return *this;
+-  }
+-  template <typename T>
+-  Value& operator=(const T& x) {
+-    clear();
+-    ::g_value_init(this, type_to_gtypeid<typename promotes_from<T>::type>());
+-    RawSet(this, x);
+-    return *this;
+-  }
+-
+-  // Lower-case names to follow STL container conventions.
+-
+-  void clear() {
+-    if (!empty())
+-      ::g_value_unset(this);
+-  }
+-
+-  bool empty() const { return G_VALUE_TYPE(this) == G_TYPE_INVALID; }
+-};
+-
+-template <>
+-inline const Value* RawCast<const Value*>(const ::GValue& x) {
+-  return static_cast<const Value*>(&x);
+-}
+-
+-// \brief Retrieve gets a value from a GValue.
+-//
+-// \postcondition If \param x contains a value of type \param T, then the
+-//  value is copied to \param result and \true is returned. Otherwise, \param
+-//  result is unchanged and \false is returned.
+-//
+-// \precondition \param result is not \nullptr.
+-
+-template <typename T>
+-bool Retrieve(const ::GValue& x, T* result) {
+-  if (!G_VALUE_HOLDS(&x, type_to_gtypeid<typename promotes_from<T>::type>())) {
+-    LOG(WARNING) << "GValue retrieve failed. Expected: "
+-                 << g_type_name(
+-                        type_to_gtypeid<typename promotes_from<T>::type>())
+-                 << ", Found: " << g_type_name(G_VALUE_TYPE(&x));
+-    return false;
+-  }
+-
+-  *result = RawCast<typename promotes_from<T>::type>(x);
+-  return true;
+-}
+-
+-inline bool Retrieve(const ::GValue& x, Value* result) {
+-  *result = Value(x);
+-  return true;
+-}
+-
+-// \brief ScopedError holds a ::GError* and deletes it on destruction.
+-
+-struct FreeError {
+-  void operator()(::GError* x) const {
+-    if (x)
+-      ::g_error_free(x);
+-  }
+-};
+-
+-typedef std::unique_ptr< ::GError, FreeError> ScopedError;
+-
+-// \brief ScopedArray holds a ::GArray* and deletes both the container and the
+-// segment containing the elements on destruction.
+-
+-struct FreeArray {
+-  void operator()(::GArray* x) const {
+-    if (x)
+-      ::g_array_free(x, TRUE);
+-  }
+-};
+-
+-typedef std::unique_ptr< ::GArray, FreeArray> ScopedArray;
+-
+-// \brief ScopedPtrArray adapts ::GPtrArray* to conform to the standard
+-//  container requirements.
+-//
+-// \note ScopedPtrArray is only partially implemented and is being fleshed out
+-//  as needed.
+-//
+-// \models Random Access Container, Back Insertion Sequence, ScopedPtrArray is
+-//  not copyable and equationally incomplete.
+-
+-template <typename T>  // T models pointer
+-class ScopedPtrArray {
+- public:
+-  typedef ::GPtrArray element_type;
+-
+-  typedef T value_type;
+-  typedef const value_type& const_reference;
+-  typedef value_type* iterator;
+-  typedef const value_type* const_iterator;
+-
+-  ScopedPtrArray() : object_(0) {}
+-
+-  explicit ScopedPtrArray(::GPtrArray* x) : object_(x) {}
+-  ScopedPtrArray(const ScopedPtrArray&) = delete;
+-  ScopedPtrArray& operator=(const ScopedPtrArray&) = delete;
+-
+-  ~ScopedPtrArray() { clear(); }
+-
+-  iterator begin() { return iterator(object_ ? object_->pdata : nullptr); }
+-  iterator end() { return begin() + size(); }
+-  const_iterator begin() const {
+-    return const_iterator(object_ ? object_->pdata : nullptr);
+-  }
+-  const_iterator end() const { return begin() + size(); }
+-
+-  // \precondition x is a pointer to an object allocated with g_new().
+-
+-  void push_back(T x) {
+-    if (!object_)
+-      object_ = ::g_ptr_array_sized_new(1);
+-    ::g_ptr_array_add(object_, ::gpointer(x));
+-  }
+-
+-  T& operator[](std::size_t n) {
+-    DCHECK(!(size() < n)) << "ScopedPtrArray index out-of-bound.";
+-    return *(begin() + n);
+-  }
+-
+-  std::size_t size() const { return object_ ? object_->len : 0; }
+-
+-  void clear() {
+-    if (object_) {
+-      std::for_each(begin(), end(), FreeHelper());
+-      ::g_ptr_array_free(object_, true);
+-      object_ = nullptr;
+-    }
+-  }
+-
+-  void reset(::GPtrArray* p = nullptr) {
+-    if (p != object_) {
+-      clear();
+-      object_ = p;
+-    }
+-  }
+-
+- private:
+-  struct FreeHelper {
+-    void operator()(T x) const { ::g_free(::gpointer(x)); }
+-  };
+-
+-  template <typename U>
+-  friend void swap(ScopedPtrArray<U>& x, ScopedPtrArray<U>& y);
+-
+-  ::GPtrArray* object_;
+-};
+-
+-template <typename U>
+-inline void swap(ScopedPtrArray<U>& x, ScopedPtrArray<U>& y) {
+-  std::swap(x.object_, y.object_);
+-}
+-
+-// \brief ScopedHashTable manages the lifetime of a ::GHashTable* with an
+-// interface compatibitle with a scoped ptr.
+-//
+-// The ScopedHashTable is also the start of an adaptor to model a standard
+-// Container. The standard for an associative container would have an iterator
+-// returning a key value pair. However, that isn't possible with
+-// ::GHashTable because there is no interface returning a reference to the
+-// key value pair, only to retrieve the keys and values and individual elements.
+-//
+-// So the standard interface of find() wouldn't work. I considered implementing
+-// operator[] and count() - operator []. So retrieving a value would look like:
+-//
+-// if (table.count(key))
+-//   success = Retrieve(table[key], &value);
+-//
+-// But that requires hashing the key twice.
+-// For now I implemented a Retrieve member function to follow the pattern
+-// developed elsewhere in the code.
+-//
+-// bool success = Retrieve(key, &x);
+-//
+-// This is also a template to retrieve the corect type from the stored GValue
+-// type.
+-//
+-// I may revisit this and use scoped_ptr_malloc and a non-member function
+-// Retrieve() in the future. The Retrieve pattern is becoming common enough
+-// that I want to give some thought as to how to generalize it further.
+-
+-class ScopedHashTable {
+- public:
+-  typedef ::GHashTable element_type;
+-
+-  ScopedHashTable() : object_(nullptr) {}
+-
+-  explicit ScopedHashTable(::GHashTable* p) : object_(p) {}
+-
+-  ~ScopedHashTable() { clear(); }
+-
+-  template <typename T>
+-  bool Retrieve(const char* key, T* result) const {
+-    DCHECK(object_) << "Retrieve on empty ScopedHashTable.";
+-    if (!object_)
+-      return false;
+-
+-    ::gpointer ptr = ::g_hash_table_lookup(object_, key);
+-    if (!ptr)
+-      return false;
+-    return glib::Retrieve(*static_cast< ::GValue*>(ptr), result);
+-  }
+-
+-  void clear() {
+-    if (object_) {
+-      ::g_hash_table_unref(object_);
+-      object_ = nullptr;
+-    }
+-  }
+-
+-  GHashTable* get() { return object_; }
+-
+-  void reset(::GHashTable* p = nullptr) {
+-    if (p != object_) {
+-      clear();
+-      object_ = p;
+-    }
+-  }
+-
+- private:
+-  ::GHashTable* object_;
+-};
+-
+-}  // namespace glib
+-}  // namespace brillo
+-
+-#endif  // LIBBRILLO_BRILLO_GLIB_OBJECT_H_
+diff --git a/brillo/glib/object_test.cc b/brillo/glib/object_test.cc
+deleted file mode 100644
+index 9381866b9f..0000000000
+--- a/brillo/glib/object_test.cc
++++ /dev/null
+@@ -1,132 +0,0 @@
+-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-#include "brillo/glib/object.h"
+-
+-#include <gtest/gtest.h>
+-
+-#include <algorithm>
+-#include <cstring>
+-#include <iterator>
+-#include <string>
+-
+-using brillo::Resetter;
+-using brillo::glib::Retrieve;
+-using brillo::glib::ScopedError;
+-using brillo::glib::ScopedPtrArray;
+-using brillo::glib::Value;
+-
+-namespace {  // NOLINT
+-
+-template <typename T>
+-void SetRetrieveTest(const T& x) {
+-  Value tmp(x);
+-  T result;
+-  EXPECT_TRUE(Retrieve(tmp, &result));
+-  EXPECT_EQ(result, x);
+-}
+-
+-void ModifyValue(Value* x) {
+-  *x = 1.0 / 1231415926.0;  // An unlikely value
+-}
+-
+-template <typename T, typename O>
+-void MutableRegularTestValue(const T& x, O modify) {
+-  Value tmp(x);
+-  Value y = tmp;  // copy-construction
+-  T result;
+-  EXPECT_TRUE(Retrieve(y, &result));
+-  EXPECT_EQ(result, x);
+-  modify(&y);
+-  LOG(INFO) << "Warning Expected.";
+-  EXPECT_TRUE(!(Retrieve(y, &result) && result == x));
+-  y = tmp;  // assignment
+-  EXPECT_TRUE(Retrieve(y, &result));
+-  EXPECT_EQ(result, x);
+-  modify(&y);
+-  LOG(INFO) << "Warning Expected.";
+-  EXPECT_TRUE(!(Retrieve(y, &result) && result == x));
+-}
+-
+-void OutArgument(int** x) {
+-  *x = new int(10);  // NOLINT
+-}
+-
+-}  // namespace
+-
+-TEST(ResetterTest, All) {
+-  std::unique_ptr<int> x;
+-  OutArgument(&Resetter(&x).lvalue());
+-  EXPECT_EQ(*x, 10);
+-}
+-
+-TEST(RetrieveTest, Types) {
+-  SetRetrieveTest(std::string("Hello!"));
+-  SetRetrieveTest(static_cast<uint32_t>(10));
+-  SetRetrieveTest(10.5);
+-  SetRetrieveTest(true);
+-}
+-
+-TEST(ValueTest, All) {
+-  Value x;      // default construction
+-  Value y = x;  // copy with default value
+-  x = y;        // assignment with default value
+-  Value z(1.5);
+-  x = z;  // assignment to default value
+-  MutableRegularTestValue(std::string("Hello!"), &ModifyValue);
+-}
+-
+-TEST(ScopedErrorTest, All) {
+-  ScopedError a;  // default construction
+-  ScopedError b(::g_error_new(::g_quark_from_static_string("error"), -1,
+-                              ""));  // constructor
+-  ::GError* c = ::g_error_new(::g_quark_from_static_string("error"), -1, "");
+-  ::GError* d = ::g_error_new(::g_quark_from_static_string("error"), -1, "");
+-  a.reset(c);  // reset form 1
+-  (void)d;
+-}
+-
+-TEST(ScopedPtrArrayTest, Construction) {
+-  const char item[] = "a string";
+-  char* a = static_cast<char*>(::g_malloc(sizeof(item)));
+-  std::strcpy(a, &item[0]);  // NOLINT
+-
+-  ::GPtrArray* array = ::g_ptr_array_new();
+-  ::g_ptr_array_add(array, ::gpointer(a));
+-
+-  ScopedPtrArray<const char*> x(array);
+-  EXPECT_EQ(x.size(), 1);
+-  EXPECT_EQ(x[0], a);  // indexing
+-}
+-
+-TEST(ScopedPtrArrayTest, Reset) {
+-  const char item[] = "a string";
+-  char* a = static_cast<char*>(::g_malloc(sizeof(item)));
+-  std::strcpy(a, &item[0]);  // NOLINT
+-
+-  ScopedPtrArray<const char*> x;  // default construction
+-  x.push_back(a);
+-  EXPECT_EQ(x.size(), 1);
+-  x.reset();
+-  EXPECT_EQ(x.size(), 0);
+-
+-  char* b = static_cast<char*>(::g_malloc(sizeof(item)));
+-  std::strcpy(b, &item[0]);  // NOLINT
+-
+-  ::GPtrArray* array = ::g_ptr_array_new();
+-  ::g_ptr_array_add(array, ::gpointer(b));
+-
+-  x.reset(array);
+-  EXPECT_EQ(x.size(), 1);
+-}
+-
+-TEST(ScopedPtrArrayTest, Iteration) {
+-  char* a[] = {static_cast<char*>(::g_malloc(1)),
+-               static_cast<char*>(::g_malloc(1)),
+-               static_cast<char*>(::g_malloc(1))};
+-
+-  ScopedPtrArray<const char*> x;
+-  std::copy(&a[0], &a[3], std::back_inserter(x));
+-  EXPECT_TRUE(std::equal(x.begin(), x.end(), &a[0]));
+-}
+-- 
+2.33.0.464.g1972c5931b-goog
+
diff --git a/chromeos-base/perfetto/metadata.xml b/chromeos-base/perfetto/metadata.xml
new file mode 100644
index 0000000..5948fd5
--- /dev/null
+++ b/chromeos-base/perfetto/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata>
+<pkgmetadata>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:google:perfetto</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/chromeos-base/verity/files/0001-Add-version-to-PrintTable-and-GetTable.patch b/chromeos-base/verity/files/0001-Add-version-to-PrintTable-and-GetTable.patch
new file mode 100644
index 0000000..5d1099a
--- /dev/null
+++ b/chromeos-base/verity/files/0001-Add-version-to-PrintTable-and-GetTable.patch
@@ -0,0 +1,31 @@
+From bce0b43fea3a9a4fe2be2d7e0b8f09bb2ec8b11e Mon Sep 17 00:00:00 2001
+From: Sejal Sharma <sejalsharma@google.com>
+Date: Thu, 27 Oct 2022 16:49:07 +0000
+Subject: [PATCH] Add version to PrintTable and GetTable
+
+Added argument to PrintTable and GetTable to allow for ebuild unit tests
+to run.
+
+Change-Id: Id7311439df559698f6713ae98041ad42b35924cc
+---
+ verity/file_hasher_test.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/verity/file_hasher_test.cc b/verity/file_hasher_test.cc
+index ec9e6b364e..dc6050e13e 100644
+--- a/verity/file_hasher_test.cc
++++ b/verity/file_hasher_test.cc
+@@ -55,8 +55,8 @@ TEST_F(FileHasherTest, EndToEnd) {
+   EXPECT_TRUE(hasher.Hash());
+   EXPECT_TRUE(hasher.Store());
+ 
+-  hasher.PrintTable(true);
+-  EXPECT_EQ(hasher.GetTable(true),
++  hasher.PrintTable(true, 0);
++  EXPECT_EQ(hasher.GetTable(true, 0),
+             "0 16 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=16 "
+             "alg=sha256 root_hexdigest=21f0268f4a293d8110074c678a651c638d"
+             "56a610dd2662975a35d451d3258018 salt=abcdef0123456789abcdef01"
+-- 
+2.38.1.273.g43a17bfeac-goog
+
diff --git a/chromeos-base/verity/files/support-new-dm-verity-format.patch b/chromeos-base/verity/files/support-new-dm-verity-format.patch
new file mode 100644
index 0000000..fe899bf
--- /dev/null
+++ b/chromeos-base/verity/files/support-new-dm-verity-format.patch
@@ -0,0 +1,186 @@
+From 892e42a06f570fdb0c968f645d131ba26b5e5a22 Mon Sep 17 00:00:00 2001
+From: Meena Shanmugam <meenashanmugam@google.com>
+Date: Mon, 10 Oct 2022 00:32:50 +0000
+Subject: [PATCH] LAKITU:verity: Add support to print new and old dm-verity
+ format.
+
+Current verity tool returns old dm-verity format. COS plan to use the
+new dm verity format in the upcoming release. Added a version option to
+specify the dm verity format. If no option is given, it returns old
+format by default. Once the patch is upstreamed and SDK tool is updated
+with this option, this patch can be removed.
+
+Change-Id: If21c2d164c1cd0bede24d551e32ae71b8293eead
+---
+ verity/file_hasher.cc | 54 +++++++++++++++++++++++++++++++------------
+ verity/file_hasher.h  |  4 ++--
+ verity/verity_main.cc | 21 +++++++++++++----
+ 3 files changed, 57 insertions(+), 22 deletions(-)
+
+diff --git a/verity/file_hasher.cc b/verity/file_hasher.cc
+index fae04f817c..25ea3a3b3f 100644
+--- a/verity/file_hasher.cc
++++ b/verity/file_hasher.cc
+@@ -146,7 +146,8 @@ const char* FileHasher::RandomSalt() {
+   return random_salt_;
+ }
+ 
+-std::string FileHasher::GetTable(bool colocated) {
++std::string FileHasher::GetTable(bool colocated,
++                                 unsigned int version) {
+   // Grab the digest (up to 1kbit supported)
+   uint8_t digest[128];
+   char hexsalt[DM_BHT_SALT_SIZE * 2 + 1];
+@@ -161,24 +162,47 @@ std::string FileHasher::GetTable(bool colocated) {
+   if (colocated)
+     hash_start = root_end;
+ 
+-  std::vector<std::string> parts = {
+-      "0",
+-      base::NumberToString(root_end),
+-      "verity",
+-      "payload=ROOT_DEV",
+-      "hashtree=HASH_DEV",
+-      "hashstart=" + base::NumberToString(hash_start),
+-      "alg=" + std::string(alg_),
+-      "root_hexdigest=" + std::string(reinterpret_cast<char*>(digest)),
+-  };
+-  if (have_salt)
+-    parts.push_back("salt=" + std::string(hexsalt));
++  std::vector<std::string> parts;
++  if (version == 1) {
++    parts = {
++        "0",
++        base::NumberToString(root_end),
++        "verity",
++        "0",
++        "ROOT_DEV",
++        "HASH_DEV",
++        "4096",
++        "4096",
++        base::NumberToString(hash_start>>3),
++        base::NumberToString(hash_start>>3),
++        std::string(alg_),
++        std::string(reinterpret_cast<char*>(digest)),
++    };
++    if (have_salt) {
++      parts.push_back(std::string(hexsalt));
++    }
++  } else {
++    parts = {
++        "0",
++        base::NumberToString(root_end),
++        "verity",
++        "payload=ROOT_DEV",
++        "hashtree=HASH_DEV",
++        "hashstart=" + base::NumberToString(hash_start),
++        "alg=" + std::string(alg_),
++        "root_hexdigest=" + std::string(reinterpret_cast<char*>(digest)),
++    };
++    if (have_salt) {
++      parts.push_back("salt=" + std::string(hexsalt));
++    }
++  }
+ 
+   return base::JoinString(parts, " ");
+ }
+ 
+-void FileHasher::PrintTable(bool colocated) {
+-  printf("%s\n", GetTable(colocated).c_str());
++void FileHasher::PrintTable(bool colocated,
++                            unsigned int version) {
++  printf("%s\n", GetTable(colocated, version).c_str());
+ }
+ 
+ }  // namespace verity
+diff --git a/verity/file_hasher.h b/verity/file_hasher.h
+index 1549555f4e..d5151b6219 100644
+--- a/verity/file_hasher.h
++++ b/verity/file_hasher.h
+@@ -40,8 +40,8 @@ class BRILLO_EXPORT FileHasher {
+   virtual bool Hash();
+   virtual bool Store();
+   // Print a table to stdout which contains a dmsetup compatible format
+-  virtual void PrintTable(bool colocated);
+-  virtual std::string GetTable(bool colocated);
++  virtual void PrintTable(bool colocated, unsigned int version);
++  virtual std::string GetTable(bool colocated, unsigned int version);
+ 
+   virtual const char* RandomSalt();
+   virtual void set_salt(const char* salt);
+diff --git a/verity/verity_main.cc b/verity/verity_main.cc
+index 16d9aead65..934af23d6c 100644
+--- a/verity/verity_main.cc
++++ b/verity/verity_main.cc
+@@ -31,6 +31,7 @@ void print_usage(const char* name) {
+       "  hashtree          Path to a hash tree to create or read from\n"
+       "  root_hexdigest    Digest of the root node (in hex) for verification\n"
+       "  salt              Salt (in hex)\n"
++      "  version           one of 0 or 1\n"
+       "\n",
+       name);
+ }
+@@ -46,7 +47,8 @@ static int verity_create(const char* alg,
+                          const char* image_path,
+                          unsigned int image_blocks,
+                          const char* hash_path,
+-                         const char* salt);
++                         const char* salt,
++                         unsigned int version);
+ 
+ void splitarg(char* arg, char** key, char** val) {
+   char* sp = NULL;
+@@ -61,6 +63,7 @@ int main(int argc, char** argv) {
+   const char* hashtree = NULL;
+   const char* salt = NULL;
+   unsigned int payload_blocks = 0;
++  unsigned int version = 0;
+   int i;
+   char *key, *val;
+ 
+@@ -87,7 +90,14 @@ int main(int argc, char** argv) {
+       // Silently drop the mode for now...
+     } else if (!strcmp(key, "salt")) {
+       salt = val;
+-    } else {
++    } else if (!strcmp(key, "version")) {
++      version = (unsigned int)strtoul(val, NULL, 0);
++      if (version > 1) {
++        fprintf(stderr, "version should be either 0 or 1\n");
++        print_usage(argv[0]);
++        return -1;
++      }
++    } else {
+       fprintf(stderr, "bogus key: '%s'\n", key);
+       print_usage(argv[0]);
+       return -1;
+@@ -102,7 +112,7 @@ int main(int argc, char** argv) {
+   }
+ 
+   if (mode == VERITY_CREATE) {
+-    return verity_create(alg, payload, payload_blocks, hashtree, salt);
++    return verity_create(alg, payload, payload_blocks, hashtree, salt, version);
+   } else {
+     LOG(FATAL) << "Verification not done yet";
+   }
+@@ -113,7 +123,8 @@ static int verity_create(const char* alg,
+                          const char* image_path,
+                          unsigned int image_blocks,
+                          const char* hash_path,
+-                         const char* salt) {
++                         const char* salt,
++                         unsigned int version) {
+   auto source = std::make_unique<base::File>(
+       base::FilePath(image_path),
+       base::File::FLAG_OPEN | base::File::FLAG_READ);
+@@ -133,6 +144,6 @@ static int verity_create(const char* alg,
+     hasher.set_salt(salt);
+   LOG_IF(FATAL, !hasher.Hash()) << "Failed to hash hasher";
+   LOG_IF(FATAL, !hasher.Store()) << "Failed to store hasher";
+-  hasher.PrintTable(true);
++  hasher.PrintTable(true, version);
+   return 0;
+ }
+-- 
+2.38.0.413.g74048e4d9e-goog
+
diff --git a/chromeos-base/verity/verity-0.0.1-r307.ebuild b/chromeos-base/verity/verity-0.0.1-r307.ebuild
index d148461..83a4866 100644
--- a/chromeos-base/verity/verity-0.0.1-r307.ebuild
+++ b/chromeos-base/verity/verity-0.0.1-r307.ebuild
@@ -8,8 +8,11 @@
 CROS_WORKON_INCREMENTAL_BUILD=1
 CROS_WORKON_LOCALNAME="platform2"
 CROS_WORKON_PROJECT="chromiumos/platform2"
-CROS_WORKON_OUTOFTREE_BUILD=1
+CROS_WORKON_REPO="${CROS_GIT_HOST_URL}"
+#CROS_WORKON_OUTOFTREE_BUILD=1
 CROS_WORKON_SUBTREE="common-mk verity .gn"
+CROS_WORKON_DESTDIR="${S}/platform2"
+CROS_WORKON_EGIT_BRANCH="main"
 
 PLATFORM_SUBDIR="verity"
 
@@ -21,6 +24,21 @@
 LICENSE="BSD-Google GPL-2"
 KEYWORDS="*"
 
+PATCHES=(
+	"${FILESDIR}/verity-print.patch"
+)
+
+src_prepare() {
+	# The workdir is platform2/nnapi - we need to pop up one level in the stack
+	# to apply our patches.
+	pushd .. || exit
+	eapply -p1 "${FILESDIR}/support-new-dm-verity-format.patch"
+	eapply -p1 "${FILESDIR}/0001-Add-version-to-PrintTable-and-GetTable.patch"
+	popd || exit
+
+	eapply_user
+}
+
 src_install() {
 	dobin "${OUT}"/verity
 
diff --git a/chromeos/binhost/host/sdk_version.conf b/chromeos/binhost/host/sdk_version.conf
index bc24880..5895dcf 100644
--- a/chromeos/binhost/host/sdk_version.conf
+++ b/chromeos/binhost/host/sdk_version.conf
@@ -3,11 +3,11 @@
 # found in the LICENSE file.
 
 # The last version of the sdk that we built & tested.
-SDK_LATEST_VERSION="2022.08.08.183312"
+SDK_LATEST_VERSION="105/17324.0.0/sdk/cros-sdk-17324.0.0"
 
 # How to find the standalone toolchains from the above sdk.
-TC_PATH="2022/08/%(target)s-2022.08.03.184706.tar.xz"
+TC_PATH="105/17324.0.0/sdk/toolchain-pkgs/%(target)s.tar.xz"
 
 # Frozen version of SDK used for bootstrapping.
 # If unset, SDK_LATEST_VERSION will be used for bootstrapping.
-BOOTSTRAP_FROZEN_VERSION="2022.05.09.125449"
+BOOTSTRAP_FROZEN_VERSION="101/17109.0.0/sdk/cros-sdk-17109.0.0"
diff --git a/chromeos/config/chromeos_version.sh b/chromeos/config/chromeos_version.sh
index d0b2a4f..148b4d9 100755
--- a/chromeos/config/chromeos_version.sh
+++ b/chromeos/config/chromeos_version.sh
@@ -45,7 +45,7 @@
 fi
 
 # Major version for Chrome.
-CHROME_BRANCH=106
+CHROME_BRANCH=105
 # Set CHROME values (Used for releases) to pass to chromeos-chrome-bin ebuild
 # URL to chrome archive
 CHROME_BASE=
diff --git a/chromeos/config/env/sys-fs/lvm2 b/chromeos/config/env/sys-fs/lvm2
deleted file mode 100644
index ccd6487..0000000
--- a/chromeos/config/env/sys-fs/lvm2
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Remove files that will not be used from targets.
-# /etc/lvm/lvm.conf is added by chromeos-init.
-# dmeventd's function is already handled by platform2 packages.
-if [[ $(cros_target) != "cros_host" ]]; then
-  lvm_mask="
-    /etc/dmtab
-    /etc/lvm/lvm.conf
-    /etc/lvm/profile/*
-    /lib*/liblvm2app.so*
-    /lib/udev/rules.d/11-dm-lvm.rules
-    /lib/udev/rules.d/69-dm-lvm-metad.rules
-    /usr/lib*/liblvm2app.so*
-    /usr/lib*/pkgconfig/lvm2app.pc
-    /usr/lib/tmpfiles.d/lvm2.conf
-    /usr/include/lvm2app.h
-    /sbin/dmeventd
-    /sbin/lvmetad
-    /sbin/lvpolld
-  "
-
-  PKG_INSTALL_MASK+=" ${lvm_mask}"
-  INSTALL_MASK+=" ${lvm_mask}"
-  unset lvm_mask
-fi
diff --git a/chromeos/config/env/sys-libs/compiler-rt b/chromeos/config/env/sys-libs/compiler-rt
new file mode 100644
index 0000000..216c46b
--- /dev/null
+++ b/chromeos/config/env/sys-libs/compiler-rt
@@ -0,0 +1,5 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+EGIT_MASTER="main"
diff --git a/chromeos/config/env/sys-libs/llvm-libunwind b/chromeos/config/env/sys-libs/llvm-libunwind
new file mode 100644
index 0000000..216c46b
--- /dev/null
+++ b/chromeos/config/env/sys-libs/llvm-libunwind
@@ -0,0 +1,5 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+EGIT_MASTER="main"
diff --git a/chromeos/config/make.conf.amd64-host b/chromeos/config/make.conf.amd64-host
index e8184a0..4020128 100644
--- a/chromeos/config/make.conf.amd64-host
+++ b/chromeos/config/make.conf.amd64-host
@@ -21,7 +21,7 @@
 PORT_LOGDIR="/var/log/portage"
 
 source /mnt/host/source/src/third_party/chromiumos-overlay/chromeos/binhost/host/amd64-PREFLIGHT_BINHOST.conf
-FULL_BINHOST="gs://chromeos-prebuilt/host/amd64/amd64-host/chroot-2022.08.08.183312/packages/"
+FULL_BINHOST="gs://cos-prebuilt/105/17324.0.0/sdk"
 PORTAGE_BINHOST="$PREFLIGHT_BINHOST $FULL_BINHOST"
 
 GENTOO_MIRRORS="https://commondatastorage.googleapis.com/chromeos-localmirror"
diff --git a/chromeos/config/make.conf.sdk-chromeos b/chromeos/config/make.conf.sdk-chromeos
index 17695c3..959e930 100644
--- a/chromeos/config/make.conf.sdk-chromeos
+++ b/chromeos/config/make.conf.sdk-chromeos
@@ -8,7 +8,9 @@
 # See "man 5 make.conf" and "man 5 portage" for the available options.
 
 # TODO: Drop this!
-USE="${USE} internal"
+# lakitu: Do not set the internal USE flag, because we don't need it (our
+# chromeos-overlay is empty)
+# USE="${USE} internal"
 
 # For internal builds, automatically accept the licenses needed to
 # build Chrome OS.  All Googlers have agreed to this.
diff --git a/dev-go/go-tools/Manifest b/dev-go/go-tools/Manifest
index e0a058a..10ecb3a 100644
--- a/dev-go/go-tools/Manifest
+++ b/dev-go/go-tools/Manifest
@@ -1 +1 @@
-DIST go.googlesource.com-tools-v0.1.9.tar.gz 2937781 BLAKE2B 49ff2f7b6090c7c96adadebedb28eb86d87377067bd3fc60e96a5c86d8228c966da6fad6834ca19cc6c6cb37306a026cd74177ae38e449816826530469f7c3ed SHA512 2e0006eaf9c36e5bb9321137854474db22788bcf0b9e029b2e7143c954beec201b5c7d16d6f85ce0a4721fc332f260d9f2d44467fe2e2d8666d5db09cf2aa5e6
+DIST go.googlesource.com-tools-v0.1.11.tar.gz 3075563 BLAKE2B d7599ece680d56bac2f2a5ac752edd2b3fbd3ee3e44b01cc5c4c65259dd52422327147416557151b06ebc907435de0b1b283aa218d3ee90571e631b96e60fbbd SHA512 d31352a70f16aa81949d31fa1a6247358f0aa5703edb590f46bed29fb9534be586e529913ce9a3c068e6b795263550c59b6bd1f031c71320e736b75d94895b56
diff --git a/dev-go/go-tools/go-tools-0.1.11-r1.ebuild b/dev-go/go-tools/go-tools-0.1.11-r1.ebuild
new file mode 120000
index 0000000..be87c35
--- /dev/null
+++ b/dev-go/go-tools/go-tools-0.1.11-r1.ebuild
@@ -0,0 +1 @@
+go-tools-0.1.11.ebuild
\ No newline at end of file
diff --git a/dev-go/go-tools/go-tools-0.1.9.ebuild b/dev-go/go-tools/go-tools-0.1.11.ebuild
similarity index 98%
rename from dev-go/go-tools/go-tools-0.1.9.ebuild
rename to dev-go/go-tools/go-tools-0.1.11.ebuild
index ff4741f..c53bd94 100644
--- a/dev-go/go-tools/go-tools-0.1.9.ebuild
+++ b/dev-go/go-tools/go-tools-0.1.11.ebuild
@@ -35,6 +35,7 @@
 	"golang.org/x/tools/internal/fastwalk"
 	"golang.org/x/tools/internal/gocommand"
 	"golang.org/x/tools/internal/gopathwalk"
+	"golang.org/x/tools/internal/lsp/bug"
 	"golang.org/x/tools/internal/lsp/fuzzy"
 	"golang.org/x/tools/internal/lsp/diff/..."
 	"golang.org/x/tools/internal/packagesinternal"
diff --git a/dev-go/go-tools/go-tools-0.1.9-r5.ebuild b/dev-go/go-tools/go-tools-0.1.9-r5.ebuild
deleted file mode 120000
index a8289f7..0000000
--- a/dev-go/go-tools/go-tools-0.1.9-r5.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-go-tools-0.1.9.ebuild
\ No newline at end of file
diff --git a/dev-go/grpc/metadata.xml b/dev-go/grpc/metadata.xml
new file mode 100644
index 0000000..405101a
--- /dev/null
+++ b/dev-go/grpc/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata>
+<pkgmetadata>
+<upstream>
+	<remote-id type="cpe">cpe:/a:grpc:grpc</remote-id>
+</upstream>
+</pkgmetadata>
diff --git a/dev-go/net/metadata.xml b/dev-go/net/metadata.xml
new file mode 100644
index 0000000..7216b2b
--- /dev/null
+++ b/dev-go/net/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata>
+<pkgmetadata>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:golang:net</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-go/text/Manifest b/dev-go/text/Manifest
index 725eeb2..5fbd59b 100644
--- a/dev-go/text/Manifest
+++ b/dev-go/text/Manifest
@@ -1 +1 @@
-DIST go.googlesource.com-text-v0.3.7.tar.gz 8301341 BLAKE2B ad2005e2701e9ff4aff4252160fe796dc9370a4c31c5d7e4f070e58cf8e6dee064c9289b5af5c05aba850755f50a1304dba36b6ad07c874d5236d078a8cc1b64 SHA512 070aebd7cfc981a9bb4e64c4c2abde132b0b678efe9668f054f94591629ff152a64adf792b26f8f356d2fe2f50c3053ba96c7268079532b67c0eac16785ad989
+DIST go.googlesource.com-text-v0.3.8.tar.gz 8305890 BLAKE2B bf41da4d5fdcaaadad48a2df4dbb97fa1ef6b2d11f8c667ff67f5e67ef6665031b482d3997a6301977845f0113e6c5b8f64abe3301ec8ab91e251ffafc6b4cd3 SHA512 6f822d69b70238ee7c907d89bd0dab9d2538e22cc73e256856c8f9f2877225acb6c052c0852aa4f412aa9acb8e6e47639cb4eec88800db30a58d5571af06ff67
diff --git a/dev-go/text/metadata.xml b/dev-go/text/metadata.xml
new file mode 100644
index 0000000..fb44ac0
--- /dev/null
+++ b/dev-go/text/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata>
+<pkgmetadata>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:golang:text</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-go/text/text-0.3.7-r3.ebuild b/dev-go/text/text-0.3.7-r3.ebuild
deleted file mode 120000
index c4fbe35..0000000
--- a/dev-go/text/text-0.3.7-r3.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-text-0.3.7.ebuild
\ No newline at end of file
diff --git a/dev-go/text/text-0.3.8-r1.ebuild b/dev-go/text/text-0.3.8-r1.ebuild
new file mode 120000
index 0000000..e78cbe0
--- /dev/null
+++ b/dev-go/text/text-0.3.8-r1.ebuild
@@ -0,0 +1 @@
+text-0.3.8.ebuild
\ No newline at end of file
diff --git a/dev-go/text/text-0.3.7.ebuild b/dev-go/text/text-0.3.8.ebuild
similarity index 100%
rename from dev-go/text/text-0.3.7.ebuild
rename to dev-go/text/text-0.3.8.ebuild
diff --git a/dev-go/yaml/metadata.xml b/dev-go/yaml/metadata.xml
new file mode 100644
index 0000000..8995c90
--- /dev/null
+++ b/dev-go/yaml/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata>
+<pkgmetadata>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:yaml_project:yaml</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
index 20be620..2ae807a 100644
--- a/dev-lang/go/Manifest
+++ b/dev-lang/go/Manifest
@@ -1,2 +1,2 @@
-DIST go1.18.src.tar.gz 22827832 BLAKE2B a961563352721455c9913cd71d8f56c5409e2d4edd44144f09aaba60daf353f844884db6a20943bd84f3634ef0dd330d43d27f5a65911eb4d4d877bfc71c4f40 SHA512 f10356df9099e4d027415be5c73bd2551f2f941a31feb21e1ccc03b7d8faa1844f0a639a508e990712e11ec335675e57504edb323fa1eee63e1d09b8523b3b0d
+DIST go1.19.3.src.tar.gz 26535494 BLAKE2B 369f2fe45cda19f3c5e840a7d737a45268c6d5a63f25b99d221793cea00c50ffc72f88944e8e137ae8128563d8f562cc3e49c3399a75adb2437d877e4ba0c222 SHA512 9aa8548597d52455afad8bf3b882eeeb9992814721ff2b9d8ed1f0e1ee0fec74aecd9d4e8c9c00eafbfe690bcdc50f3ad0b00bc4818b87e9d584cce7df97ee76
 DIST go1.4-bootstrap-20170531.tar.gz 11315348 BLAKE2B bdc66bc1aca3f86ca8deaa01f598db955d6de6dd069bc2ae095a4335a9b113079aff93a23310c3bb6ea7e91b0ce0ef45394ce7094d234f7daffc088af4c1b6e0 SHA512 f04b4822aae0953ec2982ab9e8ad02dde588bbf3cf27ad294178f7faa7c3359ee20e77c2c06b293e88d9b680b79c4b5958f1f772f0710637324a3b8c024c1bc3
diff --git a/dev-lang/go/go-1.18-r2.ebuild b/dev-lang/go/go-1.18-r2.ebuild
deleted file mode 120000
index 1425ef1..0000000
--- a/dev-lang/go/go-1.18-r2.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-go-1.18.ebuild
\ No newline at end of file
diff --git a/dev-lang/go/go-1.19.3-r1.ebuild b/dev-lang/go/go-1.19.3-r1.ebuild
new file mode 120000
index 0000000..e599432
--- /dev/null
+++ b/dev-lang/go/go-1.19.3-r1.ebuild
@@ -0,0 +1 @@
+go-1.19.3.ebuild
\ No newline at end of file
diff --git a/dev-lang/go/go-1.18.ebuild b/dev-lang/go/go-1.19.3.ebuild
similarity index 95%
rename from dev-lang/go/go-1.18.ebuild
rename to dev-lang/go/go-1.19.3.ebuild
index fa9f3aa..e1cdf49 100644
--- a/dev-lang/go/go-1.18.ebuild
+++ b/dev-lang/go/go-1.19.3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
 # Distributed under the terms of the GNU General Public License v2.
 
 EAPI=7
@@ -17,10 +17,7 @@
 SLOT="0"
 KEYWORDS="*"
 IUSE=""
-RESTRICT="binchecks strip"
-PATCHES=(
-	"${FILESDIR}/${P}-e66f895-dw-tag-variable-fix.patch"
-)
+RESTRICT="binchecks"
 
 is_cross() {
 	[[ "${CATEGORY}" == cross-* ]]
diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml
new file mode 100644
index 0000000..92bfc82
--- /dev/null
+++ b/dev-lang/go/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>williamh@gentoo.org</email>
+		<name>William Hubbs</name>
+	</maintainer>
+	<longdescription lang="en">
+		Go is a new systems programming language developped at google by
+		Rob Pike. It has garbage collection, coroutines, communication
+		channels and a clean syntax.
+	</longdescription>
+	<upstream>
+		<remote-id type="cpe">cpe:/a:golang:go</remote-id>
+		<remote-id type="github">golang/go</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-lang/python/files/python-3.6.12-CVE-2022-37454.patch b/dev-lang/python/files/python-3.6.12-CVE-2022-37454.patch
new file mode 100644
index 0000000..fc14eb7a
--- /dev/null
+++ b/dev-lang/python/files/python-3.6.12-CVE-2022-37454.patch
@@ -0,0 +1,101 @@
+From 8088c90044ba04cd5624b278340ebf934dbee4a5 Mon Sep 17 00:00:00 2001
+From: "Miss Islington (bot)"
+ <31488909+miss-islington@users.noreply.github.com>
+Date: Fri, 21 Oct 2022 20:37:54 -0700
+Subject: [PATCH] [3.7] gh-98517: Fix buffer overflows in _sha3 module
+ (GH-98519) (GH-98528)
+
+This is a port of the applicable part of XKCP's fix [1] for
+CVE-2022-37454 and avoids the segmentation fault and the infinite
+loop in the test cases published in [2].
+
+[1]: https://github.com/XKCP/XKCP/commit/fdc6fef075f4e81d6b1bc38364248975e08e340a
+[2]: https://mouha.be/sha-3-buffer-overflow/
+
+Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
+(cherry picked from commit 0e4e058602d93b88256ff90bbef501ba20be9dd3)
+
+Co-authored-by: Theo Buehler <botovq@users.noreply.github.com>
+---
+ Lib/test/test_hashlib.py                          |  9 +++++++++
+ .../2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst |  1 +
+ Modules/_sha3/kcp/KeccakSponge.inc                | 15 ++++++++-------
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+ create mode 100644 Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
+
+diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
+index fc0649d670d2..2bf96de4e0e7 100644
+--- a/Lib/test/test_hashlib.py
++++ b/Lib/test/test_hashlib.py
+@@ -415,6 +415,15 @@ def test_case_md5_huge(self, size):
+     def test_case_md5_uintmax(self, size):
+         self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
+ 
++    @unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit systems')
++    @bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
++    def test_sha3_update_overflow(self, size):
++        """Regression test for gh-98517 CVE-2022-37454."""
++        h = hashlib.sha3_224()
++        h.update(b'\x01')
++        h.update(b'\x01'*0xffff_ffff)
++        self.assertEqual(h.hexdigest(), '80762e8ce6700f114fec0f621fd97c4b9c00147fa052215294cceeed')
++
+     # use the three examples from Federal Information Processing Standards
+     # Publication 180-1, Secure Hash Standard,  1995 April 17
+     # http://www.itl.nist.gov/div897/pubs/fip180-1.htm
+diff --git a/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst b/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
+new file mode 100644
+index 000000000000..2d23a6ad93c7
+--- /dev/null
++++ b/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
+@@ -0,0 +1 @@
++Port XKCP's fix for the buffer overflows in SHA-3 (CVE-2022-37454).
+diff --git a/Modules/_sha3/kcp/KeccakSponge.inc b/Modules/_sha3/kcp/KeccakSponge.inc
+index e10739deafa8..cf92e4db4d36 100644
+--- a/Modules/_sha3/kcp/KeccakSponge.inc
++++ b/Modules/_sha3/kcp/KeccakSponge.inc
+@@ -171,7 +171,7 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
+     i = 0;
+     curData = data;
+     while(i < dataByteLen) {
+-        if ((instance->byteIOIndex == 0) && (dataByteLen >= (i + rateInBytes))) {
++        if ((instance->byteIOIndex == 0) && (dataByteLen-i >= rateInBytes)) {
+ #ifdef SnP_FastLoop_Absorb
+             /* processing full blocks first */
+ 
+@@ -199,10 +199,10 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
+         }
+         else {
+             /* normal lane: using the message queue */
+-
+-            partialBlock = (unsigned int)(dataByteLen - i);
+-            if (partialBlock+instance->byteIOIndex > rateInBytes)
++            if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
+                 partialBlock = rateInBytes-instance->byteIOIndex;
++            else
++                partialBlock = (unsigned int)(dataByteLen - i);
+             #ifdef KeccakReference
+             displayBytes(1, "Block to be absorbed (part)", curData, partialBlock);
+             #endif
+@@ -281,7 +281,7 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
+     i = 0;
+     curData = data;
+     while(i < dataByteLen) {
+-        if ((instance->byteIOIndex == rateInBytes) && (dataByteLen >= (i + rateInBytes))) {
++        if ((instance->byteIOIndex == rateInBytes) && (dataByteLen-i >= rateInBytes)) {
+             for(j=dataByteLen-i; j>=rateInBytes; j-=rateInBytes) {
+                 SnP_Permute(instance->state);
+                 SnP_ExtractBytes(instance->state, curData, 0, rateInBytes);
+@@ -299,9 +299,10 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
+                 SnP_Permute(instance->state);
+                 instance->byteIOIndex = 0;
+             }
+-            partialBlock = (unsigned int)(dataByteLen - i);
+-            if (partialBlock+instance->byteIOIndex > rateInBytes)
++            if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
+                 partialBlock = rateInBytes-instance->byteIOIndex;
++            else
++                partialBlock = (unsigned int)(dataByteLen - i);
+             i += partialBlock;
+ 
+             SnP_ExtractBytes(instance->state, curData, instance->byteIOIndex, partialBlock);
diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml
index 98fa548..d8e7c3f 100644
--- a/dev-lang/python/metadata.xml
+++ b/dev-lang/python/metadata.xml
@@ -11,4 +11,7 @@
 	<flag name="wide-unicode">Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag>
 	<flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag>
 </use>
+<upstream>
+	<remote-id type="cpe">cpe:/a:python:python</remote-id>
+</upstream>
 </pkgmetadata>
diff --git a/dev-lang/python/python-3.6.15.ebuild b/dev-lang/python/python-3.6.15.ebuild
index d5c5294..aa98bc6 100644
--- a/dev-lang/python/python-3.6.15.ebuild
+++ b/dev-lang/python/python-3.6.15.ebuild
@@ -108,6 +108,8 @@
 	eapply "${FILESDIR}/python-3.6.5-system-libffi.patch"
 	eapply "${FILESDIR}/python-3.6.5-sigint-handler.patch"
 	eapply "${FILESDIR}/python-3.6-mock.patch"
+	# The below patch can be dropped once python is upgraded to >=3.7.
+	eapply "${FILESDIR}/python-3.6.12-CVE-2022-37454.patch"
 
 	if use pgo_use; then
 		eapply "${FILESDIR}/python-3.6.12-pgo-use.patch"
diff --git a/dev-libs/nss/Manifest b/dev-libs/nss/Manifest
index 023b5b2..7901893 100644
--- a/dev-libs/nss/Manifest
+++ b/dev-libs/nss/Manifest
@@ -1,4 +1,2 @@
-DIST nss-3.68.2.tar.gz 82406396 BLAKE2B 0542278f63770e9d4f3ce51516d7786680f2a869907ec91b2c4160f9fcad60703dd0e2a77bae91306349ff56908af0020e9479815e2b15392da7b14b27f8c7bc SHA512 31fe62f9e6f1695546bf8b087ae35ac2d3f39fde6be6ab3fcbc81ef66cf6290fc34b799e3809fcba4e913d0e305c476ee8ee1f22d0f957ec6978025920bdb9de
-DIST nss-3.75.tar.gz 84738291 BLAKE2B 35e8b1c3a6e2817d30e16b04288a5382332fa37d07f934de139dfb664c6a0ddd6a0e585902bd402cf45be5f9f9ae799c055a51cc4ec4a82c8dd12a454832e141 SHA512 0ad42f663b48649d7d16dc8b8956d2971a9566c0f7f655dd0609b94877f400977e5ad693f2eb44e1e277e55d1669294f07b3ba7a32573d3d72837b3944adf86d
-DIST nss-3.76.tar.gz 84623743 BLAKE2B 4e7ce8cfbfccae4d92357a86a0170427a50594387a73bd101e7400c85945de6104247900b4a0d5c0571370f718dc01b40749eba460b87ff339e097c07769412d SHA512 ffbdd8a27f60b796e1204912cde2fa62ac99747ce550258ccdd6fe96d60a46c6ac3f82758a7aba3c7ee58da4e7bf09f1bf817fb9f0fa4e62faaea08a6301b8bd
+DIST nss-3.73.tar.gz 83928905 BLAKE2B 64c95a04c366dc3d57c42ddb105b3afe5b4b579b3fdb554ffa684f74f5c203b136213a1a67a554756be605722ac03c15cee766afba6edf2c7c0b2162a8181ec5 SHA512 84b6e4ce8838f77674a5587cd227fa103c80f1b36c8bfb9b60a175157f131e59153c79ee77b29feffa57f49b217a90a8a091ee368eb0bc03312894e386a4c01b
 DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
diff --git a/dev-libs/nss/nss-3.68.2-r2.ebuild b/dev-libs/nss/nss-3.68.2-r2.ebuild
deleted file mode 120000
index 0aec18c..0000000
--- a/dev-libs/nss/nss-3.68.2-r2.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-nss-3.68.2.ebuild
\ No newline at end of file
diff --git a/dev-libs/nss/nss-3.73-r1.ebuild b/dev-libs/nss/nss-3.73-r1.ebuild
new file mode 120000
index 0000000..84f63b0
--- /dev/null
+++ b/dev-libs/nss/nss-3.73-r1.ebuild
@@ -0,0 +1 @@
+nss-3.73.ebuild
\ No newline at end of file
diff --git a/dev-libs/nss/nss-3.68.2.ebuild b/dev-libs/nss/nss-3.73.ebuild
similarity index 100%
rename from dev-libs/nss/nss-3.68.2.ebuild
rename to dev-libs/nss/nss-3.73.ebuild
diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
index eb3e8fc..e05f7d2 100644
--- a/dev-libs/openssl/Manifest
+++ b/dev-libs/openssl/Manifest
@@ -1,2 +1,3 @@
-DIST openssl-1.1.1n.tar.gz 9850712 BLAKE2B af530258d9f7ca4f1bd1c6c344eb385e766e465c9341dd08797676165f67bbb82d3fd549ed7559dc12fb8c9c4db5e04fa6ec7ab729ec1467f5e8bce469ff5398 SHA512 1937796736613dcf4105a54e42ecb61f95a1cea74677156f9459aea0f2c95159359e766089632bf364ee6b0d28d661eb9957bce8fecc9d2436378d8d79e8d0a4
-DIST openssl-1.1.1n.tar.gz.asc 488 BLAKE2B 8fc18fdc884473dc4c243499cc3528691a9ecc184e39e8d942450d41c42d22a96398036ae804af23c4f28d082c62f5babaa275ceb2e13b33b5acfd59a802c186 SHA512 24abc3d187cabed830dcd3189a34c2dc29e0b8013a607011a0e85cc68f0ec48c1de14a005053a4de3a4013cfa9658016ac65cfb8cfac58da55231371926beeda
+DIST openssl-1.1.1q.tar.gz 9864061 BLAKE2B fc8fd6a62dc291d0bda328a051e253175fb04442cc4b8f45d67c3a5027748a0fc5fb372d0483bc9024ae0bff119c4fac8f1e982a182612427696d6d09f5935f5 SHA512 cb9f184ec4974a3423ef59c8ec86b6bf523d5b887da2087ae58c217249da3246896fdd6966ee9c13aea9e6306783365239197e9f742c508a0e35e5744e3e085f
+DIST openssl-1.1.1q.tar.gz.asc 833 BLAKE2B 9311abf47469c3802a84dc9b7427a168ba7717496960e6f84b04e4d9263dea1168493082937a06bcb6ef4169b2ed9b2f36084bbac15b5f7ca5b4c41041c4bab6 SHA512 03a41f29d1713c47bb300e01e36dbd048074076a6a3b9913e2fc9a1b56b726c038978f99e86f9a3e4ea39f72bd82a15965842f6d94210fa9d3474f6f0f68559e
+
diff --git a/dev-libs/openssl/openssl-1.1.1n-r1.ebuild b/dev-libs/openssl/openssl-1.1.1n-r1.ebuild
deleted file mode 120000
index 923411f..0000000
--- a/dev-libs/openssl/openssl-1.1.1n-r1.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-openssl-1.1.1n.ebuild
\ No newline at end of file
diff --git a/dev-libs/openssl/openssl-1.1.1q-r1.ebuild b/dev-libs/openssl/openssl-1.1.1q-r1.ebuild
new file mode 120000
index 0000000..a0524eb
--- /dev/null
+++ b/dev-libs/openssl/openssl-1.1.1q-r1.ebuild
@@ -0,0 +1 @@
+openssl-1.1.1q.ebuild
\ No newline at end of file
diff --git a/dev-libs/openssl/openssl-1.1.1n.ebuild b/dev-libs/openssl/openssl-1.1.1q.ebuild
similarity index 100%
rename from dev-libs/openssl/openssl-1.1.1n.ebuild
rename to dev-libs/openssl/openssl-1.1.1q.ebuild
diff --git a/dev-util/bsdiff/metadata.xml b/dev-util/bsdiff/metadata.xml
index 42d88df..43566e5 100644
--- a/dev-util/bsdiff/metadata.xml
+++ b/dev-util/bsdiff/metadata.xml
@@ -2,4 +2,7 @@
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
 <maintainer><email>ferringb@gentoo.org</email></maintainer>
+<upstream>
+	<remote-id type="cpe">cpe:/a:daemonology:bsdiff</remote-id>
+</upstream>
 </pkgmetadata>
diff --git a/dev-util/perf/perf-5.15.ebuild b/dev-util/perf/perf-5.15.ebuild
index 29d8546..ac2a31a 100644
--- a/dev-util/perf/perf-5.15.ebuild
+++ b/dev-util/perf/perf-5.15.ebuild
@@ -242,7 +242,7 @@
 		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
 	fi
 	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
+	use doc && nonfatal perf_make -C Documentation man
 }
 
 src_test() {
@@ -254,7 +254,8 @@
 		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
 	}
 
-	perf_make -f Makefile.perf install DESTDIR="${D}"
+	perf_make -f Makefile.perf install-bin DESTDIR="${D}"
+	nonfatal perf_make -f Makefile.perf try-install-man DESTDIR="${D}"
 
 	if use python; then
 		python_foreach_impl _install_python_ext
@@ -277,6 +278,6 @@
 	docompress -x /usr/share/doc/${PF}/tips.txt
 
 	if use doc ; then
-		doman Documentation/*.1
+		nonfatal doman Documentation/*.1
 	fi
 }
diff --git a/eclass/cros-kernel2.eclass b/eclass/cros-kernel2.eclass
index 184432a..464d213 100644
--- a/eclass/cros-kernel2.eclass
+++ b/eclass/cros-kernel2.eclass
@@ -215,6 +215,7 @@
 	hibernate
 	highmem
 	hypervisor_guest
+	mellanox_eth
 	i2cdev
 	iioservice
 	irqsoff_tracer
@@ -278,6 +279,9 @@
 	wifi_diag
 	x32
 	xen_guest
+	hyperv_guest
+	ntfs_fs
+	cdrom
 )
 
 acpi_ac_desc="Enable ACPI AC"
@@ -492,6 +496,30 @@
 CONFIG_COIOMMU=y
 "
 
+mellanox_eth_desc="Mellanox Ethernet Drivers"
+mellanox_eth_config="
+CONFIG_NET_VENDOR_MELLANOX=y
+CONFIG_MLX4_EN=m
+CONFIG_MLX4_CORE=m
+CONFIG_MLX4_DEBUG=y
+CONFIG_MLX4_CORE_GEN2=y
+CONFIG_MLX5_CORE=m
+CONFIG_MLX5_ACCEL=y
+CONFIG_MLX5_FPGA=y
+CONFIG_MLX5_CORE_EN=y
+CONFIG_MLX5_EN_ARFS=y
+CONFIG_MLX5_EN_RXNFC=y
+CONFIG_MLX5_MPFS=y
+# CONFIG_MLX5_CORE_IPOIB is not set
+CONFIG_MLX5_FPGA_IPSEC=y
+CONFIG_MLXSW_CORE=m
+CONFIG_MLXSW_CORE_THERMAL=y
+CONFIG_MLXSW_PCI=m
+CONFIG_MLXFW=m
+# CONFIG_MLX_WDT is not set
+CONFIG_MELLANOX_PLATFORM=y
+"
+
 i2cdev_desc="I2C device interface"
 i2cdev_config="
 CONFIG_I2C_CHARDEV=y
@@ -1071,6 +1099,31 @@
 CONFIG_XEN_HAVE_VPMU=y
 "
 
+hyperv_guest_desc="Microsoft Hyper-V guest support"
+hyperv_guest_config="
+CONFIG_HYPERV=y
+CONFIG_HYPERV_NET=y
+CONFIG_HYPERV_TSCPAGE=y
+CONFIG_HYPERV_KEYBOARD=y
+CONFIG_HYPERV_STORAGE=y
+CONFIG_HYPERV_BALLOON=y
+CONFIG_HYPERV_UTILS=y
+CONFIG_HYPERV_TIMER=y
+CONFIG_HYPERV_IOMMU=y
+CONFIG_FB_HYPERV=y
+CONFIG_PCI_HYPERV=y
+"
+
+ntfs_fs_desc="Microsoft NTFS support"
+ntfs_fs_config="
+CONFIG_NTFS_FS=m
+"
+
+cdrom_desc="CDROM support"
+cdrom_config="
+CONFIG_BLK_DEV_SR=y
+"
+
 vtconsole_desc="VT console"
 vtconsole_config="
 CONFIG_VT=y
diff --git a/licenses/copyright-attribution/sys-apps/systemd-cryptsetup b/licenses/copyright-attribution/sys-apps/systemd-cryptsetup
new file mode 120000
index 0000000..1514658
--- /dev/null
+++ b/licenses/copyright-attribution/sys-apps/systemd-cryptsetup
@@ -0,0 +1 @@
+systemd
\ No newline at end of file
diff --git a/net-libs/libslirp/Manifest b/net-libs/libslirp/Manifest
new file mode 100644
index 0000000..b508e93
--- /dev/null
+++ b/net-libs/libslirp/Manifest
@@ -0,0 +1 @@
+DIST libslirp-4.3.1.tar.gz 127008 BLAKE2B de40980521a54367fda73b9a67a80159ff14e8ea073086d8df3b42028ffe778b62f0aabe2b3f0929e168c73c453a8eda3fe0bb866d22de5b0712775e9cece19f SHA512 fa38a5e508b00802538f8466b8b52fc4842d6f7f74caa399db1011c15bb37198678415147327a606e3f259fd5def9390012df1d4dc76e8869e9bb77ca6514005
diff --git a/net-libs/libslirp/files/libslirp-4.3.1-bug-756910-check-pkt_len.patch b/net-libs/libslirp/files/libslirp-4.3.1-bug-756910-check-pkt_len.patch
new file mode 100644
index 0000000..aef7f19
--- /dev/null
+++ b/net-libs/libslirp/files/libslirp-4.3.1-bug-756910-check-pkt_len.patch
@@ -0,0 +1,48 @@
+From: Prasad J Pandit <pjp@fedoraproject.org>
+Date: Thu, 26 Nov 2020 13:57:06 +0000
+Subject: [PATCH] slirp: check pkt_len before reading protocol header
+
+While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input'
+routines, ensure that pkt_len is large enough to accommodate the
+respective protocol headers, lest it should do an OOB access.
+Add check to avoid it.
+
+Reported-by: Qiuhao Li @outlook.com;
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
+---
+ src/ncsi.c  | 4 ++++
+ src/slirp.c | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/src/ncsi.c b/src/ncsi.c
+index 3c1dfef..75dcc08 100644
+--- a/src/ncsi.c
++++ b/src/ncsi.c
+@@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
+     uint32_t checksum;
+     uint32_t *pchecksum;
+ 
++    if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) {
++        return; /* packet too short */
++    }
++
+     memset(ncsi_reply, 0, sizeof(ncsi_reply));
+ 
+     memset(reh->h_dest, 0xff, ETH_ALEN);
+diff --git a/src/slirp.c b/src/slirp.c
+index 9bead0c..abb6f9a 100644
+--- a/src/slirp.c
++++ b/src/slirp.c
+@@ -860,6 +860,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
+         return;
+     }
+ 
++    if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) {
++        return; /* packet too short */
++    }
++
+     ar_op = ntohs(ah->ar_op);
+     switch (ar_op) {
+     case ARPOP_REQUEST:
+-- 
+2.28.0
diff --git a/net-libs/libslirp/libslirp-4.3.1-r1.ebuild b/net-libs/libslirp/libslirp-4.3.1-r1.ebuild
new file mode 100644
index 0000000..fef0fb7
--- /dev/null
+++ b/net-libs/libslirp/libslirp-4.3.1-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit meson
+
+KEYWORDS="*"
+MY_P="${PN}-v${PV}"
+SRC_URI="https://gitlab.freedesktop.org/slirp/libslirp/-/archive/v${PV}/${MY_P}.tar.gz -> ${P}.tar.gz"
+DESCRIPTION="A general purpose TCP-IP emulator used by virtual machine hypervisors to provide virtual networking services."
+HOMEPAGE="https://gitlab.freedesktop.org/slirp/libslirp"
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="static-libs"
+
+RDEPEND="dev-libs/glib:="
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+	"${FILESDIR}/libslirp-4.3.1-bug-756910-check-pkt_len.patch"
+)
+
+src_prepare() {
+	default
+	echo "${PV}" > .tarball-version || die
+	echo -e "#!${BASH}\necho -n \$(cat '${S}/.tarball-version')" > build-aux/git-version-gen || die
+}
+
+src_configure() {
+	local emesonargs=(
+		-Ddefault_library=$(usex static-libs both shared)
+	)
+	meson_src_configure
+}
diff --git a/net-libs/libslirp/metadata.xml b/net-libs/libslirp/metadata.xml
new file mode 100644
index 0000000..8830eef
--- /dev/null
+++ b/net-libs/libslirp/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<name>Zac Medico</name>
+		<email>zmedico@gentoo.org</email>
+	</maintainer>
+	<upstream>
+		<remote-id type="gitlab">gitlab.freedesktop.org/slirp/libslirp</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/profiles/base/profile.bashrc b/profiles/base/profile.bashrc
index 4f82727..7074090 100644
--- a/profiles/base/profile.bashrc
+++ b/profiles/base/profile.bashrc
@@ -198,10 +198,13 @@
 	}
 	_sdk_build_filter_ld() {
 		case ${CATEGORY}/${PN}:${PV} in
+		app-crypt/nss:*|\
 		cross-*/gcc:*|\
 		cross-*/go:*|\
 		dev-embedded/coreboot-sdk:*|\
-		dev-lang/go:*) return 1;;
+		dev-lang/go:*|\
+		dev-libs/nss:*|\
+		dev-util/perf:*) return 1;;
 		esac
 	}
 	_sdk_build_filter_as() {
@@ -355,6 +358,9 @@
 	}
 	_board_build_filter_ld() {
 		case ${CATEGORY}/${PN}:${PV} in
+		app-crypt/nss:*|\
+		dev-libs/nss:*|\
+		dev-util/perf:*|\
 		media-libs/arc-mali-drivers-bifrost:*|\
 		media-libs/mali-drivers-bifrost:*|\
 		sys-kernel/arcvm-kernel-*:*|\
diff --git a/profiles/targets/sdk/package.mask b/profiles/targets/sdk/package.mask
new file mode 100644
index 0000000..571c24e8
--- /dev/null
+++ b/profiles/targets/sdk/package.mask
@@ -0,0 +1,9 @@
+# Mask sys-libs/ncurses versions above v6
+# This is done because certain binpkg in
+# sdk tarball has a dependency on ncurses-5
+# which was installed in Slot-0. Upgrade to
+# ncurses to v6 creates a conflict in
+# create_sdk step due to multiple ncurses
+# version being tried to install into the same
+# SLOT.
+>=sys-libs/ncurses-6
diff --git a/profiles/targets/sdk/package.use b/profiles/targets/sdk/package.use
index 23f884e..63b3592 100644
--- a/profiles/targets/sdk/package.use
+++ b/profiles/targets/sdk/package.use
@@ -37,6 +37,7 @@
 dev-libs/glib static-libs
 dev-libs/libpcre static-libs
 net-libs/nghttp2 static-libs
+net-libs/libslirp static-libs
 sys-apps/attr static-libs
 
 # mkfs.erofs needs selinux for SELinux context labeling.
@@ -100,7 +101,7 @@
 # Build qemu's userland helpers statically so we can copy them into sysroots
 # and run unittests standalone.  Build qemu's softmmu helpers statically so
 # we can run vms outside of the chroot.
-app-emulation/qemu	-pin-upstream-blobs -seccomp static-user usb virtfs
+app-emulation/qemu	-ncurses -pin-upstream-blobs -seccomp static-user usb virtfs
 dev-libs/glib		static-libs
 dev-libs/libaio		static-libs
 dev-libs/libpcre	static-libs
@@ -148,7 +149,8 @@
 # dependencies.
 dev-python/pygobject -cairo
 
-# Disable crypt for vim so sodium is not used.
+# Disable crypt for vim to avoid pulling libsodium into the build. libsodium
+# isn't in our tree and it shouldn't be necessary.
 app-editors/vim -crypt
 
 # cbindgen expects to be able to unwind panics rather than immediately abort.
diff --git a/sys-apps/baselayout/baselayout-2.2-r1.ebuild b/sys-apps/baselayout/baselayout-2.2-r2.ebuild
similarity index 100%
rename from sys-apps/baselayout/baselayout-2.2-r1.ebuild
rename to sys-apps/baselayout/baselayout-2.2-r2.ebuild
diff --git a/sys-apps/baselayout/baselayout-2.2.ebuild b/sys-apps/baselayout/baselayout-2.2.ebuild
index 656912e..7c9fc42 100644
--- a/sys-apps/baselayout/baselayout-2.2.ebuild
+++ b/sys-apps/baselayout/baselayout-2.2.ebuild
@@ -18,6 +18,9 @@
 
 src_prepare() {
 	epatch "${FILESDIR}"/add-dash-shell.patch
+	# lakitu: bracketed paste mode causes problems in software that doesn't
+	# expect it (b/232085583)
+	epatch "${FILESDIR}"/disable-bracketed-paste-mode.patch
 }
 
 src_install() {
diff --git a/sys-apps/baselayout/files/disable-bracketed-paste-mode.patch b/sys-apps/baselayout/files/disable-bracketed-paste-mode.patch
new file mode 100644
index 0000000..6e81d526
--- /dev/null
+++ b/sys-apps/baselayout/files/disable-bracketed-paste-mode.patch
@@ -0,0 +1,10 @@
+--- etc.Linux/inputrc.orig	2010-02-14 09:28:40.000000000 -0800
++++ etc.Linux/inputrc	2022-05-16 18:21:29.535629180 -0700
+@@ -70,3 +70,7 @@
+ # fix Home and End for German users
+ "\e[7~": beginning-of-line
+ "\e[8~": end-of-line
++
++# disable bracketed paste mode
++set enable-bracketed-paste off
++
diff --git a/sys-apps/portage/files/chromeos-version.sh b/sys-apps/portage/files/chromeos-version.sh
index e2210a7..45085d0 100755
--- a/sys-apps/portage/files/chromeos-version.sh
+++ b/sys-apps/portage/files/chromeos-version.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
diff --git a/sys-apps/portage/portage-2.3.75-r121.ebuild b/sys-apps/portage/portage-2.3.75-r129.ebuild
similarity index 97%
rename from sys-apps/portage/portage-2.3.75-r121.ebuild
rename to sys-apps/portage/portage-2.3.75-r129.ebuild
index 13cf2d1..86c705b 100644
--- a/sys-apps/portage/portage-2.3.75-r121.ebuild
+++ b/sys-apps/portage/portage-2.3.75-r129.ebuild
@@ -1,10 +1,10 @@
 # Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI="7"
 
-CROS_WORKON_COMMIT="a19bc4604bad58cf743719b704732722339ea315"
-CROS_WORKON_TREE="8ba40f0d294397dbb028317bf624a44d2ab9c78b"
+CROS_WORKON_COMMIT="0df08e1c78c6819d1035f2a838e828c61bb1a2d3"
+CROS_WORKON_TREE="b4d45a2c20396eb9e7add16e29ed38853ac073bf"
 PYTHON_COMPAT=(
 	python3_{6..9}
 )
@@ -239,7 +239,7 @@
 	dodir /usr/sbin
 	for target in ${sbin_relocations}; do
 		einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
-		mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
+		mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
 	done
 }
 
diff --git a/sys-apps/portage/portage-9999.ebuild b/sys-apps/portage/portage-9999.ebuild
index 46aea57..0ea75ca 100644
--- a/sys-apps/portage/portage-9999.ebuild
+++ b/sys-apps/portage/portage-9999.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI="7"
 
 PYTHON_COMPAT=(
 	python3_{6..9}
@@ -237,7 +237,7 @@
 	dodir /usr/sbin
 	for target in ${sbin_relocations}; do
 		einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
-		mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
+		mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
 	done
 }
 
diff --git a/sys-boot/grub/files/0005-strip-interp-from-diskboot.patch b/sys-boot/grub/files/0005-strip-interp-from-diskboot.patch
new file mode 100644
index 0000000..492f468
--- /dev/null
+++ b/sys-boot/grub/files/0005-strip-interp-from-diskboot.patch
@@ -0,0 +1,20 @@
+--- grub-core/Makefile.core.def	2021-07-06 23:58:33.094383161 -0700
++++ grub-core/Makefile.core.def	2021-07-06 23:59:01.142164648 -0700
+@@ -372,7 +372,7 @@
+   sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
+   sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+ 
+-  objcopyflags = '-O binary';
++  objcopyflags = '-R .interp -O binary';
+   enable = i386_pc;
+   enable = i386_qemu;
+   enable = sparc64_ieee1275;
+@@ -430,7 +430,7 @@
+   sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S;
+   sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200';
+ 
+-  objcopyflags = '-O binary';
++  objcopyflags = '-R .interp -O binary';
+ 
+   enable = i386_pc;
+   enable = sparc64_ieee1275;
diff --git a/sys-boot/grub/files/b189992601-no-soft-float.patch b/sys-boot/grub/files/b189992601-no-soft-float.patch
new file mode 100644
index 0000000..1d3e6e9
--- /dev/null
+++ b/sys-boot/grub/files/b189992601-no-soft-float.patch
@@ -0,0 +1,27 @@
+Work around b/189992601: "SSE register cannot be used when SSE is disabled!"
+
+The combination of -Xclang -msoft-float and -Xclang -no-implicit-float
+causes Clang to assert. Since GRUB doesn't use floats, not passing
+ -Xclang -msoft-float is a safe way to avoid this assert.
+https://bugs.llvm.org/show_bug.cgi?id=48528 tracks fixing this on the
+LLVM side, after which we won't need this patch anymore.
+
+diff --git a/grub-2.02.old/configure.ac b/grub-2.02/configure.ac
+index edd1841..3ec8008 100644
+--- a/grub-2.02.old/configure.ac
++++ b/grub-2.02/configure.ac
+@@ -811,9 +811,11 @@ if test x"$platform" != xemu ; then
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ 		         [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], [])
+     fi
+-    for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \
+-		"-Xclang -msoft-float -Xclang -no-implicit-float" \
+-		"-Xclang -msoft-float" "-msoft-float"; do
++    # b/189992601: "SSE register cannot be used when SSE is disabled!"
++    # if we use -Xclang -msoft-float and -Xclang -no-implicit-float.
++    # Since GRUB doesn't use any floating point, just -no-implicit-float
++    # should be enough.
++    for cand in "-Xclang -no-implicit-float"; do
+       if test x"$grub_cv_target_cc_soft_float" != xno ; then
+         break
+       fi
\ No newline at end of file
diff --git a/sys-fs/squashfs-tools/metadata.xml b/sys-fs/squashfs-tools/metadata.xml
index a017cec..6db656f 100644
--- a/sys-fs/squashfs-tools/metadata.xml
+++ b/sys-fs/squashfs-tools/metadata.xml
@@ -6,6 +6,7 @@
 		<name>MichaƂ Górny</name>
 	</maintainer>
 	<upstream>
+		<remote-id type="cpe">cpe:/a:squashfs-tools_project:squashfs-tools</remote-id>
 		<remote-id type="sourceforge">squashfs</remote-id>
 	</upstream>
 </pkgmetadata>
diff --git a/x11-drivers/opengles-headers/opengles-headers-0.0.1-r41.ebuild b/x11-drivers/opengles-headers/opengles-headers-0.0.1-r41.ebuild
index 9a94c05..812c557 100644
--- a/x11-drivers/opengles-headers/opengles-headers-0.0.1-r41.ebuild
+++ b/x11-drivers/opengles-headers/opengles-headers-0.0.1-r41.ebuild
@@ -6,6 +6,7 @@
 CROS_WORKON_TREE="b361c5863ff03785be5f24968c25fa6a69bf4465"
 CROS_WORKON_PROJECT="chromiumos/third_party/khronos"
 CROS_WORKON_LOCALNAME="khronos"
+CROS_WORKON_EGIT_BRANCH="master"
 
 inherit cros-workon cros-sanitizers