[PATCH 7/22] UML - Cross-build support : mk_task and mk_constants

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

 



>From Al Viro:

	helpers in arch/um/util (mk_task and mk_constants) converted.
That's it - none of the helpers depends on build and target being the
same architecture anymore.

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Jeff Dike <[email protected]>

diff -urN RC12-rc3-uml-thread/arch/um/Makefile RC12-rc3-uml-util/arch/um/Makefile
--- RC12-rc3-uml-thread/arch/um/Makefile	Wed Apr 27 18:13:27 2005
+++ RC12-rc3-uml-util/arch/um/Makefile	Wed Apr 27 18:13:17 2005
@@ -206,7 +206,7 @@
 
 $(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ;
 
-$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h FORCE
+$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FORCE
 	$(Q)$(MAKE) $(build)=$@
 
 $(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
diff -urN RC12-rc3-uml-thread/arch/um/util/Makefile RC12-rc3-uml-util/arch/um/util/Makefile
--- RC12-rc3-uml-thread/arch/um/util/Makefile	Wed Aug 25 12:32:49 2004
+++ RC12-rc3-uml-util/arch/um/util/Makefile	Wed Apr 27 17:07:31 2005
@@ -1,8 +1,5 @@
 hostprogs-y		:= mk_task mk_constants
 always			:= $(hostprogs-y)
 
-mk_task-objs		:= mk_task_user.o mk_task_kern.o
-mk_constants-objs	:= mk_constants_user.o mk_constants_kern.o
-
-HOSTCFLAGS_mk_task_kern.o	:= $(CFLAGS) $(CPPFLAGS)
-HOSTCFLAGS_mk_constants_kern.o	:= $(CFLAGS) $(CPPFLAGS)
+HOSTCFLAGS_mk_task.o := -I$(objtree)/arch/um
+HOSTCFLAGS_mk_constants.o := -I$(objtree)/arch/um
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_constants.c RC12-rc3-uml-util/arch/um/util/mk_constants.c
--- RC12-rc3-uml-thread/arch/um/util/mk_constants.c	Wed Dec 31 19:00:00 1969
+++ RC12-rc3-uml-util/arch/um/util/mk_constants.c	Wed Apr 27 17:07:31 2005
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <kernel-offsets.h>
+
+#define SHOW_INT(sym) printf("#define %s %d\n", #sym, sym)
+#define SHOW_STR(sym) printf("#define %s %s\n", #sym, sym)
+
+int main(int argc, char **argv)
+{
+  printf("/*\n");
+  printf(" * Generated by mk_constants\n");
+  printf(" */\n");
+  printf("\n");
+  printf("#ifndef __UM_CONSTANTS_H\n");
+  printf("#define __UM_CONSTANTS_H\n");
+  printf("\n");
+
+  SHOW_INT(UM_KERN_PAGE_SIZE);
+
+  SHOW_STR(UM_KERN_EMERG);
+  SHOW_STR(UM_KERN_ALERT);
+  SHOW_STR(UM_KERN_CRIT);
+  SHOW_STR(UM_KERN_ERR);
+  SHOW_STR(UM_KERN_WARNING);
+  SHOW_STR(UM_KERN_NOTICE);
+  SHOW_STR(UM_KERN_INFO);
+  SHOW_STR(UM_KERN_DEBUG);
+
+  SHOW_INT(UM_NSEC_PER_SEC);
+  printf("\n");
+  printf("#endif\n");
+  return(0);
+}
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_constants_kern.c RC12-rc3-uml-util/arch/um/util/mk_constants_kern.c
--- RC12-rc3-uml-thread/arch/um/util/mk_constants_kern.c	Wed Aug 25 12:32:49 2004
+++ RC12-rc3-uml-util/arch/um/util/mk_constants_kern.c	Wed Dec 31 19:00:00 1969
@@ -1,28 +0,0 @@
-#include "linux/kernel.h"
-#include "linux/stringify.h"
-#include "linux/time.h"
-#include "asm/page.h"
-
-extern void print_head(void);
-extern void print_constant_str(char *name, char *value);
-extern void print_constant_int(char *name, int value);
-extern void print_tail(void);
-
-int main(int argc, char **argv)
-{
-  print_head();
-  print_constant_int("UM_KERN_PAGE_SIZE", PAGE_SIZE);
-
-  print_constant_str("UM_KERN_EMERG", KERN_EMERG);
-  print_constant_str("UM_KERN_ALERT", KERN_ALERT);
-  print_constant_str("UM_KERN_CRIT", KERN_CRIT);
-  print_constant_str("UM_KERN_ERR", KERN_ERR);
-  print_constant_str("UM_KERN_WARNING", KERN_WARNING);
-  print_constant_str("UM_KERN_NOTICE", KERN_NOTICE);
-  print_constant_str("UM_KERN_INFO", KERN_INFO);
-  print_constant_str("UM_KERN_DEBUG", KERN_DEBUG);
-
-  print_constant_int("UM_NSEC_PER_SEC", NSEC_PER_SEC);
-  print_tail();
-  return(0);
-}
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_constants_user.c RC12-rc3-uml-util/arch/um/util/mk_constants_user.c
--- RC12-rc3-uml-thread/arch/um/util/mk_constants_user.c	Wed Feb  4 10:35:02 2004
+++ RC12-rc3-uml-util/arch/um/util/mk_constants_user.c	Wed Dec 31 19:00:00 1969
@@ -1,28 +0,0 @@
-#include <stdio.h>
-
-void print_head(void)
-{
-  printf("/*\n");
-  printf(" * Generated by mk_constants\n");
-  printf(" */\n");
-  printf("\n");
-  printf("#ifndef __UM_CONSTANTS_H\n");
-  printf("#define __UM_CONSTANTS_H\n");
-  printf("\n");
-}
-
-void print_constant_str(char *name, char *value)
-{
-  printf("#define %s \"%s\"\n", name, value);
-}
-
-void print_constant_int(char *name, int value)
-{
-  printf("#define %s %d\n", name, value);
-}
-
-void print_tail(void)
-{
-  printf("\n");
-  printf("#endif\n");
-}
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_task.c RC12-rc3-uml-util/arch/um/util/mk_task.c
--- RC12-rc3-uml-thread/arch/um/util/mk_task.c	Wed Dec 31 19:00:00 1969
+++ RC12-rc3-uml-util/arch/um/util/mk_task.c	Wed Apr 27 17:07:31 2005
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <kernel-offsets.h>
+
+void print_ptr(char *name, char *type, int offset)
+{
+  printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type,
+	 offset);
+}
+
+void print(char *name, char *type, int offset)
+{
+  printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
+	 offset);
+}
+
+int main(int argc, char **argv)
+{
+  printf("/*\n");
+  printf(" * Generated by mk_task\n");
+  printf(" */\n");
+  printf("\n");
+  printf("#ifndef __TASK_H\n");
+  printf("#define __TASK_H\n");
+  printf("\n");
+  print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS);
+  print("TASK_PID", "int", TASK_PID);
+  printf("\n");
+  printf("#endif\n");
+  return(0);
+}
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_task_kern.c RC12-rc3-uml-util/arch/um/util/mk_task_kern.c
--- RC12-rc3-uml-thread/arch/um/util/mk_task_kern.c	Wed Feb  4 10:49:17 2004
+++ RC12-rc3-uml-util/arch/um/util/mk_task_kern.c	Wed Dec 31 19:00:00 1969
@@ -1,17 +0,0 @@
-#include "linux/sched.h"
-#include "linux/stddef.h"
-
-extern void print(char *name, char *type, int offset);
-extern void print_ptr(char *name, char *type, int offset);
-extern void print_head(void);
-extern void print_tail(void);
-
-int main(int argc, char **argv)
-{
-  print_head();
-  print_ptr("TASK_REGS", "union uml_pt_regs", 
-	    offsetof(struct task_struct, thread.regs));
-  print("TASK_PID", "int", offsetof(struct task_struct, pid));
-  print_tail();
-  return(0);
-}
diff -urN RC12-rc3-uml-thread/arch/um/util/mk_task_user.c RC12-rc3-uml-util/arch/um/util/mk_task_user.c
--- RC12-rc3-uml-thread/arch/um/util/mk_task_user.c	Wed Feb  4 09:31:40 2004
+++ RC12-rc3-uml-util/arch/um/util/mk_task_user.c	Wed Dec 31 19:00:00 1969
@@ -1,30 +0,0 @@
-#include <stdio.h>
-
-void print(char *name, char *type, int offset)
-{
-  printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type,
-	 offset);
-}
-
-void print_ptr(char *name, char *type, int offset)
-{
-  printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type,
-	 offset);
-}
-
-void print_head(void)
-{
-  printf("/*\n");
-  printf(" * Generated by mk_task\n");
-  printf(" */\n");
-  printf("\n");
-  printf("#ifndef __TASK_H\n");
-  printf("#define __TASK_H\n");
-  printf("\n");
-}
-
-void print_tail(void)
-{
-  printf("\n");
-  printf("#endif\n");
-}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux