lakitu: Use tarball for dump-capture-kernel.

This CL changes the dump-capture-kernel ebuild file such that
it uses the tarball instead of the source present in the local
filesystem. This also makes the ebuild file cros-workon
independent.

This CL also adds a README for updating dump-capture-kernel.

BUG=b/162519089
TEST=presubmit (sponge2/913ebc20-8211-4862-98d6-a20319bb697e)
RELEASE_NOTE=None

Change-Id: I904543b824cfb7940455855d65e7d54ec02f54e0
diff --git a/overlay-lakitu/sys-kernel/dump-capture-kernel/Manifest b/overlay-lakitu/sys-kernel/dump-capture-kernel/Manifest
new file mode 100644
index 0000000..84cfb24
--- /dev/null
+++ b/overlay-lakitu/sys-kernel/dump-capture-kernel/Manifest
@@ -0,0 +1 @@
+DIST cos-dump-capture-kernel-f8649a7.tar.gz 161556523 BLAKE2B 2b9afb615aa57cf56f256c3f7460d1ff5e384ab599aa417c7ce47ca28c9628243356464f874a295291a3523c5aee0e5ac45f16f7e6b0086229f076b6ff8b0fd9 SHA512 3d42a846cd5f54c142dca4f1c27da65da65d15c201f1e6b35477420e320615628491b87149525c9fc1d36e09808e9ae4dad7137bf991a67d2c36bd83c7013fb3
diff --git a/overlay-lakitu/sys-kernel/dump-capture-kernel/README.md b/overlay-lakitu/sys-kernel/dump-capture-kernel/README.md
new file mode 100644
index 0000000..82cda9b
--- /dev/null
+++ b/overlay-lakitu/sys-kernel/dump-capture-kernel/README.md
@@ -0,0 +1,46 @@
+# How to update dump-capture-kernel
+
+Find the dump-capture-kernel commit you want to use for the tarball at
+https://cos.googlesource.com/third_party/dump-capture-kernel.
+Download the dump-capture-kernel tarball and upload it to chromeos-localmirror
+using the following commands:
+
+```
+# Better do this outside the chroot otherwise gsutil will complain
+# For example: Consider the kernel commit to be f8649a7.
+$ wget https://cos.googlesource.com/third_party/dump-capture-kernel/+archive/f8649a7.tar.gz
+$ gsutil cp -n -a public-read f8649a7.tar.gz \
+    gs://chromeos-localmirror/distfiles/cos-dump-capture-kernel-f8649a7.tar.gz
+$ rm f8649a7.tar.gz
+```
+
+Update the `EGIT_COMMIT` variable in the ebuild file with the new commit.
+
+1. If you have just changed the dump-capture-kernel commit in the same kernel
+   version, use the following command:
+
+   ```
+   # Outside chroot
+   $ git mv dump-capture-kernel-<kernel_version>-r<revision>.ebuild dump-capture-kernel-<kernel_version>-r<revision+1>.ebuild
+   ```
+   ```
+   # Inside chroot
+   $ equery-lakitu w dump-capture-kernel
+   $ ebuild-lakitu </path/to/ebuild>.ebuild manifest
+   $ emerge-lakitu dump-capture-kernel
+   ```
+
+2. If you have changed the kernel version for dump-capture-kernel, use the following
+   commands:
+
+   ```
+   # Outside chroot
+   $ git mv dump-capture-kernel-<old_kernel_version>-r<revision>.ebuild dump-capture-kernel-<new_kernel_version>-r1.ebuild
+   ```
+
+   ```
+   # Inside chroot
+   $ equery-lakitu w dump-capture-kernel
+   $ ebuild-lakitu </path/to/ebuild>.ebuild manifest
+   $ emerge-lakitu dump-capture-kernel
+   ```
diff --git a/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-0.0.1-r512.ebuild b/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-0.0.1-r512.ebuild
deleted file mode 100644
index c043f73..0000000
--- a/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-0.0.1-r512.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
-# Distributed under the terms of the GNU General Public License v2
-
-# Any changes submitted in the current ebuild needs to be duplicated in
-# `9999` ebuild as well.
-
-EAPI=5
-CROS_WORKON_REPO="https://cos.googlesource.com"
-CROS_WORKON_PROJECT="third_party/kernel"
-CROS_WORKON_EGIT_BRANCH="cos-4.19"
-CROS_WORKON_COMMIT="f8649a7408c63f53937e33b0e8379679b0434849"
-CROS_WORKON_LOCALNAME="kernel/v4.19"
-CROS_WORKON_BLACKLIST="1"
-
-CHROMEOS_KERNEL_CONFIG="${FILESDIR}/base.config"
-
-# This must be inherited *after* EGIT/CROS_WORKON variables defined
-inherit cros-workon cros-kernel2
-
-STRIP_MASK+=" /usr/src/${P}/build/vmlinux"
-STRIP_MASK+=" *.ko"
-
-DESCRIPTION="A dump capture kernel for kdump functionality"
-HOMEPAGE="https://cloud.google.com/container-optimized-os"
-KEYWORDS="*"
-
-
-src_install() {
-	dodir /boot/kdump
-	kmake INSTALL_PATH="${D}/boot/kdump" INSTALL_MOD_PATH="${D}" \
-		INSTALL_MOD_STRIP=1 install
-	local version
-	version=$(kmake -s --no-print-directory kernelrelease)
-	ln -sf "vmlinuz-${version}" "${D}/boot/kdump/vmlinuz" || die
-
-	# We also strips the symbol table /boot/kdump/System.map-* at:
-	# overlay-lakitu/scripts/board_specific_setup.sh
-}
diff --git a/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19-r1.ebuild b/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19-r1.ebuild
new file mode 120000
index 0000000..d736a57
--- /dev/null
+++ b/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19-r1.ebuild
@@ -0,0 +1 @@
+dump-capture-kernel-4.19.ebuild
\ No newline at end of file
diff --git a/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-9999.ebuild b/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19.ebuild
similarity index 72%
rename from overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-9999.ebuild
rename to overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19.ebuild
index 9bcd73d..1f94a92 100644
--- a/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-9999.ebuild
+++ b/overlay-lakitu/sys-kernel/dump-capture-kernel/dump-capture-kernel-4.19.ebuild
@@ -1,27 +1,33 @@
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
 # Distributed under the terms of the GNU General Public License v2
 
