Re: [PATCH] Check generated config files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/10/2016 01:54 AM, Miguel Flores Silverio wrote:
Double check configuration files in order to avoid discrepancies
like this: https://bugzilla.redhat.com/show_bug.cgi?id=1347454

Signed-off-by: Miguel Flores Silverio <floresmigu3l@xxxxxxxxx>

These are the steps or stages I understood to take part in the
process of generating the config files to build the diffent kernels.

Stage 1: Copy required files
Copy all the config files and merge.pl in the tree to the
directory with the vanilla version of the kernel

Stage 2: Generate config files dynamically
Dynamically create the config files for the different
architectures and kernel version. The recipe for each of one
the config files is in Makefile.config which uses merge.pl. The
latter takes two config files at a time and its only purpose
is to put them together. The resulting config files are a combination
of config-generic,config-[cpu arch]-generic and config-[cpu arch]-debug
with the name kernel-[kernel version]-[cpu arch].config

Stage 3: Apply any local configs
After all the different config files are generated, if there
are any configuration options in config-local, using merge.pl
apply them to the generated config files.

Stage 4: oldconfig over generated files
for each of the generated configs rename as .config and run
listnewconfigs to find any new config options. Any new options
are saved in .newoptions. If .newoptions contains anything, display
them and stop the compilation. If there are no new options, run
oldnoconfig(?). The resulting .config file is then renamed back and
copied to the configs directory.


It's at this stage we want to be doing the actual checking,
compilation is a bit too late.

What we want to be comparing is the entries from the partial
config files. These are what we are modifying and can get missed.
Essentially what we want

for each config file for each arch (config-generic, config-x86 etc.)
	for each line in config file
		if line is not found in config-arch-name
			error


You'll need a way to get a list of each config file for each arch.
It's current just part of Makefile.config although spread over
a couple of places in there.

Stage 5: Final config
At compilation time the right config file is grabed and copied
to .config and used as the final config file to build the kernel.

My initial approach was to use grep and nested loops which added
several lines to spec file. I also decided to check the config
files at Stage 5, right before compilation.

The spec file is already very complex as it is. I think
it appropiate to keep the solution as short and sweet as possible. So
I am reaching to the Fedora kernel wizards for guidance \o/


That's a good thing to keep in mind :) Don't be afraid to add more
code if necessary to make something cleaner though.

---
 kernel.spec | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel.spec b/kernel.spec
index 6bab535..8bcf44f 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1278,6 +1278,12 @@ cp_vmlinux()
   eu-strip --remove-comment -o "$2" "$1"
 }

+CheckConfigs() {
+    generated_config=$1
+    final_config=$2
+    diff -s "$generated_config" "$final_config"
+}
+

So this just happens to work because x86_64 was the last .config to
be generated. It's not something to rely on. Until we actually do
the make mrproper and the copy of the config this could be anything.

 BuildKernel() {
     MakeTarget=$1
     KernelImage=$2
@@ -1314,12 +1320,10 @@ BuildKernel() {
     perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
     %endif
     %endif
-
+    CheckConfigs configs/$Config .config
     # and now to start the build process
-
     make -s mrproper
     cp configs/$Config .config
-
     %if %{signkernel}%{signmodules}
     cp %{SOURCE11} certs/.
     %endif
--
2.7.4

_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux