Skip to contentSkip to conversation

ikconfig - resolve rebuild permissions

PATCH In review Stephen Hemminger 3 participants 5 messages Sep 4, 2003 – Sep 5, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ikconfig - resolve rebuild permissions

If ikconfig is enabled then the following annoying permission problem happens.

 $ make 
 $ su
 #  make install
 $ make

make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.

  CHK     include/asm-i386/asm_offsets.h
  CHK     include/linux/compile.h
  CC      kernel/configs.o

mv: overwrite `kernel/configs.o', overriding mode 0644?

This patch fixes it by removing the configs.o file when needed.

It applies against 2.6.0-test4 but is also needed even with the ikconfig patch already in -mm5

kernel/Makefile +1 -0
diff -Nru a/kernel/Makefile b/kernel/Makefile
@@ -36,5 +36,6 @@
 
 $(obj)/ikconfig.h: scripts/mkconfigs .config Makefile FORCE
 	$(call if_changed,ikconfig)
+	@rm -f $(obj)/configs.o
 
 $(obj)/configs.o: $(obj)/ikconfig.h
#1 lore raw
Quoted 2 lines · Stephen Hemminger

This patch fixes it by removing the configs.o file when needed.

A better approach would be to remove the need for compile.h from configs.c. See attached patch for the makefile change. It just took the relevant part from mk_compile and used it in the Makefile.
Example only - I expect Randy to integrate it properly.

But what you see is also a more fundamental problem. Should we allow the kernel to be build by two distinct users - in this case a normal user and root.

We could check for this early, and stop. But it would require too many changes in the top-level Makefile for my taste.

Sam

===== kernel/Makefile 1.33 vs edited =====

kernel/Makefile +1 -0
@@ -19,6 +19,7 @@
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_IKCONFIG) += configs.o
+CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"
 
 ifneq ($(CONFIG_IA64),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
#2 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 2 lines

This patch fixes it by removing the configs.o file when needed.

A better approach would be to remove the need for compile.h from configs.c. See attached patch for the makefile change. It just took the relevant part from mk_compile and used it in the Makefile.
Example only - I expect Randy to integrate it properly.

configs.o also wants UTS_RELEASE from compile.h, and I really dislike generating the same data in multiple places, so I prefer to continue to use compile.h.
I'll see about other options or using Steve's patch.

Thanks,
~Randy

Quoted 13 lines

===== kernel/Makefile 1.33 vs edited =====

kernel/Makefile +1 -2
@@ -19,6 +19,7 @@
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_IKCONFIG) += configs.o
+CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"
 
 ifneq ($(CONFIG_IA64),y)
 # According to Alan Modra <[email protected]>, the
-fno-omit-frame-pointer is
-
#3 lore raw
Quoted 11 lines
Quoted 9 lines · Stephen Hemminger
Quoted 2 lines

This patch fixes it by removing the configs.o file when needed.

A better approach would be to remove the need for compile.h from configs.c. See attached patch for the makefile change. It just took the relevant part from mk_compile and used it in the Makefile.
Example only - I expect Randy to integrate it properly.

configs.o also wants UTS_RELEASE from compile.h, and

UTS_RELEASE is not from compile.h....
so Sam's patch looks reasonable, working on it now.

Quoted 3 lines

I really dislike generating the same data in multiple places, so I prefer to continue to use compile.h.
I'll see about other options or using Steve's patch.

~Randy

#4 lore raw
In reply to Sam Ravnborg

On Thu, 4 Sep 2003 21:13:53 +0200 Sam Ravnborg <[email protected]> wrote:

| On Thu, Sep 04, 2003 at 11:31:33AM -0700, Stephen Hemminger wrote:
| > This patch fixes it by removing the configs.o file when
| > needed.
| 
| A better approach would be to remove the need for compile.h from
| configs.c. See attached patch for the makefile change.
| It just took the relevant part from mk_compile and
| used it in the Makefile.
| Example only - I expect Randy to integrate it properly.

Steve, can you test this? I don't have/see the problem. Anyway, configs.c no longer uses compile.h with this patch, so hopefully this will fix it.

Thanks for the patch, Sam.

This patch is against 2.6.0-test4-current of 2003-09-04 evening PST.

--
~Randy

patch_name: no_compile_h.patch
patch_version: 2003-09-04.18:36:25
author: Randy.Dunlap <[email protected]>
description: don't use compile.h in kernel/configs.c
product: Linux
product_versions: 260-904
diffstat: =

 kernel/Makefile  |    1 +
 kernel/configs.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-
kernel/Makefile renamed from kernel/Makefile~compile +1 -0
diff -Naur ./kernel/Makefile~compile ./kernel/Makefile
@@ -20,6 +20,7 @@
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_IKCONFIG) += configs.o
 obj-$(CONFIG_IKCONFIG_PROC) += configs.o
+CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"
 
 ifneq ($(CONFIG_IA64),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/configs.c renamed from kernel/configs.c~compile +2 -2
diff -Naur ./kernel/configs.c~compile ./kernel/configs.c
@@ -28,8 +28,8 @@
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/stringify.h>
 #include <linux/init.h>
-#include <linux/compile.h>
 #include <linux/version.h>
 #include <asm/uaccess.h>
 
@@ -81,7 +81,7 @@
 {
 	seq_printf(seq,
 		   "Kernel:    %s\nCompiler:  %s\nVersion_in_Makefile: %s\n",
-		   ikconfig_build_info, LINUX_COMPILER, UTS_RELEASE);
+		   ikconfig_build_info, __stringify(LINUX_COMPILER), UTS_RELEASE);
 	return 0;
 }