From: tytso@ATHENA.MIT.EDU (Theodore Ts'o)
Newsgroups: comp.os.linux
Subject: Patch to 0.97PL2 to reduce unnecessary compiles during a build
Date: 29 Aug 92 05:45:24 GMT
Reply-To: tytso@ATHENA.MIT.EDU (Theodore Ts'o)
Organization: The Internet

I got tired of waiting for a build of the system to finish, after I only
modified one or two configuration files.  But due to how the UTS_RELEASE
and UTS_VERSION defines were updated, a lot of unnecessary files would
get recompiled due to their dependency on config.h, when they didn't
need to get recompiled.  By separating out those #define's to another
building, we reduce the need to recompile sections of the kernel when we
relink the kernel.

Linus, could you make sure this patch makes it to the next release?
Thanks!!!! 

							- Ted

*** 1.3	1992/08/28 08:15:36
--- Makefile	1992/08/28 11:43:32
***************
*** 4,10 ****
  # default of FLOPPY is used by 'build'.
  #
  
! ROOT_DEV = /dev/hdb1
  
  #
  # uncomment this if you want kernel profiling: the profile_shift is the
--- 4,10 ----
  # default of FLOPPY is used by 'build'.
  #
  
! ROOT_DEV = /dev/hda4
  
  #
  # uncomment this if you want kernel profiling: the profile_shift is the
***************
*** 30,38 ****
  # 0x08 - tilde (~)
  # 0x10 - dieresis (umlaut)
  
! KEYBOARD = -DKBD_FINNISH -DKBDFLAGS=0
  # KEYBOARD = -DKBD_FINNISH_LATIN1 -DKBDFLAGS=0x9F
! # KEYBOARD = -DKBD_US -DKBDFLAGS=0
  # KEYBOARD = -DKBD_GR -DKBDFLAGS=0
  # KEYBOARD = -DKBD_GR_LATIN1 -DKBDFLAGS=0x9F
  # KEYBOARD = -DKBD_FR -DKBDFLAGS=0
--- 30,38 ----
  # 0x08 - tilde (~)
  # 0x10 - dieresis (umlaut)
  
! # KEYBOARD = -DKBD_FINNISH -DKBDFLAGS=0
  # KEYBOARD = -DKBD_FINNISH_LATIN1 -DKBDFLAGS=0x9F
! KEYBOARD = -DKBD_US -DKBDFLAGS=0
  # KEYBOARD = -DKBD_GR -DKBDFLAGS=0
  # KEYBOARD = -DKBD_GR_LATIN1 -DKBDFLAGS=0x9F
  # KEYBOARD = -DKBD_FR -DKBDFLAGS=0
***************
*** 73,79 ****
  # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
  # The number is the same as you would ordinarily press at bootup.
  #
! #SVGA_MODE=	-DSVGA_MODE=1
  
  AS	=as
  LD	=ld
--- 73,79 ----
  # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
  # The number is the same as you would ordinarily press at bootup.
  #
! SVGA_MODE=	-DSVGA_MODE=NORMAL_VGA
  
  AS	=as
  LD	=ld
***************
*** 107,115 ****
  
  Version:
  	@./makever.sh
! 	@echo \#define UTS_RELEASE \"0.97.pl2-`cat .version`\" > include/linux/config_rel.h
! 	@echo \#define UTS_VERSION \"`date +%D`\" > include/linux/config_ver.h
! 	touch include/linux/config.h
  
  Image: boot/bootsect boot/setup tools/system tools/build
  	cp tools/system system.tmp
--- 107,117 ----
  
  Version:
  	@./makever.sh
! 	@echo \#define UTS_RELEASE \"0.97.pl2-`cat .version`\" > version.h
! 	@echo \#define UTS_VERSION \"`date +%D`\" >> version.h
! 	@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> version.h
! 	@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> version.h
! 	@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> version.h
  
  Image: boot/bootsect boot/setup tools/system tools/build
  	cp tools/system system.tmp
***************
*** 130,137 ****
  init/main.o: init/main.c
  	$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
  
! tools/system:	boot/head.o init/main.o linuxsubdirs
! 	$(LD) $(LDFLAGS) -M boot/head.o init/main.o \
  		$(ARCHIVES) \
  		$(FILESYSTEMS) \
  		$(DRIVERS) \
--- 132,139 ----
  init/main.o: init/main.c
  	$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
  
! tools/system:	boot/head.o init/main.o version.o linuxsubdirs
! 	$(LD) $(LDFLAGS) -M boot/head.o init/main.o version.o \
  		$(ARCHIVES) \
  		$(FILESYSTEMS) \
  		$(DRIVERS) \
*** 1.2	1992/08/28 08:10:19
--- include/linux/config.h	1992/08/28 08:27:48
***************
*** 12,26 ****
  #ifndef UTS_NODENAME
  #define UTS_NODENAME "(none)"	/* set by sethostname() */
  #endif
- #include <linux/config_rel.h>
- #ifndef UTS_RELEASE
- #define UTS_RELEASE "0.95c-0" 
- #endif
- #include <linux/config_ver.h>
- #ifndef UTS_VERSION
- #define UTS_VERSION "mm/dd/yy"
- #endif
  #define UTS_MACHINE "i386"	/* hardware type */
  
  /* Don't touch these, unless you really know what your doing. */
  #define DEF_INITSEG	0x9000
--- 12,22 ----
  #ifndef UTS_NODENAME
  #define UTS_NODENAME "(none)"	/* set by sethostname() */
  #endif
  #define UTS_MACHINE "i386"	/* hardware type */
+ /*
+  * The definitions for UTS_RELEASE and UTS_VERSION are now defined
+  * in linux/version.h, and should only be used by linux/version.c
+  */
  
  /* Don't touch these, unless you really know what your doing. */
  #define DEF_INITSEG	0x9000
*** 1.1	1992/08/28 08:30:21
--- include/linux/utsname.h	1992/08/28 08:30:54
***************
*** 21,24 ****
--- 21,26 ----
  	char machine[65];
  };
  
+ extern struct new_utsname system_utsname;
+ 
  #endif
*** 1.2	1992/08/28 08:15:36
--- kernel/sys.c	1992/08/28 08:31:07
***************
*** 494,509 ****
  	return 0;
  }
  
- static struct new_utsname thisname = {
- 	UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION, UTS_MACHINE
- };
- 
  int sys_newuname(struct new_utsname * name)
  {
  	if (!name)
  		return -EFAULT;
  	verify_area(name, sizeof *name);
! 	memcpy_tofs(name,&thisname,sizeof *name);
  	return 0;
  }
  
--- 494,505 ----
  	return 0;
  }
  
  int sys_newuname(struct new_utsname * name)
  {
  	if (!name)
  		return -EFAULT;
  	verify_area(name, sizeof *name);
! 	memcpy_tofs(name,&system_utsname,sizeof *name);
  	return 0;
  }
  
***************
*** 512,526 ****
  	if (!name)
  		return -EINVAL;
  	verify_area(name,sizeof *name);
! 	memcpy_tofs(&name->sysname,&thisname.sysname,__OLD_UTS_LEN);
  	put_fs_byte(0,name->sysname+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->nodename,&thisname.nodename,__OLD_UTS_LEN);
  	put_fs_byte(0,name->nodename+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->release,&thisname.release,__OLD_UTS_LEN);
  	put_fs_byte(0,name->release+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->version,&thisname.version,__OLD_UTS_LEN);
  	put_fs_byte(0,name->version+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->machine,&thisname.machine,__OLD_UTS_LEN);
  	put_fs_byte(0,name->machine+__OLD_UTS_LEN);
  	return 0;
  }
--- 508,522 ----
  	if (!name)
  		return -EINVAL;
  	verify_area(name,sizeof *name);
! 	memcpy_tofs(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
  	put_fs_byte(0,name->sysname+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
  	put_fs_byte(0,name->nodename+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->release,&system_utsname.release,__OLD_UTS_LEN);
  	put_fs_byte(0,name->release+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->version,&system_utsname.version,__OLD_UTS_LEN);
  	put_fs_byte(0,name->version+__OLD_UTS_LEN);
! 	memcpy_tofs(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
  	put_fs_byte(0,name->machine+__OLD_UTS_LEN);
  	return 0;
  }
***************
*** 537,546 ****
  	if (len > __NEW_UTS_LEN)
  		return -EINVAL;
  	for (i=0; i < len; i++) {
! 		if ((thisname.nodename[i] = get_fs_byte(name+i)) == 0)
  			return 0;
  	}
! 	thisname.nodename[i] = 0;
  	return 0;
  }
  
--- 533,542 ----
  	if (len > __NEW_UTS_LEN)
  		return -EINVAL;
  	for (i=0; i < len; i++) {
! 		if ((system_utsname.nodename[i] = get_fs_byte(name+i)) == 0)
  			return 0;
  	}
! 	system_utsname.nodename[i] = 0;
  	return 0;
  }
  
*** 1.2	1992/08/28 08:10:19
--- init/main.c	1992/08/28 11:45:42
***************
*** 21,26 ****
--- 21,27 ----
  extern unsigned long * prof_buffer;
  extern unsigned long prof_len;
  extern int end;
+ extern char *linux_banner;
  
  /*
   * we need this inline - forking from kernel space will result
***************
*** 172,178 ****
  	memory_start = mem_init(memory_start,memory_end);
  	buffer_init();
  	time_init();
! 	printk("Linux version " UTS_RELEASE " " __DATE__ " " __TIME__ "\n");
  	floppy_init();
  	sock_init();
  	sti();
--- 173,179 ----
  	memory_start = mem_init(memory_start,memory_end);
  	buffer_init();
  	time_init();
! 	printk(linux_banner);
  	floppy_init();
  	sock_init();
  	sti();
*** /dev/null	Thu Mar 19 11:10:38 1992
--- version.c	Fri Aug 28 08:51:28 1992
***************
*** 0 ****
--- 1,20 ----
+ /*
+  *  linux/version.c
+  *
+  *  Copyright (C) 1992  Theodore Ts'o
+  *
+  *  May be freely distributed as part of Linux.
+  */
+ 
+ #include <linux/config.h>
+ #include <linux/utsname.h>
+ 
+ #include "./version.h"
+ 
+ struct new_utsname system_utsname = {
+ 	UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION, UTS_MACHINE
+ };
+ 
+ char *linux_banner = 
+ 	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+ 	LINUX_COMPILE_HOST ") " UTS_VERSION " " LINUX_COMPILE_TIME " \n";
*** /dev/null	Thu Mar 19 11:10:38 1992
--- version.h	Fri Aug 28 12:06:02 1992
***************
*** 0 ****
--- 1,5 ----
+ #define UTS_RELEASE "0.97.pl2-25"
+ #define UTS_VERSION "08/28/92"
+ #define LINUX_COMPILE_TIME "12:06:01"
+ #define LINUX_COMPILE_BY "tytso"
+ #define LINUX_COMPILE_HOST "rt-11"
Newsgroups: comp.os.linux