Skip to content

Commit

Permalink
linux-backports: new package
Browse files Browse the repository at this point in the history
(a.k.a./formerly named compat-wireless, then compat-drivers)

The backports patches have submitted upstream [1].

[1] http://marc.info/?l=linux-backports&m=139958161612447&w=4

Signed-off-by: Samuel Martin <[email protected]>
  • Loading branch information
tSed committed Jun 23, 2014
1 parent c52bd99 commit d7a3051
Show file tree
Hide file tree
Showing 14 changed files with 507 additions and 0 deletions.
2 changes: 2 additions & 0 deletions linux/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ define LINUX_CONFIGURE_CMDS
$(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_NETWORK,$(@D)/.config))
$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),
$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config))
$(if $(BR2_PACKAGE_LINUX_BACKPORTS),
$(call KCONFIG_ENABLE_OPT,CONFIG_MODULES,$(@D)/.config))
yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
endef

Expand Down
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ endif
source "package/iucode-tool/Config.in"
source "package/kbd/Config.in"
source "package/lcdproc/Config.in"
source "package/linux-backports/Config.in"
source "package/lm-sensors/Config.in"
source "package/lshw/Config.in"
source "package/lsuio/Config.in"
Expand Down
40 changes: 40 additions & 0 deletions package/linux-backports/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
config BR2_PACKAGE_LINUX_BACKPORTS
bool "linux-backports"
depends on BR2_LINUX_KERNEL
help
Compatibility driver backports (former compat-wireless).

http://wireless.kernel.org/

#
# Configuration selection
#
if BR2_PACKAGE_LINUX_BACKPORTS

choice
prompt "Backport configuration"
default BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG

config BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG
bool "Using a defconfig"

config BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG
bool "Using a custom config file"

endchoice

config BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG
string "Defconfig name"
depends on BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG
help
Name of the backports defconfig file to use, without the
leading 'defconfig-'. The defconfig is located in
defconfigs/ in the linux-backports tree.

config BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG
help
Path to the linux-backports configuration file

endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 83b3f7e3a9b2a2b3057b32fd41bed4b4503e86d3 Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 15:06:15 +0200
Subject: [PATCH 01/10] backports: Makefile: introduce KROOT and fix
INSTALL_MOD_PATH definition

INSTALL_MOD_PATH should point to the root directory of the target
rootfs, what is KROOT.

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index ea3982b..3ff74d9 100644
--- a/Makefile
+++ b/Makefile
@@ -9,10 +9,11 @@ SHELL := /bin/bash
BACKPORT_PWD := $(shell pwd)

KMODDIR ?= updates
-ifneq ($(origin KLIB), undefined)
-KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)"
+ifneq ($(origin KROOT), undefined)
+KMODPATH_ARG := "INSTALL_MOD_PATH=$(KROOT)"
else
KLIB := /lib/modules/$(shell uname -r)/
+KROOT := /
KMODPATH_ARG :=
endif
KLIB_BUILD ?= $(KLIB)/build/
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 0f44ff07f1a3cfd80638695d6f625f39ec8b22ef Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 15:09:34 +0200
Subject: [PATCH 02/10] backports: Makefile: introduce KVERSION and rework KLIB
definition

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3ff74d9..e9256e4 100644
--- a/Makefile
+++ b/Makefile
@@ -12,10 +12,18 @@ KMODDIR ?= updates
ifneq ($(origin KROOT), undefined)
KMODPATH_ARG := "INSTALL_MOD_PATH=$(KROOT)"
else
-KLIB := /lib/modules/$(shell uname -r)/
KROOT := /
KMODPATH_ARG :=
endif
+
+ifneq ($(origin KLIB_BUILD), undefined)
+KVERSION := $(shell $(MAKE) -C $(KLIB_BUILD) $(if $(ARCH),ARCH=$(ARCH)) \
+ --no-print-directory -s kernelrelease)
+else
+KVERSION := $(shell uname -r)
+endif
+
+KLIB := $(KROOT)/lib/modules/$(KVERSION)
KLIB_BUILD ?= $(KLIB)/build/
KERNEL_CONFIG := $(KLIB_BUILD)/.config
KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 67644fb4eb9638e941255cc37dc450b8383c83e9 Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 15:10:08 +0200
Subject: [PATCH 03/10] backports: Makefile: export KROOT and KVERSION
variables

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index e9256e4..2f446e6 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ KERNEL_CONFIG := $(KLIB_BUILD)/.config
KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')

