Get rid of the static kernel configuration files

With a backported patch from the OpenWrt trunk, it is now easy to generate an
equivalent configuration using CONFIG_ALL_KMODS.

The build will take a bit longer because all kernel module packages are actually
built even when they are not included in the image, but adding new targets
becomes a lot easier.

Also, related documentation updates and fixes.
This commit is contained in:
Matthias Schiffer 2015-03-16 13:49:25 +01:00
parent 41df7400d8
commit 630de84465
16 changed files with 73 additions and 24225 deletions

View File

@ -73,30 +73,23 @@ won't run correctly without some adjustments, so better double check that everyt
Add support to the build system
'''''''''''''''''''''''''''''''
A directory for the new target must be created under ``targets``, and it must be added
to ``targets/targets.mk``. In the new target directory, four files must be created:
to ``targets/targets.mk``. In the new target directory, three files must be created:
* config
* kernel-config
* kernel-vermagic
* profiles.mk
* vermagic
The file ``config`` can be used to add additional, target-specific options to the OpenWrt config. If such options
aren't necessary, it can be left empty. For ``profiles.mk``, see :ref:`hardware-adding-profiles`.
The file ``config`` can be used to add additional, target-specific options to the OpenWrt config. It
must at least select the correct target and subtarget. For ``profiles.mk``, see :ref:`hardware-adding-profiles`.
The files ``kernel-config`` and ``kernel-vermagic`` must have the correct content so kernel modules from the upstream repositories
can be easily installed. The OpenWrt version a Gluon release is based on is defined by the upstream package repo URL in ``include/gluon.mk``
(in the variable ``CONFIG_VERSION_REPO``); at the time this documentation was written, this was ``barrier_breaker/14.07-rc3``; whenever
the package repo is updated, all ``kernel-config`` and ``kernel-vermagic`` files must be updated as well.
The files ``vermagic`` must have the correct content so kernel modules from the upstream repositories
can be installed without dependency issues. The OpenWrt version a Gluon release is based on is defined by the upstream package repo URL in ``include/gluon.mk``
(in the variable ``CONFIG_VERSION_REPO``); at the time this documentation was written, this was ``barrier_breaker/14.07``; whenever
the package repo is updated, all ``vermagic`` files must be updated as well.
The file ``kernel-vermagic`` just contains a hash which is part of the version number of the kernel package. So in the case of ``ar71xx-generic`` on
``barrier_breaker/14.07-rc3``, we look in the directory ``https://downloads.openwrt.org/barrier_breaker/14.07-rc3/ar71xx/generic/packages/`` and
find that the kernel package is called ``kernel_3.10.49-1-94831e5bcf361d1c03e87a15e152b0e8_ar71xx.ipk``. This makes the ``kernel-vermagic`` the
string ``94831e5bcf361d1c03e87a15e152b0e8``.
For ``kernel-config``, the OpenWrt image builder must be downloaded. Again, for ``ar71xx-generic`` on
``barrier_breaker/14.07-rc3``, we download ``OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2``
from ``https://downloads.openwrt.org/barrier_breaker/14.07-rc3/ar71xx/generic/``. After unpacking it, we use the file
``OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_64/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.49/.config``
as our ``kernel-config``.
The content is a hash which is part of the version number of the kernel package. So in the case of ``ar71xx-generic`` on
``barrier_breaker``, we look for the kernel package in the directory ``https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/``.
As the kernel package is called ``kernel_3.10.49-1-0114c71ed85677c9c1e4911437af4743_ar71xx.ipk``, the correct ``vermagic`` string
is ``0114c71ed85677c9c1e4911437af4743``.
After this, is should be sufficient to call ``make GLUON_TARGET=<target>-<subtarget>`` to build the images for the new target.

View File

@ -1,10 +1,6 @@
override define Kernel/Configure
cp $(GLUONDIR)/targets/$(GLUON_TARGET)/kernel-config $(LINUX_DIR)/.config
+$(MAKE) $(KERNEL_MAKEOPTS) oldnoconfig
$(call Kernel/SetInitramfs)
rm -rf $(KERNEL_BUILD_DIR)/modules
+[ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
cp $(GLUONDIR)/targets/$(GLUON_TARGET)/kernel-vermagic $(LINUX_DIR)/.vermagic
$(call Kernel/Configure/Default)
cp $(GLUONDIR)/targets/$(GLUON_TARGET)/vermagic $(LINUX_DIR)/.vermagic
endef
# The Makefile included here is $(TOPDIR)/target/linux/$(BOARD)/Makefile

View File

@ -1,3 +1,5 @@
CONFIG_ALL_KMODS=y
CONFIG_IMAGEOPT=y
# CONFIG_PER_FEED_REPO is not set

View File

@ -0,0 +1,57 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 16 Mar 2015 13:23:34 +0100
Subject: buildroot: make it easier to build all kmods
Split out kmods from ALL to make it easier to create local builds that
are compatible kmod-wise with releases.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
diff --git a/config/Config-build.in b/config/Config-build.in
index 371ae76..8b0ebbf 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -6,8 +6,12 @@
menu "Global build settings"
+ config ALL_KMODS
+ bool "Select all kernel module packages by default"
+ default ALL
+
config ALL
- bool "Select all packages by default"
+ bool "Select all userspace packages by default"
default n
comment "General build options"
diff --git a/include/version.mk b/include/version.mk
index 2fd605f..f6c0fe2 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -50,7 +50,7 @@ $(lastword $(subst :, ,$(1)))
endef
VERSION_TAINT_SPECS := \
- -ALL:no-all \
+ -ALL_KMODS:no-all \
-IPV6:no-ipv6 \
+USE_EGLIBC:eglibc \
+USE_MKLIBS:mklibs \
diff --git a/scripts/metadata.pl b/scripts/metadata.pl
index 79f930c..4eecb0c 100755
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -574,7 +574,11 @@ sub print_package_config_category($) {
print "\t\t".($pkg->{tristate} ? 'tristate' : 'bool')." $title\n";
print "\t\tdefault y if DEFAULT_".$pkg->{name}."\n";
unless ($pkg->{hidden}) {
- $pkg->{default} ||= "m if ALL";
+ if ($pkg->{name} =~ /^kmod-/) {
+ $pkg->{default} ||= "m if ALL_KMODS";
+ } else {
+ $pkg->{default} ||= "m if ALL";
+ }
}
if ($pkg->{default}) {
foreach my $default (split /\s*,\s*/, $pkg->{default}) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff