public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media <linux-media@vger.kernel.org>
Subject: Re: [RFC PATCH] media_build: two fixes + one unresolved issue
Date: Thu, 06 Oct 2011 07:50:30 -0300	[thread overview]
Message-ID: <4E8D87F6.10502@redhat.com> (raw)
In-Reply-To: <201110061043.24652.hverkuil@xs4all.nl>

Em 06-10-2011 05:43, Hans Verkuil escreveu:
> On Wednesday 05 October 2011 18:26:20 Mauro Carvalho Chehab wrote:
>> Em 05-10-2011 10:45, Hans Verkuil escreveu:
>>> I'll see if I can make a patch for this.
>>
>> Ok, thanks!
>
> Mauro, can you test this patch? It should translate 2.4x naming convention to 3.x.
>
> Regards,
>
> 	Hans
>
> diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
> index 33348d9..00d8b7f 100755
> --- a/linux/patches_for_kernel.pl
> +++ b/linux/patches_for_kernel.pl
> @@ -13,11 +13,15 @@ my $file = "../backports/backports.txt";
>   open IN, $file or die "can't find $file\n";
>
>   sub kernel_version($) {
> -	my $sublevel;
> +	my ($version, $patchlevel, $sublevel) = $_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
>
> -	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
> -	$sublevel = $3 == "" ? 0 : $3;
> -	return ($1*65536 + $2*256 + $sublevel);
> +	# fix kernel version for distros that 'translated' 3.0 to 2.40
> +	if ($version == 2&&  $patchlevel>= 40) {
> +		$version = 3;
> +		$patchlevel -= 40;
> +	}
> +	$sublevel = 0 if ($sublevel == "");
> +	return ($version * 65536 + $patchlevel * 256 + $sublevel);
>   }
>
>   my $kernel = kernel_version($version);
> diff --git a/v4l/Makefile b/v4l/Makefile
> index 311924e..57302cc 100644
> --- a/v4l/Makefile
> +++ b/v4l/Makefile
> @@ -248,7 +248,7 @@ ifneq ($(VER),)
>   	@echo $(VER)|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf
> ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };'>  $(obj)/.version
>   else
>   	@echo No version yet, using `uname -r`
> -	@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.?([0-9]*)(.*)$$/) { printf
> ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s",$$1,$$2,$$3==""?"0":$$3,$$_); };'>  $(obj)/.version
> +	@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.?([0-9]*)(.*)$$/) { $$ver = $$1; $$patch = $$2; $$sub = $$3; if ($$ver == 2&&  $$patch>= 40) {
> $$ver = 3; $$patch -= 40; }; printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s",$$ver,$$patch,$$sub==""?"0":
> $$sub,$$_); };'>  $(obj)/.version
>   endif
>   endif
>

Hi Hans,

The idea was good, but the patch didn't work ;)

Fixed it. It is now properly recognizing the version 2.40 as 3.0.0 on both
scripts. See enclosed. I didn't apply it yet.

Btw, I just applied another fix upstream. The most noticed effect is that calling
make -C linux apply_patches will now show:
	Patches for 2.6.40.4-5.fc15.x86_64 already applied.
instead of:
	Patches for  already applied.

-
Fix Name convention for kernels 2.6.40 and upper

Based on a patch from Hans Verkuil <hverkuil@xs4all.nl>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
index 33348d9..2669e6c 100755
--- a/linux/patches_for_kernel.pl
+++ b/linux/patches_for_kernel.pl
@@ -13,11 +13,18 @@ my $file = "../backports/backports.txt";
  open IN, $file or die "can't find $file\n";
  
  sub kernel_version($) {
-	my $sublevel;
+	my ($version, $patchlevel, $sublevel) = $_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
  
-	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
-	$sublevel = $3 == "" ? 0 : $3;
-	return ($1*65536 + $2*256 + $sublevel);
+	# fix kernel version for distros that 'translated' 3.0 to 2.40
+	$version += 0;
+	$patchlevel += 0;
+	if ($version == 2 && $patchlevel == 6 && $sublevel >= 40) {
+		$version = 3;
+		$patchlevel = $sublevel - 40;
+		$sublevel = 0;
+	}
+	$sublevel = 0 if ($sublevel == "");
+	return ($version * 65536 + $patchlevel * 256 + $sublevel);
  }
  
  my $kernel = kernel_version($version);
diff --git a/v4l/Makefile b/v4l/Makefile
index 311924e..580c997 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -248,7 +248,7 @@ ifneq ($(VER),)
  	@echo $(VER)|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
  else
  	@echo No version yet, using `uname -r`
-	@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.?([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s",$$1,$$2,$$3==""?"0":$$3,$$_); };' > $(obj)/.version
+	@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.?([0-9]*)(.*)$$/) { $$ver = $$1; $$patch = $$2; $$sub = $$3; if ($$ver == 2 && $$patch == 6 && $$sub >= 40) { $$ver = 3; $$patch = $$sub - 40; $$sub = 0; }; printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s",$$ver,$$patch,$$sub==""?"0":$$sub,$$_); };' > $(obj)/.version
  endif
  endif
  



  reply	other threads:[~2011-10-06 10:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05  9:23 [RFC PATCH] media_build: two fixes + one unresolved issue Hans Verkuil
2011-10-05 12:46 ` Mauro Carvalho Chehab
2011-10-05 13:45   ` Hans Verkuil
2011-10-05 16:26     ` Mauro Carvalho Chehab
2011-10-06  8:43       ` Hans Verkuil
2011-10-06 10:50         ` Mauro Carvalho Chehab [this message]
2011-10-06 11:03           ` Hans Verkuil
2011-10-06 11:57             ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8D87F6.10502@redhat.com \
    --to=mchehab@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox