linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] bin/ckmake: Relax distribution check
@ 2012-05-27 10:38 Ozan Çağlayan
  2012-05-27 10:38 ` [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu Ozan Çağlayan
  2012-06-11 18:30 ` [PATCH 1/2] bin/ckmake: Relax distribution check Luis R. Rodriguez
  0 siblings, 2 replies; 5+ messages in thread
From: Ozan Çağlayan @ 2012-05-27 10:38 UTC (permalink / raw)
  To: mcgrof
  Cc: lf_driver_backport, linux-wireless, linux-bluetooth,
	Ozan Çağlayan

Do not check specifically for Ubuntu as we will be using Ubuntu vanilla
kernels for every distribution.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
---
 bin/ckmake |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/bin/ckmake b/bin/ckmake
index 2d422af..9956cf1 100755
--- a/bin/ckmake
+++ b/bin/ckmake
@@ -31,18 +31,9 @@ ARGS=""
 
 RET=""
 
-LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
-case $LSB_RED_ID in
-"Ubuntu")
-	for i in $(find /lib/modules/ -type d -name \*generic\* | sort -n -r | grep -v -E '\-[[:alnum:]]{1,2}\-'); do
-		KLIBS="$KLIBS $i"
-	done
-	;;
-*)
-	echo -e "Unsupported distribution"
-	exit
-	;;
-esac
+for i in $(find /lib/modules/ -type d -name \*generic\* | sort -n -r | grep -v -E '\-[[:alnum:]]{1,2}\-'); do
+	KLIBS="$KLIBS $i"
+done
 
 function tee_color_split()
 {
-- 
1.7.10.2


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

* [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu
  2012-05-27 10:38 [PATCH 1/2] bin/ckmake: Relax distribution check Ozan Çağlayan
@ 2012-05-27 10:38 ` Ozan Çağlayan
  2012-05-27 10:46   ` Ozan Çağlayan
  2012-06-11 18:37   ` Luis R. Rodriguez
  2012-06-11 18:30 ` [PATCH 1/2] bin/ckmake: Relax distribution check Luis R. Rodriguez
  1 sibling, 2 replies; 5+ messages in thread
From: Ozan Çağlayan @ 2012-05-27 10:38 UTC (permalink / raw)
  To: mcgrof
  Cc: lf_driver_backport, linux-wireless, linux-bluetooth,
	Ozan Çağlayan

Use Ubuntu PPA vanilla kernels on other distributions too.
The .deb files are extracted using 'ar' and 'tar'.

Also check if the target directory exists before downloading
the deb files.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
---
 bin/get-compat-kernels |   81 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 57 insertions(+), 24 deletions(-)

diff --git a/bin/get-compat-kernels b/bin/get-compat-kernels
index 7a253c2..6cac898 100755
--- a/bin/get-compat-kernels
+++ b/bin/get-compat-kernels
@@ -10,6 +10,9 @@
 # to test compile the Linux kernel compatibility module. You can
 # then use ckmake to cross compile against all supported kernels.
 
+KERNELS=""
+KPATH="http://kernel.ubuntu.com/~kernel-ppa/mainline/"
+
 function get_ubuntu_kernels() {
 
 	ARCH=$(uname -m)
@@ -28,10 +31,6 @@ function get_ubuntu_kernels() {
 		;;
 	esac
 
-	KERNELS=""
-
-	KPATH="http://kernel.ubuntu.com/~kernel-ppa/mainline/"
-
 	KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-headers-2.6.24-020624_2.6.24-020624_all.deb"
 	KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-headers-2.6.24-020624-generic_2.6.24-020624_${TARGET}.deb"
 	KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-image-2.6.24-020624-generic_2.6.24-020624_${TARGET}.deb"
@@ -121,19 +120,63 @@ function get_ubuntu_kernels() {
 			continue
 		fi
 
-		if [[ ! -f $FILE ]]; then
+		# Do not download if installed, I think this
+		# workarounds the below XXX: comment.
+		if [[ ! -d /usr/src/$PKG && ! -f $FILE ]]; then
 			wget -c $i
 		fi
 	done
 
-	# Let dpkg figure out dependency magic.
-	#
-	# XXX: I tried adding some magic to not install a package if
-	# if its already presently installed but then had to deal
-	# with the dependency mess. I welcome someone else to
-	# figure this out. Running this can come in handy once
-	# a new public kernel gets released.
-	sudo dpkg -i *.deb
+	LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
+	case $LSB_RED_ID in
+	"Ubuntu")
+		# Let dpkg figure out dependency magic.
+		#
+		# XXX: I tried adding some magic to not install a package if
+		# if its already presently installed but then had to deal
+		# with the dependency mess. I welcome someone else to
+		# figure this out. Running this can come in handy once
+		# a new public kernel gets released.
+		sudo dpkg -i *.deb
+		;;
+	*)
+		# For every other distribution around
+
+		# Create a temporary directory first
+		TEMP_DIR=`mktemp -d`
+
+		# Check whether 'ar' exists
+		ar V 2>&1 | grep -q "GNU ar"
+		if [[ $? != 0 ]]; then
+			echo "ar is needed to extract the .deb files. Please install binutils."
+			exit
+		fi
+
+		for deb in $(ls linux-*.deb); do
+			DIR_NAME=$(echo $deb | awk -F"_" '{print $1}')
+			if [[ ! -d /usr/src/$DIR_NAME ]]; then
+				echo "Extracting $deb..."
+				ar p $deb data.tar.gz | sudo tar xz --exclude=usr/share -C $TEMP_DIR
+			fi
+		done
+
+		# Move the extracted folders into the system
+		if [[ -d $TEMP_DIR/lib/modules ]]; then
+			mv $TEMP_DIR/lib/modules/* /lib/modules
+		fi
+		if [[ -d $TEMP_DIR/usr/src ]]; then
+			# 2.6.2[45678] has a bug with make 3.82 and it should be fixed
+			# as Fedora uses make 3.82. Ubuntu still sticks with 3.81
+			# so no need to touch in case of Ubuntu.
+			sed -i 's#^/ %/:#%/:#' $TEMP_DIR/usr/src/linux-headers-2.6.2[45678]-0*/Makefile &>/dev/null
+
+			mv $TEMP_DIR/usr/src/* /usr/src
+		fi
+
+		# Remove the temporary directory
+		rm -rf $TEMP_DIR
+		;;
+	esac
 }
 
 function usage() {
@@ -158,14 +201,4 @@ if [[ $# -eq 1 && $1 = "-i" ]]; then
 	INSTALL_IMAGES="y"
 fi
 
-
-LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
-case $LSB_RED_ID in
-"Ubuntu")
-	get_ubuntu_kernels
-	;;
-*)
-	echo -e "Unsupported distribution"
-	exit
-	;;
-esac
+get_kernels
-- 
1.7.10.2


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

* Re: [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu
  2012-05-27 10:38 ` [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu Ozan Çağlayan
@ 2012-05-27 10:46   ` Ozan Çağlayan
  2012-06-11 18:37   ` Luis R. Rodriguez
  1 sibling, 0 replies; 5+ messages in thread
From: Ozan Çağlayan @ 2012-05-27 10:46 UTC (permalink / raw)
  To: mcgrof; +Cc: lf_driver_backport, linux-wireless, linux-bluetooth

On Sun, May 27, 2012 at 1:38 PM, Ozan Çağlayan <ozancag@gmail.com> wrote:
> Use Ubuntu PPA vanilla kernels on other distributions too.
> The .deb files are extracted using 'ar' and 'tar'.
>
> Also check if the target directory exists before downloading
> the deb files.
>
> Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>

This patch shouldn't introduce any side effects for Ubuntu users. I
only changed a conditional to check
if the debs are installed by looking whether the directories are found
in the system.

There's also a "make 3.82" bug found in kernels < 2.6.29. I fixed that
using sed. As Ubuntu sticks with make 3.81, there's no need to fix
that bug when the system is Ubuntu.

I build tested with Ubuntu PPA's on Fedora 17 x86_64:

[root@ozzyfedora compat]# bin/ckmake
Trying kernel                  3.3.0-030300rc2-generic	[FAILED] (This
is caused because of the latest CoDel backports, ignore this)
Trying kernel                     3.2.2-030202-generic	[OK]
Trying kernel                    3.1.10-030110-generic	[OK]
Trying kernel                    3.0.18-030018-generic	[OK]
Trying kernel                  2.6.39-02063904-generic	[OK]
Trying kernel                  2.6.38-02063808-generic	[OK]
Trying kernel                  2.6.37-02063706-generic	[OK]
Trying kernel                  2.6.36-02063604-generic	[OK]
Trying kernel                  2.6.35-02063512-generic	[OK]
Trying kernel                  2.6.34-02063410-generic	[OK]
Trying kernel                  2.6.33-02063305-generic	[OK]
Trying kernel                  2.6.32-02063255-generic	[OK]
Trying kernel                  2.6.31-02063113-generic	[OK]
Trying kernel                  2.6.30-02063010-generic	[OK]
Trying kernel                  2.6.29-02062906-generic	[OK]
Trying kernel                  2.6.28-02062810-generic	[OK]
Trying kernel                    2.6.27-020627-generic	[OK]
Trying kernel                    2.6.26-020626-generic	[OK]
Trying kernel                    2.6.25-020625-generic	[OK]
Trying kernel                    2.6.24-020624-generic	[OK]

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

* Re: [PATCH 1/2] bin/ckmake: Relax distribution check
  2012-05-27 10:38 [PATCH 1/2] bin/ckmake: Relax distribution check Ozan Çağlayan
  2012-05-27 10:38 ` [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu Ozan Çağlayan
@ 2012-06-11 18:30 ` Luis R. Rodriguez
  1 sibling, 0 replies; 5+ messages in thread
From: Luis R. Rodriguez @ 2012-06-11 18:30 UTC (permalink / raw)
  To: Ozan Çağlayan
  Cc: mcgrof, lf_driver_backport, linux-wireless, linux-bluetooth

On Sun, May 27, 2012 at 3:38 AM, Ozan Çağlayan <ozancag@gmail.com> wrote:
> Do not check specifically for Ubuntu as we will be using Ubuntu vanilla
> kernels for every distribution.
>
> Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>

This change removes the lsb check but -- at this point in the patch
life cycle if you run this code it will not work for other Linux
distributions. Its best to leave this patch then for later *after* you
have addressed fixing using the script for other Linux distributions.

  Luis

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

* Re: [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu
  2012-05-27 10:38 ` [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu Ozan Çağlayan
  2012-05-27 10:46   ` Ozan Çağlayan
@ 2012-06-11 18:37   ` Luis R. Rodriguez
  1 sibling, 0 replies; 5+ messages in thread
From: Luis R. Rodriguez @ 2012-06-11 18:37 UTC (permalink / raw)
  To: Ozan Çağlayan
  Cc: mcgrof, lf_driver_backport, linux-wireless, linux-bluetooth

On Sun, May 27, 2012 at 3:38 AM, Ozan Çağlayan <ozancag@gmail.com> wrote:
> Use Ubuntu PPA vanilla kernels on other distributions too.
> The .deb files are extracted using 'ar' and 'tar'.
>
> Also check if the target directory exists before downloading
> the deb files.
>
> Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
> ---
>  bin/get-compat-kernels |   81 ++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 57 insertions(+), 24 deletions(-)
>
> diff --git a/bin/get-compat-kernels b/bin/get-compat-kernels
> index 7a253c2..6cac898 100755
> --- a/bin/get-compat-kernels
> +++ b/bin/get-compat-kernels
> @@ -10,6 +10,9 @@
>  # to test compile the Linux kernel compatibility module. You can
>  # then use ckmake to cross compile against all supported kernels.
>
> +KERNELS=""
> +KPATH="http://kernel.ubuntu.com/~kernel-ppa/mainline/"
> +
>  function get_ubuntu_kernels() {
>
>        ARCH=$(uname -m)
> @@ -28,10 +31,6 @@ function get_ubuntu_kernels() {
>                ;;
>        esac
>
> -       KERNELS=""
> -
> -       KPATH="http://kernel.ubuntu.com/~kernel-ppa/mainline/"
> -
>        KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-headers-2.6.24-020624_2.6.24-020624_all.deb"
>        KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-headers-2.6.24-020624-generic_2.6.24-020624_${TARGET}.deb"
>        KERNELS="$KERNELS ${KPATH}/v2.6.24/linux-image-2.6.24-020624-generic_2.6.24-020624_${TARGET}.deb"
> @@ -121,19 +120,63 @@ function get_ubuntu_kernels() {
>                        continue
>                fi
>
> -               if [[ ! -f $FILE ]]; then
> +               # Do not download if installed, I think this
> +               # workarounds the below XXX: comment.

If I merge this patch the "XXX" comment would no longer present so
anyone reading this comment would not understand what was being
referred to with this. If this patch was meant more as an [RFC] then
the placement of the comment makes sense but my recommendation would
be to put these type of ephemeral comments right below the --- after
the commig log and right before the diff stat.

> +               if [[ ! -d /usr/src/$PKG && ! -f $FILE ]]; then

It is certainly a nice additional check, I'll take it, and yeah you
can remove the comment also then.

Nice stuff, I'll take these patches, feel free to send an [PATCH v2]!

  Luis

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

end of thread, other threads:[~2012-06-11 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 10:38 [PATCH 1/2] bin/ckmake: Relax distribution check Ozan Çağlayan
2012-05-27 10:38 ` [PATCH 2/2] bin/get-compat-kernels: Do not depend on Ubuntu Ozan Çağlayan
2012-05-27 10:46   ` Ozan Çağlayan
2012-06-11 18:37   ` Luis R. Rodriguez
2012-06-11 18:30 ` [PATCH 1/2] bin/ckmake: Relax distribution check Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).