support building against a particular kernel

Message ID CAEsFdVO+Wn6mSn8dC9D8yR9oy13c0943dM0Or6-55xT4dQTqXQ@mail.gmail.com (mailing list archive)
State Superseded, archived
Headers
Series support building against a particular kernel |

Commit Message

Vincent McIntyre Nov. 9, 2019, 1:25 a.m. UTC
  Support building against a particular kernel

I find it helpful to be able to build the linux-media modules
for a kernel other than the one I am currently running.

signed-off-by: vincent.mcintyre@gmail.com


@@ -579,6 +586,11 @@ depth parameter, in order to get a smaller tree.

 That helps to reduce disk storage and download time.

+=item B<--version> [KERNELVERSION]
+
+Build for a kernel version other than the running kernel. The format of
+the KERNELVERSION string is the same as the output from 'uname -r'.
+
 =back

 =head1 DESCRIPTION
  

Patch

diff --git a/build b/build
index 2f6b3f4..c2067e7 100755
--- a/build
+++ b/build
@@ -14,6 +14,7 @@  my $check_only = 0;
 my $main_git = 0;
 my $depth;
 my @git;
+my $kernel_version = '';

 my $main_git_url = "git://linuxtv.org/media_tree.git";
 my $main_branch = "master";
@@ -27,6 +28,7 @@  GetOptions('v|verbose' => \$level,
           'main_git|main-git' => \$main_git,
           'depth=i' => \$depth,
           'git=s{2}' => \@git,
+          'version=s' => \$kernel_version,
          ) or pod2usage(2);
 pod2usage(1) if $help;
 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
@@ -522,7 +524,12 @@  print "******************\n";
 print "* Start building *\n";
 print "******************\n";

-run("make allyesconfig", "can't select all drivers");
+if ($kernel_version =~ /\S/) {
+    print "Building for kernel version $kernel_version\n";
+    run("make allyesconfig VER=$kernel_version", "can't select all drivers");
+} else {
+    run("make allyesconfig", "can't select all drivers");
+}
 run("make", "build failed");

 print "**********************************************************\n";
@@ -539,7 +546,7 @@  build - Builds the media drivers without needing
to compile a new kernel
 =head1 SYNOPSIS

 build [--help] [--man] [--verbose] [--check-only] [<--git> [URL] [BRANCH]]
- [--main-git] [--depth [DEPTH]]
+ [--main-git] [--depth [DEPTH]] [--version [KERNELVERSION]]

 =head1 OPTIONS