feat: linux-kbuild-tree download source from CDN rather than git now
fix: linux-kbuild-tree path move in `all` subfolder
This commit is contained in:
parent
8d6a663379
commit
0245c15855
|
|
@ -0,0 +1,21 @@
|
||||||
|
sources:
|
||||||
|
"7.0.0":
|
||||||
|
"6.17.0":
|
||||||
|
"6.8.0":
|
||||||
|
"6.5.9":
|
||||||
|
url: "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.9.tar.gz"
|
||||||
|
sha256: "3c269612220746ba87dc9063bec2afcb2df04b4fdaa9f7e1f67751284966cf37"
|
||||||
|
"5.19.9":
|
||||||
|
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.9.tar.gz"
|
||||||
|
sha256: "1f01b0ee846547737793103f23cc46a382e4694e7728e8cb8c48ea51a2bb7a8d"
|
||||||
|
"5.19.0":
|
||||||
|
"5.15.0":
|
||||||
|
"5.15.128":
|
||||||
|
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.128.tar.gz"
|
||||||
|
sha256: "4ce1331bb3877bc92581ec5faff76d63d19e7b1fa174acdda1f5cba4a8f2abf7"
|
||||||
|
"5.14.9":
|
||||||
|
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.14.9.tar.gz"
|
||||||
|
sha256: "b5cd37e6d193c8f6a98e41ce6f9d97260d178e0a3cfc43d7ff684f67c6c25f29"
|
||||||
|
"5.13.9":
|
||||||
|
url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.13.9.tar.gz"
|
||||||
|
sha256: "cc82e4461d5f759c820b74079164450d1f1ad09def9f3356a58814abd0268787"
|
||||||
|
|
@ -6,7 +6,7 @@ import subprocess
|
||||||
from conan import ConanFile
|
from conan import ConanFile
|
||||||
from conan.errors import ConanInvalidConfiguration
|
from conan.errors import ConanInvalidConfiguration
|
||||||
from conan.tools.build import cross_building
|
from conan.tools.build import cross_building
|
||||||
from conan.tools.files import copy, save
|
from conan.tools.files import copy, get, save
|
||||||
|
|
||||||
|
|
||||||
class LinuxKbuildTreeConan(ConanFile):
|
class LinuxKbuildTreeConan(ConanFile):
|
||||||
|
|
@ -22,8 +22,8 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
}
|
}
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
"url": "https://github.com/torvalds/linux.git",
|
"url": "",
|
||||||
"defconfig": "",
|
"defconfig": "defconfig",
|
||||||
"make_modules": False,
|
"make_modules": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,10 +57,13 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
)
|
)
|
||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
self.run(
|
source_url, sha256 = self._linux_source()
|
||||||
"git clone --depth=1 "
|
get(
|
||||||
f"--branch {shlex.quote(self._linux_ref_from_version())} "
|
self,
|
||||||
"https://github.com/torvalds/linux.git linux"
|
source_url,
|
||||||
|
sha256=sha256,
|
||||||
|
destination=os.path.join(self.source_folder, "linux"),
|
||||||
|
strip_root=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
@ -87,16 +90,16 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
|
|
||||||
kernelrelease = self._capture(f"{make_base} kernelrelease")
|
kernelrelease = self._capture(f"{make_base} kernelrelease")
|
||||||
compiler = self._capture(f"{self._cross_gcc} --version").splitlines()[0]
|
compiler = self._capture(f"{self._cross_gcc} --version").splitlines()[0]
|
||||||
git_commit = self._capture(f"git -C {shlex.quote(linux)} rev-parse HEAD")
|
source_url, sha256 = self._linux_source()
|
||||||
|
|
||||||
save(
|
save(
|
||||||
self,
|
self,
|
||||||
os.path.join(self.build_folder, "kbuild-tree-info.txt"),
|
os.path.join(self.build_folder, "kbuild-tree-info.txt"),
|
||||||
"\n".join(
|
"\n".join(
|
||||||
[
|
[
|
||||||
f"url={self.options.url}",
|
f"url={source_url}",
|
||||||
f"ref={self._linux_ref_from_version()}",
|
f"ref={self._linux_ref_from_version()}",
|
||||||
f"git_commit={git_commit}",
|
f"sha256={sha256 or ''}",
|
||||||
f"kernelrelease={kernelrelease}",
|
f"kernelrelease={kernelrelease}",
|
||||||
f"arch={arch}",
|
f"arch={arch}",
|
||||||
f"cross_compile={cross_compile}",
|
f"cross_compile={cross_compile}",
|
||||||
|
|
@ -131,6 +134,25 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
return f"v{version_parts[0]}.{version_parts[1]}"
|
return f"v{version_parts[0]}.{version_parts[1]}"
|
||||||
return f"v{self.version}"
|
return f"v{self.version}"
|
||||||
|
|
||||||
|
def _linux_archive_version(self):
|
||||||
|
version_parts = str(self.version).split(".")
|
||||||
|
if len(version_parts) == 3 and version_parts[2] == "0":
|
||||||
|
return f"{version_parts[0]}.{version_parts[1]}"
|
||||||
|
return str(self.version)
|
||||||
|
|
||||||
|
def _linux_source(self):
|
||||||
|
source = self.conan_data.get("sources", {}).get(str(self.version)) or {}
|
||||||
|
source_url = source.get("url") or self._kernel_cdn_url()
|
||||||
|
return source_url, source.get("sha256")
|
||||||
|
|
||||||
|
def _kernel_cdn_url(self):
|
||||||
|
archive_version = self._linux_archive_version()
|
||||||
|
major = archive_version.split(".", 1)[0]
|
||||||
|
return (
|
||||||
|
f"https://cdn.kernel.org/pub/linux/kernel/v{major}.x/"
|
||||||
|
f"linux-{archive_version}.tar.gz"
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _kernel_arch(self):
|
def _kernel_arch(self):
|
||||||
arch = str(self.settings.arch)
|
arch = str(self.settings.arch)
|
||||||
Loading…
Reference in New Issue