public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] media_build: two fixes + one unresolved issue
@ 2011-10-05  9:23 Hans Verkuil
  2011-10-05 12:46 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2011-10-05  9:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Hi Mauro,

While doing a compatibility build I found three issues. I've got patches for two,
but one issue is still unresolved.

The first is this small patch to get rid of this warning when doing 'make install':

make -C firmware install
make[2]: Entering directory `/home/hve/work/media_build/v4l/firmware'
Installing firmwares at /lib/firmware: vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin 
cpia2/stv0672_vp4.bin av7110/bootcode.bin *.fw* cp: target `/lib/firmware/v4l-pvrusb2-29xxx-01.fw' is not a directory
make[2]: [install] Error 1 (ignored)

The fix is simply to remove '*.fw*' since it doesn't match any files.

diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
index fb53ef2..bcbc784 100644
--- a/v4l/firmware/Makefile
+++ b/v4l/firmware/Makefile
@@ -22,7 +22,7 @@ distclean: clean
 install: default
 	@echo -n "Installing firmwares at $(FW_DIR): "
 	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
-	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
+	-@for i in $(TARGETS); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
 	@echo
 
 rminstall:

I think this fix is fine, unless this is something you want to have for the future.

The other is a kernel naming issue: my aptosid distro (debian based) running
kernel v3.0.0 uses a different naming convention:

$ uname -r
3.0-4.slh.6-aptosid-amd64

So the sublevel is not shown.

This patch makes the sublevel optional (and assumes it to be 0 if absent):

diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
index c19b216..33348d9 100755
--- a/linux/patches_for_kernel.pl
+++ b/linux/patches_for_kernel.pl
@@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
 open IN, $file or die "can't find $file\n";
 
 sub kernel_version($) {
-	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
-	return ($1*65536 + $2*256 + $3);
+	my $sublevel;
+
+	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
+	$sublevel = $3 == "" ? 0 : $3;
+	return ($1*65536 + $2*256 + $sublevel);
 }
 
 my $kernel = kernel_version($version);
diff --git a/v4l/Makefile b/v4l/Makefile
index ab07a7a..311924e 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.
%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
+	@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
 endif
 endif
 
The last issue I have is that the media.ko module isn't installed when I run
'make install'. I tried to fix it, but I got lost in the Makefile/perl magic :-)

Let me know if you are OK with these two patches, and if you can fix the last
issue (or give me some hints on how to fix it), then that would be great!

Regards,

	Hans

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2011-10-05 12:46 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media

Em 05-10-2011 06:23, Hans Verkuil escreveu:
> Hi Mauro,
> 
> While doing a compatibility build I found three issues. I've got patches for two,
> but one issue is still unresolved.
> 
> The first is this small patch to get rid of this warning when doing 'make install':
> 
> make -C firmware install
> make[2]: Entering directory `/home/hve/work/media_build/v4l/firmware'
> Installing firmwares at /lib/firmware: vicam/firmware.fw dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin 
> cpia2/stv0672_vp4.bin av7110/bootcode.bin *.fw* cp: target `/lib/firmware/v4l-pvrusb2-29xxx-01.fw' is not a directory
> make[2]: [install] Error 1 (ignored)
> 
> The fix is simply to remove '*.fw*' since it doesn't match any files.
> 
> diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
> index fb53ef2..bcbc784 100644
> --- a/v4l/firmware/Makefile
> +++ b/v4l/firmware/Makefile
> @@ -22,7 +22,7 @@ distclean: clean
>  install: default
>  	@echo -n "Installing firmwares at $(FW_DIR): "
>  	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
> -	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
> +	-@for i in $(TARGETS); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
>  	@echo

I suspect that, for some unknown reason, you're not capable of downloading the firmwares from
linuxtv.org, or maybe you never ran the build script. The build firmware downloads the latest
version of the firmwares from:
	http://www.linuxtv.org/downloads/firmware/

It should be noticed that the install procedure won't fail if you never downloaded the firmwares,
due to the "-" signal. So, please don't apply this patch.

>  rminstall:
> 
> I think this fix is fine, unless this is something you want to have for the future.
> 
> The other is a kernel naming issue: my aptosid distro (debian based) running
> kernel v3.0.0 uses a different naming convention:
> 
> $ uname -r
> 3.0-4.slh.6-aptosid-amd64
> 
> So the sublevel is not shown.
> 
> This patch makes the sublevel optional (and assumes it to be 0 if absent):
> 
> diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
> index c19b216..33348d9 100755
> --- a/linux/patches_for_kernel.pl
> +++ b/linux/patches_for_kernel.pl
> @@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
>  open IN, $file or die "can't find $file\n";
>  
>  sub kernel_version($) {
> -	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
> -	return ($1*65536 + $2*256 + $3);
> +	my $sublevel;
> +
> +	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
> +	$sublevel = $3 == "" ? 0 : $3;
> +	return ($1*65536 + $2*256 + $sublevel);
>  }
>  
>  my $kernel = kernel_version($version);
> diff --git a/v4l/Makefile b/v4l/Makefile
> index ab07a7a..311924e 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.
> %s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
> +	@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
>  endif
>  endif

Seems OK to me. If you're willing to fix those distro-specific stuff, on Fedora 15, 
the 3.0 kernel were renamed as "2.40", as they wanted to avoid touching on some scripts
(that's what I got from a lwn discussion). Maybe other distros might have done weird
things like that. The only practical consequence I noticed with F15 is that one driver
were disabled (the firewire one).

> The last issue I have is that the media.ko module isn't installed when I run
> 'make install'. I tried to fix it, but I got lost in the Makefile/perl magic :-)

That's weird... I took a look here. My Makefile.media was generated with a line
to install it. See:

@n=0;for i in dvb-ttpci.ko budget-patch.ko ttpci-eeprom.ko budget-av.ko budget.ko budget-core.ko budget-ci.ko;do if [ -f 
"$$i" ]; then if [ $$n -eq 0 ]; then echo -n "	dvb/ttpci/: "; install -d $(DESTDIR)$(KDIR26)/dvb/ttpci; fi; n=$$(($$n+1)); if [ 
 $$n -eq 4 ]; then echo; echo -n "		"; n=1; fi; echo -n "$$i "; install -m 644 -c $$i $(DESTDIR)$(KDIR26)/dvb/ttpci; 
fi; done; if [  $$n -ne 0 ]; then echo; strip --strip-debug $(DESTDIR)$(KDIR26)/dvb/ttpci/*.ko; fi;


@n=0;for i in media.ko;do if [ -f "$$i" ]; then if [ $$n -eq 0 ]; then echo -n "	../linux/drivers/media/: "; insta
ll -d $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; n=$$(($$n+1)); if [  $$n -eq 4 ]; then echo; echo -n "		"; n=1; f
i; echo -n "$$i "; install -m 644 -c $$i $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; done; if [  $$n -ne 0 ]; then echo; stri
p --strip-debug $(DESTDIR)$(KDIR26)/../linux/drivers/media/*.ko; fi;

For me, it is likely a trouble at scripts/make_makefile.pl, on that line of
the script:
		$idir =~ s|^../linux/drivers/media/||;

An one line patch to make the last / optional is probably enough to fix it.

Care to write the patch and fix it?
> 
> Let me know if you are OK with these two patches, and if you can fix the last
> issue (or give me some hints on how to fix it), then that would be great!

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-05 12:46 ` Mauro Carvalho Chehab
@ 2011-10-05 13:45   ` Hans Verkuil
  2011-10-05 16:26     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2011-10-05 13:45 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

On Wednesday 05 October 2011 14:46:16 Mauro Carvalho Chehab wrote:
> Em 05-10-2011 06:23, Hans Verkuil escreveu:
> > Hi Mauro,
> > 
> > While doing a compatibility build I found three issues. I've got patches
> > for two, but one issue is still unresolved.
> > 
> > The first is this small patch to get rid of this warning when doing 'make
> > install':
> > 
> > make -C firmware install
> > make[2]: Entering directory `/home/hve/work/media_build/v4l/firmware'
> > Installing firmwares at /lib/firmware: vicam/firmware.fw
> > dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin
> > cpia2/stv0672_vp4.bin av7110/bootcode.bin *.fw* cp: target
> > `/lib/firmware/v4l-pvrusb2-29xxx-01.fw' is not a directory make[2]:
> > [install] Error 1 (ignored)
> > 
> > The fix is simply to remove '*.fw*' since it doesn't match any files.
> > 
> > diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
> > index fb53ef2..bcbc784 100644
> > --- a/v4l/firmware/Makefile
> > +++ b/v4l/firmware/Makefile
> > @@ -22,7 +22,7 @@ distclean: clean
> > 
> >  install: default
> >  
> >  	@echo -n "Installing firmwares at $(FW_DIR): "
> >  	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p
> >  	$(FW_DIR)/$$i; fi; done
> > 
> > -	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i;
> > done +	-@for i in $(TARGETS); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i;
> > done
> > 
> >  	@echo
> 
> I suspect that, for some unknown reason, you're not capable of downloading
> the firmwares from linuxtv.org, or maybe you never ran the build script.

I never ran the build script. I'm just using 'make dir'.

> The build firmware downloads the latest version of the firmwares from:
> 	http://www.linuxtv.org/downloads/firmware/
> 
> It should be noticed that the install procedure won't fail if you never
> downloaded the firmwares, due to the "-" signal. So, please don't apply
> this patch.

I'll apply this patch instead:

-       -@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
+       -@for i in $(TARGETS) $(wildcard *.fw*); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done

The make wildcard function resolves to nothing if the pattern can't be matched,
thus avoiding the error.

> 
> >  rminstall:
> > I think this fix is fine, unless this is something you want to have for
> > the future.
> > 
> > The other is a kernel naming issue: my aptosid distro (debian based)
> > running kernel v3.0.0 uses a different naming convention:
> > 
> > $ uname -r
> > 3.0-4.slh.6-aptosid-amd64
> > 
> > So the sublevel is not shown.
> > 
> > This patch makes the sublevel optional (and assumes it to be 0 if
> > absent):
> > 
> > diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
> > index c19b216..33348d9 100755
> > --- a/linux/patches_for_kernel.pl
> > +++ b/linux/patches_for_kernel.pl
> > @@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
> > 
> >  open IN, $file or die "can't find $file\n";
> >  
> >  sub kernel_version($) {
> > 
> > -	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
> > -	return ($1*65536 + $2*256 + $3);
> > +	my $sublevel;
> > +
> > +	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
> > +	$sublevel = $3 == "" ? 0 : $3;
> > +	return ($1*65536 + $2*256 + $sublevel);
> > 
> >  }
> >  
> >  my $kernel = kernel_version($version);
> > 
> > diff --git a/v4l/Makefile b/v4l/Makefile
> > index ab07a7a..311924e 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.
> > %s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
> > +	@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
> > 
> >  endif
> >  endif
> 
> Seems OK to me. If you're willing to fix those distro-specific stuff, on
> Fedora 15, the 3.0 kernel were renamed as "2.40", as they wanted to avoid
> touching on some scripts (that's what I got from a lwn discussion). Maybe
> other distros might have done weird things like that. The only practical
> consequence I noticed with F15 is that one driver were disabled (the
> firewire one).

I'll see if I can make a patch for this.

> > The last issue I have is that the media.ko module isn't installed when I
> > run 'make install'. I tried to fix it, but I got lost in the
> > Makefile/perl magic :-)
> 
> That's weird... I took a look here. My Makefile.media was generated with a
> line to install it. See:
> 
> @n=0;for i in dvb-ttpci.ko budget-patch.ko ttpci-eeprom.ko budget-av.ko
> budget.ko budget-core.ko budget-ci.ko;do if [ -f "$$i" ]; then if [ $$n
> -eq 0 ]; then echo -n "	dvb/ttpci/: "; install -d
> $(DESTDIR)$(KDIR26)/dvb/ttpci; fi; n=$$(($$n+1)); if [ $$n -eq 4 ]; then
> echo; echo -n "		"; n=1; fi; echo -n "$$i "; install -m 644 -c $$i
> $(DESTDIR)$(KDIR26)/dvb/ttpci; fi; done; if [  $$n -ne 0 ]; then echo;
> strip --strip-debug $(DESTDIR)$(KDIR26)/dvb/ttpci/*.ko; fi;
> 
> 
> @n=0;for i in media.ko;do if [ -f "$$i" ]; then if [ $$n -eq 0 ]; then echo
> -n "	../linux/drivers/media/: "; insta ll -d
> $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; n=$$(($$n+1)); if [  $$n
> -eq 4 ]; then echo; echo -n "		"; n=1; f i; echo -n "$$i "; install -m 644
> -c $$i $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; done; if [  $$n -ne
> 0 ]; then echo; stri p --strip-debug
> $(DESTDIR)$(KDIR26)/../linux/drivers/media/*.ko; fi;
> 
> For me, it is likely a trouble at scripts/make_makefile.pl, on that line of
> the script:
> 		$idir =~ s|^../linux/drivers/media/||;
> 
> An one line patch to make the last / optional is probably enough to fix it.

You're absolutely right.

The output from make install looks like this:

        video/cx25840/: cx25840.ko 
        dvb/ttusb-dec/: ttusbdecfe.ko ttusb_dec.ko 
        dvb/ngene/: ngene.ko 
        dvb/dm1105/: dm1105.ko 
        ../linux/drivers/media/: media.ko 
        video/gspca/gl860/: gspca_gl860.ko 
        video/et61x251/: et61x251.ko

As you can see it tries to get media.ko from the wrong place. Making the last /
optional fixes this.

> 
> Care to write the patch and fix it?

This patch fixes all three:

diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
index c19b216..33348d9 100755
--- a/linux/patches_for_kernel.pl
+++ b/linux/patches_for_kernel.pl
@@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
 open IN, $file or die "can't find $file\n";
 
 sub kernel_version($) {
-	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
-	return ($1*65536 + $2*256 + $3);
+	my $sublevel;
+
+	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
+	$sublevel = $3 == "" ? 0 : $3;
+	return ($1*65536 + $2*256 + $sublevel);
 }
 
 my $kernel = kernel_version($version);
diff --git a/v4l/Makefile b/v4l/Makefile
index ab07a7a..311924e 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.
%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
+	@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
 endif
 endif
 
diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
index fb53ef2..ff08bf2 100644
--- a/v4l/firmware/Makefile
+++ b/v4l/firmware/Makefile
@@ -22,7 +22,7 @@ distclean: clean
 install: default
 	@echo -n "Installing firmwares at $(FW_DIR): "
 	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
-	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
+	-@for i in $(TARGETS) $(wildcard *.fw*); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
 	@echo
 
 rminstall:
diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl
index 4a578a5..1832e5b 100755
--- a/v4l/scripts/make_makefile.pl
+++ b/v4l/scripts/make_makefile.pl
@@ -32,7 +32,7 @@ sub check_line($$$)
 		# It's a file, add it to list of files to install
 		s/\.o$/.ko/;
 		my $idir = $dir;
-		$idir =~ s|^../linux/drivers/media/||;
+		$idir =~ s|^../linux/drivers/media/?||;
 		$instdir{$idir}{$_} = 1;
 		$count++;
 	}

Regards,

	Hans

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-05 13:45   ` Hans Verkuil
@ 2011-10-05 16:26     ` Mauro Carvalho Chehab
  2011-10-06  8:43       ` Hans Verkuil
  0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2011-10-05 16:26 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media

Em 05-10-2011 10:45, Hans Verkuil escreveu:
> On Wednesday 05 October 2011 14:46:16 Mauro Carvalho Chehab wrote:
>> Em 05-10-2011 06:23, Hans Verkuil escreveu:
>>> Hi Mauro,
>>>
>>> While doing a compatibility build I found three issues. I've got patches
>>> for two, but one issue is still unresolved.
>>>
>>> The first is this small patch to get rid of this warning when doing 'make
>>> install':
>>>
>>> make -C firmware install
>>> make[2]: Entering directory `/home/hve/work/media_build/v4l/firmware'
>>> Installing firmwares at /lib/firmware: vicam/firmware.fw
>>> dabusb/firmware.fw dabusb/bitstream.bin ttusb-budget/dspbootcode.bin
>>> cpia2/stv0672_vp4.bin av7110/bootcode.bin *.fw* cp: target
>>> `/lib/firmware/v4l-pvrusb2-29xxx-01.fw' is not a directory make[2]:
>>> [install] Error 1 (ignored)
>>>
>>> The fix is simply to remove '*.fw*' since it doesn't match any files.
>>>
>>> diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
>>> index fb53ef2..bcbc784 100644
>>> --- a/v4l/firmware/Makefile
>>> +++ b/v4l/firmware/Makefile
>>> @@ -22,7 +22,7 @@ distclean: clean
>>>
>>>   install: default
>>>
>>>   	@echo -n "Installing firmwares at $(FW_DIR): "
>>>   	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p
>>>   	$(FW_DIR)/$$i; fi; done
>>>
>>> -	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i;
>>> done +	-@for i in $(TARGETS); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i;
>>> done
>>>
>>>   	@echo
>>
>> I suspect that, for some unknown reason, you're not capable of downloading
>> the firmwares from linuxtv.org, or maybe you never ran the build script.
>
> I never ran the build script. I'm just using 'make dir'.

If you don't run the script, it won't download the firmwares ;) The build script
does some sanity checks. It also offers a "--git" and "--main-git" to make easier
for developers that work with git trees.

>> The build firmware downloads the latest version of the firmwares from:
>> 	http://www.linuxtv.org/downloads/firmware/
>>
>> It should be noticed that the install procedure won't fail if you never
>> downloaded the firmwares, due to the "-" signal. So, please don't apply
>> this patch.
>
> I'll apply this patch instead:
>
> -       -@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
> +       -@for i in $(TARGETS) $(wildcard *.fw*); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
>
> The make wildcard function resolves to nothing if the pattern can't be matched,
> thus avoiding the error.

Seems fine for me.

>>
>>>   rminstall:
>>> I think this fix is fine, unless this is something you want to have for
>>> the future.
>>>
>>> The other is a kernel naming issue: my aptosid distro (debian based)
>>> running kernel v3.0.0 uses a different naming convention:
>>>
>>> $ uname -r
>>> 3.0-4.slh.6-aptosid-amd64
>>>
>>> So the sublevel is not shown.
>>>
>>> This patch makes the sublevel optional (and assumes it to be 0 if
>>> absent):
>>>
>>> diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
>>> index c19b216..33348d9 100755
>>> --- a/linux/patches_for_kernel.pl
>>> +++ b/linux/patches_for_kernel.pl
>>> @@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
>>>
>>>   open IN, $file or die "can't find $file\n";
>>>
>>>   sub kernel_version($) {
>>>
>>> -	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
>>> -	return ($1*65536 + $2*256 + $3);
>>> +	my $sublevel;
>>> +
>>> +	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
>>> +	$sublevel = $3 == "" ? 0 : $3;
>>> +	return ($1*65536 + $2*256 + $sublevel);
>>>
>>>   }
>>>
>>>   my $kernel = kernel_version($version);
>>>
>>> diff --git a/v4l/Makefile b/v4l/Makefile
>>> index ab07a7a..311924e 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.
>>> %s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };'>  $(obj)/.version
>>> +	@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
>>>
>>>   endif
>>>   endif
>>
>> Seems OK to me. If you're willing to fix those distro-specific stuff, on
>> Fedora 15, the 3.0 kernel were renamed as "2.40", as they wanted to avoid
>> touching on some scripts (that's what I got from a lwn discussion). Maybe
>> other distros might have done weird things like that. The only practical
>> consequence I noticed with F15 is that one driver were disabled (the
>> firewire one).
>
> I'll see if I can make a patch for this.

Ok, thanks!

>>> The last issue I have is that the media.ko module isn't installed when I
>>> run 'make install'. I tried to fix it, but I got lost in the
>>> Makefile/perl magic :-)
>>
>> That's weird... I took a look here. My Makefile.media was generated with a
>> line to install it. See:
>>
>> @n=0;for i in dvb-ttpci.ko budget-patch.ko ttpci-eeprom.ko budget-av.ko
>> budget.ko budget-core.ko budget-ci.ko;do if [ -f "$$i" ]; then if [ $$n
>> -eq 0 ]; then echo -n "	dvb/ttpci/: "; install -d
>> $(DESTDIR)$(KDIR26)/dvb/ttpci; fi; n=$$(($$n+1)); if [ $$n -eq 4 ]; then
>> echo; echo -n "		"; n=1; fi; echo -n "$$i "; install -m 644 -c $$i
>> $(DESTDIR)$(KDIR26)/dvb/ttpci; fi; done; if [  $$n -ne 0 ]; then echo;
>> strip --strip-debug $(DESTDIR)$(KDIR26)/dvb/ttpci/*.ko; fi;
>>
>>
>> @n=0;for i in media.ko;do if [ -f "$$i" ]; then if [ $$n -eq 0 ]; then echo
>> -n "	../linux/drivers/media/: "; insta ll -d
>> $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; n=$$(($$n+1)); if [  $$n
>> -eq 4 ]; then echo; echo -n "		"; n=1; f i; echo -n "$$i "; install -m 644
>> -c $$i $(DESTDIR)$(KDIR26)/../linux/drivers/media; fi; done; if [  $$n -ne
>> 0 ]; then echo; stri p --strip-debug
>> $(DESTDIR)$(KDIR26)/../linux/drivers/media/*.ko; fi;
>>
>> For me, it is likely a trouble at scripts/make_makefile.pl, on that line of
>> the script:
>> 		$idir =~ s|^../linux/drivers/media/||;
>>
>> An one line patch to make the last / optional is probably enough to fix it.
>
> You're absolutely right.
>
> The output from make install looks like this:
>
>          video/cx25840/: cx25840.ko
>          dvb/ttusb-dec/: ttusbdecfe.ko ttusb_dec.ko
>          dvb/ngene/: ngene.ko
>          dvb/dm1105/: dm1105.ko
>          ../linux/drivers/media/: media.ko
>          video/gspca/gl860/: gspca_gl860.ko
>          video/et61x251/: et61x251.ko
>
> As you can see it tries to get media.ko from the wrong place. Making the last /
> optional fixes this.
>
>>
>> Care to write the patch and fix it?
>
> This patch fixes all three:
>
> diff --git a/linux/patches_for_kernel.pl b/linux/patches_for_kernel.pl
> index c19b216..33348d9 100755
> --- a/linux/patches_for_kernel.pl
> +++ b/linux/patches_for_kernel.pl
> @@ -13,8 +13,11 @@ my $file = "../backports/backports.txt";
>   open IN, $file or die "can't find $file\n";
>
>   sub kernel_version($) {
> -	$_[0] =~ m/^(\d+)\.(\d+)\.(\d+)/;
> -	return ($1*65536 + $2*256 + $3);
> +	my $sublevel;
> +
> +	$_[0] =~ m/^(\d+)\.(\d+)\.?(\d*)/;
> +	$sublevel = $3 == "" ? 0 : $3;
> +	return ($1*65536 + $2*256 + $sublevel);
>   }
>
>   my $kernel = kernel_version($version);
> diff --git a/v4l/Makefile b/v4l/Makefile
> index ab07a7a..311924e 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.
> %s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };'>  $(obj)/.version
> +	@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
>   endif
>   endif
>
> diff --git a/v4l/firmware/Makefile b/v4l/firmware/Makefile
> index fb53ef2..ff08bf2 100644
> --- a/v4l/firmware/Makefile
> +++ b/v4l/firmware/Makefile
> @@ -22,7 +22,7 @@ distclean: clean
>   install: default
>   	@echo -n "Installing firmwares at $(FW_DIR): "
>   	-@for i in $(DIRS); do if [ ! -d $(FW_DIR)/$$i ]; then mkdir -p $(FW_DIR)/$$i; fi; done
> -	-@for i in $(TARGETS) *.fw*; do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
> +	-@for i in $(TARGETS) $(wildcard *.fw*); do echo -n "$$i "; cp $$i $(FW_DIR)/$$i; done
>   	@echo
>
>   rminstall:
> diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl
> index 4a578a5..1832e5b 100755
> --- a/v4l/scripts/make_makefile.pl
> +++ b/v4l/scripts/make_makefile.pl
> @@ -32,7 +32,7 @@ sub check_line($$$)
>   		# It's a file, add it to list of files to install
>   		s/\.o$/.ko/;
>   		my $idir = $dir;
> -		$idir =~ s|^../linux/drivers/media/||;
> +		$idir =~ s|^../linux/drivers/media/?||;
>   		$instdir{$idir}{$_} = 1;
>   		$count++;
>   	}
>
> Regards,
>
> 	Hans

Seems perfect for me. Feel free to apply it directly.

Thanks!
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-05 16:26     ` Mauro Carvalho Chehab
@ 2011-10-06  8:43       ` Hans Verkuil
  2011-10-06 10:50         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2011-10-06  8:43 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

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
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-06  8:43       ` Hans Verkuil
@ 2011-10-06 10:50         ` Mauro Carvalho Chehab
  2011-10-06 11:03           ` Hans Verkuil
  0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2011-10-06 10:50 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media

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
  



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-06 10:50         ` Mauro Carvalho Chehab
@ 2011-10-06 11:03           ` Hans Verkuil
  2011-10-06 11:57             ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2011-10-06 11:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

On Thursday 06 October 2011 12:50:30 Mauro Carvalho Chehab wrote:
> 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,$$p
> > atch,$$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.

Yeah, it's 2.6.40 to 3.0 instead of 2.40 to 3.0. It's amazing how quickly you 
forget :-)

> 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.

Nice!

> -
> 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

This comment is wrong, it should be 2.6.40.

> +	$version += 0;
> +	$patchlevel += 0;

These two lines seems to be leftovers from debugging.

I assume you will commit this?

Regards,

	Hans

> +	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,$$pat
> ch,$$sub==""?"0":$$sub,$$_); };' > $(obj)/.version endif
>   endif
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH] media_build: two fixes + one unresolved issue
  2011-10-06 11:03           ` Hans Verkuil
@ 2011-10-06 11:57             ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2011-10-06 11:57 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media

>> 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.
>
> Yeah, it's 2.6.40 to 3.0 instead of 2.40 to 3.0. It's amazing how quickly you
> forget :-)

Yes :)
>
>> 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.
>
> Nice!
>
>> -
>> 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
>
> This comment is wrong, it should be 2.6.40.
>
>> +	$version += 0;
>> +	$patchlevel += 0;
>
> These two lines seems to be leftovers from debugging.

Yes. Ok, fixed on a separate patch.

> I assume you will commit this?

I can do it.

Ok, done!

Thanks!
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-06 11:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-10-06 11:03           ` Hans Verkuil
2011-10-06 11:57             ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox