With support for sharing packs, we can now optionally split the larger
mainline kernel content up to v5.10 (approx 1.5G) into two.  This may be
advantageous to people with release media constraints or unreliable
connections.

By setting "INITIAL_KERNEL_SPLIT = 1" in your configuration, you will
get a linux-4.0 clone and then the linux-5.10 clone in your downloads
directory.  From a size perspective, v4.0 is roughly the half way point
between when git use started in 2005, and v5.10 from 2020.

This split is achieved by manually selecting the midpoint tag and cloning
that portion 1st, and then cloning the 2nd 1/2, while using the packs in
the 1st 1/2 as a reference.

Packs deploy both zlib and delta compression - and as with all
compression technologies, splitting the input comes at a cost in terms
of reducing the compression.  So two packs will be bigger than one,
three packs bigger than two, and so on.  Representative numbers are
listed alongside the implementation in the change itself.

The 2nd 1/2 includes a fetch dependency on the 1st 1/2, so that things
will be serialiazed properly.  The dependency also links it into the
chain of events, so no other mentions of v4.0 are required.

Signed-off-by: Paul Gortmaker <paul.gortma...@windriver.com>
---
 meta/recipes-kernel/linux/fetch-linux.inc | 15 ++++++++++++++-
 meta/recipes-kernel/linux/linux-4.0.bb    |  9 +++++++++
 meta/recipes-kernel/linux/linux-5.10.bb   | 20 ++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/linux/linux-4.0.bb

diff --git a/meta/recipes-kernel/linux/fetch-linux.inc 
b/meta/recipes-kernel/linux/fetch-linux.inc
index e3fdd0bb36c2..96653a2bea06 100644
--- a/meta/recipes-kernel/linux/fetch-linux.inc
+++ b/meta/recipes-kernel/linux/fetch-linux.inc
@@ -2,6 +2,19 @@
 
 require recipes-kernel/linux/fetch-only.inc
 
+python __anonymous () {
+    kref = d.getVar("KREF")
+    if not kref:
+        d.setVar("KORG_REF", "")
+        d.setVar("KORG_REFDEP", "")
+        return;
+    clonehost = d.getVar("KORG_SERVER")
+    d.setVar("KORG_REF", ";packref=%s.torvalds.linux-%s" % (clonehost, kref))
+    d.setVar("KORG_REFDEP", "linux-%s:do_fetch"% kref)
+}
+
+do_fetch[depends] += "${KORG_REFDEP}"
+
 GITCLONEARGS = "--bare --single-branch --branch v${KTAG}"
 DL_NAME = ".torvalds.linux-${KTAG}"
-SRC_URI = 
"${KORG_URLBASE}/torvalds/linux;tag=v${KTAG};nobranch=1;static=1;dlname=${DL_NAME}"
+SRC_URI = 
"${KORG_URLBASE}/torvalds/linux;tag=v${KTAG};nobranch=1;static=1;dlname=${DL_NAME}${KORG_REF}"
diff --git a/meta/recipes-kernel/linux/linux-4.0.bb 
b/meta/recipes-kernel/linux/linux-4.0.bb
new file mode 100644
index 000000000000..68dd054970ca
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-4.0.bb
@@ -0,0 +1,9 @@
+SUMMARY = "Linux kernel v4.0 source"
+DESCRIPTION = "Fetch source of the linux kernel up to the v4.0 tag"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+
+KTAG = "4.0"
+
+require recipes-kernel/linux/fetch-linux.inc
diff --git a/meta/recipes-kernel/linux/linux-5.10.bb 
b/meta/recipes-kernel/linux/linux-5.10.bb
index 7f8a27bcb1f0..73e33d405376 100644
--- a/meta/recipes-kernel/linux/linux-5.10.bb
+++ b/meta/recipes-kernel/linux/linux-5.10.bb
@@ -6,4 +6,24 @@ LIC_FILES_CHKSUM = 
"file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
 KTAG = "5.10"
 
+# We optionally split the v5.10 download via adding refs and depends.
+# Fragmented downloads can be less apt to timeout, but delta compression
+# will lead to object duplication for > 1 objects/pack/*pack file and
+# an increase in overall on-disk totals.  The du -hsm for bare repos:
+#
+# No split:    1521    epoch->5.10
+# One split:   1730    epoch->4.0, 4.0->5.10 (854+877)
+#
+# Download sizes will vary depending on server compression settings.
+
+python __anonymous () {
+    splits = int(d.getVar("INITIAL_KERNEL_SPLIT") or 0)
+    if not splits:
+        return
+    if splits == 1:
+        d.setVar("KREF", "4.0")
+        return
+    bb.fatal("Unsupported number of v5.10 kernel content splits (%s)." % 
splits)
+}
+
 require recipes-kernel/linux/fetch-linux.inc
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9647): 
https://lists.yoctoproject.org/g/linux-yocto/message/9647
Mute This Topic: https://lists.yoctoproject.org/mt/81808177/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to