-export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG
+export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG KROOT KVERSION

# disable built-in rules for this file
.SUFFIXES:
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From fbab3acdb2043fb24fb557e536e15aa7c2db0a15 Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 15:45:11 +0200
Subject: [PATCH 04/10] backports: blacklist.sh: support install root not in /

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile.real | 2 +-
scripts/blacklist.sh | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile.real b/Makefile.real
index f60d5ca..5a25db4 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -92,7 +92,7 @@ install: modules
@$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) \
INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \
modules_install
- @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
+ @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT)
@./scripts/compress_modules.sh $(KLIB)/$(KMODDIR)
@./scripts/check_depmod.sh
@/sbin/depmod -a
diff --git a/scripts/blacklist.sh b/scripts/blacklist.sh
index f941c4a..f995f11 100755
--- a/scripts/blacklist.sh
+++ b/scripts/blacklist.sh
@@ -1,10 +1,11 @@
#!/bin/bash

-BLACKLIST_CONF="/etc/modprobe.d/backports.conf"
-BLACKLIST_MAP=".blacklist.map"
-
MODULE_DIR=$1
MODULE_UPDATES=$2
+KROOT=$3
+
+BLACKLIST_CONF="$KROOT/etc/modprobe.d/backports.conf"
+BLACKLIST_MAP=".blacklist.map"

if [[ ! -d $MODULE_DIR ]]; then
exit
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 44c7269249a5cbf4b0b96d99ec63aac04f05cebf Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 15:55:31 +0200
Subject: [PATCH 05/10] backports: check_depmod.sh: support install root not in
/

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile.real | 6 ++++--
scripts/check_depmod.sh | 7 ++++---
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile.real b/Makefile.real
index 5a25db4..a12a0db 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -6,6 +6,8 @@ else
export BACKPORTS_GIT_TRACKER_DEF=
endif

+DEPMOD ?= /sbin/depmod
+
# disable built-in rules for this file
.SUFFIXES:

@@ -94,8 +96,8 @@ install: modules
modules_install
@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT)
@./scripts/compress_modules.sh $(KLIB)/$(KMODDIR)
- @./scripts/check_depmod.sh
- @/sbin/depmod -a
+ @./scripts/check_depmod.sh $(DEPMOD) $(KROOT)
+ @$(DEPMOD) -a
@./scripts/update-initramfs.sh $(KLIB)
@echo
@echo Your backported driver modules should be installed now.
diff --git a/scripts/check_depmod.sh b/scripts/check_depmod.sh
index 6123894..9f2e238 100755
--- a/scripts/check_depmod.sh
+++ b/scripts/check_depmod.sh
@@ -6,13 +6,14 @@

# Seems Mandriva has an $DEPMOD_DIR but it doesn't have any files,
# so lets deal with those distributions.
-DEPMOD_CONF="/etc/depmod.conf"
+DEPMOD_CMD="${1:-depmod}"
+KROOT="${2:-/}"
+DEPMOD_CONF="$KROOT/etc/depmod.conf"
DEPMOD_CONF_TMP="$DEPMOD_CONF.backports.old"
-DEPMOD_DIR="/etc/depmod.d/"
+DEPMOD_DIR="$KROOT/etc/depmod.d/"
BACKPORT_DEPMOD_FILE="backports.conf"
GREP_REGEX_UPDATES="^[[:space:]]*search.*[[:space:]]updates\([[:space:]]\|$\)"
GREP_REGEX_SEARCH="^[[:space:]]*search[[:space:]].\+$"
-DEPMOD_CMD="depmod"

function add_compat_depmod_conf {
echo "NOTE: Your distribution lacks an $DEPMOD_DIR directory with "
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 32af7610d8db0591180d803ccd714d6bd1e7593e Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 16:08:52 +0200
Subject: [PATCH 06/10] backports: Makefile.real: use depmod.sh instead of the
depmod program

Call depmod.sh from the kernel source tree and set all parameter to
improve cross-compilation support.

This way, target root location, kernel version and symbol prefix are
also handled.

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile.real | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile.real b/Makefile.real
index a12a0db..1dc9323 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -97,7 +97,11 @@ install: modules
@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT)
@./scripts/compress_modules.sh $(KLIB)/$(KMODDIR)
@./scripts/check_depmod.sh $(DEPMOD) $(KROOT)
- @$(DEPMOD) -a
+ @$(KMODPATH_ARGS) $(KLIB_BUILD)/scripts/depmod.sh \
+ $(DEPMOD) \
+ $(KVERSION) \
+ "$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \
+ $(KLIB_BUILD)/.config)"
@./scripts/update-initramfs.sh $(KLIB)
@echo
@echo Your backported driver modules should be installed now.
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From f374a3e33fac77a0d639314653194c5cf5c5c94c Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 16:19:31 +0200
Subject: [PATCH 07/10] backports: Makefile.real: disable update-initramfs.sh
execution when cross-compiling

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile.real | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.real b/Makefile.real
index 1dc9323..2503016 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -102,7 +102,7 @@ install: modules
$(KVERSION) \
"$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \
$(KLIB_BUILD)/.config)"
- @./scripts/update-initramfs.sh $(KLIB)
+ @test -n "$(CROSS_COMPILE)" || ./scripts/update-initramfs.sh $(KLIB)
@echo
@echo Your backported driver modules should be installed now.
@echo Reboot.
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From d09feb79cb46c3c7c7b211043d88b3fc951f922b Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Thu, 8 May 2014 16:20:12 +0200
Subject: [PATCH 08/10] backports: Makefile.real: silent reboot message when
cross-compiling

Signed-off-by: Samuel Martin <[email protected]>
---
Makefile.real | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile.real b/Makefile.real
index 2503016..3be1913 100644
--- a/Makefile.real
+++ b/Makefile.real
@@ -103,10 +103,12 @@ install: modules
"$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \
$(KLIB_BUILD)/.config)"
@test -n "$(CROSS_COMPILE)" || ./scripts/update-initramfs.sh $(KLIB)
- @echo
- @echo Your backported driver modules should be installed now.
- @echo Reboot.
- @echo
+ @if test ! -n "$(CROSS_COMPILE)" ; then \
+ echo ; \
+ echo Your backported driver modules should be installed now. ; \
+ echo Reboot. ; \
+ echo ; \
+ fi

.PHONY: modules_install
modules_install: install
--
1.9.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 9f13e8636354f53ad9a82715f30bc7733daaf92f Mon Sep 17 00:00:00 2001
From: Samuel Martin <[email protected]>
Date: Wed, 7 May 2014 16:40:25 +0200
Subject: [PATCH 09/10] backports: compress_module.sh: gzip silently overrides
existing compressed modules

Signed-off-by: Samuel Martin <[email protected]>
---
scripts/compress_modules.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/compress_modules.sh b/scripts/compress_modules.sh
index b2034c2..631eec9 100755
--- a/scripts/compress_modules.sh
+++ b/scripts/compress_modules.sh
@@ -7,6 +7,6 @@ source ./scripts/mod_helpers.sh
if test "$(mod_filename mac80211)" = "mac80211.ko.gz" ; then
for driver in $(find "$1" -type f -name *.ko); do
echo COMPRESS $driver
- gzip -9 $driver
+ gzip -f -9 $driver
done
fi
--
1.9.2

Loading

0 comments on commit d7a3051

Please sign in to comment.