-# Any changes submitted in the current ebuild needs to be duplicated in
-# `non-9999` ebuild as well.
-
 EAPI=5
-CROS_WORKON_REPO="https://cos.googlesource.com"
-CROS_WORKON_PROJECT="third_party/kernel"
-CROS_WORKON_LOCALNAME="kernel/v4.19"
-CROS_WORKON_BLACKLIST="1"
 
-CHROMEOS_KERNEL_CONFIG="${FILESDIR}/base.config"
+CROS_WORKON_BLACKLIST="1"
+EGIT_COMMIT="f8649a7"
 
 # This must be inherited *after* EGIT/CROS_WORKON variables defined
 inherit cros-workon cros-kernel2
 
+DESCRIPTION="A dump capture kernel for kdump functionality"
+HOMEPAGE="https://cloud.google.com/container-optimized-os"
+KEYWORDS="*"
+CHROMEOS_KERNEL_CONFIG="${FILESDIR}/base.config"
+
+SRC_URI="gs://chromeos-localmirror/distfiles/cos-dump-capture-kernel-${EGIT_COMMIT}.tar.gz"
+S="${WORKDIR}"
+
 STRIP_MASK+=" /usr/src/${P}/build/vmlinux"
 STRIP_MASK+=" *.ko"
 
-DESCRIPTION="A dump capture kernel for kdump functionality"
-HOMEPAGE="https://cloud.google.com/container-optimized-os"
-KEYWORDS="~*"
+DEPEND="
+	!sys-kernel/lakitu-kernel
+"
+RDEPEND="${DEPEND}"
 
+src_unpack() {
+	default
+}
 
 src_install() {
 	dodir /boot/kdump