backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Resurrect backports Integration Mode
@ 2021-11-24  5:54 Thomas Pedersen
  2021-11-24  5:54 ` [PATCH 1/7] backport: refresh integration patch Thomas Pedersen
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:54 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

The backports integration mode[0] seems to have suffered some bitrot and
doesn't currently work. Integration mode can be convenient in certain
use cases and build flows though, so this patch set tries to fixup the
integration mode.

These changes were developed and tested for backporting a v5.10
backports + linux branch to a v4.19 kernel. v5.15-rc6 backports + linux
was successfully built against v4.19.

0: https://backports.wiki.kernel.org/index.php/Documentation/integration

Thomas Pedersen (7):
  backport: refresh integration patch
  backport: resurrect integrations
  gentree: try to make patch operation idempotent in case of --clean
  gentree: do not prefix Kernel.local symbols
  lib/bpversion: calculate Kconfig.versions for next major version
  backport: expose BP_MODULES in package mode only
  kconfig: fix select conversion for BPAUTO_ symbols in integration mode

 backport/Kconfig.integrate                    | 11 ++--
 backport/Kconfig.package                      | 10 +--
 backport/Kconfig.package.hacks                |  9 +++
 backport/Kconfig.sources                      | 18 +++---
 backport/compat/Kconfig                       |  9 ---
 gentree.py                                    | 62 +++++++++++++------
 .../0001-enable-backports-built-in.patch      | 34 +++++-----
 lib/bpversion.py                              | 11 +++-
 lib/kconfig.py                                |  5 +-
 9 files changed, 96 insertions(+), 73 deletions(-)

-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 1/7] backport: refresh integration patch
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
@ 2021-11-24  5:54 ` Thomas Pedersen
  2021-11-28 21:50   ` Hauke Mehrtens
  2021-11-24  5:55 ` [PATCH 2/7] backport: resurrect integrations Thomas Pedersen
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:54 UTC (permalink / raw)
  To: backports
  Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen, Thomas Pedersen

From: Thomas Pedersen <thomas@ibsgaard.io>

This was refreshed on Linux v5-10.42.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 .../0001-enable-backports-built-in.patch      | 34 ++++++++-----------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch b/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
index d66b203d0d07..35765ed113eb 100644
--- a/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
+++ b/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
@@ -1,40 +1,36 @@
-Allow backports to be integrated into vmlinux.
-
 diff --git a/Makefile b/Makefile
-index 6d1e304..de26b18 100644
+index e5d41b6792d7..cdd600bda9d1 100644
 --- a/Makefile
 +++ b/Makefile
-@@ -542,6 +542,7 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
- 	$(Q)$(MAKE) $(build)=$(@)
+@@ -594,6 +594,7 @@ export KBUILD_MODULES KBUILD_BUILTIN
  
+ ifeq ($(KBUILD_EXTMOD),)
  # Objects we will link into vmlinux / subdirs we need to visit
 +backports-y 	:= backports/
  init-y		:= init/
  drivers-y	:= drivers/ sound/ firmware/
  net-y		:= net/
-@@ -820,13 +821,16 @@ core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
+@@ -989,11 +990,13 @@ core-y		+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
  
  vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
  		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
 +		     $(backports-y) $(backports-m) \
- 		     $(net-y) $(net-m) $(libs-y) $(libs-m)))
+ 		     $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
  
  vmlinux-alldirs	:= $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
- 		     $(init-n) $(init-) \
- 		     $(core-n) $(core-) $(drivers-n) $(drivers-) \
-+		     $(backports-n) $(backports-) \
- 		     $(net-n)  $(net-)  $(libs-n)    $(libs-))))
+-		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
++		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-) $(backports))))
  
-+backports-y	:= $(patsubst %/, %/built-in.o, $(backports-y))
- init-y		:= $(patsubst %/, %/built-in.o, $(init-y))
- core-y		:= $(patsubst %/, %/built-in.o, $(core-y))
- drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
-@@ -837,7 +841,7 @@ libs-y		:= $(libs-y1) $(libs-y2)
++backports-y	:= $(patsubst %/, %/built-in.a, $(backports-y))
+ init-y		:= $(patsubst %/, %/built-in.a, $(init-y))
+ core-y		:= $(patsubst %/, %/built-in.a, $(core-y))
+ drivers-y	:= $(patsubst %/, %/built-in.a, $(drivers-y))
+@@ -1004,7 +1007,7 @@ virt-y		:= $(patsubst %/, %/built-in.a, $(virt-y))
  
  # Externally visible symbols (used by link-vmlinux.sh)
  export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
--export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
-+export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(backports-y)
+-export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
++export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) $(backports-y)
+ export KBUILD_VMLINUX_LIBS := $(libs-y1)
  export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
  export LDFLAGS_vmlinux
- # used by scripts/pacmage/Makefile
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 2/7] backport: resurrect integrations
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
  2021-11-24  5:54 ` [PATCH 1/7] backport: refresh integration patch Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 3/7] gentree: try to make patch operation idempotent in case of --clean Thomas Pedersen
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

Couple fixes to fix the kernel build when using a built in
backports ("integration mode"):

- newer kernel kconfig doesn't seem to like evaluating
  variables with just '$'. Use '$()'.
- define BACKPORT_DIR in the integration Kconfig so we
  don't have to supply it in an environment variable
  (where it can probably only ever be "backports/"
  anyway).

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 backport/Kconfig.integrate | 11 +++++------
 backport/Kconfig.package   | 10 +++++-----
 backport/Kconfig.sources   | 18 +++++++++---------
 gentree.py                 |  4 ++--
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/backport/Kconfig.integrate b/backport/Kconfig.integrate
index 45ab3ecd4d57..10e9f2cb8ac5 100644
--- a/backport/Kconfig.integrate
+++ b/backport/Kconfig.integrate
@@ -1,3 +1,4 @@
+BACKPORT_DIR:=%%BACKPORT_DIR%%
 config BACKPORT_INTEGRATE
 	bool
 	def_bool y
@@ -29,9 +30,7 @@ menuconfig BACKPORT_LINUX
 	  this should we run into any issues.
 
 if BACKPORT_LINUX
-
-source "$BACKPORT_DIR/Kconfig.versions"
-source "$BACKPORT_DIR/Kconfig.sources"
-source "$BACKPORT_DIR/Kconfig.local"
-
-endif # BACKPORT_LINUX
+source "$(BACKPORT_DIR)/Kconfig.versions"
+source "$(BACKPORT_DIR)/Kconfig.sources"
+source "$(BACKPORT_DIR)/Kconfig.local"
+endif	# BACKPORT_LINUX
diff --git a/backport/Kconfig.package b/backport/Kconfig.package
index 250cdf3e4278..ce2f1cdb5893 100644
--- a/backport/Kconfig.package
+++ b/backport/Kconfig.package
@@ -14,12 +14,12 @@ config BACKPORTED_KERNEL_NAME
 	option env="BACKPORTED_KERNEL_NAME"
 
 # Packaging hacks
-source "$BACKPORT_DIR/Kconfig.package.hacks"
+source "$(BACKPORT_DIR)/Kconfig.package.hacks"
 
 # Code we backport
-source "$BACKPORT_DIR/Kconfig.sources"
+source "$(BACKPORT_DIR)/Kconfig.sources"
 
 # these will be generated
-source "$BACKPORT_DIR/Kconfig.kernel"
-source "$BACKPORT_DIR/Kconfig.versions"
-source "$BACKPORT_DIR/Kconfig.local"
+source "$(BACKPORT_DIR)/Kconfig.kernel"
+source "$(BACKPORT_DIR)/Kconfig.versions"
+source "$(BACKPORT_DIR)/Kconfig.local"
diff --git a/backport/Kconfig.sources b/backport/Kconfig.sources
index 5fb44780d842..8344a9aaa378 100644
--- a/backport/Kconfig.sources
+++ b/backport/Kconfig.sources
@@ -1,15 +1,15 @@
 # this has the configuration for the backport code
-source "$BACKPORT_DIR/compat/Kconfig"
+source "$(BACKPORT_DIR)/compat/Kconfig"
 
 # these are copied from the kernel
-source "$BACKPORT_DIR/net/wireless/Kconfig"
-source "$BACKPORT_DIR/net/mac80211/Kconfig"
-source "$BACKPORT_DIR/drivers/net/wireless/Kconfig"
-source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
+source "$(BACKPORT_DIR)/net/wireless/Kconfig"
+source "$(BACKPORT_DIR)/net/mac80211/Kconfig"
+source "$(BACKPORT_DIR)/drivers/net/wireless/Kconfig"
+source "$(BACKPORT_DIR)/drivers/net/usb/Kconfig"
 
-source "$BACKPORT_DIR/drivers/ssb/Kconfig"
-source "$BACKPORT_DIR/drivers/bcma/Kconfig"
+source "$(BACKPORT_DIR)/drivers/ssb/Kconfig"
+source "$(BACKPORT_DIR)/drivers/bcma/Kconfig"
 
-source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
+source "$(BACKPORT_DIR)/drivers/usb/class/Kconfig"
 
-source "$BACKPORT_DIR/drivers/staging/Kconfig"
+source "$(BACKPORT_DIR)/drivers/staging/Kconfig"
diff --git a/gentree.py b/gentree.py
index 05bb91b39291..4705ffa08fc4 100755
--- a/gentree.py
+++ b/gentree.py
@@ -701,7 +701,7 @@ def _main():
                            project_dir = args.outdir,
                            target_dir = os.path.join(args.outdir, 'backports/'),
                            target_dir_name = 'backports/',
-                           kconfig_source_var = '$BACKPORT_DIR',
+                           kconfig_source_var = '$(BACKPORT_DIR)',
                            )
     else:
         bpid = Bp_Identity(integrate = args.integrate,
@@ -710,7 +710,7 @@ def _main():
                            project_dir = args.outdir,
                            target_dir = args.outdir,
                            target_dir_name = '',
-                           kconfig_source_var = '$BACKPORT_DIR',
+                           kconfig_source_var = '$(BACKPORT_DIR)',
                            )
 
     def logwrite(msg):
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 3/7] gentree: try to make patch operation idempotent in case of --clean
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
  2021-11-24  5:54 ` [PATCH 1/7] backport: refresh integration patch Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 2/7] backport: resurrect integrations Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 4/7] gentree: do not prefix Kernel.local symbols Thomas Pedersen
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

The patch utility will not just skip a patch if it has
already been applied. In the case of --integrate --clean
we may need to repatch the kernel Makefile, which wasn't
removed along with backports/. To support reapplying
patches without error, revert a failed patch with -R, then
reapply it.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 gentree.py | 56 +++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/gentree.py b/gentree.py
index 4705ffa08fc4..0576e14d6fe5 100755
--- a/gentree.py
+++ b/gentree.py
@@ -484,6 +484,31 @@ def upload_release(args, rel_prep, logwrite=lambda x:None):
         kup_cmd = "kup put /\n\t\t%s /\n\t\t%s /\n\t\t%s" % (gzip_name, tar_name + '.asc', korg_path)
         logwrite("kup-test: skipping cmd: %s" % kup_cmd)
 
+def do_patch(args, logwrite, pfile, target_dir, reverse=False):
+    cmd = 'patch -p1'.split()
+
+    if reverse:
+        cmd.append('-R')
+    process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                               stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
+                               close_fds=True, universal_newlines=True,
+                               cwd=target_dir)
+    output = process.communicate(input=open(pfile, 'r').read())[0]
+    output = output.split('\n')
+    if output[-1] == '':
+        output = output[:-1]
+    if args.verbose:
+        for line in output:
+            logwrite('> %s' % line)
+    else:
+        logwrite("Failed to apply changes from %s" % print_name)
+        if not args.verbose:
+            for line in output:
+                logwrite('> %s' % line)
+
+    return process.returncode
+
+
 def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda x:None):
     """
     Given a path of a directories of patches and SmPL patches apply
@@ -539,23 +564,20 @@ def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda
                 fullfn = os.path.join(target_dir, patched_file)
                 shutil.copyfile(fullfn, fullfn + '.orig_file')
 
-        process = subprocess.Popen(['patch', '-p1'], stdout=subprocess.PIPE,
-                                   stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
-                                   close_fds=True, universal_newlines=True,
-                                   cwd=target_dir)
-        output = process.communicate(input=open(pfile, 'r').read())[0]
-        output = output.split('\n')
-        if output[-1] == '':
-            output = output[:-1]
-        if args.verbose:
-            for line in output:
-                logwrite('> %s' % line)
-        if process.returncode != 0:
-            if not args.verbose:
-                logwrite("Failed to apply changes from %s" % print_name)
-                for line in output:
-                    logwrite('> %s' % line)
-            return 2
+        err = do_patch(args, logwrite, pfile, target_dir)
+        if err > 0:
+            if not args.clean or err == 2:
+                return 2
+
+            # in case of clean, try to make patch idempotent
+            # try the reverse
+            err = do_patch(args, logwrite, pfile, target_dir, reverse=True)
+            if err != 0:
+                return 2
+            # that worked, now reapply..
+            err = do_patch(args, logwrite, pfile, target_dir)
+            if err != 0:
+                return 2
 
         if args.refresh:
             pfilef = open(pfile + '.tmp', 'a')
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 4/7] gentree: do not prefix Kernel.local symbols
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (2 preceding siblings ...)
  2021-11-24  5:55 ` [PATCH 3/7] gentree: try to make patch operation idempotent in case of --clean Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 5/7] lib/bpversion: calculate Kconfig.versions for next major version Thomas Pedersen
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

In package mode the prefix is empty, so the ignore list
does not matter. In integration mode there is a nonzero
prefix, so add Kconfig.local to the ignore list like
elsewhere in gentree.py.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 gentree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gentree.py b/gentree.py
index 0576e14d6fe5..9699ce0128d0 100755
--- a/gentree.py
+++ b/gentree.py
@@ -235,7 +235,7 @@ def add_automatic_backports(args):
     export = re.compile(r'^EXPORT_SYMBOL(_GPL)?\((?P<sym>[^\)]*)\)')
     bpi = kconfig.get_backport_info(os.path.join(args.bpid.target_dir, 'compat', 'Kconfig'))
     configtree = kconfig.ConfigTree(os.path.join(args.bpid.target_dir, 'Kconfig'), args.bpid)
-    ignore=['Kconfig.kernel', 'Kconfig.versions']
+    ignore=['Kconfig.kernel', 'Kconfig.versions', 'Kconfig.local']
     configtree.verify_sources(ignore=ignore)
     git_debug_snapshot(args, "verify sources for automatic backports")
     all_selects = configtree.all_selects()
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 5/7] lib/bpversion: calculate Kconfig.versions for next major version
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (3 preceding siblings ...)
  2021-11-24  5:55 ` [PATCH 4/7] gentree: do not prefix Kernel.local symbols Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 6/7] backport: expose BP_MODULES in package mode only Thomas Pedersen
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 lib/bpversion.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/bpversion.py b/lib/bpversion.py
index aefdcf0ce3c9..1659823baaf4 100644
--- a/lib/bpversion.py
+++ b/lib/bpversion.py
@@ -42,7 +42,12 @@ def kernelversion(tree):
 
 def genkconfig_versions(rel_specs):
     data = ''
-    for i in range(int(rel_specs['PATCHLEVEL']) + 1, 99):
-        data += "config BACKPORT_KERNEL_%s_%s\n" % (rel_specs['VERSION'], i)
-        data += "    def_bool y\n"
+    print(str(rel_specs))
+    version = int(rel_specs['VERSION'])
+    start_patchlevel = int(rel_specs['PATCHLEVEL']) + 1
+    for i in range(version, version + 2):
+        for j in range(start_patchlevel, 99):
+            data += "config BACKPORT_KERNEL_%s_%s\n" % (i, j)
+            data += "    def_bool y\n"
+        start_patchlevel = 0
     return data
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 6/7] backport: expose BP_MODULES in package mode only
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (4 preceding siblings ...)
  2021-11-24  5:55 ` [PATCH 5/7] lib/bpversion: calculate Kconfig.versions for next major version Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24  5:55 ` [PATCH 7/7] kconfig: fix select conversion for BPAUTO_ symbols in integration mode Thomas Pedersen
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

Otherwise 'option modules' conflicts with the kernel
namespace.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 backport/Kconfig.package.hacks | 9 +++++++++
 backport/compat/Kconfig        | 9 ---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/backport/Kconfig.package.hacks b/backport/Kconfig.package.hacks
index 6a429dd107fd..85c71d43c690 100644
--- a/backport/Kconfig.package.hacks
+++ b/backport/Kconfig.package.hacks
@@ -6,3 +6,12 @@ config NET_CORE
 	def_bool y
 config EXPERT
 	def_bool y
+
+config BP_MODULES
+	option modules
+	bool
+	default MODULES
+
+	help
+	This symbol is necessary for the newer kconf tool, it looks
+	for the "option modules" to control the 'm' state.
diff --git a/backport/compat/Kconfig b/backport/compat/Kconfig
index 174322d8a340..87df1f731a34 100644
--- a/backport/compat/Kconfig
+++ b/backport/compat/Kconfig
@@ -53,15 +53,6 @@
 # Variations are obviously possible.
 #
 
-config BP_MODULES
-	option modules
-	bool
-	default MODULES
-
-	help
-	This symbol is necessary for the newer kconf tool, it looks
-	for the "option modules" to control the 'm' state.
-
 config BPAUTO_BUILD_NLATTR
 	def_bool y
 	depends on KERNEL_5_2
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 7/7] kconfig: fix select conversion for BPAUTO_ symbols in integration mode
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (5 preceding siblings ...)
  2021-11-24  5:55 ` [PATCH 6/7] backport: expose BP_MODULES in package mode only Thomas Pedersen
@ 2021-11-24  5:55 ` Thomas Pedersen
  2021-11-24 13:57 ` [PATCH 0/7] Resurrect backports Integration Mode Luis Chamberlain
  2021-11-28 21:52 ` Hauke Mehrtens
  8 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-24  5:55 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens, Luis Rodriguez, Thomas Pedersen

In integration mode, the bpid.project_prefix is nonzero
and needs to be prepended to the expected symbol to get a
match.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 lib/kconfig.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/kconfig.py b/lib/kconfig.py
index a77f8a54eea7..0b5f8ebc1726 100644
--- a/lib/kconfig.py
+++ b/lib/kconfig.py
@@ -228,9 +228,10 @@ class ConfigTree(object):
             out = ''
             for l in open(os.path.join(self.bpid.target_dir, nf), 'r'):
                 m = sel_line.match(l)
+                bpauto_prefix = self.bpid.project_prefix + 'BPAUTO_'
                 if m and not m.group('sym') in syms:
-                    if 'BPAUTO_' + m.group('sym') in syms:
-                        out += m.group('spc') + "select BPAUTO_" + m.group('sym') + '\n'
+                    if bpauto_prefix + m.group('sym') in syms:
+                        out += m.group('spc') + "select " + bpauto_prefix + m.group('sym') + '\n'
                     else:
                         out += m.group('spc') + "depends on " + m.group('sym') + '\n'
                 else:
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 0/7] Resurrect backports Integration Mode
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (6 preceding siblings ...)
  2021-11-24  5:55 ` [PATCH 7/7] kconfig: fix select conversion for BPAUTO_ symbols in integration mode Thomas Pedersen
@ 2021-11-24 13:57 ` Luis Chamberlain
  2021-11-25  4:00   ` Thomas Pedersen
  2021-11-28 21:52 ` Hauke Mehrtens
  8 siblings, 1 reply; 15+ messages in thread
From: Luis Chamberlain @ 2021-11-24 13:57 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: backports, Hauke Mehrtens

On Tue, Nov 23, 2021 at 09:54:58PM -0800, Thomas Pedersen wrote:
> The backports integration mode[0] seems to have suffered some bitrot and
> doesn't currently work. Integration mode can be convenient in certain
> use cases and build flows though, so this patch set tries to fixup the
> integration mode.
> 
> These changes were developed and tested for backporting a v5.10
> backports + linux branch to a v4.19 kernel. v5.15-rc6 backports + linux
> was successfully built against v4.19.
> 
> 0: https://backports.wiki.kernel.org/index.php/Documentation/integration

Good stuff, looks good, just one thing the $FOO --> $(FOO) thing,
does that assume/require a bump in kconfig used in backports, ie,
if not using integration does that still work? If so then cool,
otherwise an upgrade to kconfig would be needed, and if that is
going to be done, I have a better solution to bump kconfig soon.

I'll be making kconfig code stand alone tree soon which projects
which want to embrace it can use it as a git subtree (note this
is different and better than a git sub module). Then updates
can just be done with something like:

  make refresh-kconfig

And that would just get the latest kconfig and trigger a merge commit 
locally.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 0/7] Resurrect backports Integration Mode
  2021-11-24 13:57 ` [PATCH 0/7] Resurrect backports Integration Mode Luis Chamberlain
@ 2021-11-25  4:00   ` Thomas Pedersen
  2022-02-04  2:22     ` Luis Chamberlain
  0 siblings, 1 reply; 15+ messages in thread
From: Thomas Pedersen @ 2021-11-25  4:00 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: backports, Hauke Mehrtens

Hi Luis,

On 2021-11-24 05:57, Luis Chamberlain wrote:
> On Tue, Nov 23, 2021 at 09:54:58PM -0800, Thomas Pedersen wrote:
>> The backports integration mode[0] seems to have suffered some bitrot 
>> and
>> doesn't currently work. Integration mode can be convenient in certain
>> use cases and build flows though, so this patch set tries to fixup the
>> integration mode.
>> 
>> These changes were developed and tested for backporting a v5.10
>> backports + linux branch to a v4.19 kernel. v5.15-rc6 backports + 
>> linux
>> was successfully built against v4.19.
>> 
>> 0: 
>> https://backports.wiki.kernel.org/index.php/Documentation/integration
> 
> Good stuff, looks good, just one thing the $FOO --> $(FOO) thing,
> does that assume/require a bump in kconfig used in backports, ie,
> if not using integration does that still work? If so then cool,
> otherwise an upgrade to kconfig would be needed, and if that is
> going to be done, I have a better solution to bump kconfig soon.

I just tried the package mode, and no it doesn't work. The embedded 
kconfig doesn't like "$()".

In that case I'll wait for your changes and resubmit once they've been 
merged.

> I'll be making kconfig code stand alone tree soon which projects
> which want to embrace it can use it as a git subtree (note this
> is different and better than a git sub module). Then updates
> can just be done with something like:
> 
>   make refresh-kconfig
> 
> And that would just get the latest kconfig and trigger a merge commit
> locally.

Cool. It seems kconfig is becoming somewhat of a standard for build time 
configuration (backports, u-boot, buildroot, etc.), so it makes sense to 
live as a standalone repo.

Thanks.

-- 
thomas
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 1/7] backport: refresh integration patch
  2021-11-24  5:54 ` [PATCH 1/7] backport: refresh integration patch Thomas Pedersen
@ 2021-11-28 21:50   ` Hauke Mehrtens
  2021-12-02 19:51     ` Thomas Pedersen
  0 siblings, 1 reply; 15+ messages in thread
From: Hauke Mehrtens @ 2021-11-28 21:50 UTC (permalink / raw)
  To: Thomas Pedersen, backports; +Cc: Luis Rodriguez, Thomas Pedersen

On 11/24/21 6:54 AM, Thomas Pedersen wrote:
> From: Thomas Pedersen <thomas@ibsgaard.io>
> 
> This was refreshed on Linux v5-10.42.

Does this patch still apply with kernel 5.15?

> 
> Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
> ---
>   .../0001-enable-backports-built-in.patch      | 34 ++++++++-----------
>   1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch b/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
> index d66b203d0d07..35765ed113eb 100644
> --- a/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
> +++ b/integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch
> @@ -1,40 +1,36 @@
> -Allow backports to be integrated into vmlinux.
> -
>   diff --git a/Makefile b/Makefile
> -index 6d1e304..de26b18 100644
> +index e5d41b6792d7..cdd600bda9d1 100644
>   --- a/Makefile
>   +++ b/Makefile
> -@@ -542,6 +542,7 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
> - 	$(Q)$(MAKE) $(build)=$(@)
> +@@ -594,6 +594,7 @@ export KBUILD_MODULES KBUILD_BUILTIN
>    
> + ifeq ($(KBUILD_EXTMOD),)
>    # Objects we will link into vmlinux / subdirs we need to visit
>   +backports-y 	:= backports/
>    init-y		:= init/
>    drivers-y	:= drivers/ sound/ firmware/
>    net-y		:= net/
> -@@ -820,13 +821,16 @@ core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
> +@@ -989,11 +990,13 @@ core-y		+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
>    
>    vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
>    		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
>   +		     $(backports-y) $(backports-m) \
> - 		     $(net-y) $(net-m) $(libs-y) $(libs-m)))
> + 		     $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
>    
>    vmlinux-alldirs	:= $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
> - 		     $(init-n) $(init-) \
> - 		     $(core-n) $(core-) $(drivers-n) $(drivers-) \
> -+		     $(backports-n) $(backports-) \
> - 		     $(net-n)  $(net-)  $(libs-n)    $(libs-))))
> +-		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
> ++		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-) $(backports))))
>    
> -+backports-y	:= $(patsubst %/, %/built-in.o, $(backports-y))
> - init-y		:= $(patsubst %/, %/built-in.o, $(init-y))
> - core-y		:= $(patsubst %/, %/built-in.o, $(core-y))
> - drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
> -@@ -837,7 +841,7 @@ libs-y		:= $(libs-y1) $(libs-y2)
> ++backports-y	:= $(patsubst %/, %/built-in.a, $(backports-y))
> + init-y		:= $(patsubst %/, %/built-in.a, $(init-y))
> + core-y		:= $(patsubst %/, %/built-in.a, $(core-y))
> + drivers-y	:= $(patsubst %/, %/built-in.a, $(drivers-y))
> +@@ -1004,7 +1007,7 @@ virt-y		:= $(patsubst %/, %/built-in.a, $(virt-y))
>    
>    # Externally visible symbols (used by link-vmlinux.sh)
>    export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
> --export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
> -+export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(backports-y)
> +-export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
> ++export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) $(backports-y)
> + export KBUILD_VMLINUX_LIBS := $(libs-y1)
>    export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
>    export LDFLAGS_vmlinux
> - # used by scripts/pacmage/Makefile
> 

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 0/7] Resurrect backports Integration Mode
  2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
                   ` (7 preceding siblings ...)
  2021-11-24 13:57 ` [PATCH 0/7] Resurrect backports Integration Mode Luis Chamberlain
@ 2021-11-28 21:52 ` Hauke Mehrtens
  8 siblings, 0 replies; 15+ messages in thread
From: Hauke Mehrtens @ 2021-11-28 21:52 UTC (permalink / raw)
  To: Thomas Pedersen, backports; +Cc: Luis Rodriguez

On 11/24/21 6:54 AM, Thomas Pedersen wrote:
> The backports integration mode[0] seems to have suffered some bitrot and
> doesn't currently work. Integration mode can be convenient in certain
> use cases and build flows though, so this patch set tries to fixup the
> integration mode.
> 
> These changes were developed and tested for backporting a v5.10
> backports + linux branch to a v4.19 kernel. v5.15-rc6 backports + linux
> was successfully built against v4.19.
> 
> 0: https://backports.wiki.kernel.org/index.php/Documentation/integration

Thank you for your work. I didn't use this feature and you are right it 
did bit rot.

Hauke

> 
> Thomas Pedersen (7):
>    backport: refresh integration patch
>    backport: resurrect integrations
>    gentree: try to make patch operation idempotent in case of --clean
>    gentree: do not prefix Kernel.local symbols
>    lib/bpversion: calculate Kconfig.versions for next major version
>    backport: expose BP_MODULES in package mode only
>    kconfig: fix select conversion for BPAUTO_ symbols in integration mode
> 
>   backport/Kconfig.integrate                    | 11 ++--
>   backport/Kconfig.package                      | 10 +--
>   backport/Kconfig.package.hacks                |  9 +++
>   backport/Kconfig.sources                      | 18 +++---
>   backport/compat/Kconfig                       |  9 ---
>   gentree.py                                    | 62 +++++++++++++------
>   .../0001-enable-backports-built-in.patch      | 34 +++++-----
>   lib/bpversion.py                              | 11 +++-
>   lib/kconfig.py                                |  5 +-
>   9 files changed, 96 insertions(+), 73 deletions(-)
> 

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 1/7] backport: refresh integration patch
  2021-11-28 21:50   ` Hauke Mehrtens
@ 2021-12-02 19:51     ` Thomas Pedersen
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Pedersen @ 2021-12-02 19:51 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: backports, Luis Rodriguez, Thomas Pedersen

Hi Hauke,

Sorry for the late response.

On 2021-11-28 13:50, Hauke Mehrtens wrote:
> On 11/24/21 6:54 AM, Thomas Pedersen wrote:
>> From: Thomas Pedersen <thomas@ibsgaard.io>
>> 
>> This was refreshed on Linux v5-10.42.
> 
> Does this patch still apply with kernel 5.15?

It does not, and in fact the original commit message was a lie.

This patch is applied to the _target_ kernel Makefile (in this case I 
used v4.19.x), so it needs to be versioned against the target kernel 
somehow. Is the target kernel version currently available during the 
gentree stage?

-- 
thomas
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 0/7] Resurrect backports Integration Mode
  2021-11-25  4:00   ` Thomas Pedersen
@ 2022-02-04  2:22     ` Luis Chamberlain
  2022-02-04 21:41       ` Luis Chamberlain
  0 siblings, 1 reply; 15+ messages in thread
From: Luis Chamberlain @ 2022-02-04  2:22 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: backports, Hauke Mehrtens, Johannes Berg

On Wed, Nov 24, 2021 at 08:00:18PM -0800, Thomas Pedersen wrote:
> Hi Luis,
> 
> On 2021-11-24 05:57, Luis Chamberlain wrote:
> > On Tue, Nov 23, 2021 at 09:54:58PM -0800, Thomas Pedersen wrote:
> > > The backports integration mode[0] seems to have suffered some bitrot
> > > and
> > > doesn't currently work. Integration mode can be convenient in certain
> > > use cases and build flows though, so this patch set tries to fixup the
> > > integration mode.
> > > 
> > > These changes were developed and tested for backporting a v5.10
> > > backports + linux branch to a v4.19 kernel. v5.15-rc6 backports +
> > > linux
> > > was successfully built against v4.19.
> > > 
> > > 0:
> > > https://backports.wiki.kernel.org/index.php/Documentation/integration
> > 
> > Good stuff, looks good, just one thing the $FOO --> $(FOO) thing,
> > does that assume/require a bump in kconfig used in backports, ie,
> > if not using integration does that still work? If so then cool,
> > otherwise an upgrade to kconfig would be needed, and if that is
> > going to be done, I have a better solution to bump kconfig soon.
> 
> I just tried the package mode, and no it doesn't work. The embedded kconfig
> doesn't like "$()".
> 
> In that case I'll wait for your changes and resubmit once they've been
> merged.

OK I have kconfig as a git subtree and two trees using it. The main
kconfig tree:

https://github.com/mcgrof/kconfig

Two demos:

https://github.com/mcgrof/init-kconfig
https://github.com/mcgrof/kdevops

Can someone try to convert over backports to it?

First:

git rm -rf backport/kconf/

I think something like the following is needed after that:


diff --git a/backport/Makefile.real b/backport/Makefile.real
index 65508028..1488e117 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -10,36 +10,8 @@ endif
 .SUFFIXES:
 
 export CONFIG_=CPTCFG_
-
-.PHONY: menuconfig
-menuconfig:
-	@$(MAKE) -C kconf mconf
-	@./kconf/mconf Kconfig
-
-.PHONY: listnewconfig oldaskconfig oldconfig \
-	silentoldconfig olddefconfig oldnoconfig \
-	allnoconfig allyesconfig allmodconfig \
-	alldefconfig randconfig
-listnewconfig oldaskconfig oldconfig \
-silentoldconfig olddefconfig oldnoconfig \
-allnoconfig allyesconfig allmodconfig \
-alldefconfig randconfig:
-	@$(MAKE) -C kconf conf
-	@./kconf/conf --$@ Kconfig
-
-.PHONY: usedefconfig
-usedefconfig:
-	@$(MAKE) -C kconf conf
-	@./kconf/conf --defconfig=defconfig Kconfig
-
-.PHONY: savedefconfig
-savedefconfig:
-	@$(MAKE) -C kconf conf
-	@./kconf/conf --savedefconfig=defconfig Kconfig
-
-defconfig-%::
-	@$(MAKE) -C kconf conf
-	@./kconf/conf --defconfig=defconfigs/$(@:defconfig-%=%) Kconfig
+export KCONFIG_DIR=$(CURDIR)/scripts/kconf
+include $(KCONFIG_DIR)/kconfig.Makefile
 
 .config:
 	@test -f defconfig && $(MAKE) usedefconfig || (			\

Or just wait to add the code until after the next commits.
Then see this on init-kconfig example:

mcgrof@fulton ~/devel/init-kconfig (git::master)$ cat Makefile.subtrees 
# If you need to use a git subtree, please add it here.
add-kconfig-remote:
	git remote add kconfig https://github.com/mcgrof/kconfig.git

add-kconfig:
	git subtree add --prefix=scripts/kconfig/ kconfig master

refresh-kconfig:
	git fetch kconfig
	git subtree pull --prefix=scripts/kconfig/ kconfig master

The prefix will be differnt for backports, so backport/kconfig/
So you can just run this manually first:

git remote add kconfig https://github.com/mcgrof/kconfig.git
git subtree add --prefix=backport/kconf/ kconfig master

Generate a tree and see if that worked.

> > I'll be making kconfig code stand alone tree soon which projects
> > which want to embrace it can use it as a git subtree (note this
> > is different and better than a git sub module). Then updates
> > can just be done with something like:
> > 
> >   make refresh-kconfig
> > 
> > And that would just get the latest kconfig and trigger a merge commit
> > locally.
> 
> Cool. It seems kconfig is becoming somewhat of a standard for build time
> configuration (backports, u-boot, buildroot, etc.), so it makes sense to
> live as a standalone repo.

Indeed. Hence the above effort. I finally got it. If this works then
we can just sync kconfig once in the kconfig tree and then projects
which use it can just run the refresh target to update.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 0/7] Resurrect backports Integration Mode
  2022-02-04  2:22     ` Luis Chamberlain
@ 2022-02-04 21:41       ` Luis Chamberlain
  0 siblings, 0 replies; 15+ messages in thread
From: Luis Chamberlain @ 2022-02-04 21:41 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: backports, Hauke Mehrtens, Johannes Berg

On Thu, Feb 03, 2022 at 06:22:16PM -0800, Luis Chamberlain wrote:
> Can someone try to convert over backports to it?

Nevermind, I've done this work and I'll post patches now.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

end of thread, other threads:[~2022-02-04 21:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  5:54 [PATCH 0/7] Resurrect backports Integration Mode Thomas Pedersen
2021-11-24  5:54 ` [PATCH 1/7] backport: refresh integration patch Thomas Pedersen
2021-11-28 21:50   ` Hauke Mehrtens
2021-12-02 19:51     ` Thomas Pedersen
2021-11-24  5:55 ` [PATCH 2/7] backport: resurrect integrations Thomas Pedersen
2021-11-24  5:55 ` [PATCH 3/7] gentree: try to make patch operation idempotent in case of --clean Thomas Pedersen
2021-11-24  5:55 ` [PATCH 4/7] gentree: do not prefix Kernel.local symbols Thomas Pedersen
2021-11-24  5:55 ` [PATCH 5/7] lib/bpversion: calculate Kconfig.versions for next major version Thomas Pedersen
2021-11-24  5:55 ` [PATCH 6/7] backport: expose BP_MODULES in package mode only Thomas Pedersen
2021-11-24  5:55 ` [PATCH 7/7] kconfig: fix select conversion for BPAUTO_ symbols in integration mode Thomas Pedersen
2021-11-24 13:57 ` [PATCH 0/7] Resurrect backports Integration Mode Luis Chamberlain
2021-11-25  4:00   ` Thomas Pedersen
2022-02-04  2:22     ` Luis Chamberlain
2022-02-04 21:41       ` Luis Chamberlain
2021-11-28 21:52 ` Hauke Mehrtens

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